【问题标题】:How to properly i18n a string如何正确地 i18n 字符串
【发布时间】:2010-08-06 14:19:24
【问题描述】:

在我的 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." %}

谢谢。

【问题讨论】:

    标签: internationalization django-templates


    【解决方案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>
    

    原来如此

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-08
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-13
      相关资源
      最近更新 更多