Use mediagoblin._compat.{ugettext, ungettext} on Python 3.
This commit is contained in:
parent
5a239cb7b8
commit
f9a7201c32
@ -7,6 +7,7 @@ from mediagoblin import mg_globals
|
|||||||
if PY3:
|
if PY3:
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from urllib import parse as urlparse
|
from urllib import parse as urlparse
|
||||||
|
# TODO(berker): Rename to gettext and ungettext instead?
|
||||||
ugettext = mg_globals.thread_scope.translations.gettext
|
ugettext = mg_globals.thread_scope.translations.gettext
|
||||||
ungettext = mg_globals.thread_scope.translations.ngettext
|
ungettext = mg_globals.thread_scope.translations.ngettext
|
||||||
else:
|
else:
|
||||||
|
@ -22,6 +22,7 @@ from babel import localedata
|
|||||||
from babel.support import LazyProxy
|
from babel.support import LazyProxy
|
||||||
|
|
||||||
from mediagoblin import mg_globals
|
from mediagoblin import mg_globals
|
||||||
|
from mediagoblin._compat import ugettext, ungettext
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Translation tools
|
# Translation tools
|
||||||
@ -146,8 +147,7 @@ def pass_to_ugettext(*args, **kwargs):
|
|||||||
The reason we can't have a global ugettext method is because
|
The reason we can't have a global ugettext method is because
|
||||||
mg_globals gets swapped out by the application per-request.
|
mg_globals gets swapped out by the application per-request.
|
||||||
"""
|
"""
|
||||||
return mg_globals.thread_scope.translations.ugettext(
|
return ugettext(*args, **kwargs)
|
||||||
*args, **kwargs)
|
|
||||||
|
|
||||||
def pass_to_ungettext(*args, **kwargs):
|
def pass_to_ungettext(*args, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -156,8 +156,7 @@ def pass_to_ungettext(*args, **kwargs):
|
|||||||
The reason we can't have a global ugettext method is because
|
The reason we can't have a global ugettext method is because
|
||||||
mg_globals gets swapped out by the application per-request.
|
mg_globals gets swapped out by the application per-request.
|
||||||
"""
|
"""
|
||||||
return mg_globals.thread_scope.translations.ungettext(
|
return ungettext(*args, **kwargs)
|
||||||
*args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def lazy_pass_to_ugettext(*args, **kwargs):
|
def lazy_pass_to_ugettext(*args, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user