示例#1
0
 def test_each_lang(self):
     langs = set(available_translations()) - {'en_GB'}
     for lang in langs:
         translate = set_up_gettext(lang)
         for text in REQUIRED_TRANSLATIONS:
             translated = translate(text)
             assert translated
             msg = "'{text}' is untranslated for {lang}".format(**locals())
             assert translated != text, msg
示例#2
0
def test_binding_uses_settings_locale():
    with NewLocale("fr_FR"):
        _ = set_up_gettext("en_GB.UTF-8")
        assert _("favorites") == "favourites"
示例#3
0
def test_gettext_uses_fallback():
    _ = set_up_gettext("fr_FR.UTF-8")
    assert _("favorites") == "favorites"
示例#4
0
def test_binding_respects_language():
    _ = set_up_gettext("en_US.UTF-8")
    assert _("favorites") == "favorites"
示例#5
0
def test_some_german_works():
    _ = set_up_gettext("de_DE.UTF-8")
    assert _("favorites") == "Favoriten"
    assert _("Playing mix of {genres}") == "Spiele eine Mischung aus {genres}"
示例#6
0
def test_some_french_works():
    _ = set_up_gettext("fr.UTF-8")
    assert _("favorites") == "favoris"
    french = "La lecture aléatoire est maintenant désactivée"
    assert _("Shuffle is now off") == french
示例#7
0
def test_gettext_uses_fallback():
    _ = set_up_gettext(UNSUPPORTED_LOCALE)
    assert _("favorites") == "favorites"