summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorBernardo Pires <carneiro.be@gmail.com>2013-11-09 11:32:19 +0100
committerBaptiste Mispelon <bmispelon@gmail.com>2013-11-09 23:56:53 +0100
commit8bc350b38516d8c3a14aed113dd3402b9375b75c (patch)
treebcd91140d5a11983cc1fa0b5262eca5a1a0374e8 /docs/ref
parente7383f16b438a03ea2258a49e4889fd6e2303e53 (diff)
Fixed #21372 -- Corrected docs regarding translating LANGUAGES.
Corrected LANGUAGES documentation on how to translate language names. Now using django.utils.translation.ugettext_lazy instead of a dummy gettext() function. Thanks to Salvatore for the report.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/settings.txt24
1 files changed, 7 insertions, 17 deletions
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index 4b813a8ac7..0c4924e0d3 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1366,29 +1366,19 @@ This specifies which languages are available for language selection. See
Generally, the default value should suffice. Only set this setting if you want
to restrict language selection to a subset of the Django-provided languages.
-If you define a custom :setting:`LANGUAGES` setting, it's OK to mark the
-languages as translation strings (as in the default value referred to above)
--- but use a "dummy" ``gettext()`` function, not the one in
-``django.utils.translation``. You should *never* import
-``django.utils.translation`` from within your settings file, because that
-module in itself depends on the settings, and that would cause a circular
-import.
+If you define a custom :setting:`LANGUAGES` setting, you can mark the
+language names as translation strings using the
+:func:`~django.utils.translation.ugettext_lazy` function.
-The solution is to use a "dummy" ``gettext()`` function. Here's a sample
-settings file::
+Here's a sample settings file::
- gettext = lambda s: s
+ from django.utils.translation import ugettext_lazy as _
LANGUAGES = (
- ('de', gettext('German')),
- ('en', gettext('English')),
+ ('de', _('German')),
+ ('en', _('English')),
)
-With this arrangement, ``django-admin.py makemessages`` will still find and
-mark these strings for translation, but the translation won't happen at
-runtime -- so you'll have to remember to wrap the languages in the *real*
-``gettext()`` in any code that uses :setting:`LANGUAGES` at runtime.
-
.. setting:: LOCALE_PATHS
LOCALE_PATHS