[Django] #29712: Add warning in makemessages command if the localecode with `l` flag is not correct

49 views
Skip to first unread message

Django

unread,
Aug 26, 2018, 8:01:08 PM8/26/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
------------------------------------------------+------------------------
Reporter: Sanyam Khurana | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
The translations only work when the locale involving region code is
generated as this:

`zh_CN` for Simplified Chinese

Notice here that the region code should be in capital letters for the
`django.po` file in the directory to correctly work.

If we do `makemessages` as

`python manage.py makemessages -l zh_cn`
OR
`python manage.py makemessages -l zh-cn`

It wouldn't work and no error is produced even after running
compilemessages, which can leave people baffled for a while.

I would suggest adding a warning/error messages if the locale is used
incorrectly. That would certainly be a great help.

I can make a patch for this as well.

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

Django

unread,
Aug 26, 2018, 10:21:38 PM8/26/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: darvid7
Type: Bug | Status: assigned
Component: | Version: 2.1
Internationalization |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by darvid7):

* owner: nobody => darvid7
* status: new => assigned


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

Django

unread,
Aug 27, 2018, 4:05:50 AM8/27/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------

Reporter: Sanyam Khurana | Owner: darvid7
Type: Bug | Status: assigned
Component: Internationalization | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

* stage: Unreviewed => Accepted


Comment:

We have to be careful in deciding what is a "good" and a "bad" code.
However I agree that we can avoid some mistakes, notably the confusion
between IETF language tags [1] and ISO/IEC 15897 (Posix) [2] codes
generally expected by Django.

[1] https://en.wikipedia.org/wiki/IETF_language_tag
[2] https://en.wikipedia.org/wiki/Locale_(computer_software)

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

Django

unread,
Aug 27, 2018, 6:49:19 PM8/27/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: (none)

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

* owner: David => (none)
* status: assigned => new


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

Django

unread,
Aug 27, 2018, 8:02:02 PM8/27/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: (none)
Type: Bug | Status: new
Component: Internationalization | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Description changed by Sanyam Khurana:

Old description:

> The translations only work when the locale involving region code is
> generated as this:
>
> `zh_CN` for Simplified Chinese
>
> Notice here that the region code should be in capital letters for the
> `django.po` file in the directory to correctly work.
>
> If we do `makemessages` as
>
> `python manage.py makemessages -l zh_cn`
> OR
> `python manage.py makemessages -l zh-cn`
>
> It wouldn't work and no error is produced even after running
> compilemessages, which can leave people baffled for a while.
>
> I would suggest adding a warning/error messages if the locale is used
> incorrectly. That would certainly be a great help.
>
> I can make a patch for this as well.

New description:

Hey Calude,

What about normalizing the directory name to something that would just
work.

For example,

No matter, if the developer is doing all these:

`python manage.py makemessages -l zh_cn`

`python manage.py makemessages -l zh_CN`
`python manage.py makemessages -l ZH_CN`
`python manage.py makemessages -l ZH-CN`

etc.

we, just normalize the directory name to `zh_CN` and it would work.

I'm still about to read the code of `makemessages` command and probably if
there are any more checks than just this, then we'll have to figure out
another way all together.

--

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

Django

unread,
Aug 27, 2018, 8:02:46 PM8/27/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: MattSegal
Type: Bug | Status: assigned
Component: | Version: 2.1
Internationalization |

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

* owner: (none) => MattSegal


* status: new => assigned


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

Django

unread,
Aug 28, 2018, 7:58:48 AM8/28/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: MattSegal
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master

Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* has_patch: 0 => 1
* version: 2.1 => master
* type: Bug => Cleanup/optimization
* needs_tests: 0 => 1


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

Django

unread,
Aug 28, 2018, 11:46:03 PM8/28/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Matt
Type: | Segal
Cleanup/optimization | Status: assigned

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

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

Comment (by Matt Segal):

PR Ready

[https://github.com/django/django/pull/10345]

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

Django

unread,
Sep 3, 2018, 3:41:57 PM9/3/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak

Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Vishvajit Pathak):

* cc: Vishvajit Pathak (added)
* owner: Matt Segal => Vishvajit Pathak

Django

unread,
Sep 3, 2018, 7:34:04 PM9/3/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

Comment (by Vishvajit Pathak):

[https://github.com/django/django/pull/10365]

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

Django

unread,
Sep 3, 2018, 7:37:39 PM9/3/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Vishvajit Pathak):

* needs_tests: 1 => 0


Comment:

[https://github.com/django/django/pull/10365 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:9>

Django

unread,
Sep 4, 2018, 3:08:16 AM9/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

I think I would still output a warning when a language code is normalized,
just to inform the user that its input has been corrected.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:10>

Django

unread,
Sep 4, 2018, 4:36:07 AM9/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Vishvajit Pathak):

