Opened 7 years ago

Closed 7 years ago

#28546 closed Bug (fixed)

Add support for private subtags in translation's to_locale().

Reported by: Ronnie van den Crommenacker Owned by: Brent Hand
Component: Internationalization Version: dev
Severity: Normal Keywords: i18n, translation, language
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

In Dutch we make a difference between formal and informal communications.
We're starting to implement this by using a private subtag nl-nl-x-informal
https://www.w3.org/International/articles/language-tags/#extension

Because of the sr-latn exception in the to_locale function the private subtag is formatted wrong.

>>> from django.utils.translation.trans_real import to_locale
>>> to_locale('nl-nl-x-informal')
nl_Nl-x-informal

While the country code should be with a capital L:

nl_NL-x-informal

Change History (5)

comment:1 by Claude Paroz, 7 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Brent Hand, 7 years ago

Owner: changed from nobody to Brent Hand
Status: newassigned

comment:3 by Brent Hand, 7 years ago

Has patch: set

I have added the check to make sure that subtags are formatted properly. Here is the link to the PR https://github.com/django/django/pull/8995

comment:4 by Tim Graham, 7 years ago

Patch needs improvement: set
Summary: Django translations to_locale() function incorrectly formats private subtagsAdd support for private subtags in translation's to_locale().

comment:5 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 0c4ac12:

Fixed #28546 -- Fixed translation's to_locale() with langauge subtags.

Thanks Brent Hand for the initial patch.

Note: See TracTickets for help on using tickets.
Back to Top