Kaydet (Commit) 35ea6d83 authored tarafından Mattias Loverot's avatar Mattias Loverot Kaydeden (comit) Tim Graham

Fixed #27069 -- Doc'd which gettext functions may be aliased as _.

üst 49fcbe73
......@@ -70,6 +70,16 @@ as a shorter alias, ``_``, to save typing.
global ``_()`` function causes interference. Explicitly importing
``ugettext()`` as ``_()`` avoids this problem.
.. admonition:: What functions may be aliased as ``_``?
Because of how ``xgettext`` (used by :djadmin:`makemessages`) works, only
functions that take a single string argument can be imported as ``_``:
* :func:`~django.utils.translation.gettext`
* :func:`~django.utils.translation.gettext_lazy`
* :func:`~django.utils.translation.ugettext`
* :func:`~django.utils.translation.ugettext_lazy`
In this example, the text ``"Welcome to my site."`` is marked as a translation
string::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment