diff options
-rw-r--r-- | CHANGES | 10 | ||||
-rw-r--r-- | babel/core.py | 2 | ||||
-rw-r--r-- | tests/test_core.py | 5 |
3 files changed, 16 insertions, 1 deletions
@@ -6,6 +6,16 @@ Version 2.0 (release date to be decided, codename to be selected) +Version 1.4 +----------- + +(bugfix release, release date to be decided) + +- Fixed a bug that caused deprecated territory codes not being + converted properly by the subtag resolving. This for instance + showed up when trying to use ``und_UK`` as a language code + which now properly resolves to ``en_GB``. + Version 1.3 ----------- diff --git a/babel/core.py b/babel/core.py index 6e6e6d6..56dbf55 100644 --- a/babel/core.py +++ b/babel/core.py @@ -282,7 +282,7 @@ class Locale(object): language, territory, script, variant = parts language = get_global('language_aliases').get(language, language) - territory = get_global('territory_aliases').get(territory, territory) + territory = get_global('territory_aliases').get(territory, (territory,))[0] script = get_global('script_aliases').get(script, script) variant = get_global('variant_aliases').get(variant, variant) diff --git a/tests/test_core.py b/tests/test_core.py index b4a1ac5..ec3f9ea 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -111,6 +111,11 @@ class TestLocaleClass: assert l.language == 'de' assert l.territory == 'AT' + l = Locale.parse('und_UK') + assert l.language == 'en' + assert l.territory == 'GB' + assert l.script is None + def test_get_display_name(self): zh_CN = Locale('zh', 'CN', script='Hans') assert zh_CN.get_display_name('en') == 'Chinese (Simplified, China)' |