You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we noticed this problem when we translated our app to 'zh_Hant' where 'Hant' is a script not a region, but Locale.get_closest treats it as it treats region codes and tries to find it capitalized.
This is AFAIK wrong on multiple levels. First rfc4647 says that
Language tags and thus language ranges 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.
Matching of language tags to language ranges MUST be done in a case-
insensitive manner.
Language tags are to my understanding the whole string, (so 'zh_Hant' for us) and thus all matching should happen at least case insensitive.
But that code is also making lots of assumptions and does some parsing which probably is wrong (though I'm not deep enough in the RFC to say so).
Some things that could be done here (in ascending order of severance of code changes)
Add a fallback that tries to find the original argument without trying to change it, so there is at least a workaround for programmers who know what they're doing.
Change matching to be case insensitive. This would be more in line with the RFC, but also has more probability of introducing new problems for existing users.
Use a propper locale parsing library (e.g. Babel )
The text was updated successfully, but these errors were encountered:
Hi there,
we noticed this problem when we translated our app to 'zh_Hant' where 'Hant' is a script not a region, but Locale.get_closest treats it as it treats region codes and tries to find it capitalized.
This is AFAIK wrong on multiple levels. First rfc4647 says that
Language tags are to my understanding the whole string, (so 'zh_Hant' for us) and thus all matching should happen at least case insensitive.
But that code is also making lots of assumptions and does some parsing which probably is wrong (though I'm not deep enough in the RFC to say so).
Some things that could be done here (in ascending order of severance of code changes)
The text was updated successfully, but these errors were encountered: