[GRASS-dev] Re: fprintf in raster modules converted to G_message

Paul Kelly paul-grass at stjohnspoint.co.uk
Sat Dec 23 16:53:59 EST 2006



On Sat, 23 Dec 2006, Jachym Cepicky wrote:

> hi,
> I tryed this patch for glocale.h, which sets standard messages, which
> should be used in all grass modules.

FWIW I don't like this idea, as it means (IIUC) that you can't grep for 
error messages in source files. Makes debugging a pain and is something 
that really annoys me with other software packages that do something 
similar. I don't see any advantage in using these macros over simply 
changing non-standard text strings to whichever ones we decide are 
standard?

> it worked for r.average quite well, but when I updated .po files, new
> messages did not appear.

But are they not old messages - they are already used in other modules? 
But I don't know how the translation stuff works??

Paul

>
> could someone tell me, how to add glocale.h to list of files, which are
> searched trough by running "make pot" ?
>
> thanks
>
> Jachym
>
> On Thu, Dec 14, 2006 at 10:55:31AM +0000, Glynn Clements wrote:
>>
>> Hamish wrote:
>>
>>>> My suggestion is:
>>>>
>>>> Index: include/glocale.h
>>>> ===================================================================
>>>> RCS file: /grassrepository/grass6/include/glocale.h,v
>>>> retrieving revision 2.2
>>>> diff -u -r2.2 glocale.h
>>>> --- include/glocale.h   26 Nov 2006 21:32:36 -0000      2.2
>>>> +++ include/glocale.h   13 Dec 2006 18:51:56 -0000
>>>> @@ -1,6 +1,11 @@
>>>>  #ifndef GRASS_GLOCALE_H
>>>>  #define GRASS_GLOCALE_H
>>>>
>>>> +#define ERRMSG_RASTER_OPEN_FILE        _("Unable to find raster map <%s>")
>>>> +#define ERRMSG_VECTOR_OPEN_FILE        _("Unable to find vector map <%s>")
>>>> +#define ERRMSG_ASCII_OPEN_FILE        _("Unable to find ASCII file <%s>")
>>>> +#define ERRMSG_OTHER_OPEN_FILE        _("Unable to find file <%s>")
>>>
>>>
>>> Will that hardcode whatever language GRASS was built with as the
>>> only translation it can use for those messages? Or will the _(macros)
>>> survive the build process and be processed normally at run-time?
>>
>> Macros are substituted by the preprocessor, so there's no difference
>> between:
>>
>> 	G_fatal_error(ERRMSG_RASTER_OPEN_FILE, mapname);
>> and:
>> 	G_fatal_error(_("Unable to find raster map <%s>"), mapname);
>>
>> so far as the resulting object file is concerned.
>>
>> In either case, the code which is actually compiled will be either:
>>
>> 	G_fatal_error(("Unable to find raster map <%s>"), mapname);
>> or:
>> 	G_fatal_error(G_gettext(PACKAGE,("Unable to find raster map <%s>")), mapname);
>>
>> depending upon whether I18N is enabled (in the latter case, PACKAGE
>> will have been expanded to either "grasslibs" or "grassmods").
>>
>> --
>> Glynn Clements <glynn at gclements.plus.com>
>>
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at grass.itc.it
>> http://grass.itc.it/mailman/listinfo/grass-dev
>
> -- 
> Jachym Cepicky
> e-mail: jachym.cepicky at centrum.cz
> URL: http://les-ejk.cz
> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
> -----------------------------------------
> OFFICE:
> Department of Geoinformation Technologies
> Zemedelska 3
> 613 00, Brno
> Czech Republick
> e-mail: xcepicky at node.mendelu.cz
> URL:    http://mapserver.mendelu.cz
> Tel.:   +420 545 134 514
>




More information about the grass-dev mailing list