changeset 4:5a7f2bc6b114 trunk

Fixes for the extended translations class.
author cmlenz
date Wed, 30 May 2007 08:43:51 +0000
parents 3fb8ba1a4444
children 132526dcd074
files babel/__init__.py babel/catalog/__init__.py
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/babel/__init__.py
+++ b/babel/__init__.py
@@ -26,7 +26,7 @@
 :see: http://www.unicode.org/cldr/
 """
 
-from babel.core import Locale
+from babel.core import *
 
 __docformat__ = 'restructuredtext en'
 __version__ = __import__('pkg_resources').get_distribution('Babel').version
--- a/babel/catalog/__init__.py
+++ b/babel/catalog/__init__.py
@@ -29,7 +29,7 @@
         :param fileobj: the file-like object the translation should be read
                         from
         """
-        GNUTranslations.__init__(self, fp=fileobj)
+        gettext.GNUTranslations.__init__(self, fp=fileobj)
         self.files = [getattr(fileobj, 'name')]
 
     def load(cls, dirname=None, locales=None, domain=DEFAULT_DOMAIN):
@@ -44,11 +44,13 @@
                  matching translations were found
         :rtype: `Translations`
         """
+        if not isinstance(locales, (list, tuple)):
+            locales = [locales]
         locales = [str(locale) for locale in locales]
         filename = gettext.find(domain, dirname, locales)
         if not filename:
-            return NullTranslations()
-        return cls(open(filename, 'rb'))
+            return gettext.NullTranslations()
+        return cls(fileobj=open(filename, 'rb'))
     load = classmethod(load)
 
     def merge(self, translations):
Copyright (C) 2012-2017 Edgewall Software