Salome HOME
#12754 fixed i18n accent francais
[tools/sat.git] / src / i18n / i18nTest.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3
4 # %% LICENSE_SALOME_CEA_BEGIN
5 # Copyright (C) 2008-2018  CEA/DEN
6
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21 # See http://www.salome-platform.org or email : webmaster.salome@opencascade.com
22 # %% LICENSE_END
23
24 import os
25 import gettext
26 import unittest
27
28 verbose = False
29
30 class TestCase(unittest.TestCase):
31   
32   def test_001(self):
33     # first load resources for internationalization
34     gettext.install('salomeTools', os.path.realpath(os.path.dirname(__file__)))
35  
36   def test_005(self):
37     res = _("Harvey writes '%(1)s' for %(2)s.") % {"1": "hello", "2": "test_005"}
38     if verbose: print(res)
39     self.assertEqual(res, "pour test_005 Hervé écrit 'hello'.")
40
41   def test_010(self):
42     res = _("Harvey writes '%(1)s' for %(2)s.") % {"1": _("hello"), "2": "test_010"}
43     if verbose: print(res)
44     self.assertEqual(res, "pour test_010 Hervé écrit 'bonjour'.")
45
46   def test_020(self):
47     # keep Ooops inexisting in salomeTools.po as no translation
48     res = _("Harvey writes '%(1)s' for %(2)s.") % {"1": _("Ooops"), "2": "test_020"}
49     if verbose: print(res)
50     self.assertEqual(res, "pour test_020 Hervé écrit 'Ooops'.")
51
52 if __name__ == '__main__':
53   verbose = False
54   unittest.main()
55   pass