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