mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Monkey patch .gettext with .ugettext if possible (we use python 2.x)
This commit is contained in:
parent
817a7bb2c8
commit
532a0de601
@ -209,7 +209,7 @@ class Locale(Transform):
|
|||||||
for node, msg in extract_messages(self.document):
|
for node, msg in extract_messages(self.document):
|
||||||
ctx = node.parent
|
ctx = node.parent
|
||||||
patch = new_document(source, settings)
|
patch = new_document(source, settings)
|
||||||
msgstr = catalog.ugettext(msg)
|
msgstr = catalog.gettext(msg)
|
||||||
#XXX add marker to untranslated parts
|
#XXX add marker to untranslated parts
|
||||||
if not msgstr or msgstr == msg: # as-of-yet untranslated
|
if not msgstr or msgstr == msg: # as-of-yet untranslated
|
||||||
continue
|
continue
|
||||||
|
@ -217,4 +217,6 @@ def init(locale_dirs, language, catalog='sphinx'):
|
|||||||
translator = gettext.NullTranslations()
|
translator = gettext.NullTranslations()
|
||||||
has_translation = False
|
has_translation = False
|
||||||
translators[catalog] = translator
|
translators[catalog] = translator
|
||||||
|
if hasattr(translator, 'ugettext'):
|
||||||
|
translator.gettext = translator.ugettext
|
||||||
return translator, has_translation
|
return translator, has_translation
|
||||||
|
Loading…
Reference in New Issue
Block a user