Skip to content
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

parse_locale(): upper-case variant tag to match file system #829

Merged
merged 1 commit into from Jan 27, 2022

Conversation

akx
Copy link
Member

@akx akx commented Jan 25, 2022

Upper-casing the variant tag should be okay, since quoth the spec:

At all times, language tags and their subtags, including private use
and extensions, are to be treated as case insensitive: there exist
conventions for the capitalization of some of the subtags, but these
MUST NOT be taken to carry meaning.

Fixes #814

   At all times, language tags and their subtags, including private use
   and extensions, are to be treated as case insensitive: there exist
   conventions for the capitalization of some of the subtags, but these
   MUST NOT be taken to carry meaning.

Fixes #814
@akx
Copy link
Member Author

akx commented Jan 26, 2022

@krassowski Does this look like a good approach to you?

@krassowski
Copy link

Thank you, this would fix my issue. Is it guaranteed that future version of CLDR will follow the same naming (using capitals?).

For even better UX (preserving the capitalisation) one could consider rewriting the load() method to read the list of files in the locale-data directory first and then find the appropriate casing of the relevant .dat file (but I am not sure if it is worth the effort).

@akx
Copy link
Member Author

akx commented Jan 26, 2022

I'd imagine they won't change the casing anytime soon - maybe I should add a check for that in #826 anyway.

The loading code will need reworking later anyway (there are nebulous plans for a "Loader" interface in Babel 3, whenever that is).

@akx akx merged commit 8bbaa65 into master Jan 27, 2022
@akx akx deleted the case-variant branch January 27, 2022 16:57
@akx akx added this to the Babel 2.10 milestone Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ca_ES_valencia throws FileNotFoundError on get_display_name() but ca_ES_VALENCIA works fine
2 participants