summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-06-02 15:39:42 -0400
committerTim Graham <timograham@gmail.com>2015-06-02 15:51:00 -0400
commit9ca0961b8a4a6a5ff3ee903f71fd22e1936d004f (patch)
tree14df27f694cb9bb2d8c2f6cfc378bfb647b3427e /docs
parent84522c0d165076d01cd034d7c381b75044daec8d (diff)
Added headings to i18n template tags and filters.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/i18n/translation.txt52
1 files changed, 42 insertions, 10 deletions
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index 6654082f2b..bfaec965e4 100644
--- a/docs/topics/i18n/translation.txt
+++ b/docs/topics/i18n/translation.txt
@@ -816,18 +816,33 @@ Other tags
These tags also require a ``{% load i18n %}``.
-* ``{% get_available_languages as LANGUAGES %}`` returns a list of tuples in
- which the first element is the :term:`language code` and the second is the
- language name (translated into the currently active locale).
+.. templatetag:: get_available_languages
-* ``{% get_current_language as LANGUAGE_CODE %}`` returns the current user's
- preferred language, as a string. Example: ``en-us``. (See
- :ref:`how-django-discovers-language-preference`.)
+``get_available_languages``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* ``{% get_current_language_bidi as LANGUAGE_BIDI %}`` returns the current
- locale's direction. If True, it's a right-to-left language, e.g.: Hebrew,
- Arabic. If False it's a left-to-right language, e.g.: English, French, German
- etc.
+``{% get_available_languages as LANGUAGES %}`` returns a list of tuples in
+which the first element is the :term:`language code` and the second is the
+language name (translated into the currently active locale).
+
+.. templatetag:: get_current_language
+
+``get_current_languages``
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``{% get_current_language as LANGUAGE_CODE %}`` returns the current user's
+preferred language as a string. Example: ``en-us``. See
+:ref:`how-django-discovers-language-preference`.
+
+.. templatetag:: get_current_language_bidi
+
+``get_current_language_bidi``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``{% get_current_language_bidi as LANGUAGE_BIDI %}`` returns the current
+locale's direction. If ``True``, it's a right-to-left language, e.g. Hebrew,
+Arabic. If ``False`` it's a left-to-right language, e.g. English, French,
+German, etc.
If you enable the ``django.template.context_processors.i18n`` context processor
then each ``RequestContext`` will have access to ``LANGUAGES``,
@@ -837,6 +852,11 @@ then each ``RequestContext`` will have access to ``LANGUAGES``,
The ``i18n`` context processor is not enabled by default for new projects.
+.. templatetag:: get_language_info
+
+``get_language_info``
+~~~~~~~~~~~~~~~~~~~~~
+
You can also retrieve information about any of the available languages using
provided template tags and filters. To get information about a single language,
use the ``{% get_language_info %}`` tag::
@@ -851,6 +871,11 @@ You can then access the information::
Name in English: {{ lang.name }}<br />
Bi-directional: {{ lang.bidi }}
+.. templatetag:: get_language_info_list
+
+``get_language_info_list``
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
You can also use the ``{% get_language_info_list %}`` template tag to retrieve
information for a list of languages (e.g. active languages as specified in
:setting:`LANGUAGES`). See :ref:`the section about the set_language redirect
@@ -871,6 +896,13 @@ you can iterate over those languages in the template::
{% get_language_info_list for available_languages as langs %}
{% for lang in langs %} ... {% endfor %}
+.. templatefilter:: language_name
+.. templatefilter:: language_name_local
+.. templatefilter:: language_bidi
+
+Template filters
+~~~~~~~~~~~~~~~~
+
There are also simple filters available for convenience:
* ``{{ LANGUAGE_CODE|language_name }}`` ("German")