i18n translation live update, how to ?

78 views
Skip to first unread message

Nicolas Di Pietro

unread,
Feb 7, 2013, 4:46:26 AM2/7/13
to pylons-...@googlegroups.com
Hi group !

I'm trying to implement some cms like system for a website that must be translated in several languages (more or less 10), one of the aim of this is to have some translation teams to be able to translate part of the site, translations reviewed by, let's say, editors and, on approval, translations updated on the site. (so the app is more or less just a webinterface )

I will write functions to edit po files (translate the site), I guess, I will have to call some os.system to call the setup.py update_catalog and setup.py compile_catalog (although I would prefer to use some functions to do this, but I did not find yet how to do it).

The question is: how to force pyramid to take in account the updated mo file ? I mean, without stopping  the application and starting it again ? I guess the file is uploaded in memory and not re-read after that, is this the case ?

Thanks for your help, have a nice day,

Nicolas

Grzegorz Śliwiński

unread,
Feb 14, 2013, 5:58:33 AM2/14/13
to pylons-...@googlegroups.com
Would calling add_translation_dirs again help?

http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/api/config.html#pyramid.config.Configurator.add_translation_dirs

That might be at least some starting point. I'm also looking at the way to internationalise pyramid app, and apart from using gettext, I'm wondering, If I can preload these translations from database.

As for the update/extract I'm wondering, if it wouldn't be better to use babel cli (but I have to read further on this).

Grzegorz Śliwiński

unread,
Feb 15, 2013, 5:07:28 AM2/15/13
to pylons-...@googlegroups.com
Digging and reading, has brought me to this method, which I think might be utilised best.

https://github.com/Pylons/pyramid/blob/master/pyramid/i18n.py#L197

Seems like we need to unregister previous localizer first, and then recreate it and reregister it again.

I'm working on a similar functionality for my project, with .po files editing.


W dniu czwartek, 7 lutego 2013 10:46:26 UTC+1 użytkownik Nicolas Di Pietro napisał:

Ryan

unread,
Mar 29, 2013, 9:19:21 PM3/29/13
to pylons-...@googlegroups.com
I have the same issue. Wondering if you made any progress on the live updating. Thanks.
Reply all
Reply to author
Forward
0 new messages