Hi Daniel,
(cc grass5)
On Fri, Mar 04, 2005 at 01:55:38AM -0500, Daniel Calvelo Aros wrote:
Hi, Markus.
I spent some time estimating the amount of work needed to _-mark all
translatable strings. There is one case that can be fully automated: the
G_(message|warning|fatal_error) functions. There is a mostly automatic case:
description strings for options. There is a half automatic case: fprintf's.In the attached tarball there are two files. The important one is
gettextize.cmds. It's a howto-commented script that tries to perform the
automatic possible _-markings.1. For G_*, it's straightforward: find all instances of
G_(message|warning|fatal_error) calls, and enclose the constant strings
therein with _(). I used a find-grep-perl filter to generate a context diff
that is then patch'ed into the source tree. Only non-constant strings are left
to be hand-marked, things like 'G_message(msg)'.2. For option descriptions, the same principle applies, only care must be
taken with multi-line strings, which I haven't found in the G_* calls.3. For fprintf calls, it's trickier since they are mostly present in older
code, which doesn't quite follow Radim's proposal of using stderr for anything
informative and stdout for output proper. Also, there are several occurrences
of fprintf being used for debug and exception signaling. In those cases, the
output is meant to be read by the command's developper rather than the user.
what I did was a find-grep filter, followed by hand editing of the resulting
occurrences, followed by patch generation. The hand-edited intermediary file
is 'fprintf_nongettexted', and corresponds to 6.0.0beta2. I'm not sure it's as
useful as the other two conversions.
thanks for your work. I have attached for the list the
gettextize_auto.tgz script for further discussion (which hopefully happens).
Finally, as I was happily perling, I remember having come across a message by
yourself to grass5 list where you sought to have <table>s managed in
g.html2man; I attach a patch that allows for *well-formed* <table> entries to
be translated to tbl markup. (By well-formed I mean using <th></th> as actual
headers, not boldface markers and closing <td> and <tr> correctly.)
Very nice, uploaded to CVS (please verify:
cvs up tools
cd man
make
)
I ran the automatic converter on beta2 sources, and I got some 1700 undefined
entries in grassmods. Scary. I haven't run through it, but it is possible that
several messages are slight variations of each other and should be merged
accordingly. That should go along the *huge* work of going module by module
checking proper usage of output.
In fact, we have to somewhat cleanup the messages to avoid that
it becomes an endless story. This is time consuming, but consider
the time needed to replicate translations for n languages...
I hope this is helpful.
Definitely! Please consider to subscribe to grass5 to participate
in the discussion (changing to digest mode/mime you can keep the number
of mails smaller if needed).
Thanks for your input
Markus
(attachments)
gettextize_auto.tgz (47.8 KB)