mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Remove Python 2 gettext builtin installation
This commit is contained in:
parent
a83fbb56c0
commit
384e1e196d
1 changed files with 4 additions and 15 deletions
|
|
@ -33,21 +33,10 @@ default_domain = None
|
|||
|
||||
def install_builtin (translator, do_unicode):
|
||||
"""Install _() and _n() gettext methods into default namespace."""
|
||||
try:
|
||||
import __builtin__ as builtins
|
||||
except ImportError:
|
||||
# Python 3
|
||||
import builtins
|
||||
# Python 3 has no ugettext
|
||||
has_unicode = hasattr(translator, 'ugettext')
|
||||
if do_unicode and has_unicode:
|
||||
builtins.__dict__['_'] = translator.ugettext
|
||||
# also install ngettext
|
||||
builtins.__dict__['_n'] = translator.ungettext
|
||||
else:
|
||||
builtins.__dict__['_'] = translator.gettext
|
||||
# also install ngettext
|
||||
builtins.__dict__['_n'] = translator.ngettext
|
||||
import builtins
|
||||
builtins.__dict__['_'] = translator.gettext
|
||||
# also install ngettext
|
||||
builtins.__dict__['_n'] = translator.ngettext
|
||||
|
||||
class Translator (gettext.GNUTranslations):
|
||||
"""A translation class always installing its gettext methods into the
|
||||
|
|
|
|||
Loading…
Reference in a new issue