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

Glynn Clements glynn at gclements.plus.com
Thu Dec 14 05:55:31 EST 2006


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>




More information about the grass-translations mailing list