Exemple #1
0
 def test_gettext(self):
     tornado.locale.load_gettext_translations(
         os.path.join(os.path.dirname(__file__), 'gettext_translations'),
         "tornado_test")
     locale = tornado.locale.get("fr_FR")
     self.assertTrue(isinstance(locale, tornado.locale.GettextLocale))
     self.assertEqual(locale.translate("school"), u"\u00e9cole")
     self.assertEqual(locale.pgettext("law", "right"), u"le droit")
     self.assertEqual(locale.pgettext("good", "right"), u"le bien")
     self.assertEqual(locale.pgettext("organization", "club", "clubs", 1), u"le club")
     self.assertEqual(locale.pgettext("organization", "club", "clubs", 2), u"les clubs")
     self.assertEqual(locale.pgettext("stick", "club", "clubs", 1), u"le b\xe2ton")
     self.assertEqual(locale.pgettext("stick", "club", "clubs", 2), u"les b\xe2tons")
Exemple #2
0
 def test_gettext(self):
     tornado.locale.load_gettext_translations(
         os.path.join(os.path.dirname(__file__), 'gettext_translations'),
         "tornado_test")
     locale = tornado.locale.get("fr_FR")
     self.assertTrue(isinstance(locale, tornado.locale.GettextLocale))
     self.assertEqual(locale.translate("school"), u("\u00e9cole"))
     self.assertEqual(locale.pgettext("law", "right"), u("le droit"))
     self.assertEqual(locale.pgettext("good", "right"), u("le bien"))
     self.assertEqual(locale.pgettext("organization", "club", "clubs", 1), u("le club"))
     self.assertEqual(locale.pgettext("organization", "club", "clubs", 2), u("les clubs"))
     self.assertEqual(locale.pgettext("stick", "club", "clubs", 1), u("le b\xe2ton"))
     self.assertEqual(locale.pgettext("stick", "club", "clubs", 2), u("les b\xe2tons"))