示例#1
0
 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.")
示例#2
0
    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")
示例#3
0
    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")
示例#4
0
 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.")
示例#5
0
    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)
示例#6
0
    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)
示例#7
0
    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)
示例#8
0
    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)