Warning added when a language code is normalized.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:11>

Django

unread,
Sep 4, 2018, 5:41:21 AM9/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nick Pope):

Trying to coerce ''any'' input to something like a
[https://www.w3.org/International/articles/language-tags/ language tag]
only to hack it back to a
[https://www.gnu.org/software/libc/manual/html_node/Locale-Names.html
locale] using {{{to_locale()}}} feels like a kludge. It would be better to
improve documentation.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:12>

Django

unread,
Sep 4, 2018, 9:45:09 AM9/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

Improving documentation is welcome, but silently accepting a wrong
language code also look a bit suspicious. I think I would be happy with a
warning without coercing anything.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:13>

Django

unread,
Sep 4, 2018, 11:35:51 AM9/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Vishvajit Pathak):

We definitely need to improve the documentations. Coercing the language
code is something we have to take call on.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:14>

Django

unread,
Sep 5, 2018, 11:31:02 AM9/5/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nick Pope):

Replying to [comment:13 Claude Paroz]:


> Improving documentation is welcome, but silently accepting a wrong
language code also look a bit suspicious. I think I would be happy with a
warning without coercing anything.

I agree. I think a warning would make sense, without coercion.

It is still possible to provide a locale to {{{makemessages}}} where there
are no actual message catalogs in any of the paths in
`settings.LOCALE_PATHS`.
We should probably scrap all the normalization stuff and just output a
warning message if a locale specified by the user is not in
{{{all_locales}}}.
At the moment we output a {{{"processing locale xx_XX"}}} message if
{{{verbosity > 0}}} which should be fixed to only happen for valid,
existing locales.

As an aside, this is checking {{{--locale}}} for {{{makemessages}}}, but
what about {{{compilemessages}}}? (And are their any others?)

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:15>

Django

unread,
Sep 5, 2018, 8:06:52 PM9/5/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Vishvajit Pathak):

Now I am thinking more to avoid the coercing and to put just a warning
message.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:16>

Django

unread,
Sep 14, 2018, 2:16:50 PM9/14/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:17>

Django

unread,
Sep 14, 2018, 8:24:29 PM9/14/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Vishvajit Pathak):

Tim

Current implementation involved just adding the warning message. We are
not normalizing locale now.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:18>

Django

unread,
Sep 18, 2018, 2:26:48 PM9/18/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:19>

Django

unread,
Sep 29, 2018, 4:57:08 PM9/29/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Vishvajit Pathak):

Tim,

I would like to understand better what needs to be done next ?

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:20>

Django

unread,
Oct 1, 2018, 4:00:31 AM10/1/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* needs_better_patch: 0 => 1


Comment:

As commented on the pull request, you cannot use the `all_locales`
variable as a reference as it does not contain new (valid) language codes.
The modified test in your patch shows a `'Invalid locale en'` message
which is obviously wrong, isn't it?
You may try using the
`django.utils.translation.trans_real.language_code_re` to check the locale
code syntax.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:21>

Django

unread,
Oct 18, 2018, 3:19:29 PM10/18/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Sanyam Khurana):

Hi Vishvajit!

Are you still working on the bug? Do you need any help?

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:22>

Django

unread,
Oct 20, 2018, 2:52:07 AM10/20/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Vishvajit
Type: | Pathak
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

Comment (by Vishvajit Pathak):

Hi Sanyam,

Yes, I am working on this ticket but your help would be very appreciated.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:23>

Django

unread,
Nov 4, 2018, 1:42:55 AM11/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: (none)
Type: Cleanup/optimization | 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: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Vishvajit Pathak):

* status: assigned => new
* cc: Vishvajit Pathak (removed)
* owner: Vishvajit Pathak => (none)


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:24>

Django

unread,
Nov 4, 2018, 7:06:28 AM11/4/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Abhith
Type: | Krishna

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

* owner: (none) => Abhith Krishna


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:25>

Django

unread,
Nov 7, 2018, 6:51:41 AM11/7/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: (none)
Type: Cleanup/optimization | 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: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Abhith Krishna):

* owner: Abhith Krishna => (none)


* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:26>

Django

unread,
Nov 7, 2018, 12:35:12 PM11/7/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Mark
Type: | Dawson

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

* owner: (none) => Mark Dawson


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:27>

Django

unread,
Nov 8, 2018, 7:11:17 AM11/8/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Mark
Type: | Dawson
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Herbert Fortes):

* cc: Herbert Fortes (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:28>

Django

unread,
Nov 8, 2018, 7:47:59 AM11/8/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Mark
Type: | Dawson
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Herbert Fortes):

Hi,

Here my thoughts:

language_code_re gets 'pt_BR'. And it does not get 'ZH-CN'. I did this:
{{{ r'[a-z]{2}(_[A-Z]{2})?' }}}

