summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-015-translate.py
blob: 8ca9463a6e565af10bc75d3bd8dcfec8685078e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()