-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-87281: Fix support for locales with modifiers #137253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
11fce5c
to
853cfbd
Compare
Tests crash on Windows. See #137273. |
if modifier == 'euro' and '.' not in code: | ||
# Assume Latin-9 for @euro locales. This is bogus, | ||
# since some systems may use other encodings for these | ||
# locales. Also, we ignore other modifiers. | ||
return code, 'iso-8859-15' | ||
# locales. | ||
return code + '@euro', 'ISO8859-15' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be a dead code, because normalize()
above adds encoding.
1013430
to
abcbb93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small change requests, but otherwise this looks good. Thanks, @serhiy-storchaka
@@ -487,11 +487,16 @@ def _parse_localename(localename): | |||
if modifier == 'euro' and '.' not in code: | |||
# Assume Latin-9 for @euro locales. This is bogus, | |||
# since some systems may use other encodings for these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rewrite the comment to:
# Assume ISO8859-15 for @euro locales. Do note that some systems
# may use other encodings for these locales, so this may not always
# be correct.
@@ -375,12 +375,12 @@ def _replace_encoding(code, encoding): | |||
def _append_modifier(code, modifier): | |||
if modifier == 'euro': | |||
if '.' not in code: | |||
return code + '.ISO8859-15' | |||
return code + '.ISO8859-15@euro' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment to this section stating that Linux appears to require keeping the "@euro" modifier in place, even when using the ".ISO8859-15" encoding.
@@ -44,13 +44,20 @@ def parse(filename): | |||
# Ignore one letter locale mappings (except for 'c') | |||
if len(locale) == 1 and locale != 'c': | |||
continue | |||
if '@' in locale and '@' not in alias: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining why this is done (to make glibc on Linux happy)
Uh oh!
There was an error while loading. Please reload this page.