[GRASS-dev] Error and warning messages in output

Hamish hamish_nospam at yahoo.com
Tue Jul 3 04:49:04 EDT 2007


Carlos Dávila wrote:
> There's a lot of error and warning messages that are shown in the
> output of different modules and scripts that are not included in po
> files. IMHO these messages should be translated, as they are the key
> for the user to know what is being done wrong and correct it.
>
> Usually they are written in the way: g.message flag 
> "what_you_want_to_say" I've tried adding _( ) but it doesn't work.
>
> So I have two questions:
> Do you agree they should be included in po files?
> If so, how to include them?


"g.parser -t" is currently only picking up #% description text, not
g.message messages.

g.parser help page:
=================================
TRANSLATION

g.parser provides some support for translating the options of scripts.
If called with the -t switch before the script filename like this 

g.parser -t somescriptfile

g.parser will print the text of the translatable options to stdout, one
per line, and exit. This is for internal use within the build system to
prepare GRASS scripts for translation. 
=================================


e.g

G63> g.parser -t `which v.in.gpsbabel` | wc -l
12

G63> grep g.message `which v.in.gpsbabel` | wc -l
54


"g.parser -t" or g.message needs to be extended somehow.

You can extract the messages with

SCRIPT=v.in.gpsbabel
grep g.message `which $SCRIPT` | \
  sed -e 's/-w \|-e \|-v \|-i //' \
      -e 's/.*g.message //' \
      -e 's/^message=//'| grep -v '^""$'


saving `grep g.message` to a TMP file and running it gives the messages,
but the shell processes all $VARIABLES (mostly to ""), which may be
needed.

double and single quotes are important (e.g. '!'), and I'm not sure how
g.parser coule paste in the translations, I'm doubtful that this is even
possible with g.parser -- it probably needs to happen in g.message, with
.po lists generated as above.


???,
Hamish




More information about the grass-dev mailing list