Ticket #5591: i18n_r8520_after_docsrefactor.patch

File i18n_r8520_after_docsrefactor.patch, 1.7 KB (added by Idan Gazit, 16 years ago)

Same patch, applied to trunk post-docs-refactor

  • i18n.txt

     
    219219tags and a slightly different syntax than in Python code. To give your template
    220220access to these tags, put ``{% load i18n %}`` toward the top of your template.
    221221
    222 The ``{% trans %}`` template tag translates a constant string or a variable
    223 content::
     222The ``{% trans %}`` template tag translates either a constant string
     223(enclosed in single or double quotes) or variable content::
    224224
    225225    <title>{% trans "This is the title." %}</title>
     226    <title>{% trans myvar %}</title>
    226227
    227 If you only want to mark a value for translation, but translate it later from a
    228 variable, use the ``noop`` option::
     228If the ``noop`` option is present, variable lookup still takes place but the
     229translation is skipped. This is useful when "stubbing out" content that will
     230require translation in the future::
    229231
    230     <title>{% trans "value" noop %}</title>
     232    <title>{% trans "myvar" noop %}</title>
    231233
    232 It's not possible to use template variables in ``{% trans %}`` -- only constant
    233 strings, in single or double quotes, are allowed. If your translations require
    234 variables (placeholders), use ``{% blocktrans %}``. Example::
     234It's not possible to mix a template variable inside a string within
     235``{% trans %}``. If your translations require strings with variables (placeholders),
     236use ``{% blocktrans %}``. Example::
    235237
    236     {% blocktrans %}This will have {{ value }} inside.{% endblocktrans %}
     238    {% blocktrans %}This string will have {{ value }} inside.{% endblocktrans %}
    237239
    238240To translate a template expression -- say, using template filters -- you need
    239241to bind the expression to a local variable for use within the translation
Back to Top