def test_init_language_with_local_modification(local_translation): trans = i18n._init_language("de") assert isinstance(trans, gettext.GNUTranslations) assert trans.info()["language"] == "de" assert trans.info()["project-id-version"] == "Locally modified Check_MK translation" translated = trans.gettext("bla") assert isinstance(translated, str) assert translated == "blub"
def test_init_language_only_builtin(): trans = i18n._init_language("de") assert isinstance(trans, gettext.GNUTranslations) assert trans.info()["language"] == "de" assert trans.info()["project-id-version"] == "Checkmk user interface translation 0.1" translated = trans.gettext("bla") assert isinstance(translated, str) assert translated == "bla"
def test_init_language_only_builtin(): trans = i18n._init_language("de") assert isinstance(trans, gettext.GNUTranslations) assert trans.info()["language"] == "de" assert trans.info()["project-id-version"] == "Check_MK Multisite translation 0.1" translated = trans.ugettext("bla") assert isinstance(translated, unicode) assert translated == "bla"
def test_init_language_with_local_modification_fallback(local_translation): trans = i18n._init_language("de") assert isinstance(trans, gettext.GNUTranslations) assert trans.info()["language"] == "de" assert trans.info()["project-id-version"] == "Locally modified Check_MK translation" translated = trans.gettext("bla") assert isinstance(translated, str) assert translated == "blub" # This string is localized in the standard file, not in the locally # overridden file translated = trans.gettext("Age") assert isinstance(translated, str) assert translated == "Alter"
def test_init_language_not_existing(): assert i18n._init_language("xz") is None
def test_init_language_with_package_localization(local_translation): trans = i18n._init_language("de") translated = trans.ugettext("pkg1") assert isinstance(translated, six.text_type) assert translated == "lala"
def test_init_language_with_package_localization(local_translation): trans = i18n._init_language("de") assert trans is not None translated = trans.gettext("pkg1") assert isinstance(translated, str) assert translated == "lala"