diff options
-rw-r--r-- | Lib/locale.py | 7 | ||||
-rw-r--r-- | Lib/test/test_locale.py | 14 | ||||
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rw-r--r-- | Tools/i18n/makelocalealias.py | 6 |
4 files changed, 26 insertions, 3 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index f9bceaf..7cfea61 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -1320,7 +1320,7 @@ locale_alias = { 'korean.euc': 'ko_KR.eucKR', 'ks': 'ks_IN.UTF-8', 'ks_in': 'ks_IN.UTF-8', - 'ks_in@devanagari': 'ks_IN@devanagari.UTF-8', + 'ks_in@devanagari': 'ks_IN.UTF-8@devanagari', 'kw': 'kw_GB.ISO8859-1', 'kw_gb': 'kw_GB.ISO8859-1', 'kw_gb.iso88591': 'kw_GB.ISO8859-1', @@ -1485,8 +1485,9 @@ locale_alias = { 'rw_rw': 'rw_RW.ISO8859-1', 'rw_rw.iso88591': 'rw_RW.ISO8859-1', 'sd': 'sd_IN.UTF-8', - 'sd@devanagari': 'sd_IN@devanagari.UTF-8', - 'sd_in@devanagari': 'sd_IN@devanagari.UTF-8', + 'sd@devanagari': 'sd_IN.UTF-8@devanagari', + 'sd_in': 'sd_IN.UTF-8', + 'sd_in@devanagari': 'sd_IN.UTF-8@devanagari', 'se_no': 'se_NO.UTF-8', 'serbocroatian': 'sr_RS.UTF-8@latin', 'sh': 'sr_RS.UTF-8@latin', diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index 45c0149..76347b7 100644 --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -421,6 +421,20 @@ class NormalizeTest(unittest.TestCase): self.check('ca_ES@valencia', 'ca_ES.ISO8859-1@valencia') self.check('ca@valencia', 'ca_ES.ISO8859-1@valencia') + def test_devanagari_modifier(self): + self.check('ks_IN.UTF-8@devanagari', 'ks_IN.UTF-8@devanagari') + self.check('ks_IN@devanagari', 'ks_IN.UTF-8@devanagari') + self.check('ks@devanagari', 'ks_IN.UTF-8@devanagari') + self.check('ks_IN.UTF-8', 'ks_IN.UTF-8') + self.check('ks_IN', 'ks_IN.UTF-8') + self.check('ks', 'ks_IN.UTF-8') + self.check('sd_IN.UTF-8@devanagari', 'sd_IN.UTF-8@devanagari') + self.check('sd_IN@devanagari', 'sd_IN.UTF-8@devanagari') + self.check('sd@devanagari', 'sd_IN.UTF-8@devanagari') + self.check('sd_IN.UTF-8', 'sd_IN.UTF-8') + self.check('sd_IN', 'sd_IN.UTF-8') + self.check('sd', 'sd_IN.UTF-8') + class TestMiscellaneous(unittest.TestCase): def test_getpreferredencoding(self): @@ -29,6 +29,8 @@ Core and Builtins Library ------- +- Issue #20027: Fixed locale aliases for devanagari locales. + - Issue #20067: Tkinter variables now work when wantobjects is false. - Issue #19020: Tkinter now uses splitlist() instead of split() in configure diff --git a/Tools/i18n/makelocalealias.py b/Tools/i18n/makelocalealias.py index 3445ec8..8b92ae1 100644 --- a/Tools/i18n/makelocalealias.py +++ b/Tools/i18n/makelocalealias.py @@ -23,6 +23,12 @@ def parse(filename): if line[:1] == '#': continue locale, alias = line.split() + # Fix non-standard locale names, e.g. ks_IN@devanagari.UTF-8 + if '@' in alias: + alias_lang, _, alias_mod = alias.partition('@') + if '.' in alias_mod: + alias_mod, _, alias_enc = alias_mod.partition('.') + alias = alias_lang + '.' + alias_enc + '@' + alias_mod # Strip ':' if locale[-1] == ':': locale = locale[:-1] |