[GRASS translations] Re: [GRASS-dev] Re: fprintf in raster modules
converted to G_message
Brad Douglas
rez at touchofmadness.com
Wed Dec 13 16:36:03 EST 2006
On Mon, 2006-12-11 at 16:41 +1300, Hamish wrote:
> 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?)
What I meant by "not exactly trivial" is that the above will *require*
locale support. Two conditional copies of the same thing to accommodate
with and without locale is ugly...even worse is definitions in two
separate files (glocale.h and another non-locale header).
I have no elegant answer.
--
Brad Douglas <rez touchofmadness com> KB8UYR/6
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785
More information about the grass-translations
mailing list