decoded_headers[name] = value
return decoded_headers
self.mime_headers = _parse_header(message.string).items()
- self.header_comment = '\n'.join(['# %s' % comment for comment
+ self.header_comment = '\n'.join([('# %s' % c).rstrip() for c
in message.user_comments])
self.fuzzy = message.fuzzy
else:
<http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files>`_
"""
-from datetime import datetime
import os
import re
"""Read messages from a ``gettext`` PO (portable object) file from the given
file-like object and return a `Catalog`.
+ >>> from datetime import datetime
>>> from StringIO import StringIO
>>> buf = StringIO('''
... #: main.py:1
os.chdir(self.olddir)
- def _i18n_dir(self):
+ def _i18n_dir(self):
return os.path.join(self.datadir, 'project', 'i18n')
def _pot_file(self):
po_file = self._po_file('en_US')
assert os.path.isfile(po_file)
- self.assertEqual(
-r"""# English (United States) translations for TestProject.
+ self.assertEqual(r"""# English (United States) translations for TestProject.
# Copyright (C) 2007 FooBar, Inc.
# This file is distributed under the same license as the TestProject
# project.
pofile.write_po(buf, catalog, no_location=True, omit_header=True,
width=42)
self.assertEqual(r'''msgid ""
-"Here's some text where \n"
+"Here's some text where\n"
"white space and line breaks matter, and"
" should\n"
"\n"