如何正确地使用字符串

时间:2010-08-06 14:19:24

标签: internationalization django-templates

在我的Django模板中翻译的这个或多或少复杂的短语是:

This site is owned by "<a href="url">The Company Name</a>" and is maintained by partner organizations.

是否如此简单:

{% trans "This site is owned by "<a href="url">The Company Name</a>" and is maintained by partner organizations." %}

谢谢。

1 个答案:

答案 0 :(得分:1)

从翻译的角度来看,只要译者翻译整个字符串,就可以了。我的意思是他们把href放在公司名称周围。

从技术角度来看,您可能需要查看此页面:http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/

trans template tag

The {% trans %} template tag translates either a constant string (enclosed in single or double quotes) or variable content:

<title>{% trans "This is the title." %}</title>
<title>{% trans myvar %}</title>

所以看来