#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 <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.e386c9593b286a14b38ac1b0cdc2542f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to