[Django] #24063: Locale code validation too strict

9 views
Skip to first unread message

Django

unread,
Dec 30, 2014, 9:41:12 AM12/30/14
to django-...@googlegroups.com
#24063: Locale code validation too strict
--------------------------------------+--------------------
Reporter: nijel | Owner: nobody
Type: Uncategorized | Status: new
Component: Internationalization | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
The locale code validation is too strict as it refuses locale variants
which are used by some. See
https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html
for more information. Most frequently it can be seen with languages which
can be written in both Latin and Cyrillic.

I will provide pull request for this.

--
Ticket URL: <https://code.djangoproject.com/ticket/24063>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 30, 2014, 9:46:03 AM12/30/14
to django-...@googlegroups.com
#24063: Locale code validation too strict
-------------------------------------+-------------------------------------

Reporter: nijel | Owner: nobody
Type: Uncategorized | Status: new
Component: | Version: 1.7
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nijel):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Pull requests for master and 1.7.x:

https://github.com/django/django/pull/3815

https://github.com/django/django/pull/3816

--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:1>

Django

unread,
Jan 1, 2015, 9:37:52 PM1/1/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
--------------------------------------+------------------------------------

Reporter: nijel | Owner: nobody
Type: Uncategorized | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by berkerpeksag):

* version: 1.7 => master
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:2>

Django

unread,
Jan 1, 2015, 9:40:29 PM1/1/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
--------------------------------------+------------------------------------
Reporter: nijel | Owner: nobody
Type: New feature | Status: new

Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by berkerpeksag):

* type: Uncategorized => New feature


--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:3>

Django

unread,
Jan 7, 2015, 2:57:18 PM1/7/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
--------------------------------------+------------------------------------
Reporter: nijel | Owner: nobody

Type: New feature | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: 0 => 1


Comment:

I think this issue is a little more complicated. There are several
families of language codes. But basically, we are handling two different
ones in Django:
- IETF Language tags coming from the browser, defined in
http://tools.ietf.org/html/rfc5646
- POSIX locale codes (http://en.wikipedia.org/wiki/Locale) which is the
format used by gettext translations file names.

We should not mix those. See also
`django.utils.translation.trans_real.to_locale/to_language` which is the
code trying to map strings from one code to the other. To correctly handle
script variants, there is surely some more clever mapping work to do (e.g.
`Cyrl` in RFC5646 should map to `@cyrillic` in the POSIX locale).

--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:4>

Django

unread,
Jan 8, 2015, 3:38:18 AM1/8/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
--------------------------------------+------------------------------------
Reporter: nijel | Owner: nobody

Type: New feature | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by nijel):

Indeed handling Language tags coming from the browser is not covered by my
patch. What I've tried to address is to allow Django to set such locale
manually. Automatic mapping of browser locales would be indeed nice.

--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:5>

Django

unread,
Apr 23, 2015, 8:24:28 AM4/23/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
--------------------------------------+------------------------------------
Reporter: nijel | Owner: nobody

Type: New feature | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0


Comment:

Claude, could you check the pull request now?

--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:6>

Django

unread,
Apr 24, 2015, 1:42:11 PM4/24/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
-------------------------------------+-------------------------------------
Reporter: nijel | Owner: nobody

Type: New feature | Status: new
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:7>

Django

unread,
Apr 24, 2015, 8:32:56 PM4/24/15
to django-...@googlegroups.com
#24063: Locale code validation too strict
-------------------------------------+-------------------------------------
Reporter: nijel | Owner: nobody
Type: New feature | Status: closed
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"76d26d89220f5740103a16bf71df2ae255c00da4" 76d26d89]:
{{{
#!CommitTicketReference repository=""
revision="76d26d89220f5740103a16bf71df2ae255c00da4"
Fixed #24063 -- Allowed locale variants supported by gettext.

The locale code can contain a variant after @, so allowed that.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24063#comment:8>

Reply all
Reply to author
Forward
0 new messages