]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GNUTranslations._parse(): Backport of fix for SF bug #658233, where
authorBarry Warsaw <barry@python.org>
Tue, 20 May 2003 22:33:03 +0000 (22:33 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 20 May 2003 22:33:03 +0000 (22:33 +0000)
continuation lines in .po metadata caused a crash.

Also, export more symbols from __all__.

Lib/gettext.py

index 6795ee6528f39f9e10b601c85e01a92b837560a1..8736b41a3d67a0c17d680a8a8e5b29726d936dc8 100644 (file)
@@ -48,8 +48,10 @@ import sys
 import struct
 from errno import ENOENT
 
-__all__ = ["bindtextdomain","textdomain","gettext","dgettext",
-           "find","translation","install","Catalog"]
+__all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',
+           'find', 'translation', 'install', 'textdomain', 'bindtextdomain',
+           'dgettext', 'gettext',
+           ]
 
 _default_localedir = os.path.join(sys.prefix, 'share', 'locale')
 
@@ -173,14 +175,19 @@ class GNUTranslations(NullTranslations):
             # See if we're looking at GNU .mo conventions for metadata
             if mlen == 0 and tmsg.lower().startswith('project-id-version:'):
                 # Catalog description
+                lastk = None
                 for item in tmsg.split('\n'):
                     item = item.strip()
                     if not item:
                         continue
-                    k, v = item.split(':', 1)
-                    k = k.strip().lower()
-                    v = v.strip()
-                    self._info[k] = v
+                    if ':' in item:
+                        k, v = item.split(':', 1)
+                        k = k.strip().lower()
+                        v = v.strip()
+                        self._info[k] = v
+                        lastk = k
+                    elif lastk:
+                        self._info[lastk] += '\n' + item
                     if k == 'content-type':
                         self._charset = v.split('charset=')[1]
             # advance to next entry in the seek tables