I got translations ready in .po and .mo files. How can I make django 1.2 display these? I can use the builtin trnanslations and now I want to enable in addition the ones I keep in [application-name]/conf/locale/[Language_Code]/LC_MESSAGES'
Is there a way? It used to work with django 0.96 and after the upgrade only the builtin translations work.
UPDATE: I tried moving to APP_DIR/locale/LANG_CODE/LC_MESSAGES/django.po and it won't work for me. Maybe I missed something. Do I have to recompile .po files?
UPDATE: Folowing the instructions here, I put my .po and .mo files in
APP_DIR/locale/LANG_CODE/LC_MESSAGES/django.po
It still won't work. I'm considering why and welcoming any more advice or recommendation how to enable i18n features with django for google app engine.
EDIT: Here's a link where we discuss this issue in the GAE python group.
Update: Now it works. We didn't have to move around the directories in the conf directory. We just use:
from google.appengine.dist import use_library
use_library('django', '1.2')
# Force Django to reload settings
from django.conf import settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'conf.settings'
settings._target = None
First you should use
in your settings file, but I think you already are aware of that. Next I suggest using
ugettext_lazy
for translation in your views (i.e. every string'test'
in view should be passed byugettext_lazy('test')
). In templates using{% trans "text" %}
should work (remember that templates need to load{% load i18n %}
). Then use the script:in your
APP_DIR
. Finally editdjango.po
files and useafter translations. That's all. Did you tried this? Does it work or not?
Put you locale files at:
I had same problem and changing the path worked