def test_no_env_variables(self): self.overrideEnv('LANGUAGE', None) self.overrideEnv('LC_ALL', None) self.overrideEnv('LC_MESSAGES', None) self.overrideEnv('LANG', None) i18n.install() # Whether we found a valid tranlsation or not doesn't matter, we got # one and _translations is not None anymore. self.assertIsInstance(i18n._translations, i18n._gettext.NullTranslations)
def get_help_text(self, additional_see_also=None, plain=True): """Return a string with the help for this topic. :param additional_see_also: Additional help topics to be cross-referenced. :param plain: if False, raw help (reStructuredText) is returned instead of plain text. """ result = topic_registry.get_detail(self.topic) result += _format_see_also(additional_see_also) if plain: result = help_as_plain_text(result) i18n.install() result = i18n.gettext_per_paragraph(result) return result
def test_disable_i18n(self): i18n.disable_i18n() i18n.install() # It's disabled, you can't install anything and we fallback to null self.assertIsInstance(i18n._translations, i18n._gettext.NullTranslations)
def test_custom_languages(self): i18n.install('nl:fy') # Whether we found a valid tranlsation or not doesn't matter, we got # one and _translations is not None anymore. self.assertIsInstance(i18n._translations, i18n._gettext.NullTranslations)