refactor this to not use gettext's __builtin__ hack
This commit is contained in:
parent
d6d3192d82
commit
a5cccbe757
|
@ -20,16 +20,18 @@
|
||||||
from version import APP_NAME
|
from version import APP_NAME
|
||||||
from util import dbg
|
from util import dbg
|
||||||
|
|
||||||
|
_ = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gettext
|
import gettext
|
||||||
gettext.install(APP_NAME)
|
gettext.textdomain(APP_NAME)
|
||||||
|
_ = gettext.gettext
|
||||||
except ImportError:
|
except ImportError:
|
||||||
dbg("Using fallback _()")
|
dbg("Using fallback _()")
|
||||||
import __builtin__
|
|
||||||
|
|
||||||
def dummytrans (text):
|
def dummytrans (text):
|
||||||
"""A _ function for systems without gettext. Effectively a NOOP"""
|
"""A _ function for systems without gettext. Effectively a NOOP"""
|
||||||
return(text)
|
return(text)
|
||||||
|
|
||||||
__builtin__.__dict__['_'] = dummytrans
|
_ = dummytrans
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue