|
@@ -1,12 +1,10 @@
|
|
|
"""
|
|
|
Internationalization support.
|
|
|
"""
|
|
|
-import warnings
|
|
|
from contextlib import ContextDecorator
|
|
|
from decimal import ROUND_UP, Decimal
|
|
|
|
|
|
from django.utils.autoreload import autoreload_started, file_changed
|
|
|
-from django.utils.deprecation import RemovedInDjango40Warning
|
|
|
from django.utils.functional import lazy
|
|
|
from django.utils.regex_helper import _lazy_re_compile
|
|
|
|
|
@@ -16,9 +14,7 @@ __all__ = [
|
|
|
'get_language_info', 'get_language_bidi',
|
|
|
'check_for_language', 'to_language', 'to_locale', 'templatize',
|
|
|
'gettext', 'gettext_lazy', 'gettext_noop',
|
|
|
- 'ugettext', 'ugettext_lazy', 'ugettext_noop',
|
|
|
'ngettext', 'ngettext_lazy',
|
|
|
- 'ungettext', 'ungettext_lazy',
|
|
|
'pgettext', 'pgettext_lazy',
|
|
|
'npgettext', 'npgettext_lazy',
|
|
|
'LANGUAGE_SESSION_KEY',
|
|
@@ -77,53 +73,14 @@ def gettext_noop(message):
|
|
|
return _trans.gettext_noop(message)
|
|
|
|
|
|
|
|
|
-def ugettext_noop(message):
|
|
|
- """
|
|
|
- A legacy compatibility wrapper for Unicode handling on Python 2.
|
|
|
- Alias of gettext_noop() since Django 2.0.
|
|
|
- """
|
|
|
- warnings.warn(
|
|
|
- 'django.utils.translation.ugettext_noop() is deprecated in favor of '
|
|
|
- 'django.utils.translation.gettext_noop().',
|
|
|
- RemovedInDjango40Warning, stacklevel=2,
|
|
|
- )
|
|
|
- return gettext_noop(message)
|
|
|
-
|
|
|
-
|
|
|
def gettext(message):
|
|
|
return _trans.gettext(message)
|
|
|
|
|
|
|
|
|
-def ugettext(message):
|
|
|
- """
|
|
|
- A legacy compatibility wrapper for Unicode handling on Python 2.
|
|
|
- Alias of gettext() since Django 2.0.
|
|
|
- """
|
|
|
- warnings.warn(
|
|
|
- 'django.utils.translation.ugettext() is deprecated in favor of '
|
|
|
- 'django.utils.translation.gettext().',
|
|
|
- RemovedInDjango40Warning, stacklevel=2,
|
|
|
- )
|
|
|
- return gettext(message)
|
|
|
-
|
|
|
-
|
|
|
def ngettext(singular, plural, number):
|
|
|
return _trans.ngettext(singular, plural, number)
|
|
|
|
|
|
|
|
|
-def ungettext(singular, plural, number):
|
|
|
- """
|
|
|
- A legacy compatibility wrapper for Unicode handling on Python 2.
|
|
|
- Alias of ngettext() since Django 2.0.
|
|
|
- """
|
|
|
- warnings.warn(
|
|
|
- 'django.utils.translation.ungettext() is deprecated in favor of '
|
|
|
- 'django.utils.translation.ngettext().',
|
|
|
- RemovedInDjango40Warning, stacklevel=2,
|
|
|
- )
|
|
|
- return ngettext(singular, plural, number)
|
|
|
-
|
|
|
-
|
|
|
def pgettext(context, message):
|
|
|
return _trans.pgettext(context, message)
|
|
|
|
|
@@ -136,19 +93,6 @@ gettext_lazy = lazy(gettext, str)
|
|
|
pgettext_lazy = lazy(pgettext, str)
|
|
|
|
|
|
|
|
|
-def ugettext_lazy(message):
|
|
|
- """
|
|
|
- A legacy compatibility wrapper for Unicode handling on Python 2. Has been
|
|
|
- Alias of gettext_lazy since Django 2.0.
|
|
|
- """
|
|
|
- warnings.warn(
|
|
|
- 'django.utils.translation.ugettext_lazy() is deprecated in favor of '
|
|
|
- 'django.utils.translation.gettext_lazy().',
|
|
|
- RemovedInDjango40Warning, stacklevel=2,
|
|
|
- )
|
|
|
- return gettext_lazy(message)
|
|
|
-
|
|
|
-
|
|
|
def lazy_number(func, resultclass, number=None, **kwargs):
|
|
|
if isinstance(number, int):
|
|
|
kwargs['number'] = number
|
|
@@ -204,19 +148,6 @@ def ngettext_lazy(singular, plural, number=None):
|
|
|
return lazy_number(ngettext, str, singular=singular, plural=plural, number=number)
|
|
|
|
|
|
|
|
|
-def ungettext_lazy(singular, plural, number=None):
|
|
|
- """
|
|
|
- A legacy compatibility wrapper for Unicode handling on Python 2.
|
|
|
- An alias of ungettext_lazy() since Django 2.0.
|
|
|
- """
|
|
|
- warnings.warn(
|
|
|
- 'django.utils.translation.ungettext_lazy() is deprecated in favor of '
|
|
|
- 'django.utils.translation.ngettext_lazy().',
|
|
|
- RemovedInDjango40Warning, stacklevel=2,
|
|
|
- )
|
|
|
- return ngettext_lazy(singular, plural, number)
|
|
|
-
|
|
|
-
|
|
|
def npgettext_lazy(context, singular, plural, number=None):
|
|
|
return lazy_number(npgettext, str, context=context, singular=singular, plural=plural, number=number)
|
|
|
|