|
List Info
Thread: Genshi and Translation (via Matt Good)
|
|
| Genshi and Translation (via Matt Good) |

|
2006-12-29 06:26:31 |
> So, I've set my mind working on the extraction code
without the
> search_text set to False, so, I'm using regex find all
my _() calls.
This might be a stupid question but anyway....
Why do you need a regex to search for _() calls?
Isn't it simpler to setup a _ function that outputs to a POT
file and
then just run the template? As genshi encouters _() calls it
will add
the strings in the call to the POT file.
If genshi could be made to step a line by line through the
template
file, and you just increase a global current_line_number you
will have
the line numbers in the POT too.
Or I'm missing something obvious here???
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Genshi and Translation (via Matt Good) |

|
2006-12-29 06:51:52 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Damjan wrote:
>
>> So, I've set my mind working on the extraction code
without the
>> search_text set to False, so, I'm using regex find
all my _() calls.
>
> This might be a stupid question but anyway....
> Why do you need a regex to search for _() calls?
> Isn't it simpler to setup a _ function that outputs to
a POT file and
> then just run the template? As genshi encouters _()
calls it will add
> the strings in the call to the POT file.
If you did read the previous post, you'd saw, that I'm not
using regex
anymore.
http://i18ntoolbox.ufsoft.org/brows
er/trunk/I18NToolBox/lib/genshi_gettext.py
> If genshi could be made to step a line by line through
the template
> file, and you just increase a global
current_line_number you will have
> the line numbers in the POT too.
>
> Or I'm missing something obvious here???
Well, that would have to be a special mode of Genshi
running, something
not currently supported.
The overall problem should be addressed by the package(when
at least 0.1
is released) for which I pasted a link above, ie, no
modifications to
your web app's code.
Regards,
- --
Pedro Algarvio
__ ___ ___ _______ ___ __
| Y .' _| _ .-----.' _| |_ .-----.----.-----.
|. | | _| 1___| _ | _| _|__| _ | _| _ |
|. | |__| |____ |_____|__| |____|__|_____|__| |___ |
|: 1 | |: 1 | |_____|
|::.. . | |::.. . | ufs [AT] ufsoft [DOT] org
`-------' `-------' ufs [AT] sapo [DOT] pt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFFlLsIniPxVTX2hA4RAgs2AJ92+UnTAQWfCXpdrL3Fztp07LB5CACa
A5nE
Wm0KCYk9QKOuyfIC251kbP4=
=R5Ky
-----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Genshi and Translation (via Matt Good) |

|
2006-12-29 16:21:52 |
Damjan wrote:
> > So, I've set my mind working on the extraction
code without the
> > search_text set to False, so, I'm using regex find
all my _() calls.
>
> This might be a stupid question but anyway....
> Why do you need a regex to search for _() calls?
> Isn't it simpler to setup a _ function that outputs to
a POT file and
> then just run the template? As genshi encouters _()
calls it will add
> the strings in the call to the POT file.
>
> If genshi could be made to step a line by line through
the template
> file, and you just increase a global
current_line_number you will have
> the line numbers in the POT too.
>
> Or I'm missing something obvious here???
You couldn't simply run the template, since you'd need to
know what
variables to provide for each template to make it actually
run, as well
as making sure to cover every branch (if, choose/when).
There are also
some different calling conventions from frameworks, such as
Pylons
using "c._()" instead of just "_()".
Instead the file linked to above by s0undt3ch scans the
parsed template
stream for EXPR events (for ${}) and scans the bytecode of
these for
calls to any of the gettext functions, such as _, gettext,
ngettext.
-- Matt Good
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Genshi and Translation (via Matt Good) |

|
2006-12-29 19:01:16 |
On 12/29/06, Matt Good <matt matt-good.net> wrote:
>
> Damjan wrote:
> > > So, I've set my mind working on the
extraction code without the
> > > search_text set to False, so, I'm using regex
find all my _() calls.
> >
> > This might be a stupid question but anyway....
> > Why do you need a regex to search for _() calls?
> > Isn't it simpler to setup a _ function that
outputs to a POT file and
> > then just run the template? As genshi encouters
_() calls it will add
> > the strings in the call to the POT file.
> >
> > If genshi could be made to step a line by line
through the template
> > file, and you just increase a global
current_line_number you will have
> > the line numbers in the POT too.
> >
> > Or I'm missing something obvious here???
>
> You couldn't simply run the template, since you'd need
to know what
> variables to provide for each template to make it
actually run, as well
> as making sure to cover every branch (if, choose/when).
Yeah, consider:
<py:if expr="world_is_coming_to_an_end">
${_("Oh sh*t!")}
</py:if>
hahahaha
-jj
--
http://jjinux.blogspot.co
m/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-4]
|
|