Skip to content
Myr

add note about ugettext

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 26d462a · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:src/jinja2/ext.py+4 added-4 removed
24 unmodified lines
25from .runtime import concat26from .utils import contextfunction27from .utils import import_string2829# the only real useful gettext functions for a Jinja template. Note30# that ugettext must be assigned to gettext as Jinja doesn't support31# non unicode strings.29# I18N functions available in Jinja templates. If the I18N library30# provides ugettext, it will be assigned to gettext.31GETTEXT_FUNCTIONS = ("_", "gettext", "ngettext")3332_ws_re = re.compile(r"\s*\n\s*")333435class ExtensionRegistry(type):
153 unmodified lines
189 newstyle_gettext=False,190 )191192 def _install(self, translations, newstyle=None):193 # ugettext and ungettext are preferred in case the I18N library194 # is providing compatibility with older Python versions.195 gettext = getattr(translations, "ugettext", None)196 if gettext is None:197 gettext = translations.gettext198 ngettext = getattr(translations, "ungettext", None)
502 unmodified lines