def testUserWrittenTranslationFunction(self): """Test I18N : user written translation function""" self.assertEquals( pokergame.init_i18n(None, lambda text : "All your string are translated to us.")("DUMMY TEXT RETURN"), "DUMMY TEXT RETURN" ) self.failUnlessEqual(pokergame._("Ace"), "All your string are translated to us.")
def testTranslationFails(self): """Test I18N : domains/lang fails""" # When we do the init, we've already set it to an _() that returns # text. self.assertEquals(pokergame.init_i18n(None)("ANYTHING"), "ANYTHING") self.failUnlessEqual(pokergame._("Ace"), "Ace")
def testWindowsSuccess(self): """Test I18N : windows success""" old_platform, pokergame.platform = pokergame.platform, FakePlatform("Windows") old_locale, pokergame.locale = pokergame.locale, FakeLocale("de") pokergame.init_i18n(path.join(TESTS_PATH, "../locale")) self.failUnlessEqual(pokergame._("King"), u"König".encode('utf8')) pokergame.platform = old_platform pokergame.locale = old_locale pokergame.init_i18n(None)
def testWindowsFails(self): """Test I18N : windows fails""" old_platform, pokergame.platform = pokergame.platform, FakePlatform("Windows") old_locale, pokergame.locale = pokergame.locale, FakeLocale("de") pokergame.init_i18n(None) self.failUnlessEqual(pokergame._("King"), "King") pokergame.platform = old_platform pokergame.locale = old_locale pokergame.init_i18n(None)
def testWindowsSuccess(self): """Test I18N : windows success""" old_platform, pokergame.platform = pokergame.platform, FakePlatform("Windows") old_locale, pokergame.locale = pokergame.locale, FakeLocale("de") pokergame.init_i18n(path.join(TESTS_PATH, "../locale")) self.failUnlessEqual(pokergame._("King"), "König") pokergame.platform = old_platform pokergame.locale = old_locale pokergame.init_i18n(None)