Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with language code sr-Latn. #12

Open
ikresoft opened this issue Dec 3, 2011 · 4 comments
Open

Problem with language code sr-Latn. #12

ikresoft opened this issue Dec 3, 2011 · 4 comments

Comments

@ikresoft
Copy link

ikresoft commented Dec 3, 2011

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
Copy link
Author

ikresoft commented Dec 3, 2011

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.

@mbi
Copy link
Owner

mbi commented Mar 31, 2012

@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 (_).

@ikresoft
Copy link
Author

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

@BakanovKirill
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants