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

Hamish hamish_nospam at yahoo.com
Sun Dec 10 22:41:26 EST 2006


Maris Nartiss wrote:
> last night I was cleaning up GRASS translation and found GRASS error
> messages very inconsistent.

In the past when adding i18n macros to modules I have used this method:

#search for messages already in use:
grass-src$ cd raster
raster$ grep -rI -A5 G_find_cell2 * | grep fatal

this gives a list of messages already used for that function (here
G_find_cell2()), then I just reuse the nicest message from that list
(prefer "raster map" to "cell file", <%s> brackets around map names,
square brackets around values (invalid color [%s]), etc).

A centralized list would be a nice idea, but I would modify Brad's macro
names,

-MSG_*
+ERR_MSG_*
+WRN_MSG_*

(and formalize usage of <> vs [], etc)

Brad:
> Okay, we now have a standard set of messages, but now locale macros
> need to be dealt with.  There's a few ways to deal with it, but none
> of them seem trivial to me.

#define ERRMSG_RASTER_OPEN_FILE        _("Unable to find raster map <%s>")
#define ERRMSG_RASTER_OPEN_FILE_MAPSET _("Unable to find raster map <%s@%s>")
#define ERRMSG_RASTER_WRITE_FILE       _("Unable to write to raster map <%s>")
...

?
but these should probably live in a .h file, and would #include <glocale.h>
at the top of that enough to get them translated at run time? (I assume not?)


Hamish




More information about the grass-dev mailing list