]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fixes for the extended translations class.
authorChristopher Lenz <cmlenz@gmail.com>
Wed, 30 May 2007 08:43:51 +0000 (08:43 +0000)
committerChristopher Lenz <cmlenz@gmail.com>
Wed, 30 May 2007 08:43:51 +0000 (08:43 +0000)
babel/__init__.py
babel/catalog/__init__.py

index cca0636fd77c13ef98679047f87ca0c6230ae26e..f74dcbf4aa286c2a8ebedb97ee4f7224ca3f02f1 100644 (file)
@@ -26,7 +26,7 @@ This package is basically composed of two major parts:
 :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
index 3f99b352eacd64c938cf8208ab71f646473061bc..653185b024c12eaaccdeca35939951f93823d2fe 100644 (file)
@@ -29,7 +29,7 @@ class Translations(gettext.GNUTranslations):
         :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 @@ class Translations(gettext.GNUTranslations):
                  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):