summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-015-translate.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-07-07 07:21:27 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-07-07 07:21:27 -0400
commitcf500d4b24cf865d77bf09e2bf149da2cf09421a (patch)
tree573b342d3fa620b61339639254cba5220623b8d6 /tests/unit/test-015-translate.py
parent2dd455c056baad1acc059273645ddf696027b2c8 (diff)
downloadpykolab-cf500d4b24cf865d77bf09e2bf149da2cf09421a.tar.gz
Add function to change user language; add en.po for English localization
Diffstat (limited to 'tests/unit/test-015-translate.py')
-rw-r--r--tests/unit/test-015-translate.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/test-015-translate.py b/tests/unit/test-015-translate.py
new file mode 100644
index 0000000..8ca9463
--- /dev/null
+++ b/tests/unit/test-015-translate.py
@@ -0,0 +1,25 @@
+import unittest
+import gettext
+from pykolab import translate
+
+class TestTranslate(unittest.TestCase):
+
+ def setUp(self):
+ translate.setUserLanguage('en')
+
+ def test_001_default_langs(self):
+ self.assertTrue(len(translate.getDefaultLangs()) > 0)
+
+ def test_002_translate(self):
+ from pykolab.translate import _
+ self.assertEqual(_("Folder name"), "Folder name")
+
+ def test_003_set_lang(self):
+ from pykolab.translate import _
+ self.assertFalse(translate.setUserLanguage('foo_bar'))
+ self.assertEqual(_("Folder name"), "Folder name")
+ self.assertTrue(translate.setUserLanguage('de_DE'))
+ self.assertEqual(_("Folder name"), "Ordnername")
+
+if __name__ == '__main__':
+ unittest.main()