Issue #20027: Fixed locale aliases for devanagari locales.

This commit is contained in:
Serhiy Storchaka 2013-12-26 21:20:59 +02:00
parent d97c01ff28
commit 5eb01530b2
4 changed files with 26 additions and 3 deletions

View File

@ -1320,7 +1320,7 @@ locale_alias = {
'korean.euc': 'ko_KR.eucKR', 'korean.euc': 'ko_KR.eucKR',
'ks': 'ks_IN.UTF-8', 'ks': 'ks_IN.UTF-8',
'ks_in': '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': 'kw_GB.ISO8859-1',
'kw_gb': 'kw_GB.ISO8859-1', 'kw_gb': 'kw_GB.ISO8859-1',
'kw_gb.iso88591': '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': 'rw_RW.ISO8859-1',
'rw_rw.iso88591': 'rw_RW.ISO8859-1', 'rw_rw.iso88591': 'rw_RW.ISO8859-1',
'sd': 'sd_IN.UTF-8', 'sd': 'sd_IN.UTF-8',
'sd@devanagari': 'sd_IN@devanagari.UTF-8', 'sd@devanagari': 'sd_IN.UTF-8@devanagari',
'sd_in@devanagari': 'sd_IN@devanagari.UTF-8', 'sd_in': 'sd_IN.UTF-8',
'sd_in@devanagari': 'sd_IN.UTF-8@devanagari',
'se_no': 'se_NO.UTF-8', 'se_no': 'se_NO.UTF-8',
'serbocroatian': 'sr_RS.UTF-8@latin', 'serbocroatian': 'sr_RS.UTF-8@latin',
'sh': 'sr_RS.UTF-8@latin', 'sh': 'sr_RS.UTF-8@latin',

View File

@ -421,6 +421,20 @@ class NormalizeTest(unittest.TestCase):
self.check('ca_ES@valencia', 'ca_ES.ISO8859-1@valencia') self.check('ca_ES@valencia', 'ca_ES.ISO8859-1@valencia')
self.check('ca@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): class TestMiscellaneous(unittest.TestCase):
def test_getpreferredencoding(self): def test_getpreferredencoding(self):

View File

@ -29,6 +29,8 @@ Core and Builtins
Library Library
------- -------
- Issue #20027: Fixed locale aliases for devanagari locales.
- Issue #20067: Tkinter variables now work when wantobjects is false. - Issue #20067: Tkinter variables now work when wantobjects is false.
- Issue #19020: Tkinter now uses splitlist() instead of split() in configure - Issue #19020: Tkinter now uses splitlist() instead of split() in configure

View File

@ -23,6 +23,12 @@ def parse(filename):
if line[:1] == '#': if line[:1] == '#':
continue continue
locale, alias = line.split() 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 ':' # Strip ':'
if locale[-1] == ':': if locale[-1] == ':':
locale = locale[:-1] locale = locale[:-1]