Back to index

python3.2  3.2.2
test_gettext.py
Go to the documentation of this file.
00001 import os
00002 import base64
00003 import shutil
00004 import gettext
00005 import unittest
00006 
00007 from test import support
00008 
00009 
00010 # TODO:
00011 #  - Add new tests, for example for "dgettext"
00012 #  - Remove dummy tests, for example testing for single and double quotes
00013 #    has no sense, it would have if we were testing a parser (i.e. pygettext)
00014 #  - Tests should have only one assert.
00015 
00016 GNU_MO_DATA = b'''\
00017 3hIElQAAAAAGAAAAHAAAAEwAAAALAAAAfAAAAAAAAACoAAAAFQAAAKkAAAAjAAAAvwAAAKEAAADj
00018 AAAABwAAAIUBAAALAAAAjQEAAEUBAACZAQAAFgAAAN8CAAAeAAAA9gIAAKEAAAAVAwAABQAAALcD
00019 AAAJAAAAvQMAAAEAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABQAAAAYAAAACAAAAAFJh
00020 eW1vbmQgTHV4dXJ5IFlhY2gtdABUaGVyZSBpcyAlcyBmaWxlAFRoZXJlIGFyZSAlcyBmaWxlcwBU
00021 aGlzIG1vZHVsZSBwcm92aWRlcyBpbnRlcm5hdGlvbmFsaXphdGlvbiBhbmQgbG9jYWxpemF0aW9u
00022 CnN1cHBvcnQgZm9yIHlvdXIgUHl0aG9uIHByb2dyYW1zIGJ5IHByb3ZpZGluZyBhbiBpbnRlcmZh
00023 Y2UgdG8gdGhlIEdOVQpnZXR0ZXh0IG1lc3NhZ2UgY2F0YWxvZyBsaWJyYXJ5LgBtdWxsdXNrAG51
00024 ZGdlIG51ZGdlAFByb2plY3QtSWQtVmVyc2lvbjogMi4wClBPLVJldmlzaW9uLURhdGU6IDIwMDAt
00025 MDgtMjkgMTI6MTktMDQ6MDAKTGFzdC1UcmFuc2xhdG9yOiBKLiBEYXZpZCBJYsOhw7FleiA8ai1k
00026 YXZpZEBub29zLmZyPgpMYW5ndWFnZS1UZWFtOiBYWCA8cHl0aG9uLWRldkBweXRob24ub3JnPgpN
00027 SU1FLVZlcnNpb246IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9aXNvLTg4
00028 NTktMQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBub25lCkdlbmVyYXRlZC1CeTogcHlnZXR0
00029 ZXh0LnB5IDEuMQpQbHVyYWwtRm9ybXM6IG5wbHVyYWxzPTI7IHBsdXJhbD1uIT0xOwoAVGhyb2F0
00030 d29iYmxlciBNYW5ncm92ZQBIYXkgJXMgZmljaGVybwBIYXkgJXMgZmljaGVyb3MAR3V2ZiB6YnFo
00031 eXIgY2ViaXZxcmYgdmFncmVhbmd2YmFueXZtbmd2YmEgbmFxIHlicG55dm1uZ3ZiYQpmaGNjYmVn
00032 IHNiZSBsYmhlIENsZ3ViYSBjZWJ0ZW56ZiBvbCBjZWJpdnF2YXQgbmEgdmFncmVzbnByIGdiIGd1
00033 ciBUQUgKdHJnZ3JrZyB6cmZmbnRyIHBuZ255YnQgeXZvZW5lbC4AYmFjb24Ad2luayB3aW5rAA==
00034 '''
00035 
00036 UMO_DATA = b'''\
00037 3hIElQAAAAACAAAAHAAAACwAAAAFAAAAPAAAAAAAAABQAAAABAAAAFEAAAAPAQAAVgAAAAQAAABm
00038 AQAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAYWLDngBQcm9qZWN0LUlkLVZlcnNpb246IDIuMApQTy1S
00039 ZXZpc2lvbi1EYXRlOiAyMDAzLTA0LTExIDEyOjQyLTA0MDAKTGFzdC1UcmFuc2xhdG9yOiBCYXJy
00040 eSBBLiBXQXJzYXcgPGJhcnJ5QHB5dGhvbi5vcmc+Ckxhbmd1YWdlLVRlYW06IFhYIDxweXRob24t
00041 ZGV2QHB5dGhvbi5vcmc+Ck1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFp
00042 bjsgY2hhcnNldD11dGYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CkdlbmVyYXRl
00043 ZC1CeTogbWFudWFsbHkKAMKkeXoA
00044 '''
00045 
00046 MMO_DATA = b'''\
00047 3hIElQAAAAABAAAAHAAAACQAAAADAAAALAAAAAAAAAA4AAAAeAEAADkAAAABAAAAAAAAAAAAAAAA
00048 UHJvamVjdC1JZC1WZXJzaW9uOiBObyBQcm9qZWN0IDAuMApQT1QtQ3JlYXRpb24tRGF0ZTogV2Vk
00049 IERlYyAxMSAwNzo0NDoxNSAyMDAyClBPLVJldmlzaW9uLURhdGU6IDIwMDItMDgtMTQgMDE6MTg6
00050 NTgrMDA6MDAKTGFzdC1UcmFuc2xhdG9yOiBKb2huIERvZSA8amRvZUBleGFtcGxlLmNvbT4KSmFu
00051 ZSBGb29iYXIgPGpmb29iYXJAZXhhbXBsZS5jb20+Ckxhbmd1YWdlLVRlYW06IHh4IDx4eEBleGFt
00052 cGxlLmNvbT4KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFy
00053 c2V0PWlzby04ODU5LTE1CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IHF1b3RlZC1wcmludGFi
00054 bGUKR2VuZXJhdGVkLUJ5OiBweWdldHRleHQucHkgMS4zCgA=
00055 '''
00056 
00057 LOCALEDIR = os.path.join('xx', 'LC_MESSAGES')
00058 MOFILE = os.path.join(LOCALEDIR, 'gettext.mo')
00059 UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo')
00060 MMOFILE = os.path.join(LOCALEDIR, 'metadata.mo')
00061 
00062 
00063 class GettextBaseTest(unittest.TestCase):
00064     def setUp(self):
00065         if not os.path.isdir(LOCALEDIR):
00066             os.makedirs(LOCALEDIR)
00067         with open(MOFILE, 'wb') as fp:
00068             fp.write(base64.decodebytes(GNU_MO_DATA))
00069         with open(UMOFILE, 'wb') as fp:
00070             fp.write(base64.decodebytes(UMO_DATA))
00071         with open(MMOFILE, 'wb') as fp:
00072             fp.write(base64.decodebytes(MMO_DATA))
00073         self.env = support.EnvironmentVarGuard()
00074         self.env['LANGUAGE'] = 'xx'
00075         gettext._translations.clear()
00076 
00077     def tearDown(self):
00078         self.env.__exit__()
00079         del self.env
00080         shutil.rmtree(os.path.split(LOCALEDIR)[0])
00081 
00082 
00083 class GettextTestCase1(GettextBaseTest):
00084     def setUp(self):
00085         GettextBaseTest.setUp(self)
00086         self.localedir = os.curdir
00087         self.mofile = MOFILE
00088         gettext.install('gettext', self.localedir)
00089 
00090     def test_some_translations(self):
00091         eq = self.assertEqual
00092         # test some translations
00093         eq(_('albatross'), 'albatross')
00094         eq(_('mullusk'), 'bacon')
00095         eq(_(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove')
00096         eq(_(r'nudge nudge'), 'wink wink')
00097 
00098     def test_double_quotes(self):
00099         eq = self.assertEqual
00100         # double quotes
00101         eq(_("albatross"), 'albatross')
00102         eq(_("mullusk"), 'bacon')
00103         eq(_(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove')
00104         eq(_(r"nudge nudge"), 'wink wink')
00105 
00106     def test_triple_single_quotes(self):
00107         eq = self.assertEqual
00108         # triple single quotes
00109         eq(_('''albatross'''), 'albatross')
00110         eq(_('''mullusk'''), 'bacon')
00111         eq(_(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove')
00112         eq(_(r'''nudge nudge'''), 'wink wink')
00113 
00114     def test_triple_double_quotes(self):
00115         eq = self.assertEqual
00116         # triple double quotes
00117         eq(_("""albatross"""), 'albatross')
00118         eq(_("""mullusk"""), 'bacon')
00119         eq(_(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove')
00120         eq(_(r"""nudge nudge"""), 'wink wink')
00121 
00122     def test_multiline_strings(self):
00123         eq = self.assertEqual
00124         # multiline strings
00125         eq(_('''This module provides internationalization and localization
00126 support for your Python programs by providing an interface to the GNU
00127 gettext message catalog library.'''),
00128            '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba
00129 fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH
00130 trggrkg zrffntr pngnybt yvoenel.''')
00131 
00132     def test_the_alternative_interface(self):
00133         eq = self.assertEqual
00134         # test the alternative interface
00135         with open(self.mofile, 'rb') as fp:
00136             t = gettext.GNUTranslations(fp)
00137         # Install the translation object
00138         t.install()
00139         eq(_('nudge nudge'), 'wink wink')
00140         # Try unicode return type
00141         t.install()
00142         eq(_('mullusk'), 'bacon')
00143         # Test installation of other methods
00144         import builtins
00145         t.install(names=["gettext", "lgettext"])
00146         eq(_, t.gettext)
00147         eq(builtins.gettext, t.gettext)
00148         eq(lgettext, t.lgettext)
00149         del builtins.gettext
00150         del builtins.lgettext
00151 
00152 
00153 class GettextTestCase2(GettextBaseTest):
00154     def setUp(self):
00155         GettextBaseTest.setUp(self)
00156         self.localedir = os.curdir
00157         # Set up the bindings
00158         gettext.bindtextdomain('gettext', self.localedir)
00159         gettext.textdomain('gettext')
00160         # For convenience
00161         self._ = gettext.gettext
00162 
00163     def test_bindtextdomain(self):
00164         self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir)
00165 
00166     def test_textdomain(self):
00167         self.assertEqual(gettext.textdomain(), 'gettext')
00168 
00169     def test_some_translations(self):
00170         eq = self.assertEqual
00171         # test some translations
00172         eq(self._('albatross'), 'albatross')
00173         eq(self._('mullusk'), 'bacon')
00174         eq(self._(r'Raymond Luxury Yach-t'), 'Throatwobbler Mangrove')
00175         eq(self._(r'nudge nudge'), 'wink wink')
00176 
00177     def test_double_quotes(self):
00178         eq = self.assertEqual
00179         # double quotes
00180         eq(self._("albatross"), 'albatross')
00181         eq(self._("mullusk"), 'bacon')
00182         eq(self._(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove')
00183         eq(self._(r"nudge nudge"), 'wink wink')
00184 
00185     def test_triple_single_quotes(self):
00186         eq = self.assertEqual
00187         # triple single quotes
00188         eq(self._('''albatross'''), 'albatross')
00189         eq(self._('''mullusk'''), 'bacon')
00190         eq(self._(r'''Raymond Luxury Yach-t'''), 'Throatwobbler Mangrove')
00191         eq(self._(r'''nudge nudge'''), 'wink wink')
00192 
00193     def test_triple_double_quotes(self):
00194         eq = self.assertEqual
00195         # triple double quotes
00196         eq(self._("""albatross"""), 'albatross')
00197         eq(self._("""mullusk"""), 'bacon')
00198         eq(self._(r"""Raymond Luxury Yach-t"""), 'Throatwobbler Mangrove')
00199         eq(self._(r"""nudge nudge"""), 'wink wink')
00200 
00201     def test_multiline_strings(self):
00202         eq = self.assertEqual
00203         # multiline strings
00204         eq(self._('''This module provides internationalization and localization
00205 support for your Python programs by providing an interface to the GNU
00206 gettext message catalog library.'''),
00207            '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba
00208 fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH
00209 trggrkg zrffntr pngnybt yvoenel.''')
00210 
00211 
00212 class PluralFormsTestCase(GettextBaseTest):
00213     def setUp(self):
00214         GettextBaseTest.setUp(self)
00215         self.mofile = MOFILE
00216 
00217     def test_plural_forms1(self):
00218         eq = self.assertEqual
00219         x = gettext.ngettext('There is %s file', 'There are %s files', 1)
00220         eq(x, 'Hay %s fichero')
00221         x = gettext.ngettext('There is %s file', 'There are %s files', 2)
00222         eq(x, 'Hay %s ficheros')
00223 
00224     def test_plural_forms2(self):
00225         eq = self.assertEqual
00226         with open(self.mofile, 'rb') as fp:
00227             t = gettext.GNUTranslations(fp)
00228         x = t.ngettext('There is %s file', 'There are %s files', 1)
00229         eq(x, 'Hay %s fichero')
00230         x = t.ngettext('There is %s file', 'There are %s files', 2)
00231         eq(x, 'Hay %s ficheros')
00232 
00233     def test_hu(self):
00234         eq = self.assertEqual
00235         f = gettext.c2py('0')
00236         s = ''.join([ str(f(x)) for x in range(200) ])
00237         eq(s, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
00238 
00239     def test_de(self):
00240         eq = self.assertEqual
00241         f = gettext.c2py('n != 1')
00242         s = ''.join([ str(f(x)) for x in range(200) ])
00243         eq(s, "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
00244 
00245     def test_fr(self):
00246         eq = self.assertEqual
00247         f = gettext.c2py('n>1')
00248         s = ''.join([ str(f(x)) for x in range(200) ])
00249         eq(s, "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
00250 
00251     def test_gd(self):
00252         eq = self.assertEqual
00253         f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2')
00254         s = ''.join([ str(f(x)) for x in range(200) ])
00255         eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222")
00256 
00257     def test_gd2(self):
00258         eq = self.assertEqual
00259         # Tests the combination of parentheses and "?:"
00260         f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)')
00261         s = ''.join([ str(f(x)) for x in range(200) ])
00262         eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222")
00263 
00264     def test_lt(self):
00265         eq = self.assertEqual
00266         f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2')
00267         s = ''.join([ str(f(x)) for x in range(200) ])
00268         eq(s, "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111")
00269 
00270     def test_ru(self):
00271         eq = self.assertEqual
00272         f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2')
00273         s = ''.join([ str(f(x)) for x in range(200) ])
00274         eq(s, "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222")
00275 
00276     def test_pl(self):
00277         eq = self.assertEqual
00278         f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2')
00279         s = ''.join([ str(f(x)) for x in range(200) ])
00280         eq(s, "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222")
00281 
00282     def test_sl(self):
00283         eq = self.assertEqual
00284         f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3')
00285         s = ''.join([ str(f(x)) for x in range(200) ])
00286         eq(s, "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333")
00287 
00288     def test_security(self):
00289         raises = self.assertRaises
00290         # Test for a dangerous expression
00291         raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)")
00292 
00293 
00294 class UnicodeTranslationsTest(GettextBaseTest):
00295     def setUp(self):
00296         GettextBaseTest.setUp(self)
00297         with open(UMOFILE, 'rb') as fp:
00298             self.t = gettext.GNUTranslations(fp)
00299         self._ = self.t.gettext
00300 
00301     def test_unicode_msgid(self):
00302         unless = self.assertTrue
00303         unless(isinstance(self._(''), str))
00304         unless(isinstance(self._(''), str))
00305 
00306     def test_unicode_msgstr(self):
00307         eq = self.assertEqual
00308         eq(self._('ab\xde'), '\xa4yz')
00309 
00310 
00311 class WeirdMetadataTest(GettextBaseTest):
00312     def setUp(self):
00313         GettextBaseTest.setUp(self)
00314         with open(MMOFILE, 'rb') as fp:
00315             try:
00316                 self.t = gettext.GNUTranslations(fp)
00317             except:
00318                 self.tearDown()
00319                 raise
00320 
00321     def test_weird_metadata(self):
00322         info = self.t.info()
00323         self.assertEqual(len(info), 9)
00324         self.assertEqual(info['last-translator'],
00325            'John Doe <jdoe@example.com>\nJane Foobar <jfoobar@example.com>')
00326 
00327 
00328 class DummyGNUTranslations(gettext.GNUTranslations):
00329     def foo(self):
00330         return 'foo'
00331 
00332 
00333 class GettextCacheTestCase(GettextBaseTest):
00334     def test_cache(self):
00335         self.localedir = os.curdir
00336         self.mofile = MOFILE
00337 
00338         self.assertEqual(len(gettext._translations), 0)
00339 
00340         t = gettext.translation('gettext', self.localedir)
00341 
00342         self.assertEqual(len(gettext._translations), 1)
00343 
00344         t = gettext.translation('gettext', self.localedir,
00345                                 class_=DummyGNUTranslations)
00346 
00347         self.assertEqual(len(gettext._translations), 2)
00348         self.assertEqual(t.__class__, DummyGNUTranslations)
00349 
00350         # Calling it again doesn't add to the cache
00351 
00352         t = gettext.translation('gettext', self.localedir,
00353                                 class_=DummyGNUTranslations)
00354 
00355         self.assertEqual(len(gettext._translations), 2)
00356         self.assertEqual(t.__class__, DummyGNUTranslations)
00357 
00358 
00359 def test_main():
00360     support.run_unittest(__name__)
00361 
00362 if __name__ == '__main__':
00363     test_main()
00364 
00365 
00366 # For reference, here's the .po file used to created the GNU_MO_DATA above.
00367 #
00368 # The original version was automatically generated from the sources with
00369 # pygettext. Later it was manually modified to add plural forms support.
00370 
00371 '''
00372 # Dummy translation for the Python test_gettext.py module.
00373 # Copyright (C) 2001 Python Software Foundation
00374 # Barry Warsaw <barry@python.org>, 2000.
00375 #
00376 msgid ""
00377 msgstr ""
00378 "Project-Id-Version: 2.0\n"
00379 "PO-Revision-Date: 2003-04-11 14:32-0400\n"
00380 "Last-Translator: J. David Ibanez <j-david@noos.fr>\n"
00381 "Language-Team: XX <python-dev@python.org>\n"
00382 "MIME-Version: 1.0\n"
00383 "Content-Type: text/plain; charset=iso-8859-1\n"
00384 "Content-Transfer-Encoding: 8bit\n"
00385 "Generated-By: pygettext.py 1.1\n"
00386 "Plural-Forms: nplurals=2; plural=n!=1;\n"
00387 
00388 #: test_gettext.py:19 test_gettext.py:25 test_gettext.py:31 test_gettext.py:37
00389 #: test_gettext.py:51 test_gettext.py:80 test_gettext.py:86 test_gettext.py:92
00390 #: test_gettext.py:98
00391 msgid "nudge nudge"
00392 msgstr "wink wink"
00393 
00394 #: test_gettext.py:16 test_gettext.py:22 test_gettext.py:28 test_gettext.py:34
00395 #: test_gettext.py:77 test_gettext.py:83 test_gettext.py:89 test_gettext.py:95
00396 msgid "albatross"
00397 msgstr ""
00398 
00399 #: test_gettext.py:18 test_gettext.py:24 test_gettext.py:30 test_gettext.py:36
00400 #: test_gettext.py:79 test_gettext.py:85 test_gettext.py:91 test_gettext.py:97
00401 msgid "Raymond Luxury Yach-t"
00402 msgstr "Throatwobbler Mangrove"
00403 
00404 #: test_gettext.py:17 test_gettext.py:23 test_gettext.py:29 test_gettext.py:35
00405 #: test_gettext.py:56 test_gettext.py:78 test_gettext.py:84 test_gettext.py:90
00406 #: test_gettext.py:96
00407 msgid "mullusk"
00408 msgstr "bacon"
00409 
00410 #: test_gettext.py:40 test_gettext.py:101
00411 msgid ""
00412 "This module provides internationalization and localization\n"
00413 "support for your Python programs by providing an interface to the GNU\n"
00414 "gettext message catalog library."
00415 msgstr ""
00416 "Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba\n"
00417 "fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH\n"
00418 "trggrkg zrffntr pngnybt yvoenel."
00419 
00420 # Manually added, as neither pygettext nor xgettext support plural forms
00421 # in Python.
00422 msgid "There is %s file"
00423 msgid_plural "There are %s files"
00424 msgstr[0] "Hay %s fichero"
00425 msgstr[1] "Hay %s ficheros"
00426 '''
00427 
00428 # Here's the second example po file example, used to generate the UMO_DATA
00429 # containing utf-8 encoded Unicode strings
00430 
00431 '''
00432 # Dummy translation for the Python test_gettext.py module.
00433 # Copyright (C) 2001 Python Software Foundation
00434 # Barry Warsaw <barry@python.org>, 2000.
00435 #
00436 msgid ""
00437 msgstr ""
00438 "Project-Id-Version: 2.0\n"
00439 "PO-Revision-Date: 2003-04-11 12:42-0400\n"
00440 "Last-Translator: Barry A. WArsaw <barry@python.org>\n"
00441 "Language-Team: XX <python-dev@python.org>\n"
00442 "MIME-Version: 1.0\n"
00443 "Content-Type: text/plain; charset=utf-8\n"
00444 "Content-Transfer-Encoding: 7bit\n"
00445 "Generated-By: manually\n"
00446 
00447 #: nofile:0
00448 msgid "ab\xc3\x9e"
00449 msgstr "\xc2\xa4yz"
00450 '''
00451 
00452 # Here's the third example po file, used to generate MMO_DATA
00453 
00454 '''
00455 msgid ""
00456 msgstr ""
00457 "Project-Id-Version: No Project 0.0\n"
00458 "POT-Creation-Date: Wed Dec 11 07:44:15 2002\n"
00459 "PO-Revision-Date: 2002-08-14 01:18:58+00:00\n"
00460 "Last-Translator: John Doe <jdoe@example.com>\n"
00461 "Jane Foobar <jfoobar@example.com>\n"
00462 "Language-Team: xx <xx@example.com>\n"
00463 "MIME-Version: 1.0\n"
00464 "Content-Type: text/plain; charset=iso-8859-15\n"
00465 "Content-Transfer-Encoding: quoted-printable\n"
00466 "Generated-By: pygettext.py 1.3\n"
00467 '''