Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_gettext.py @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | 6270946115d0 |
| children |
| rev | line source |
|---|---|
|
14188
6223397bd6a2
Test suite for new gettext.py module.
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
1 import os |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
2 import base64 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
3 import shutil |
|
14188
6223397bd6a2
Test suite for new gettext.py module.
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
4 import gettext |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
5 import unittest |
|
14188
6223397bd6a2
Test suite for new gettext.py module.
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
6 |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
36593
diff
changeset
|
7 from test import test_support |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
8 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
9 |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
10 # TODO: |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
11 # - Add new tests, for example for "dgettext" |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
12 # - Remove dummy tests, for example testing for single and double quotes |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
13 # has no sense, it would have if we were testing a parser (i.e. pygettext) |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
14 # - Tests should have only one assert. |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
15 |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
16 GNU_MO_DATA = '''\ |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
17 3hIElQAAAAAGAAAAHAAAAEwAAAALAAAAfAAAAAAAAACoAAAAFQAAAKkAAAAjAAAAvwAAAKEAAADj |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
18 AAAABwAAAIUBAAALAAAAjQEAAEUBAACZAQAAFgAAAN8CAAAeAAAA9gIAAKEAAAAVAwAABQAAALcD |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
19 AAAJAAAAvQMAAAEAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABQAAAAYAAAACAAAAAFJh |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
20 eW1vbmQgTHV4dXJ5IFlhY2gtdABUaGVyZSBpcyAlcyBmaWxlAFRoZXJlIGFyZSAlcyBmaWxlcwBU |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
21 aGlzIG1vZHVsZSBwcm92aWRlcyBpbnRlcm5hdGlvbmFsaXphdGlvbiBhbmQgbG9jYWxpemF0aW9u |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
22 CnN1cHBvcnQgZm9yIHlvdXIgUHl0aG9uIHByb2dyYW1zIGJ5IHByb3ZpZGluZyBhbiBpbnRlcmZh |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
23 Y2UgdG8gdGhlIEdOVQpnZXR0ZXh0IG1lc3NhZ2UgY2F0YWxvZyBsaWJyYXJ5LgBtdWxsdXNrAG51 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
24 ZGdlIG51ZGdlAFByb2plY3QtSWQtVmVyc2lvbjogMi4wClBPLVJldmlzaW9uLURhdGU6IDIwMDAt |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
25 MDgtMjkgMTI6MTktMDQ6MDAKTGFzdC1UcmFuc2xhdG9yOiBKLiBEYXZpZCBJYsOhw7FleiA8ai1k |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
26 YXZpZEBub29zLmZyPgpMYW5ndWFnZS1UZWFtOiBYWCA8cHl0aG9uLWRldkBweXRob24ub3JnPgpN |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
27 SU1FLVZlcnNpb246IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9aXNvLTg4 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
28 NTktMQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBub25lCkdlbmVyYXRlZC1CeTogcHlnZXR0 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
29 ZXh0LnB5IDEuMQpQbHVyYWwtRm9ybXM6IG5wbHVyYWxzPTI7IHBsdXJhbD1uIT0xOwoAVGhyb2F0 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
30 d29iYmxlciBNYW5ncm92ZQBIYXkgJXMgZmljaGVybwBIYXkgJXMgZmljaGVyb3MAR3V2ZiB6YnFo |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
31 eXIgY2ViaXZxcmYgdmFncmVhbmd2YmFueXZtbmd2YmEgbmFxIHlicG55dm1uZ3ZiYQpmaGNjYmVn |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
32 IHNiZSBsYmhlIENsZ3ViYSBjZWJ0ZW56ZiBvbCBjZWJpdnF2YXQgbmEgdmFncmVzbnByIGdiIGd1 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
33 ciBUQUgKdHJnZ3JrZyB6cmZmbnRyIHBuZ255YnQgeXZvZW5lbC4AYmFjb24Ad2luayB3aW5rAA== |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
34 ''' |
|
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
35 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
36 UMO_DATA = '''\ |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
37 3hIElQAAAAACAAAAHAAAACwAAAAFAAAAPAAAAAAAAABQAAAABAAAAFEAAAAPAQAAVgAAAAQAAABm |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
38 AQAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAYWLDngBQcm9qZWN0LUlkLVZlcnNpb246IDIuMApQTy1S |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
39 ZXZpc2lvbi1EYXRlOiAyMDAzLTA0LTExIDEyOjQyLTA0MDAKTGFzdC1UcmFuc2xhdG9yOiBCYXJy |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
40 eSBBLiBXQXJzYXcgPGJhcnJ5QHB5dGhvbi5vcmc+Ckxhbmd1YWdlLVRlYW06IFhYIDxweXRob24t |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
41 ZGV2QHB5dGhvbi5vcmc+Ck1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFp |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
42 bjsgY2hhcnNldD11dGYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CkdlbmVyYXRl |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
43 ZC1CeTogbWFudWFsbHkKAMKkeXoA |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
44 ''' |
|
15305
07f24261c6e6
Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents:
14591
diff
changeset
|
45 |
|
29191
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
46 MMO_DATA = '''\ |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
47 3hIElQAAAAABAAAAHAAAACQAAAADAAAALAAAAAAAAAA4AAAAeAEAADkAAAABAAAAAAAAAAAAAAAA |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
48 UHJvamVjdC1JZC1WZXJzaW9uOiBObyBQcm9qZWN0IDAuMApQT1QtQ3JlYXRpb24tRGF0ZTogV2Vk |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
49 IERlYyAxMSAwNzo0NDoxNSAyMDAyClBPLVJldmlzaW9uLURhdGU6IDIwMDItMDgtMTQgMDE6MTg6 |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
50 NTgrMDA6MDAKTGFzdC1UcmFuc2xhdG9yOiBKb2huIERvZSA8amRvZUBleGFtcGxlLmNvbT4KSmFu |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
51 ZSBGb29iYXIgPGpmb29iYXJAZXhhbXBsZS5jb20+Ckxhbmd1YWdlLVRlYW06IHh4IDx4eEBleGFt |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
52 cGxlLmNvbT4KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFy |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
53 c2V0PWlzby04ODU5LTE1CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IHF1b3RlZC1wcmludGFi |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
54 bGUKR2VuZXJhdGVkLUJ5OiBweWdldHRleHQucHkgMS4zCgA= |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
55 ''' |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
56 |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
57 LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') |
|
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
58 MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
59 UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo') |
|
29191
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
60 MMOFILE = os.path.join(LOCALEDIR, 'metadata.mo') |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
61 |
|
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
62 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
63 class GettextBaseTest(unittest.TestCase): |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
64 def setUp(self): |
|
32751
95eb6e18a542
Don't try to create the directory if it already exists, otherwise the test fails
Neal Norwitz <nnorwitz@gmail.com>
parents:
29191
diff
changeset
|
65 if not os.path.isdir(LOCALEDIR): |
|
95eb6e18a542
Don't try to create the directory if it already exists, otherwise the test fails
Neal Norwitz <nnorwitz@gmail.com>
parents:
29191
diff
changeset
|
66 os.makedirs(LOCALEDIR) |
|
67854
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
67 with open(MOFILE, 'wb') as fp: |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
68 fp.write(base64.decodestring(GNU_MO_DATA)) |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
69 with open(UMOFILE, 'wb') as fp: |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
70 fp.write(base64.decodestring(UMO_DATA)) |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
71 with open(MMOFILE, 'wb') as fp: |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
72 fp.write(base64.decodestring(MMO_DATA)) |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
73 |
|
53644
85542715a249
Make test.test_support.EnvironmentVarGuard behave like a dictionary.
Walter Dörwald <walter@livinglogic.de>
parents:
41554
diff
changeset
|
74 self.env = test_support.EnvironmentVarGuard() |
|
85542715a249
Make test.test_support.EnvironmentVarGuard behave like a dictionary.
Walter Dörwald <walter@livinglogic.de>
parents:
41554
diff
changeset
|
75 self.env['LANGUAGE'] = 'xx' |
|
66013
636fed8e78d6
Merged revisions 86239,86241 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
65093
diff
changeset
|
76 gettext._translations.clear() |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
77 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
78 def tearDown(self): |
|
53644
85542715a249
Make test.test_support.EnvironmentVarGuard behave like a dictionary.
Walter Dörwald <walter@livinglogic.de>
parents:
41554
diff
changeset
|
79 self.env.__exit__() |
|
85542715a249
Make test.test_support.EnvironmentVarGuard behave like a dictionary.
Walter Dörwald <walter@livinglogic.de>
parents:
41554
diff
changeset
|
80 del self.env |
|
28867
1a0b7fc4625b
Make tests clean up after themselves better. This means:
Brett Cannon <bcannon@gmail.com>
parents:
28794
diff
changeset
|
81 shutil.rmtree(os.path.split(LOCALEDIR)[0]) |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
82 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
83 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
84 class GettextTestCase1(GettextBaseTest): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
85 def setUp(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
86 GettextBaseTest.setUp(self) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
87 self.localedir = os.curdir |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
88 self.mofile = MOFILE |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
89 gettext.install('gettext', self.localedir) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
90 |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
91 def test_some_translations(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
92 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
93 # test some translations |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
94 eq(_('albatross'), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
95 eq(_(u'mullusk'), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
96 eq(_(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
97 eq(_(ur'nudge nudge'), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
98 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
99 def test_double_quotes(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
100 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
101 # double quotes |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
102 eq(_("albatross"), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
103 eq(_(u"mullusk"), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
104 eq(_(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
105 eq(_(ur"nudge nudge"), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
106 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
107 def test_triple_single_quotes(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
108 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
109 # triple single quotes |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
110 eq(_('''albatross'''), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
111 eq(_(u'''mullusk'''), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
112 eq(_(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
113 eq(_(ur'''nudge nudge'''), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
114 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
115 def test_triple_double_quotes(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
116 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
117 # triple double quotes |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
118 eq(_("""albatross"""), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
119 eq(_(u"""mullusk"""), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
120 eq(_(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
121 eq(_(ur"""nudge nudge"""), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
122 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
123 def test_multiline_strings(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
124 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
125 # multiline strings |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
126 eq(_('''This module provides internationalization and localization |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
127 support for your Python programs by providing an interface to the GNU |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
128 gettext message catalog library.'''), |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
129 '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
130 fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
131 trggrkg zrffntr pngnybt yvoenel.''') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
132 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
133 def test_the_alternative_interface(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
134 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
135 # test the alternative interface |
|
67854
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
136 with open(self.mofile, 'rb') as fp: |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
137 t = gettext.GNUTranslations(fp) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
138 # Install the translation object |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
139 t.install() |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
140 eq(_('nudge nudge'), 'wink wink') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
141 # Try unicode return type |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
142 t.install(unicode=True) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
143 eq(_('mullusk'), 'bacon') |
|
36593
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
144 # Test installation of other methods |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
145 import __builtin__ |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
146 t.install(unicode=True, names=["gettext", "lgettext"]) |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
147 eq(_, t.ugettext) |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
148 eq(__builtin__.gettext, t.ugettext) |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
149 eq(lgettext, t.lgettext) |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
150 del __builtin__.gettext |
|
bd7f2d8e8dea
Patch #1349274: gettext.install() now optionally installs additional
Georg Brandl <georg@python.org>
parents:
32751
diff
changeset
|
151 del __builtin__.lgettext |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
152 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
153 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
154 class GettextTestCase2(GettextBaseTest): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
155 def setUp(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
156 GettextBaseTest.setUp(self) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
157 self.localedir = os.curdir |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
158 # Set up the bindings |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
159 gettext.bindtextdomain('gettext', self.localedir) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
160 gettext.textdomain('gettext') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
161 # For convenience |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
162 self._ = gettext.gettext |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
163 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
164 def test_bindtextdomain(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
165 self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
166 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
167 def test_textdomain(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
168 self.assertEqual(gettext.textdomain(), 'gettext') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
169 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
170 def test_some_translations(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
171 eq = self.assertEqual |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
172 # test some translations |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
173 eq(self._('albatross'), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
174 eq(self._(u'mullusk'), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
175 eq(self._(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
176 eq(self._(ur'nudge nudge'), 'wink wink') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
177 |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
178 def test_double_quotes(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
179 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
180 # double quotes |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
181 eq(self._("albatross"), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
182 eq(self._(u"mullusk"), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
183 eq(self._(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
184 eq(self._(ur"nudge nudge"), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
185 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
186 def test_triple_single_quotes(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
187 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
188 # triple single quotes |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
189 eq(self._('''albatross'''), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
190 eq(self._(u'''mullusk'''), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
191 eq(self._(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
192 eq(self._(ur'''nudge nudge'''), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
193 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
194 def test_triple_double_quotes(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
195 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
196 # triple double quotes |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
197 eq(self._("""albatross"""), 'albatross') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
198 eq(self._(u"""mullusk"""), 'bacon') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
199 eq(self._(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
200 eq(self._(ur"""nudge nudge"""), 'wink wink') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
201 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
202 def test_multiline_strings(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
203 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
204 # multiline strings |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
205 eq(self._('''This module provides internationalization and localization |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
206 support for your Python programs by providing an interface to the GNU |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
207 gettext message catalog library.'''), |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
208 '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
209 fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
210 trggrkg zrffntr pngnybt yvoenel.''') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
211 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
212 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
213 class PluralFormsTestCase(GettextBaseTest): |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
214 def setUp(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
215 GettextBaseTest.setUp(self) |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
216 self.mofile = MOFILE |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
217 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
218 def test_plural_forms1(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
219 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
220 x = gettext.ngettext('There is %s file', 'There are %s files', 1) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
221 eq(x, 'Hay %s fichero') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
222 x = gettext.ngettext('There is %s file', 'There are %s files', 2) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
223 eq(x, 'Hay %s ficheros') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
224 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
225 def test_plural_forms2(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
226 eq = self.assertEqual |
|
67854
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
227 with open(self.mofile, 'rb') as fp: |
|
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
228 t = gettext.GNUTranslations(fp) |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
229 x = t.ngettext('There is %s file', 'There are %s files', 1) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
230 eq(x, 'Hay %s fichero') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
231 x = t.ngettext('There is %s file', 'There are %s files', 2) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
232 eq(x, 'Hay %s ficheros') |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
233 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
234 def test_hu(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
235 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
236 f = gettext.c2py('0') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
237 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
238 eq(s, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
239 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
240 def test_de(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
241 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
242 f = gettext.c2py('n != 1') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
243 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
244 eq(s, "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
245 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
246 def test_fr(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
247 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
248 f = gettext.c2py('n>1') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
249 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
250 eq(s, "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
251 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
252 def test_gd(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
253 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
254 f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
255 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
256 eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
257 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
258 def test_gd2(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
259 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
260 # Tests the combination of parentheses and "?:" |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
261 f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
262 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
263 eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
264 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
265 def test_lt(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
266 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
267 f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
268 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
269 eq(s, "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
270 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
271 def test_ru(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
272 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
273 f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
274 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
275 eq(s, "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
276 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
277 def test_pl(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
278 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
279 f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
280 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
281 eq(s, "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
282 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
283 def test_sl(self): |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
284 eq = self.assertEqual |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
285 f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3') |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
286 s = ''.join([ str(f(x)) for x in range(200) ]) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
287 eq(s, "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333") |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
288 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
289 def test_security(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
290 raises = self.assertRaises |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
291 # Test for a dangerous expression |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
292 raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)") |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
293 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
294 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
295 class UnicodeTranslationsTest(GettextBaseTest): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
296 def setUp(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
297 GettextBaseTest.setUp(self) |
|
67854
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
298 with open(UMOFILE, 'rb') as fp: |
|
28794
05e57388cb8f
UnicodeTranslationsTest.setUp(): Removed the coerce flag to the
Barry Warsaw <barry@python.org>
parents:
28774
diff
changeset
|
299 self.t = gettext.GNUTranslations(fp) |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
300 self._ = self.t.ugettext |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
301 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
302 def test_unicode_msgid(self): |
|
55002
6768b2350c57
convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents:
53644
diff
changeset
|
303 unless = self.assertTrue |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
304 unless(isinstance(self._(''), unicode)) |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
305 unless(isinstance(self._(u''), unicode)) |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
306 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
307 def test_unicode_msgstr(self): |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
308 eq = self.assertEqual |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
309 eq(self._(u'ab\xde'), u'\xa4yz') |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
310 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
311 |
|
29191
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
312 class WeirdMetadataTest(GettextBaseTest): |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
313 def setUp(self): |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
314 GettextBaseTest.setUp(self) |
|
67854
6270946115d0
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
66013
diff
changeset
|
315 with open(MMOFILE, 'rb') as fp: |
|
29191
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
316 try: |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
317 self.t = gettext.GNUTranslations(fp) |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
318 except: |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
319 self.tearDown() |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
320 raise |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
321 |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
322 def test_weird_metadata(self): |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
323 info = self.t.info() |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
324 self.assertEqual(info['last-translator'], |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
325 'John Doe <jdoe@example.com>\nJane Foobar <jfoobar@example.com>') |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
326 |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
327 |
|
65093
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
328 class DummyGNUTranslations(gettext.GNUTranslations): |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
329 def foo(self): |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
330 return 'foo' |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
331 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
332 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
333 class GettextCacheTestCase(GettextBaseTest): |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
334 def test_cache(self): |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
335 self.localedir = os.curdir |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
336 self.mofile = MOFILE |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
337 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
338 self.assertEqual(len(gettext._translations), 0) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
339 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
340 t = gettext.translation('gettext', self.localedir) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
341 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
342 self.assertEqual(len(gettext._translations), 1) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
343 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
344 t = gettext.translation('gettext', self.localedir, |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
345 class_=DummyGNUTranslations) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
346 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
347 self.assertEqual(len(gettext._translations), 2) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
348 self.assertEqual(t.__class__, DummyGNUTranslations) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
349 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
350 # Calling it again doesn't add to the cache |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
351 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
352 t = gettext.translation('gettext', self.localedir, |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
353 class_=DummyGNUTranslations) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
354 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
355 self.assertEqual(len(gettext._translations), 2) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
356 self.assertEqual(t.__class__, DummyGNUTranslations) |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
357 |
|
12c6da5acd73
Merged revisions 85223 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents:
55002
diff
changeset
|
358 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
359 def test_main(): |
|
41554
06145fbc7ab9
Merged revisions 53952-54987 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
36593
diff
changeset
|
360 test_support.run_unittest(__name__) |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
361 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
362 if __name__ == '__main__': |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
363 test_main() |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
364 |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
365 |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
366 # For reference, here's the .po file used to created the GNU_MO_DATA above. |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
367 # |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
368 # The original version was automatically generated from the sources with |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
369 # pygettext. Later it was manually modified to add plural forms support. |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
370 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
371 ''' |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
372 # Dummy translation for the Python test_gettext.py module. |
|
19483
c171b07bf6a9
Quick and dirty fix for test_extcall failures trigged by Guido's
Barry Warsaw <barry@python.org>
parents:
15305
diff
changeset
|
373 # Copyright (C) 2001 Python Software Foundation |
|
c171b07bf6a9
Quick and dirty fix for test_extcall failures trigged by Guido's
Barry Warsaw <barry@python.org>
parents:
15305
diff
changeset
|
374 # Barry Warsaw <barry@python.org>, 2000. |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
375 # |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
376 msgid "" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
377 msgstr "" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
378 "Project-Id-Version: 2.0\n" |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
379 "PO-Revision-Date: 2003-04-11 14:32-0400\n" |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
380 "Last-Translator: J. David Ibanez <j-david@noos.fr>\n" |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
381 "Language-Team: XX <python-dev@python.org>\n" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
382 "MIME-Version: 1.0\n" |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
383 "Content-Type: text/plain; charset=iso-8859-1\n" |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
384 "Content-Transfer-Encoding: 8bit\n" |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
385 "Generated-By: pygettext.py 1.1\n" |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
386 "Plural-Forms: nplurals=2; plural=n!=1;\n" |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
387 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
388 #: test_gettext.py:19 test_gettext.py:25 test_gettext.py:31 test_gettext.py:37 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
389 #: test_gettext.py:51 test_gettext.py:80 test_gettext.py:86 test_gettext.py:92 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
390 #: test_gettext.py:98 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
391 msgid "nudge nudge" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
392 msgstr "wink wink" |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
393 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
394 #: test_gettext.py:16 test_gettext.py:22 test_gettext.py:28 test_gettext.py:34 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
395 #: test_gettext.py:77 test_gettext.py:83 test_gettext.py:89 test_gettext.py:95 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
396 msgid "albatross" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
397 msgstr "" |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
398 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
399 #: test_gettext.py:18 test_gettext.py:24 test_gettext.py:30 test_gettext.py:36 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
400 #: test_gettext.py:79 test_gettext.py:85 test_gettext.py:91 test_gettext.py:97 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
401 msgid "Raymond Luxury Yach-t" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
402 msgstr "Throatwobbler Mangrove" |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
403 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
404 #: test_gettext.py:17 test_gettext.py:23 test_gettext.py:29 test_gettext.py:35 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
405 #: test_gettext.py:56 test_gettext.py:78 test_gettext.py:84 test_gettext.py:90 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
406 #: test_gettext.py:96 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
407 msgid "mullusk" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
408 msgstr "bacon" |
|
14191
bd3d1411b66c
Set this test up so that we don't have to create xx/LC_MESSAGES in the
Barry Warsaw <barry@python.org>
parents:
14188
diff
changeset
|
409 |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
410 #: test_gettext.py:40 test_gettext.py:101 |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
411 msgid "" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
412 "This module provides internationalization and localization\n" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
413 "support for your Python programs by providing an interface to the GNU\n" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
414 "gettext message catalog library." |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
415 msgstr "" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
416 "Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba\n" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
417 "fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH\n" |
|
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
418 "trggrkg zrffntr pngnybt yvoenel." |
|
26327
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
419 |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
420 # Manually added, as neither pygettext nor xgettext support plural forms |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
421 # in Python. |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
422 msgid "There is %s file" |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
423 msgid_plural "There are %s files" |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
424 msgstr[0] "Hay %s fichero" |
|
ea1d2050d7da
Patch #633547: Support plural forms. Do TODOs in test suite.
Martin v. Löwis <martin@v.loewis.de>
parents:
24338
diff
changeset
|
425 msgstr[1] "Hay %s ficheros" |
|
14258
6396529a421c
Expand the test suite to test both the GNU gettext and translation
Barry Warsaw <barry@python.org>
parents:
14224
diff
changeset
|
426 ''' |
|
28582
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
427 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
428 # Here's the second example po file example, used to generate the UMO_DATA |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
429 # containing utf-8 encoded Unicode strings |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
430 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
431 ''' |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
432 # Dummy translation for the Python test_gettext.py module. |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
433 # Copyright (C) 2001 Python Software Foundation |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
434 # Barry Warsaw <barry@python.org>, 2000. |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
435 # |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
436 msgid "" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
437 msgstr "" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
438 "Project-Id-Version: 2.0\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
439 "PO-Revision-Date: 2003-04-11 12:42-0400\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
440 "Last-Translator: Barry A. WArsaw <barry@python.org>\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
441 "Language-Team: XX <python-dev@python.org>\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
442 "MIME-Version: 1.0\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
443 "Content-Type: text/plain; charset=utf-8\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
444 "Content-Transfer-Encoding: 7bit\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
445 "Generated-By: manually\n" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
446 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
447 #: nofile:0 |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
448 msgid "ab\xc3\x9e" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
449 msgstr "\xc2\xa4yz" |
|
03bb0c408d57
From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
Barry Warsaw <barry@python.org>
parents:
26327
diff
changeset
|
450 ''' |
|
29191
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
451 |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
452 # Here's the third example po file, used to generate MMO_DATA |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
453 |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
454 ''' |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
455 msgid "" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
456 msgstr "" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
457 "Project-Id-Version: No Project 0.0\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
458 "POT-Creation-Date: Wed Dec 11 07:44:15 2002\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
459 "PO-Revision-Date: 2002-08-14 01:18:58+00:00\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
460 "Last-Translator: John Doe <jdoe@example.com>\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
461 "Jane Foobar <jfoobar@example.com>\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
462 "Language-Team: xx <xx@example.com>\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
463 "MIME-Version: 1.0\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
464 "Content-Type: text/plain; charset=iso-8859-15\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
465 "Content-Transfer-Encoding: quoted-printable\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
466 "Generated-By: pygettext.py 1.3\n" |
|
1297d405155b
Added a test for the fix of SF bug #658233, where continuation lines
Barry Warsaw <barry@python.org>
parents:
28867
diff
changeset
|
467 ''' |
