doc: document QT_AUTO_SCREEN_SCALE_FACTORS for High-DPI displays
[git-cola.git] / test / i18n_test.py
blobfbf1c7ffc5b1fd032ca27422cc760de27b4613d7
1 from __future__ import absolute_import, division, unicode_literals
2 import unittest
4 from cola import i18n
5 from cola.i18n import N_
6 from cola.compat import uchr
9 class ColaI18nTestCase(unittest.TestCase):
10 """Test cases for the ColaApplication class"""
12 def tearDown(self):
13 i18n.uninstall()
15 def test_translates_noun(self):
16 """Test that strings with @@noun are translated
17 """
18 i18n.install('ja_JP')
19 expect = (uchr(0x30b3) + uchr(0x30df) +
20 uchr(0x30c3) + uchr(0x30c8))
21 actual = N_('Commit@@verb')
22 self.assertEqual(expect, actual)
24 def test_translates_verb(self):
25 """Test that strings with @@verb are translated
26 """
27 i18n.install('de_DE')
28 expect = 'Commit aufnehmen'
29 actual = N_('Commit@@verb')
30 self.assertEqual(expect, actual)
32 def test_translates_english_noun(self):
33 """Test that English strings with @@noun are properly handled
34 """
35 i18n.install('en_US.UTF-8')
36 expect = 'Commit'
37 actual = N_('Commit@@noun')
38 self.assertEqual(expect, actual)
40 def test_translates_english_verb(self):
41 """Test that English strings with @@verb are properly handled
42 """
43 i18n.install('en_US.UTF-8')
44 expect = 'Commit'
45 actual = N_('Commit@@verb')
46 self.assertEqual(expect, actual)
48 def test_translates_random_english(self):
49 """Test that random English strings are passed through as-is
50 """
51 i18n.install('en_US.UTF-8')
52 expect = 'Random'
53 actual = N_('Random')
54 self.assertEqual(expect, actual)
57 if __name__ == '__main__':
58 unittest.main()