i18n on google app engine 1.4.3 and django 1.2
I have found some tutorials that show how to use i18n on gae, but they assume django 0.96. Right now I don't have f开发者_开发知识库or example separate script for makemessages and I can't run manage.py. Has anyone tried using i18n recently and could explain to me, how can this be done?
EDIT
I have managed to generate po
files and compile them. I receive language headers and I am able to set translation langauge. self.request.LANGUAGE_CODE
is set to pl
which is just fine. And yet those translations are not used while rendering the webpage. Do you have any idea why this might be happening?
EDIT2
Ok, doing some trial/error I managed to discover, you need to import settings from django.conf and reload them (setting._target = None). And it finally works.
We got it working or at least we think we do. We use the script compile-messages from django 0.96 to compile the .po files and have upgraded to django 1.2 using an I18NRequestHandler so I want to confirm it works. You may have a look at our code at http://montao.googlecode.com and we don't use manage.py since we don't use all of django. I hope some of this helps. I needed to add an import saying from django.utils.translation import gettext_lazy as _
otherwise most django 0.96 was easy to upgrade to 1.2. To activate the translation we now can use the hl parameter to a HTTP query for instance for greek translations: http://classifiedsmarket.appspot.com/?hl=el and the text in greek displays from the .mo files that were compiled with the script compile-messages.py
精彩评论