It seems to work. But one test prints:
{{{
System check identified no issues (0 silenced).
Invalid locale d
Invalid locale e
.................................................
----------------------------------------------------------------------
Ran 49 tests in 1.425s

OK
}}}

I did a check and there is only one line - 740 - that's use
{{{locale=LOCALE}}}. All
others use {{{ locale=[LOCALE]}}}.

What do you think Mark?

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:29>

Django

unread,
Nov 8, 2018, 7:51:07 AM11/8/18
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Mark
Type: | Dawson
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Herbert Fortes):

I forgot to say that the regrex I sent fails to:

{{{
ja_JP_JP
no_NO_NY
th_TH_TH
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:30>

Django

unread,
Mar 18, 2019, 10:45:08 AM3/18/19
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: (none)
Type: Cleanup/optimization | 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: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* owner: Mark Dawson => (none)


* status: assigned => new


Comment:

I'm going to de-assign this because there's been progress, so that someone
looking can pick it up.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:31>

Django

unread,
Mar 21, 2019, 5:50:32 AM3/21/19
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner:
Type: | mdsheerazaziz

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

* owner: (none) => mdsheerazaziz


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:32>

Django

unread,
Jun 4, 2019, 12:07:30 AM6/4/19
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Ashish
Type: | Mohite

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

* status: new => assigned

* owner: (none) => Ashish Mohite

Django

unread,
Dec 4, 2019, 1:58:02 AM12/4/19
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: (none)
Type: Cleanup/optimization | 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: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Ashish Mohite):

* status: assigned => new
* owner: Ashish Mohite => (none)


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:33>

Django

unread,
Dec 4, 2019, 3:32:29 AM12/4/19
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
--------------------------------------+------------------------------------
Reporter: Sanyam Khurana | Owner: dk
Type: Cleanup/optimization | Status: assigned

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: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by dk):

* owner: (none) => dk


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:32>

Django

unread,
Mar 16, 2020, 10:06:25 AM3/16/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Rohit Jha
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master
Internationalization |

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

* owner: (none) => Rohit Jha

Django

unread,
Aug 30, 2020, 2:40:34 PM8/30/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Aniket118

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

* owner: (none) => Aniket118

Django

unread,
Oct 21, 2020, 7:09:54 AM10/21/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Aniket118
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Manav Agarwal):

Can I claim this? I think I can move this forward

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:33>

Django

unread,
Oct 21, 2020, 8:17:45 AM10/21/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Aniket118
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Hi Manav, please do, no need to ask (but can I advise that you take just
one at a time to begin :)

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:34>

Django

unread,
Oct 25, 2020, 6:10:13 AM10/25/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned

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

Comment (by Claude Paroz):

The problem with using `LANG_INFO` is that you exclude some extra
languages added specifically for a project.

You can try to use `language_code_re`, but you'll have to take into
account the language code vs locale code difference.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:37>

Django

unread,
Oct 27, 2020, 2:03:33 PM10/27/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Manav Agarwal):

[https://github.com/django/django/pull/13615 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:38>

Django

unread,
Oct 28, 2020, 2:43:20 AM10/28/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

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

Comment (by Manav Agarwal):

If the patch in [https://github.com/django/django/pull/13615 PR] seems
fine then please update me so that I may start working on tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:40>

Django

unread,
Oct 30, 2020, 11:14:01 AM10/30/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* needs_better_patch: 1 => 0

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:41>

Django

unread,
Oct 30, 2020, 9:18:03 PM10/30/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:42>

Django

unread,
Oct 31, 2020, 1:00:04 PM10/31/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:43>

Django

unread,
Nov 2, 2020, 2:10:57 PM11/2/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:44>

Django

unread,
Nov 12, 2020, 12:57:46 PM11/12/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Manav Agarwal):

As per the
[https://github.com/django/django/pull/13615#issuecomment-726174242
comment by felixxm] on [https://github.com/django/django/pull/13615 PR], I
have created a check for the valid locales to not have hyphens.

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:45>

Django

unread,
Nov 12, 2020, 3:21:37 PM11/12/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | Status: assigned
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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:46>

Django

unread,
Nov 13, 2020, 4:29:28 AM11/13/20
to django-...@googlegroups.com
#29712: Add warning in makemessages command if the localecode with `l` flag is not
correct
-------------------------------------+-------------------------------------
Reporter: Sanyam Khurana | Owner: Manav
Type: | Agarwal
Cleanup/optimization | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"f63f3cdf0969c23fd0c05de0f4a2a1df0cd5112e" f63f3cdf]:
{{{
#!CommitTicketReference repository=""
revision="f63f3cdf0969c23fd0c05de0f4a2a1df0cd5112e"
Fixed #29712 -- Made makemessages warn if locales have hyphens and skip
them.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29712#comment:47>

Reply all
Reply to author
Forward
0 new messages