Fixed #30165 -- Deprecated ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy().

This commit is contained in:
Jon Dufresne 2019-02-05 19:45:26 -08:00 committed by Tim Graham
parent 48c17807a9
commit 6eb4996672
6 changed files with 108 additions and 21 deletions

View file

@ -20,6 +20,10 @@ details on these changes.
* ``django.utils.encoding.force_text()`` and ``smart_text()`` will be removed.
* ``django.utils.translation.ugettext()``, ``ugettext_lazy()``,
``ugettext_noop()``, ``ungettext()``, and ``ungettext_lazy()`` will be
removed.
.. _deprecation-removed-in-3.1:
3.1

View file

@ -978,7 +978,6 @@ between unicode and bytestrings. If your code doesn't support Python 2, use the
functions without the ``u``.
.. function:: gettext(message)
.. function:: ugettext(message)
Translates ``message`` and returns it as a string.
@ -989,7 +988,6 @@ functions without the ``u``.
For more information, see :ref:`contextual-markers`.
.. function:: gettext_lazy(message)
.. function:: ugettext_lazy(message)
.. function:: pgettext_lazy(context, message)
Same as the non-lazy versions above, but using lazy execution.
@ -997,7 +995,6 @@ functions without the ``u``.
See :ref:`lazy translations documentation <lazy-translations>`.
.. function:: gettext_noop(message)
.. function:: ugettext_noop(message)
Marks strings for translation but doesn't translate them now. This can be
used to store strings in global variables that should stay in the base
@ -1005,7 +1002,6 @@ functions without the ``u``.
later.
.. function:: ngettext(singular, plural, number)
.. function:: ungettext(singular, plural, number)
Translates ``singular`` and ``plural`` and returns the appropriate string
based on ``number``.
@ -1016,7 +1012,6 @@ functions without the ``u``.
based on ``number`` and the ``context``.
.. function:: ngettext_lazy(singular, plural, number)
.. function:: ungettext_lazy(singular, plural, number)
.. function:: npgettext_lazy(context, singular, plural, number)
Same as the non-lazy versions above, but using lazy execution.

View file

@ -378,7 +378,7 @@ Translating URL patterns
Django can now look for a language prefix in the URLpattern when using the new
:func:`~django.conf.urls.i18n.i18n_patterns` helper function.
It's also now possible to define translatable URL patterns using
:func:`~django.utils.translation.ugettext_lazy`. See
``django.utils.translation.ugettext_lazy()``. See
:ref:`url-internationalization` for more information about the language prefix
and how to internationalize URL patterns.

View file

@ -309,6 +309,14 @@ Miscellaneous
aliases for: :func:`urllib.parse.quote`, :func:`~urllib.parse.quote_plus`,
:func:`~urllib.parse.unquote`, and :func:`~urllib.parse.unquote_plus`.
* ``django.utils.translation.ugettext()``, ``ugettext_lazy()``,
``ugettext_noop()``, ``ungettext()``, and ``ungettext_lazy()`` are deprecated
in favor of the functions that they're aliases for:
:func:`django.utils.translation.gettext`,
:func:`~django.utils.translation.gettext_lazy`,
:func:`~django.utils.translation.gettext_noop`,
:func:`~django.utils.translation.ngettext`, and
:func:`~django.utils.translation.ngettext_lazy`.
.. _removed-features-3.0: