Shouldn't the "dirname" from your code contain the path where actual
catalogs are stored, iow. os.path.join(os.path.dirname(__file__),
'locale')?

On 5 Mar, 13:11, Jose Ramon Palanco <[email protected]> wrote:
> So, which one is the best (and easiest) way to build an appengine
> project with i18n support without django? I think I will write a dirty
> implementation if therer are not solution to solve this problem.
>
> On Thu, Mar 5, 2009 at 9:09 AM, Jarek Zgoda <[email protected]> wrote:
>
> > I tried to put Environment object in memcache, but it's not picklable
> > so no joy. FileSystemLoader can be pickled and cached, but for some
> > unknown reason cached object throws IOErrors if template code changes
> > (eg. because of new deployment) and I did not found a way to remove it
> > from cache after succesful deployment (and do not have key versioning
> > yet).
>
> > I ended up creating module-level environment object and hoping the
> > module will be kept in module cache fo long enough to be reused.
>
> > On 5 Mar, 01:14, pedepy <[email protected]> wrote:
> >> just as a side note, loading a jinja2 environment can be quite
> >> expensive. You'll wanna seperate this code (that you will no doubt
> >> reuse extensively) into it's own method. A little memcache love also
> >> wouldnt  hurt.
>
> >> On Mar 4, 7:45 am, Jose <[email protected]> wrote:
>
> >> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to