加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

Django i18n模板包含标签

发布时间:2020-12-20 11:30:03 所属栏目:Python 来源:网络整理
导读:我需要呈现翻译的推荐书,我使用包含块作为推荐代码,如下所示: {% include "includes/blog/testimonial.html" with text="This is the best product I've ever used!" name="Tim Z" description="Store Manager" %} 我如何将blocktrans与include标签一起使用
我需要呈现翻译的推荐书,我使用包含块作为推荐代码,如下所示:

{% include "includes/blog/testimonial.html" with text="This is the best product I've ever used!" name="Tim Z" description="Store Manager" %}

我如何将blocktrans与include标签一起使用来呈现翻译的include标签?

谢谢!!

解决方法

如果我理解正确,您希望将您提供的文本翻译为“包含”标签.如果这是正确的,只需事先翻译它并将结果保存到变量:

{% trans "This is the best product I've ever used!" as text %}
{% trans "Store Manager" as description %}
{% include "includes/blog/testimonial.html" with text=text name="Tim Z" description=description %}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读