32 messages in com.googlegroups.pylons-discussRe: Recent i18n Pylons changes| Subject: | Re: Recent i18n Pylons changes![]() |
|---|---|
| From: | Shannon -jj Behrens (jjin...@public.gmane.org) |
| Date: | 12/19/2006 01:21:57 AM |
| List: | com.googlegroups.pylons-discuss |
On 12/19/06, Pedro Algarvio, aka, s0undt3ch
<ufs-beLbHzoLccIdnm+yROf...@public.gmane.org> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Shannon -jj Behrens wrote:
On 12/18/06, Pedro Algarvio, aka, s0undt3ch
<ufs-beLbHzoLccIdnm+yROf...@public.gmane.org> wrote:
Shannon -jj Behrens wrote:
I'm currently working on the extraction from genshi with help from http://genshi.edgewall.org/wiki/GenshiRecipes/Localization, but the regex presented there is too narrow. So far I've succeeded on extending it a bit more, I can now also match: _("A string which " "will become " "\"too big\" to 'keep it' " "in just one line." )
Eh? What's wrong with triple quoted strings?
You did notice I was using genshi templates right?
Yep.
I can use use tripple quoting and it, of course(translations apart), works, but grabbing the string for translation inside a genshi template is not as easy as in a python file. Although I extended that regex it still does not work for tripple quoted strings :|
I'm still hoping that we can do this somewhat lazily and let Genshi parse the Genshi templates. :-/
-jj
I am letting genshi parse the templates, but, I have to find where I'm calling _() because genshi does not know nothing about gettext.
There is a recipe which will do all work of fetching and replacing everything inside usable strings and also html attributes(possibly configurable), for example grab text inside a <h1>The Text</h1> and such or for example <a href="blah" title="String to Fetch"/> etc, but that requires some modification regarding genshi's internals, ie pre-filters so we can include a filter which grabs the correct translation to be fed to genshi right before parsing and rendering the template.
Unfortunately I haven't managed to get that recipe to work for me :\
I'm really suspicious of that recipe. I really like to be in control of what gets put into the translation catalog. Otherwise, it's too easy for the first half of the sentence to go into one msgid, and the second half to go in another. Of course, that's a total no no.
Perhaps we might just try and grab whatever is inside a _() call write that to a python temp file and run xgettext over that, dunno....
That would be just fine.
Happy Hacking! -jj




