py3: gettext no longer has a unicode= argument

This is unicode by default "since there's no point in translating to
byte strings." Good riddance.
This commit is contained in:
Eli Schwartz 2019-03-17 07:46:31 -04:00
parent 042d740593
commit 2d382274cd
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
import os, locale, re, io
from gettext import GNUTranslations, NullTranslations
from polyglot.builtins import unicode_type
from polyglot.builtins import is_py3, unicode_type
_available_translations = None
@ -244,7 +244,10 @@ def set_translators():
set_translators.lang = t.info().get('language')
except Exception:
pass
t.install(unicode=True, names=('ngettext',))
if is_py3:
t.install(names=('ngettext',))
else:
t.install(unicode=True, names=('ngettext',))
# Now that we have installed a translator, we have to retranslate the help
# for the global prefs object as it was instantiated in get_lang(), before
# the translator was installed.