Use mediagoblin._compat.{ugettext, ungettext} on Python 3.

This commit is contained in:
Berker Peksag 2014-06-02 22:25:27 +03:00
parent 5a239cb7b8
commit f9a7201c32
2 changed files with 4 additions and 4 deletions

View File

@ -7,6 +7,7 @@ from mediagoblin import mg_globals
if PY3:
from email.mime.text import MIMEText
from urllib import parse as urlparse
# TODO(berker): Rename to gettext and ungettext instead?
ugettext = mg_globals.thread_scope.translations.gettext
ungettext = mg_globals.thread_scope.translations.ngettext
else:

View File

@ -22,6 +22,7 @@ from babel import localedata
from babel.support import LazyProxy
from mediagoblin import mg_globals
from mediagoblin._compat import ugettext, ungettext
###################
# Translation tools
@ -146,8 +147,7 @@ def pass_to_ugettext(*args, **kwargs):
The reason we can't have a global ugettext method is because
mg_globals gets swapped out by the application per-request.
"""
return mg_globals.thread_scope.translations.ugettext(
*args, **kwargs)
return ugettext(*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
mg_globals gets swapped out by the application per-request.
"""
return mg_globals.thread_scope.translations.ungettext(
*args, **kwargs)
return ungettext(*args, **kwargs)
def lazy_pass_to_ugettext(*args, **kwargs):