Reputation: 13
I have installed Ckan by following the "from source" way. But after it was installed, i can't find chinese in the "language" Drop-dwon menu in the web page.
I checked the ckan i18n folder, and these are zh_CN and zh_TW in it. When i change the "locale_default" into zh_CN in the config file, there will be an error "default language zh_CN not available", and Ckan cannot run . I tried to install ckan several times, and every time met this problem.
Then i installed Ckan by the "from package" way. OK, i can find "中文(中国)"(chinese) in the drop-down menu, but when i create an dataset, and look into the dataset with language set as chinese, an error "Server error, an internal server error occured". But when i choose any other language, it will be ok.
Do any one know how to solve this problem?
Upvotes: 1
Views: 230
Reputation: 3595
When you install ckan from package there is indeed a bug in the way that string formating works for the Chinese locale. This is because the translation string was mistakenly changed. You can fix this by changing the Chinese ckan.po
file and recompiling it into the .mo
file that is going to by formatters.py
. That would be a cleaner workaround then changing the python file itself.
In order to do that cd
into /usr/lib/ckan/default/src/ckan/ckan/i18n/zh_CN/LC_MESSAGES/
and edit line 962 (should start with msgstr
and have header comment # ckan/lib/formatters.py:146
). There you need to remove all the Chinese characters in curly braces and replace them with the English ones. It probably is easiest to just copy the string from msgid
from one line above although you could also change the order of month, day, year here if you want...).
Once that is done use msgfmt
(if not installed do sudo apt install msgfmt
) to compile the translation strings again:
sudo msgfmt ckan.po -o ckan.mo
After that restart apache with sudo service apache2 restart
. Now you should not see this error anymore.
Upvotes: 0
Reputation: 4540
Both these issues are bugs. I've created two issues on the repository:
https://github.com/ckan/ckan/issues/3073
https://github.com/ckan/ckan/issues/3074
Thanks for flagging these
Upvotes: 1