First time here? Check out the FAQ!
0

How do I change language to modified chinese

hi, I have modified my django.po file to suit my needs.

the file I changed is site-packages/askbot/locale/zh_CN/LC_MESSAGES/django.po

but I did not see any change after I restarted the server.

jerry_gzy's avatar
53
jerry_gzy
asked 2012-01-13 18:38:58 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

In your settings.py you should have:

USE_I18N = True
LANGUAGE_CODE = 'zh_CN'

LocaleMiddleware should not be used.

Also django.po file needs to be compiled - cd askbot; python ../manage.py compilemessages

Your system must have package called gettext - it might be absent in some systems.

Does this help you?

Evgeny's avatar
13.2k
Evgeny
answered 2012-01-13 18:43:04 -0500, updated 2012-01-13 18:43:24 -0500
edit flag offensive 0 remove flag delete link

Comments

hi, I have tried to run python ../manage.py compilemessages , but I got Error: This script should be run from the Django SVN tree or your project or app tree, or with the settings module specified.

jerry_gzy's avatar jerry_gzy (2012-01-14 12:41:25 -0500) edit

This needs to be done fro askbot app directory not from the project root. From where did you download askbot?

Evgeny's avatar Evgeny (2012-01-14 12:43:09 -0500) edit

I used virtualenv and askbot-setup under /home/jerry/WebApp/ and used . for where the Askbot project resides. do I need to install it under the Vitualenv dir ?( for my case, /home/jerry/VE)

jerry_gzy's avatar jerry_gzy (2012-01-14 12:55:19 -0500) edit

you need to activate your virtual environment, then cd askbot, then run python ../manage.py compilemessages. That is assuming that you've installed askbot in development mode - using python setup.py develop in the first place, otherwise the command needs to be run from the askbot app directory - possibly inside your virtual environment.

Evgeny's avatar Evgeny (2012-01-14 13:00:12 -0500) edit

I think i did not have the develop mode installed, so How do I do it? I only know the askbot-setup command for installing the project. where can I find the setup.py?

jerry_gzy's avatar jerry_gzy (2012-01-14 13:15:55 -0500) edit

hi, sorry for the bad comments, I have found in the documentation, using git clone git://github.com/ASKBOT/askbot-devel.git and python setup.py develop

jerry_gzy's avatar jerry_gzy (2012-01-14 13:35:48 -0500) edit

so i have tried pip uninstall askbot and then git clone git://github.com/ASKBOT/askbot-devel.git <my_proj_dir> then python setup.py develop then askbot-setup, but I still get this Error: This script should be run from the Django SVN tree or your project or app tree, or with the settings module specified.

jerry_gzy's avatar jerry_gzy (2012-01-14 13:49:36 -0500) edit

I've done the following steps and it worked for me:

git clone git@github.com:ASKBOT/askbot-devel.git
cd askbot-devel
virtualenv env --no-site-packages
source env/bin/activate
python setup.py develop
askbot-setup #answer questions, probably use 127.0.0.1 for domain name
#edit settings.py, if necessary
python manage.py syncdb --migrate --noinput
Evgeny's avatar Evgeny (2012-01-14 15:16:00 -0500) edit

i can start the server. but the the problem is my modified locale/zh_CN/LC_MESSAGES/django.po still did not work. I tried your cmd , python ../manage.py compilemessages, but it still says "Error: This script should be run from the Django SVN tree or your project or app tree, or with the settings module specified."

jerry_gzy's avatar jerry_gzy (2012-01-14 16:04:35 -0500) edit

on the django documentation, I found django-admin.py compilemessages for update the .po files, is it same as manage.py?

jerry_gzy's avatar jerry_gzy (2012-01-14 16:12:53 -0500) edit

did you run the compilemessages from inside directory askbot? do you mean that python manage.py runserver works, but compilemessages does not?

Evgeny's avatar Evgeny (2012-01-14 16:13:23 -0500) edit

I just got a step further, I was in the wrong askbot dir, but I got these errors: processing file django.po in .../askbot/locale/zh_CN/LC_MESSAGES sh: msgfmt: not found processing file djangojs.po in .../askbot/locale/zh_CN/LC_MESSAGES sh: msgfmt: not found

jerry_gzy's avatar jerry_gzy (2012-01-14 16:25:15 -0500) edit

you are missing a system package called gettext - you will need root access to install it. If you cannot compile the file yourself you can give it to me. Also you could commit it to github if your fixes could be interesting to somebody else. Thanks.

Evgeny's avatar Evgeny (2012-01-14 16:54:08 -0500) edit

I have installed askbot in production mode (not development). I've run compilemessages from app dir and also from askbot folder and I get the message: "CommandError: This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified." I haven't used virtualenv

nicanorl's avatar nicanorl (2013-12-05 07:55:15 -0500) edit

Try using the LANGUAGE_CODE parameter in the settings.py file.

Evgeny's avatar Evgeny (2013-12-05 08:35:18 -0500) edit

Thanks, I have done that already. Anyway, despite the errors, the site is displayed in the new language. My issue is solved. Thanks

nicanorl's avatar nicanorl (2013-12-05 10:14:44 -0500) edit
add a comment see more comments