]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
The `LANGUAGE` environment variable may contain a colon-separated list of language...
authorChristopher Lenz <cmlenz@gmail.com>
Wed, 20 Jun 2007 20:18:52 +0000 (20:18 +0000)
committerChristopher Lenz <cmlenz@gmail.com>
Wed, 20 Jun 2007 20:18:52 +0000 (20:18 +0000)
babel/core.py

index fcfa0d491273cadf215807025a1834aca2b40ed4..dcf167132f8779c3503b7c7f5438044c9e4d1fb2 100644 (file)
@@ -539,6 +539,10 @@ def default_locale(category=None):
     for name in filter(None, varnames):
         locale = os.getenv(name)
         if locale:
+            if name == 'LANGUAGE' and ':' in locale:
+                # the LANGUAGE variable may contain a colon-separated list of
+                # language codes; we just pick the language on the list
+                locale = locale.split(':')[0]
             return '_'.join(filter(None, parse_locale(locale)))
 
 def negotiate_locale(preferred, available, sep='_'):