django-rosetta icon indicating copy to clipboard operation
django-rosetta copied to clipboard

Problem with language code sr-Latn.

Open ikresoft opened this issue 12 years ago • 4 comments

There is no way I can see translation for this language code sr-Latn or sr-latn. Probably django is expecting folder name sr_Latn to look for translation files.

ikresoft avatar Dec 03 '11 00:12 ikresoft

I change this line of code in poutil.py: if u'-' in lang: _l,c = map(lambda x:x.lower(),lang.split(u'-')) #add capitalize() langs += (u'%s%s' %(_l, c), u'%s%s' %(_l, c.upper()), u'%s%s' %(_l, _c.capitalize()), )

after this sr-Latin is working.

ikresoft avatar Dec 03 '11 08:12 ikresoft

@ikresoft I'm not sure, are you suggesting this is a bug in Rosetta or Django? All locale directories in Django have an underscore, regardless of whether the locale name (in settings.py) is defined with a dash (-) or an underscore (_).

mbi avatar Mar 31 '12 19:03 mbi

I am also confused, in django locale directories are underscored but in i18n for my country is sr-latn and that coresponds to sr_Latn directory in django, and only way rosseta works for me is this capitalize() function in poutil.py

ikresoft avatar Mar 31 '12 19:03 ikresoft

Same issues worked for me.

The problem is when Django sees languages, rosetta doesn't and vise versa for dashed languages as 'zh-cn', 'zh-tw'. (Django expects zh_CN, zh_TW)

Steps to fix:

  1. Rename created by rosetta directories to suit django, i .e. zh-cn - > zh_CN, zh-tw -> zh_TW
  2. Apply fix which is proposed by @ikresoft to poutil.py. This way rosetta still sees renamed dirs.

P.s. you can't just insert 'zh_CN' and 'zh_TW' into settings.py LANGUAGES list because these are invalid language codes.

BakanovKirill avatar Aug 10 '15 11:08 BakanovKirill