mbi / django-rosetta

Rosetta is a Django application that eases the translation process of your Django projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Locale formatting for Chinese script (zh_Hans vs zh_HANS)

maltebeckmann opened this issue · comments

Hi,

I just ran into an issue with the locale for simplified Chinese characters: zh_Hans. The zh_CN and zh_TW locales were deprecated in Django 1.9 (which is good). Trouble is that Django only accepts the .mo files if they are compiled when the locale folder is formatted as zh_Hans. Unfortunately, Rosetta does not recognize this format. The locale will only show up in the Rosetta UI if the locale folder is formatted as zh_HANS (note that with one only the first letter behind the underscore is capitalized and with the other, the entire part is capitalized).

Since I didn't know which formatting was the correct one (zh_Hans or zh_HANS), Claude from the Django i18n discussion group suggests zh_Hans is the correct formatting meaning that Rosetta might need updating in this regard.

https://groups.google.com/forum/#!topic/Django-I18N/o-H2DapWnvo

Claude writes:
"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). 

This was fixed in #133. I should probably release a new version to pypi including this fix.

Hi mbi, cheers! Is that easy, i.e. can I wait for you to do that?

Surething, just pushed 0.7.9 to pypi.

Fantastic, mbi, thanks! We're running a last minute operation here. Much appreciated!