Hi Malte,

Django strives to conform to published standards, mainly RFC5646 and the Posix locale syntax.

https://tools.ietf.org/html/rfc5646
https://tools.ietf.org/html/rfc5646#appendix-A
https://en.wikipedia.org/wiki/Locale

Extract from RFC 5646:

(...)
These conventions include:

   o  [ISO639-1] recommends that language codes be written in lowercase
      ('mn' Mongolian).

   o  [ISO15924] recommends that script codes use lowercase with the
      initial letter capitalized ('Cyrl' Cyrillic).

   o  [ISO3166-1] recommends that country codes be capitalized ('MN'
      Mongolia).


Claude

Le 08. 03. 16 05:42, Malte a écrit :
Hi Claude,

After another round of testing, I think I got a pattern.

Django doesn't care so much for whether the folder is named zh_Hans or
zh_HANS but what it does care for is which way I spell the locale in the
compilemessages command, i.e.

If I run ...

$ python manage.py compilemessages --locale zh_Hans

Django will create a .mo file that will be work regardless of whether I
name the folder zh_Hans or zh_HANS.

However if I run ...


python manage.py compilemessages --locale zh_HANS (and in this case the
folder needs to be named zh_HANS, otherwise Django will not process the
.po file)


my translations will not be read/found/recognized regardless of how I
name the folder afterwards.

If you search in the Django git repo, you will find only a reference to
zh_Hans, not zh_HANS. However, in the docs, it says that whatever comes
after the underscore should be spelled uppercase. Of course, the docs
only refers to two letter additions such as en_GB, hence, I will
probably pick up on your suggestion and post a ticket.

But the core of this matter is not documentation but whether it should
be zh_Hans or zh_HANS.


On Tuesday, March 8, 2016 at 1:11:21 AM UTC+8, claudep wrote:

    Glad that it finally worked for you.

    The issue of zh_Hans vs zh_HANS is most probably a django-rosetta
    issue.
    Of course, if you see any point where the Django documentation could be
    improved, feel free to propose some improvement on the ticket tracker.

    Claude

    Le 07. 03. 16 17:18, Malte a écrit :
     > Hi Claude,
     >
     > Thanks for getting back to me.
     >
     > Two things: A) You were right, it was a config issue, the path
    was off.
     > But it took me some time to get to terms with the formatting. I
    think
     > the docs are not very clear on how the locale needs to be formatted,
     > e.g. zh_Hans is how the locale appears in the Django repo. But
    unless
     > it's zh_HANS (note the part after the underscore is fully
    capitalized),
     > the locale will not be recognized by django-rosetta. It took some
    time
     > to figure that out. So should it be zh_Hans or zh_HANS? And
    perhaps this
     > special locale could be added to the docs are examples?
     >
     > But finally got it working! :)
     >
     > On Monday, March 7, 2016 at 6:23:52 AM UTC+8, claudep wrote:
     >
     >     Hey,
     >
     >     Could you tell us what's going wrong with:
     >     django-admin.py makemessages -l zh_Hans
     >
     >     If you go to your admin interface, can you see Chinese
    translations for
     >     Django itself?
     >     I suspect an issue with your project configuration.
     >
     >     Claude
     >
     >     Le 06. 03. 16 07:44, Malte a écrit :
     >      >
     >      > Through this thread here:
     >      > https://code.djangoproject.com/ticket/18419#comment:18
    <https://code.djangoproject.com/ticket/18419#comment:18>
     >     <https://code.djangoproject.com/ticket/18419#comment:18
    <https://code.djangoproject.com/ticket/18419#comment:18>>
     >      >
     >      > I found out about the zh-* deprecation
     >      >
     >      >
    https://docs.djangoproject.com/en/1.9/internals/deprecation/
    <https://docs.djangoproject.com/en/1.9/internals/deprecation/>
     >     <https://docs.djangoproject.com/en/1.9/internals/deprecation/
    <https://docs.djangoproject.com/en/1.9/internals/deprecation/>>
     >      > The zh-cn and zh-tw language codes will be removed and
    have been
     >      > replaced by the zh-hans and zh-hant language code
    respectively.
     >      >
     >      > Which is a good thing! So now we finally got the correct
    zh-hans and
     >      > zh-hant in there.
     >      >
     >      > But what the documentation isn't revealing is how I should
    deal
     >     with the
     >      > locale. The list clearly states:
     >      >
     >
    
https://github.com/django/django/blob/master/django/conf/global_settings.py#L140
    
<https://github.com/django/django/blob/master/django/conf/global_settings.py#L140>

     >
    
<https://github.com/django/django/blob/master/django/conf/global_settings.py#L140
    
<https://github.com/django/django/blob/master/django/conf/global_settings.py#L140>>

     >
     >      >
     >      > zh-hans and zh-hant for the settings.py.
     >      >
     >      > However, the documentation is very vague about how the
    formatting
     >     should
     >      > be for makemessages and compilemessages.
     >      >
     >      > Is it
     >      >
     >      > django-admin.py makemessages -l zh_Hans
     >      > or
     >      > django-admin.py makemessages -l zh_HANS
     >      > ?
     >      >
     >      > Neither works for me right now and I can't figure it out.
    I already
     >      > posted this question on SOF
     >      >
     >
    
(http://stackoverflow.com/questions/35823415/django-how-to-implement-zh-hans-chinese
    
<http://stackoverflow.com/questions/35823415/django-how-to-implement-zh-hans-chinese>

     >
    
<http://stackoverflow.com/questions/35823415/django-how-to-implement-zh-hans-chinese
    
<http://stackoverflow.com/questions/35823415/django-how-to-implement-zh-hans-chinese>>)

     >
     >      > but I am running out of time with my project. Can anyone
    help me
     >     out here?
     >
     >

--
You received this message because you are subscribed to the Google Groups "Django 
internationalization and localization" 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].
Visit this group at https://groups.google.com/group/django-i18n.
For more options, visit https://groups.google.com/d/optout.

Reply via email to