Opened 4 years ago
Closed 4 years ago
#32581 closed Cleanup/optimization (fixed)
to_locale should be idempotent
Reported by: | Claude Paroz | Owned by: | Claude Paroz |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In summary:
>>> from django.utils.translation import to_locale >>> to_locale('en-us') 'en_US' # <- Fine >>> to_locale(to_locale('en-us')) 'en_us' # <- Bad
Typically, this breaks using e.g. django.utils.translation.override
with a locale code like pt_BR
or zh_Hans
. of course, we could document that override takes a language code, not a locale code, but if we can support both without much effort, this would be a lot better.
Change History (4)
comment:1 by , 4 years ago
Has patch: | set |
---|
comment:2 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 4 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
PR