From: Berker Peksag Date: Mon, 2 Jun 2014 19:25:27 +0000 (+0300) Subject: Use mediagoblin._compat.{ugettext, ungettext} on Python 3. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f9a7201c32a42f31ac7c0c8568e80c8fbf5aec32;p=mediagoblin.git Use mediagoblin._compat.{ugettext, ungettext} on Python 3. --- diff --git a/mediagoblin/_compat.py b/mediagoblin/_compat.py index fd6172fd..c38e0727 100644 --- a/mediagoblin/_compat.py +++ b/mediagoblin/_compat.py @@ -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: diff --git a/mediagoblin/tools/translate.py b/mediagoblin/tools/translate.py index 257bd791..e6df612d 100644 --- a/mediagoblin/tools/translate.py +++ b/mediagoblin/tools/translate.py @@ -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):