I'm new in python and app engine. I'm developing a simple project
without django, just webapp. Instead use django template system I'm
using jijas2.
To enable jijas2 into my project I downloaded the last version and
after unpack it, I copied jijas2 folder into my project. I added this
imports:
from jinja2 import Template
from jinja2 import FileSystemLoader, Environment
An in my request handler I use templates in this way:
template_dirs = os.path.join(os.path.dirname(__file__),
'templates')
env = Environment(loader=FileSystemLoader(template_dirs))
template = env.get_template("index.html")
rendered = template.render(template_values)
self.response.out.write(rendered)
Everything works fine. Now, I'm trying to make use of i18n support in
jijas2. But I have a lot of problems and I would apreciate your help.
First of all I read jijas2 documentation and API, and the way to
implement this feature is with this lines:
import gettext
(..and in my request handler)
domain = "myproject"
dirname = os.path.dirname(__file__)
locales = "en_US"
translations = gettext.find(domain, dirname, locales)
env = Environment(loader=FileSystemLoader
(template_dirs),extensions=['jinja2.ext.i18n'])
env.install_gettext_translations(translations)
Second question:
I have experiencie with PHP, so it not so hard understand gettext and
po/mo files operation, so I think I have to upload my po files into
ROOT/locale/LC_MESSAGES/en_US/myproject.po
Regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---