-
Notifications
You must be signed in to change notification settings - Fork 445
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
Parsing of mixed-cased locale ID. #361
Conversation
Looks like this issue relates to #283. |
Current coverage is
|
@@ -24,15 +25,22 @@ | |||
_dirname = os.path.join(os.path.dirname(__file__), 'locale-data') | |||
|
|||
|
|||
def normalize_locale(name): | |||
"""Return a normalized locale ID or `None` if the ID is not recognized.""" |
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.
Could you explain what "normalization" means in the docstring?
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.
Nice, thanks @kdeldycke! (CI: I'm not waiting for Appveyor, since most builds completed and some failed due to ephemeral errors.) |
Thanks @akx for the quick merge! 😃 |
if name == locale_id.lower(): | ||
return locale_id | ||
|
||
|
||
def exists(name): |
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.
Wow, greedy method.
I'm really looking forward to #305 !
(just an observation, please ignore :)
Ah, crud, didn't notice this was already merged into master. Feel free to ignore all my comments, none of them are major. :) |
All comments were duly noted and processed, don't fret :D |
Following #351, it seems that mixed-cased locale IDs are not properly checked as existing depending on the platform.
The issue lies in
babel.localedata.exists()
which rely on filesystem assets. As a result, mixed-cased locale IDs are properly parsed on OSX (case-insensitive filesystem) but not on Linux.The first commit demonstrate the issue depending on the system.
The second commit ensure that locale IDs recognized by Babel are uniques, even if lower-cased.
The third commit fix to the issue.