Example #1
0
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"
Example #2
0
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"
Example #3
0
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"
Example #4
0
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"
Example #5
0
def test_init_language_not_existing():
    assert i18n._init_language("xz") is None
Example #6
0
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"
Example #7
0
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"