Issue #20027: Fixed locale aliases for devanagari locales.

This commit is contained in:
Serhiy Storchaka 2013-12-26 21:21:52 +02:00
commit e190fac5f9
4 changed files with 26 additions and 3 deletions

View File

@ -1309,7 +1309,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',
@ -1474,8 +1474,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',

View File

@ -422,6 +422,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):

View File

@ -44,6 +44,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

View File

@ -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]