pattern for currencies that includes the full name.
* depend on pytz now and wrap it nicer. This gives us improved support
for things like timezone transitions and an overall nicer API.
+ * Added support for explicit charset to PO file reading.
+ * Added experimental Python 3 support.
Version 0.9.6
project=None, version=None, copyright_holder=None,
msgid_bugs_address=None, creation_date=None,
revision_date=None, last_translator=None, language_team=None,
- charset='utf-8', fuzzy=True):
+ charset=None, fuzzy=True):
"""Initialize the catalog object.
:param locale: the locale identifier or `Locale` object, or `None`
:param revision_date: the date the catalog was revised
:param last_translator: the name and email of the last translator
:param language_team: the name and email of the language team
- :param charset: the encoding to use in the output
+ :param charset: the encoding to use in the output (defaults to utf-8)
:param fuzzy: the fuzzy bit on the catalog header
"""
self.domain = domain #: The message domain
else:
return unescape(string)
-def read_po(fileobj, locale=None, domain=None, ignore_obsolete=False):
+def read_po(fileobj, locale=None, domain=None, ignore_obsolete=False, charset=None):
"""Read messages from a ``gettext`` PO (portable object) file from the given
file-like object and return a `Catalog`.
([(u'main.py', 3)], set([]))
([u'A user comment'], [u'An auto comment'])
+ .. versionadded:: 1.0
+ Added support for explicit charset argument.
+
:param fileobj: the file-like object to read the PO file from
:param locale: the locale identifier or `Locale` object, or `None`
if the catalog is not bound to a locale (which basically
means it's a template)
:param domain: the message domain
:param ignore_obsolete: whether to ignore obsolete messages in the input
+ :param charset: the character set of the catalog.
:return: a catalog object representing the parsed PO file
:rtype: `Catalog`
"""
- catalog = Catalog(locale=locale, domain=domain)
+ catalog = Catalog(locale=locale, domain=domain, charset=charset)
counter = [0]
offset = [0]