Ask Your Question
0

We've edited django.po files but translations do not work. Why?

asked 2012-09-16 16:47:46 -0500

Toms gravatar image Toms
661 21 7 35

updated 2012-10-20 06:56:54 -0500

I'm using the ru locale and it is translated in to Russian but on my site it still appears in English.

Translation :

#: utils/functions.py:82
msgid "2 days ago"
msgstr "2 дня назад"

#: utils/functions.py:84
msgid "yesterday"
msgstr "вчера"

#: utils/functions.py:87
#, python-format
msgid "%(hr)d hour ago"
msgid_plural "%(hr)d hours ago"
msgstr[0] "%(hr)d час назад"
msgstr[1] "%(hr)d часов назад"
msgstr[2] "%(hr)d часа назад"

#: utils/functions.py:93
#, python-format
msgid "%(min)d min ago"
msgid_plural "%(min)d mins ago"
msgstr[0] "%(min)d минуту назад"
msgstr[1] "%(min)d минут назад"
msgstr[2] "%(min)d минуты назад"

I've tried

python manage.py compilemessages

then server restart.

80% of the messeges were translated, but not the time/date messages.

I've tried to manipulate functions.py (there are the original time messages), but I then the whole site does not work

EDIT:

Does it work with time translation now ?

delete close flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2012-09-16 17:11:08 -0500

Evgeny gravatar image Evgeny flag of Chile
11329 50 84 183
http://askbot.org/

updated 2012-09-16 17:13:33 -0500

You might have forgotten to compile the messages:

cd askbot  #or wherever askbot code is actually installed
python manage.py compilemessages

Note that - this works best if you have installed Askbot in the development mode (with python setup.py develop)

Secondly - translations need to be loaded by the application in order to work. You might need to restart the server's python process or the webserver.

link publish delete flag offensive edit

Comments

I did those steps, but the time/date is still in English

Toms ( 2012-09-16 17:30:35 -0500 )edit

Ok, I see. Those messages are actually in javascript. As strange as it sounds, but the best way to fix this is to migrate askbot to django 1.4. It cannot be done very quickly though. I will try to address this issue early next week, if not migrate to 1.4, but at least extract the strings for the translation correctly.

Evgeny ( 2012-09-16 17:41:11 -0500 )edit

@Evgeny I translate atm the German language files. I downloaded from Transiflex the *.po Mainfile moved it to /usr/local/lib/python2.6/dist-packages/askbot/locale/de/LC_MESSAGES (renamed it to django.po). Then I run "python setup_templates/manage.py compilemessages" in "/usr/local/lib/python2.6/dist-packages/askbot", all *.po files are processing ... restart the webserver (apache with mod_wsgi) ... akbot is fully broken (500er http errors, all sites). I move my backup files back, recompile, restart webserver, still broken. Any Ideas? (Is the dev-version OK for a production usage?)

Edur ( 2012-09-17 10:52:37 -0500 )edit

OK, after some trys with "manage.py collectstatic" "manage.py compilemessages" and "manage.py migrate" it works again. :)

Edur ( 2012-09-17 11:34:40 -0500 )edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2012-09-16 16:47:46 -0500

Seen: 250 times

Last updated: Oct 20 '12