diff options
| author | Julien Phalip <jphalip@gmail.com> | 2011-10-19 04:59:47 +0000 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2011-10-19 04:59:47 +0000 |
| commit | 26698bc85123935d5926a87a45cae25efe683639 (patch) | |
| tree | 6932998940436b4362a8a6c8d167aca1e647d5cb /docs/topics | |
| parent | 358e5a8031be14efe33dc62e821408c2a6a8e85a (diff) | |
Fixed #14806 -- Added support for contextual translations to the `trans` and `blocktrans` template tags. Thanks to jtiai for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/i18n/internationalization.txt | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/docs/topics/i18n/internationalization.txt b/docs/topics/i18n/internationalization.txt index b06c9bdfdb..c8611acff8 100644 --- a/docs/topics/i18n/internationalization.txt +++ b/docs/topics/i18n/internationalization.txt @@ -266,6 +266,11 @@ will appear in the .po file as: msgid "May" msgstr "" +.. versionadded:: 1.4 + +Contextual markers are also supported by the :ttag:`trans` and +:ttag:`blocktrans` template tags. + .. _lazy-translations: Lazy translation @@ -453,7 +458,7 @@ It's not possible to mix a template variable inside a string within ``{% trans %}``. If your translations require strings with variables (placeholders), use ``{% blocktrans %}`` instead. -.. versionchanged:: 1.4 +.. versionadded:: 1.4 If you'd like to retrieve a translated string without displaying it, you can use the following syntax:: @@ -479,6 +484,15 @@ or should be used as arguments for other template tags or filters:: {% endfor %} </p> +.. versionadded:: 1.4 + +``{% trans %}`` also supports :ref:`contextual markers<contextual-markers>` +using the ``context`` keyword: + +.. code-block:: html+django + + {% trans "May" context "month name" %} + .. templatetag:: blocktrans ``blocktrans`` template tag @@ -560,6 +574,15 @@ be retrieved (and stored) beforehand:: This is a URL: {{ the_url }} {% endblocktrans %} +.. versionadded:: 1.4 + +``{% blocktrans %}`` also supports :ref:`contextual +markers<contextual-markers>` using the ``context`` keyword: + +.. code-block:: html+django + + {% blocktrans with name=user.username context "greeting" %}Hi {{ name }}{% endblocktrans %} + .. _template-translation-vars: Other tags |
