[GRASS5] Re: Automatic gettextizations ; tables and g.html2man

Hamish hamish_nospam at yahoo.com
Sun Mar 6 23:29:06 EST 2005


> Mmmmh... Would it make sense to have a G_debug macro/function (in
> gis.h? not sure...) to help in that? I was thinking of something like
> providing

Radim has already provided this ;)


lib/gis/debug.c
/*
 *
 * G_debug (int level, char *msg)
 *
 * Print debugging message if environment variable GRASS_DEBUG_LEVEL
 * is set to level equal or greater
 *
 * Levels: (recommended levels)
 * 1 - message is printed once or few times per module
 * 3 - each row (raster) or line (vector)
 * 5 - each cell (raster) or point (vector)
*/


example:

int cat;
G_debug(3, "cat=%d", cat);

GRASS> g.gisenv set="DEBUG=3"
GRASS> g.module
D3/3: cat=123
GRASS>

This is new for 5.7/6.0 though, so while the new vector modules make
good use of it the old raster and display modules inherited from 5.0 and
earlier use lots of "#ifdef DEBUG" variations. Pre-processing should cut
all these out, so for your translation focusing efforts, perhaps run the
scripts on the cleaned version of the source code? (man gcc)

On the positive side, a lot of those error messages are there in case
there is a bug in the program, hopefully they will never be shown. Thus
they are very low priority for selective translating.


Fixing things to be translation friendly in all modules is a huge amount
of work. I think a good way to start is to define some best practices
and add them into the SUBMITTING file. Then at least whenever a module
gets a re-write or a new module appears it will be easy.


Also new for 5.7/6.0 is G_define_standard_option(). Updating modules to
use this instead of a custom version every time would also make your
efforts a bit simpler.


> Another annoyance in translations is several lines
> of fprintfs instead of one multiline string. That's quite
> uncomfortable when editing po-files. I'll look into it, it must be
> detectable automatically.

Does this work for all compilers?

search:
grep -A1 printf | sed | uniq --repeated

or something like that?



Hamish




More information about the grass-dev mailing list