Skip to content

Commit 1096f32

Browse files
Add comments.
1 parent 4954f97 commit 1096f32

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Lib/locale.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ def _replace_encoding(code, encoding):
375375
def _append_modifier(code, modifier):
376376
if modifier == 'euro':
377377
if '.' not in code:
378+
# Linux appears to require keeping the "@euro" modifier in place,
379+
# even when using the ".ISO8859-15" encoding.
378380
return code + '.ISO8859-15@euro'
379381
_, _, encoding = code.partition('.')
380382
if encoding == 'UTF-8':
@@ -485,9 +487,9 @@ def _parse_localename(localename):
485487
# Deal with locale modifiers
486488
code, modifier = code.split('@', 1)
487489
if modifier == 'euro' and '.' not in code:
488-
# Assume Latin-9 for @euro locales. This is bogus,
489-
# since some systems may use other encodings for these
490-
# locales.
490+
# Assume ISO8859-15 for @euro locales. Do note that some systems
491+
# may use other encodings for these locales, so this may not always
492+
# be correct.
491493
return code + '@euro', 'ISO8859-15'
492494
else:
493495
modifier = ''

Tools/i18n/makelocalealias.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def parse(filename):
4545
if len(locale) == 1 and locale != 'c':
4646
continue
4747
if '@' in locale and '@' not in alias:
48+
# Do not simply remove the "@euro" modifier.
49+
# Glibc generates separate locales with the "@euro" modifier, and
50+
# not always generates a locale without it with the same encoding.
51+
# It can also affect collation.
4852
if locale.endswith('@euro') and not locale.endswith('.utf-8@euro'):
4953
alias += '@euro'
5054
# Normalize encoding, if given
@@ -54,7 +58,7 @@ def parse(filename):
5458
encoding = encoding.replace('_', '')
5559
locale = lang + '.' + encoding
5660
data[locale] = alias
57-
# Conflict with GNU libc
61+
# Conflict with glibc.
5862
data.pop('el_gr@euro', None)
5963
data.pop('uz_uz@cyrillic', None)
6064
data.pop('uz_uz.utf8@cyrillic', None)

0 commit comments

Comments
 (0)