]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Added explicit charset argument to read_po and added changelog entries
authorArmin Ronacher <armin.ronacher@active-4.com>
Sun, 7 Jul 2013 18:09:23 +0000 (20:09 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sun, 7 Jul 2013 18:09:23 +0000 (20:09 +0200)
ChangeLog
babel/messages/catalog.py
babel/messages/pofile.py

index 204b249173d6e657c0b18e4e087cabe5da08af8a..9c1b133046f3c39f49e40b5f1cf84a2b13de9c73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -66,6 +66,8 @@ http://svn.edgewall.org/repos/babel/tags/1.0.0/
    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
index 120469fd2e65915cd7dcf3ce25a4fa64bdfcca61..3d90cf62cd87983efd624f7433f3a5543e57c2fa 100644 (file)
@@ -225,7 +225,7 @@ class Catalog(object):
                  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`
@@ -243,7 +243,7 @@ class Catalog(object):
         :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
index c65dcf06e3bfd59c021af8873c6c21b2085247a9..e8bb01ba71173ba5d0881b0631a8ea23972944f8 100644 (file)
@@ -83,7 +83,7 @@ def denormalize(string):
     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`.
 
@@ -118,16 +118,20 @@ def read_po(fileobj, locale=None, domain=None, ignore_obsolete=False):
       ([(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]