示例#1
0
 def testGetTextMsg1Reset(self):
     self._addLocaleDir("locale1")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _TRANS1)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
     locale.reset()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _TRANS1)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
示例#2
0
 def testGetTextMsg1Reset(self):
     self._addLocaleDir("locale1")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _TRANS1)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
     locale.reset()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _TRANS1)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
示例#3
0
 def testGetTextMsg12Remove1(self):
     self._addLocaleDir("locale1")
     self._addLocaleDir("locale2")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _TRANS1)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _TRANS2)
     self._removeLocaleDir("locale1")
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _TRANS2)
示例#4
0
 def testGetTextMsg12Remove1(self):
     self._addLocaleDir("locale1")
     self._addLocaleDir("locale2")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _TRANS1)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _TRANS2)
     self._removeLocaleDir("locale1")
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _TRANS2)
示例#5
0
 def testNoLocalePath(self):
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
示例#6
0
 def testGetTextMsg2LazyGetText(self):
     self._addLocaleDir("locale2")
     device = _Device()
     msg = locale.gettext__(_MSG2_ID)
     self.failUnless(isinstance(msg, locale.LazyTranslation))
     self.failUnlessEqual(locale.gettext(msg, device), _TRANS2)
示例#7
0
 def testGetTextMsg1EmptyLocale(self):
     self._addLocaleDir("locale1")
     device = _Device()
     device.locale = ''
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
示例#8
0
 def testGetTextTranslatedMsg1(self):
     self._addLocaleDir("locale1")
     self._addLocaleDir("locale2")
     self._addLocaleDir("locale3")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_TRANS1, device), _TRANS1)
示例#9
0
 def testGetTextMsg12Fail(self):
     self._addLocaleDir("locale3")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
示例#10
0
 def testNoLocalePath(self):
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)
示例#11
0
 def testGetTextMsg2LazyGetText(self):
     self._addLocaleDir("locale2")
     device = _Device()
     msg = locale.gettext__(_MSG2_ID)
     self.failUnless(isinstance(msg, locale.LazyTranslation))
     self.failUnlessEqual(locale.gettext(msg, device), _TRANS2)
示例#12
0
 def testGetTextMsg1EmptyLocale(self):
     self._addLocaleDir("locale1")
     device = _Device()
     device.locale = ''
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
示例#13
0
 def testGetTextTranslatedMsg1(self):
     self._addLocaleDir("locale1")
     self._addLocaleDir("locale2")
     self._addLocaleDir("locale3")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_TRANS1, device), _TRANS1)
示例#14
0
 def testGetTextMsg12Fail(self):
     self._addLocaleDir("locale3")
     device = _Device()
     self.failUnlessEqual(locale.gettext(_MSG1_ID, device), _MSG1_ID)
     self.failUnlessEqual(locale.gettext(_MSG2_ID, device), _MSG2_ID)