Fixed #2347 -- documented the use of "and" in the blocktrans template tag.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3345 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dba1f95e12
commit
50448de634
|
@ -224,6 +224,13 @@ block::
|
||||||
This will have {{ myvar }} inside.
|
This will have {{ myvar }} inside.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
|
If you need to bind more than one expression inside a ``blocktrans`` tag,
|
||||||
|
separate the pieces with ``and``::
|
||||||
|
|
||||||
|
{% blocktrans with book|title as book_t and author|title as author_t %}
|
||||||
|
This is {{ book_t }} by {{ author_t }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
|
||||||
To pluralize, specify both the singular and plural forms with the
|
To pluralize, specify both the singular and plural forms with the
|
||||||
``{% plural %}`` tag, which appears within ``{% blocktrans %}`` and
|
``{% plural %}`` tag, which appears within ``{% blocktrans %}`` and
|
||||||
``{% endblocktrans %}``. Example::
|
``{% endblocktrans %}``. Example::
|
||||||
|
@ -306,7 +313,7 @@ marked for translation. It creates (or updates) a message file in the directory
|
||||||
``conf/locale``. In the ``de`` example, the file will be
|
``conf/locale``. In the ``de`` example, the file will be
|
||||||
``conf/locale/de/LC_MESSAGES/django.po``.
|
``conf/locale/de/LC_MESSAGES/django.po``.
|
||||||
|
|
||||||
If run over your project source tree or your appliation source tree, it will
|
If run over your project source tree or your application source tree, it will
|
||||||
do the same, but the location of the locale directory is ``locale/LANG/LC_MESSAGES``
|
do the same, but the location of the locale directory is ``locale/LANG/LC_MESSAGES``
|
||||||
(note the missing ``conf`` prefix).
|
(note the missing ``conf`` prefix).
|
||||||
|
|
||||||
|
@ -349,7 +356,7 @@ A quick explanation:
|
||||||
Long messages are a special case. There, the first string directly after the
|
Long messages are a special case. There, the first string directly after the
|
||||||
``msgstr`` (or ``msgid``) is an empty string. Then the content itself will be
|
``msgstr`` (or ``msgid``) is an empty string. Then the content itself will be
|
||||||
written over the next few lines as one string per line. Those strings are
|
written over the next few lines as one string per line. Those strings are
|
||||||
directlyconcatenated. Don't forget trailing spaces within the strings;
|
directly concatenated. Don't forget trailing spaces within the strings;
|
||||||
otherwise, they'll be tacked together without whitespace!
|
otherwise, they'll be tacked together without whitespace!
|
||||||
|
|
||||||
.. admonition:: Mind your charset
|
.. admonition:: Mind your charset
|
||||||
|
@ -647,7 +654,7 @@ The ``javascript_catalog`` view
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
The main solution to these problems is the ``javascript_catalog`` view, which
|
The main solution to these problems is the ``javascript_catalog`` view, which
|
||||||
sends out a JavaScript code library with functions that mimick the ``gettext``
|
sends out a JavaScript code library with functions that mimic the ``gettext``
|
||||||
interface, plus an array of translation strings. Those translation strings are
|
interface, plus an array of translation strings. Those translation strings are
|
||||||
taken from the application, project or Django core, according to what you
|
taken from the application, project or Django core, according to what you
|
||||||
specify in either the {{{info_dict}}} or the URL.
|
specify in either the {{{info_dict}}} or the URL.
|
||||||
|
@ -665,7 +672,7 @@ You hook it up like this::
|
||||||
Each string in ``packages`` should be in Python dotted-package syntax (the
|
Each string in ``packages`` should be in Python dotted-package syntax (the
|
||||||
same format as the strings in ``INSTALLED_APPS``) and should refer to a package
|
same format as the strings in ``INSTALLED_APPS``) and should refer to a package
|
||||||
that contains a ``locale`` directory. If you specify multiple packages, all
|
that contains a ``locale`` directory. If you specify multiple packages, all
|
||||||
those catalogs aremerged into one catalog. This is useful if you have
|
those catalogs are merged into one catalog. This is useful if you have
|
||||||
JavaScript that uses strings from different applications.
|
JavaScript that uses strings from different applications.
|
||||||
|
|
||||||
You can make the view dynamic by putting the packages into the URL pattern::
|
You can make the view dynamic by putting the packages into the URL pattern::
|
||||||
|
|
Loading…
Reference in New Issue