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

Jachym Cepicky jachym.cepicky at centrum.cz
Wed Dec 13 13:55:40 EST 2006


hallo,

I greped-out list of "not found" messages used in grass raster modules

grep -r -i "not found" */*.c |grep \"| sed "s/.*\"\(.*\)\".*/\1/g" 

Basicly, there are following slightly different messages:

messages with mostly with G_program_name(), some_map->answer
-----------------------------------------------------------
    %s: %s - raster map not found
    %s: <%s> raster file not found
    cell file [%s] not found
    vector map <%s> not found
    %s: <%s> not found
    %s: <%s> reference map not found
    %s: <%s> cellfile not found
    ...

messages with only some_map->answer
-----------------------------------
    %s - map not found
    %s - map not found
    <%s> raster file not found
    Input file [%s] not found.
    File not found: %s
    Terrain raster map <%s> not found!
    Raster map [%s] not found
    %s: base raster map not found
    %s: cover raster map not found
    Raster map or group [%s] not found
    Cell file [%s] not found\n
    Raster map [%s] not found
    ...

messages with special meaing of raster/vector map
-------------------------------------------------
    3dview file <%s> not found
    Old 3dview file. Region not found in <%s> in <%s>
    elevin cell file <%s> not found
    aspin cell file <%s> not found
    slopein cell file <%s> not found
    linkein cell file <%s> not found
    albedo cell file <%s> not found
    latin cell file <%s> not found
    coefbh cell file <%s> not found
    coefdh cell file <%s> not found
    Raster file [%s] not found
    contour cell file [%s] not found\n
    ...

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>")
+
 #include <grass/config.h>
 
 extern char * G_gettext(const char *, const char *);
@@ -11,6 +16,7 @@
 #else
 #define _(str) (str)
 #endif
+
 
 #endif
 
There could come other messages during the time, but this four ERRMSG could cover all
"not found" messages listed above.

What do you think?

Thanks

Jachym

On Mon, Dec 11, 2006 at 04:41:26PM +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?)
> 
> 
> Hamish
> 
> _______________________________________________
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061213/2ab25730/attachment.bin


More information about the grass-dev mailing list