[GRASS-SVN] r46624 - grass/branches/releasebranch_6_4/vector/v.digit

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 8 20:26:23 EDT 2011


Author: neteler
Date: 2011-06-08 17:26:23 -0700 (Wed, 08 Jun 2011)
New Revision: 46624

Modified:
   grass/branches/releasebranch_6_4/vector/v.digit/attr.c
   grass/branches/releasebranch_6_4/vector/v.digit/c_face.c
   grass/branches/releasebranch_6_4/vector/v.digit/centre.c
   grass/branches/releasebranch_6_4/vector/v.digit/display.c
   grass/branches/releasebranch_6_4/vector/v.digit/form.c
   grass/branches/releasebranch_6_4/vector/v.digit/generate.c
   grass/branches/releasebranch_6_4/vector/v.digit/line.c
   grass/branches/releasebranch_6_4/vector/v.digit/main.c
   grass/branches/releasebranch_6_4/vector/v.digit/var.c
   grass/branches/releasebranch_6_4/vector/v.digit/vertex.c
   grass/branches/releasebranch_6_4/vector/v.digit/zoom.c
Log:
i18N; error trap (backport from 6.5)

Modified: grass/branches/releasebranch_6_4/vector/v.digit/attr.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/attr.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/attr.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -10,6 +10,7 @@
 #include <grass/display.h>
 #include <grass/colors.h>
 #include <grass/form.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "proto.h"
 
@@ -90,7 +91,7 @@
 	    G_debug(2, "Record already existed.");
 	}
 	else if (ret == -1) {
-	    G_warning("Cannot create new record.");
+	    G_warning("%s", _("Cannot create new record."));
 	}
     }
 
@@ -123,7 +124,7 @@
     Fi = Vect_get_field(&Map, field);
     if (Fi == NULL) {
 	i_message(MSG_OK, MSGI_ERROR,
-		  "Database table for this layer is not defined");
+		  _("Database table for this layer is not defined"));
 	return -1;
     }
 
@@ -133,7 +134,7 @@
     /* First check if already exists */
     driver = db_start_driver_open_database(Fi->driver, Fi->database);
     if (driver == NULL) {
-	sprintf(buf, "Cannot open database %s by driver %s", Fi->database,
+	sprintf(buf, _("Cannot open database %s by driver %s"), Fi->database,
 		Fi->driver);
 	i_message(MSG_OK, MSGI_ERROR, buf);
 	return -1;
@@ -141,7 +142,7 @@
     ret = db_select_value(driver, Fi->table, Fi->key, cat, Fi->key, &value);
     if (ret == -1) {
 	db_close_database_shutdown_driver(driver);
-	sprintf(buf, "Cannot select record from table %s", Fi->table);
+	sprintf(buf, _("Cannot select record from table %s"), Fi->table);
 	i_message(MSG_OK, MSGI_ERROR, buf);
 	return -1;
     }
@@ -149,11 +150,11 @@
 	sprintf(buf, "insert into %s (%s) values (%d)", Fi->table, Fi->key,
 		cat);
 	db_set_string(&sql, buf);
-	G_debug(2, db_get_string(&sql));
+	G_debug(2, "%s", db_get_string(&sql));
 	ret = db_execute_immediate(driver, &sql);
 	if (ret != DB_OK) {
 	    db_close_database_shutdown_driver(driver);
-	    sprintf(buf, "Cannot insert new record: %s", db_get_string(&sql));
+	    sprintf(buf, _("Cannot insert new record: %s"), db_get_string(&sql));
 	    i_message(MSG_OK, MSGI_ERROR, buf);
 	    return -1;
 	}
@@ -187,8 +188,8 @@
     dc->Points = Vect_new_line_struct();
     dc->Cats = Vect_new_cats_struct();
 
-    i_prompt("Display categories:");
-    i_prompt_buttons("Select line", "", "Quit tool");
+    i_prompt(_("Display categories:"));
+    i_prompt_buttons(_("Select line"), "", _("Quit tool"));
 
     dc->thresh = get_thresh();
     G_debug(2, "thresh = %f", dc->thresh);
@@ -297,8 +298,8 @@
     cc->Src_Cats = Vect_new_cats_struct();
     cc->Dest_Cats = Vect_new_cats_struct();
 
-    i_prompt("Copy attributes:");
-    i_prompt_buttons("Select source object", "", "Quit tool");
+    i_prompt(_("Copy attributes:"));
+    i_prompt_buttons(_("Select source object"), "", _("Quit tool"));
 
     cc->thresh = get_thresh();
     G_debug(2, "thresh = %f", cc->thresh);
@@ -392,18 +393,18 @@
     if (cc->dest_line > 0) {
 	display_line(cc->dest_line, SYMB_HIGHLIGHT, 1);
 	display_line(cc->src_line, SYMB_HIGHLIGHT, 1);
-	i_prompt("Select the target object");
-	i_prompt_buttons("Conform and select next", "Deselect Target",
-			 "Quit tool");
+	i_prompt(_("Select the target object"));
+	i_prompt_buttons(_("Conform and select next"), _("Deselect Target"),
+			 _("Quit tool"));
     }
     else if (cc->src_line > 0) {
 	display_line(cc->src_line, SYMB_HIGHLIGHT, 1);
-	i_prompt("Select the target object");
-	i_prompt_buttons("Select", "Deselect Source", "Quit tool");
+	i_prompt(_("Select the target object"));
+	i_prompt_buttons(_("Select"), _("Deselect Source"), _("Quit tool"));
     }
     else {
-	i_prompt("Copy attributes:");
-	i_prompt_buttons("Select source object", "", "Quit tool");
+	i_prompt(_("Copy attributes:"));
+	i_prompt_buttons(_("Select source object"), "", _("Quit tool"));
     }
 
     return 0;
@@ -458,8 +459,8 @@
     da->Points = Vect_new_line_struct();
     da->Cats = Vect_new_cats_struct();
 
-    i_prompt("Display attributes:");
-    i_prompt_buttons("Select line", "", "Quit tool");
+    i_prompt(_("Display attributes:"));
+    i_prompt_buttons(_("Select line"), "", _("Quit tool"));
 
     da->thresh = get_thresh();
     G_debug(2, "thresh = %f", da->thresh);
@@ -532,23 +533,24 @@
 		    G_debug(3, "field = %d category = %d", da->Cats->field[j],
 			    da->Cats->cat[j]);
 
-		    sprintf(title, "Layer %d", da->Cats->field[j]);
+		    sprintf(title, _("Layer %d"), da->Cats->field[j]);
 		    db_set_string(&da->html, "");
-		    db_append_string(&da->html,
-				     "<HTML><HEAD><TITLE>Attributes</TITLE><BODY>");
+		    db_append_string(&da->html, "<HTML><HEAD><TITLE>");
+		    db_append_string(&da->html, _("Attributes"));
+		    db_append_string(&da->html, "</TITLE><BODY>");
 
-		    sprintf(buf, "layer: %d<BR>category: %d<BR>",
+		    sprintf(buf, _("layer: %d<BR>category: %d<BR>"),
 			    da->Cats->field[j], da->Cats->cat[j]);
 		    db_append_string(&da->html, buf);
 
 		    Fi = Vect_get_field(&Map, da->Cats->field[j]);
 		    if (Fi == NULL) {
 			db_append_string(&da->html,
-					 "Database connection not defined<BR>");
+					 _("Database connection not defined<BR>"));
 		    }
 		    else {
 			sprintf(buf,
-				"driver: %s<BR>database: %s<BR>table: %s<BR>key column: %s<BR>",
+				_("driver: %s<BR>database: %s<BR>table: %s<BR>key column: %s<BR>"),
 				Fi->driver, Fi->database, Fi->table, Fi->key);
 			db_append_string(&da->html, buf);
 
@@ -561,19 +563,20 @@
 			G_free(Fi);
 		    }
 		    db_append_string(&da->html, "</BODY></HTML>");
-		    G_debug(3, db_get_string(&da->html));
+		    G_debug(3, "%s", db_get_string(&da->html));
 		    F_open(title, db_get_string(&da->html));
 		}
 	    }
 	    else {
-		sprintf(title, "Line %d", line);
+		sprintf(title, _("Line %d"), line);
 		db_init_string(&da->html);
 		db_set_string(&da->html, "");
-		db_append_string(&da->html,
-				 "<HTML><HEAD><TITLE>Attributes</TITLE><BODY>");
-		db_append_string(&da->html, "No categories");
+		db_append_string(&da->html, "<HTML><HEAD><TITLE>");
+		db_append_string(&da->html, _("Attributes"));
+		db_append_string(&da->html, "</TITLE><BODY>");
+		db_append_string(&da->html, _("No categories"));
 		db_append_string(&da->html, "</BODY></HTML>");
-		G_debug(3, db_get_string(&da->html));
+		G_debug(3, "%s", db_get_string(&da->html));
 		F_open(title, db_get_string(&da->html));
 	    }
 	}
@@ -644,7 +647,7 @@
     /* Does record exist ? */
     driver = db_start_driver_open_database(Fi->driver, Fi->database);
     if (driver == NULL) {
-	sprintf(buf, "Cannot open database %s by driver %s", Fi->database,
+	sprintf(buf, _("Cannot open database %s by driver %s"), Fi->database,
 		Fi->driver);
 	i_message(MSG_OK, MSGI_ERROR, buf);
 	return -1;
@@ -653,7 +656,7 @@
     G_debug(3, "n records = %d", ret);
     if (ret == -1) {
 	db_close_database_shutdown_driver(driver);
-	sprintf(buf, "Cannot select record from table %s", Fi->table);
+	sprintf(buf, _("Cannot select record from table %s"), Fi->table);
 	i_message(MSG_OK, MSGI_ERROR, buf);
 	return -1;
     }
@@ -662,8 +665,7 @@
 	return 0;
 
     sprintf(buf,
-	    "There are no more features with category %d (layer %d) in the map, but there is "
-	    "record in the table. Delete this record?", cat, field);
+	    _("There are no more features with category %d (layer %d) in the map, but there is record in the table. Delete this record?"), cat, field);
     ret = i_message(MSG_YESNO, MSGI_QUESTION, buf);
 
     if (ret == 1)
@@ -671,11 +673,11 @@
 
     sprintf(buf, "delete from %s where %s = %d", Fi->table, Fi->key, cat);
     db_set_string(&sql, buf);
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
     ret = db_execute_immediate(driver, &sql);
     if (ret != DB_OK) {
 	db_close_database_shutdown_driver(driver);
-	sprintf(buf, "Cannot delete record: %s", db_get_string(&sql));
+	sprintf(buf, _("Cannot delete record: %s"), db_get_string(&sql));
 	i_message(MSG_OK, MSGI_ERROR, buf);
 	return -1;
     }

Modified: grass/branches/releasebranch_6_4/vector/v.digit/c_face.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/c_face.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/c_face.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -8,6 +8,7 @@
 #include <grass/Vect.h>
 #include <grass/dbmi.h>
 #include <grass/raster.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "proto.h"
 
@@ -179,13 +180,13 @@
 
 	driver = db_start_driver(Fi->driver);
 	if (driver == NULL) {
-	    G_warning("Cannot open driver %s", Fi->driver);
+	    G_warning(_("Cannot open driver %s"), Fi->driver);
 	    return TCL_OK;
 	}
 	db_init_handle(&handle);
 	db_set_handle(&handle, Vect_subst_var(Fi->database, &Map), NULL);
 	if (db_open_database(driver, &handle) != DB_OK) {
-	    G_warning("Cannot open database %s", Fi->database);
+	    G_warning(_("Cannot open database %s"), Fi->database);
 	    db_shutdown_driver(driver);
 	    return TCL_OK;
 	}
@@ -222,6 +223,7 @@
     dbString sql, err;
     dbDriver *driver;
     dbHandle handle;
+    char buf[1000];
 
     G_debug(2, "c_create_table() field = %s key = %s cols = %s", argv[1],
 	    argv[3], argv[4]);
@@ -236,8 +238,8 @@
 
     driver = db_start_driver(Fi->driver);
     if (driver == NULL) {
-	G_warning("Cannot open driver %s", Fi->driver);
-	db_set_string(&err, "Cannot open driver ");
+	G_warning(_("Cannot open driver %s"), Fi->driver);
+	db_set_string(&err, _("Cannot open driver "));
 	db_append_string(&err, Fi->driver);
 	Tcl_SetVar(Toolbox, "create_table_msg", db_get_string(&err),
 		   TCL_GLOBAL_ONLY);
@@ -246,11 +248,9 @@
     db_init_handle(&handle);
     db_set_handle(&handle, Vect_subst_var(Fi->database, &Map), NULL);
     if (db_open_database(driver, &handle) != DB_OK) {
-	G_warning("Cannot open database %s", Fi->database);
-	db_set_string(&err, "Cannot open database ");
-	db_append_string(&err, Fi->database);
-	db_append_string(&err, " by driver ");
-	db_append_string(&err, Fi->driver);
+	G_warning(_("Cannot open database %s"), Fi->database);
+	sprintf(buf, _("Cannot open database %s by driver %s"), Fi->database, Fi->driver);
+	db_set_string(&err, buf);
 	db_append_string(&err, db_get_error_msg());
 	db_shutdown_driver(driver);
 	Tcl_SetVar(Toolbox, "create_table_msg", db_get_string(&err),
@@ -263,11 +263,11 @@
     db_append_string(&sql, " ( ");
     db_append_string(&sql, argv[4]);
     db_append_string(&sql, " ) ");
-    G_debug(2, db_get_string(&sql));
+    G_debug(2, "%s", db_get_string(&sql));
 
     if (db_execute_immediate(driver, &sql) != DB_OK) {
-	G_warning("Cannot create table: %s", db_get_string(&sql));
-	db_set_string(&err, "Cannot create table: ");
+	G_warning(_("Cannot create table: %s"), db_get_string(&sql));
+	db_set_string(&err, _("Cannot create table: "));
 	db_append_string(&err, db_get_string(&sql));
 	db_append_string(&err, "\n");
 	db_append_string(&err, db_get_error_msg());
@@ -279,8 +279,8 @@
     }
 
     if (db_create_index2(driver, Fi->table, argv[3]) != DB_OK) {
-	G_warning("Cannot create index");
-	db_set_string(&err, "Cannot create index:\n");
+	G_warning("%s", _("Cannot create index"));
+	db_set_string(&err, _("Cannot create index:\n"));
 	db_append_string(&err, db_get_error_msg());
 	db_close_database(driver);
 	db_shutdown_driver(driver);
@@ -291,8 +291,8 @@
 
     if (db_grant_on_table
 	(driver, Fi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK) {
-	G_warning("Cannot grant privileges on table %s", Fi->table);
-	db_set_string(&err, "Cannot grant privileges on table:\n");
+	G_warning(_("Cannot grant privileges on table %s"), Fi->table);
+	db_set_string(&err, _("Cannot grant privileges on table:\n"));
 	db_append_string(&err, db_get_error_msg());
 	db_close_database(driver);
 	db_shutdown_driver(driver);
@@ -309,8 +309,7 @@
 			    Fi->database, Fi->driver);
     if (ret == -1) {
 	db_set_string(&err,
-		      "Cannot add database link to vector, link for given field probably "
-		      "already exists.");
+		      _("Cannot add database link to vector, link for given field probably already exists."));
 	Tcl_SetVar(Toolbox, "create_table_msg", db_get_string(&err),
 		   TCL_GLOBAL_ONLY);
 	return TCL_OK;

Modified: grass/branches/releasebranch_6_4/vector/v.digit/centre.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/centre.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/centre.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -53,7 +53,7 @@
     driver_close();
 
     symb_init_gui();
-    i_prompt("Select tool");
+    i_prompt(_("Select tool"));
 }
 
 void next_tool(void)
@@ -175,7 +175,7 @@
     Vect_close(&Map);
 
     if (1 == G_put_window(&GRegion))
-	G_message(_("Region restored to original extent."));
+	G_message("%s", _("Region restored to original extent."));
 
     /* clear the screen */
     Tcl_Eval(Toolbox, ".screen.canvas delete all");

Modified: grass/branches/releasebranch_6_4/vector/v.digit/display.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/display.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/display.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -234,8 +234,11 @@
 
     for (i = 0; i < nbgcmd; i++) {
 	putenv((i > 0) ? "GRASS_PNG_READ=TRUE" : "GRASS_PNG_READ=FALSE");
-	if (Bgcmd[i].on)
-	    system(Bgcmd[i].cmd);
+	if (Bgcmd[i].on) {
+	    if (system(Bgcmd[i].cmd) == -1) {
+		G_warning("System call has failed");
+	    }
+	}
     }
 
     sprintf(cmd_buf, "image create photo bgimage -file {%s.ppm}", ppmfile);

Modified: grass/branches/releasebranch_6_4/vector/v.digit/form.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/form.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/form.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -14,6 +14,7 @@
 #include <grass/dbmi.h>
 #include <grass/form.h>
 #include <grass/Vect.h>
+#include <grass/glocale.h>
 #include "proto.h"
 
 /* Structure to store column names and values */
@@ -93,7 +94,7 @@
 
     /* Check if all internal values are set */
     if (Drvname == NULL || Dbname == NULL || Tblname == NULL || Key == NULL) {
-	G_warning("db connection was not set by form\n");
+	G_warning("%s", _("db connection was not set by form\n"));
 	sprintf(buf, "set submit_msg \"db connection was not set by form.\"");
 	Tcl_Eval(interp, buf);
 	Tcl_Eval(interp, "set submit_result 0");
@@ -104,7 +105,7 @@
     G_debug(2, "Open driver");
     driver = db_start_driver(Drvname);
     if (driver == NULL) {
-	G_warning("Cannot open driver\n");
+	G_warning("%s", _("Cannot open driver\n"));
 	sprintf(buf, "set submit_msg \"Cannot open driver '%s'\"", Drvname);
 	Tcl_Eval(interp, buf);
 	Tcl_Eval(interp, "set submit_result 0");
@@ -116,7 +117,7 @@
     db_set_handle(&handle, Dbname, NULL);
     G_debug(2, "Open database");
     if (db_open_database(driver, &handle) != DB_OK) {
-	G_warning("Cannot open database\n");
+	G_warning("%s", _("Cannot open database\n"));
 	db_shutdown_driver(driver);
 	sprintf(buf,
 		"set submit_msg \"Cannot open database '%s' by driver '%s'\"",
@@ -129,7 +130,7 @@
 
     db_set_string(&table_name, Tblname);
     if (db_describe_table(driver, &table_name, &table) != DB_OK) {
-	G_warning("Cannot describe table\n");
+	G_warning("%s", _("Cannot describe table\n"));
 	db_shutdown_driver(driver);
 	db_close_database(driver);
 	sprintf(buf, "set submit_msg \"Cannot describe table '%s'\"",
@@ -158,7 +159,7 @@
 	    }
 	}
 	if (!found && (G_strcasecmp(Columns[i].name, F_ENCODING) != 0)) {
-	    G_warning("Cannot find column type");
+	    G_warning("%s", _("Cannot find column type"));
 	    db_close_database(driver);
 	    db_shutdown_driver(driver);
 	    sprintf(buf, "set submit_msg \"Cannot find column type\"");
@@ -195,7 +196,7 @@
 		if (Tcl_SetSystemEncoding(interp, Columns[i].value) ==
 		    TCL_ERROR) {
 		    G_warning
-			("Could not set Tcl system encoding to '%s' (%s)",
+			(_("Could not set Tcl system encoding to '%s' (%s)"),
 			 Columns[i].value, Tcl_GetStringResult(interp));
 		}
 	    }
@@ -224,7 +225,7 @@
 					buf, 2000, NULL, NULL, NULL);
 
 		if (ret != TCL_OK) {
-		    G_warning("Could not convert UTF to external.");
+		    G_warning("%s", _("Could not convert UTF to external."));
 		    db_set_string(&strval, Columns[i].value);
 		}
 		else {
@@ -252,7 +253,7 @@
     db_shutdown_driver(driver);
 
     if (ret != DB_OK) {
-	G_warning("Cannot update table");
+	G_warning("%s", _("Cannot update table"));
 	Tcl_VarEval(interp, "set submit_msg \"Cannot update table:\n",
 		    db_get_error_msg(), "\"", NULL);
 	Tcl_Eval(interp, "set submit_result 0");

Modified: grass/branches/releasebranch_6_4/vector/v.digit/generate.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/generate.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/generate.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -3,6 +3,7 @@
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 #include <grass/form.h>
+#include <grass/glocale.h>
 
 /* Escape string for use in TCL */
 char *escape_tcl_string(char *input)
@@ -73,8 +74,8 @@
     G_debug(2, "Open driver");
     driver = db_start_driver(drvname);
     if (driver == NULL) {
-	G_warning("Cannot open driver");
-	sprintf(buf, "Cannot open driver '%s'<BR>",
+	G_warning("%s", _("Cannot open driver"));
+	sprintf(buf, _("Cannot open driver '%s'<BR>"),
 		escape_tcl_string(drvname));
 	*form = G_store(buf);
 	return -1;
@@ -85,9 +86,9 @@
     db_set_handle(&handle, dbname, NULL);
     G_debug(2, "Open database");
     if (db_open_database(driver, &handle) != DB_OK) {
-	G_warning("Cannot open database");
+	G_warning("%s", _("Cannot open database"));
 	db_shutdown_driver(driver);
-	sprintf(buf, "Cannot open database '%s' by driver '%s'<BR>",
+	sprintf(buf, _("Cannot open database '%s' by driver '%s'<BR>"),
 		escape_tcl_string(dbname), escape_tcl_string(drvname));
 	*form = G_store(buf);
 	return -1;
@@ -102,11 +103,11 @@
     G_debug(2, "%s", buf);
     db_set_string(&sql, buf);
     if (db_open_select_cursor(driver, &sql, &cursor, DB_SEQUENTIAL) != DB_OK) {
-	G_warning("Cannot open select cursor");
+	G_warning("%s", _("Cannot open select cursor"));
 	db_close_database(driver);
 	db_shutdown_driver(driver);
 	sprintf(buf,
-		"Cannot open select cursor:<BR>'%s'<BR>on database '%s' by driver '%s'<BR>",
+		_("Cannot open select cursor:<BR>'%s'<BR>on database '%s' by driver '%s'<BR>"),
 		escape_tcl_string(db_get_string(&sql)),
 		escape_tcl_string(dbname), escape_tcl_string(drvname));
 	*form = G_store(buf);
@@ -117,7 +118,7 @@
     table = db_get_cursor_table(&cursor);
 
     if (db_fetch(&cursor, DB_NEXT, &more) != DB_OK) {
-	G_warning("Cannot fetch next record");
+	G_warning("%s", _("Cannot fetch next record"));
 	db_close_cursor(&cursor);
 	db_close_database(driver);
 	db_shutdown_driver(driver);
@@ -126,7 +127,7 @@
     }
 
     if (!more) {
-	G_warning("No database record");
+	G_warning("%s", _("No database record"));
 	if (format == F_HTML) {
 	    *form = G_store("No record selected.<BR>");
 	}
@@ -219,7 +220,7 @@
 
 	    if (edit_mode == F_EDIT) {
 		sprintf(buf,
-			"<HR>   Assume data encoding as:<BR><BR><SELECT NAME=%s SIZE=4><HR><BR>",
+			_("<HR>   Assume data encoding as:<BR><BR><SELECT NAME=%s SIZE=4><HR><BR>"),
 			F_ENCODING);
 		db_append_string(&html, buf);
 

Modified: grass/branches/releasebranch_6_4/vector/v.digit/line.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/line.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/line.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -8,6 +8,7 @@
 #include <grass/display.h>
 #include <grass/colors.h>
 #include <grass/form.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "proto.h"
 
@@ -50,7 +51,9 @@
     if (var_geti(VAR_CAT_MODE) != CAT_MODE_NO && var_geti(VAR_INSERT) &&
 	cat > 0) {
 	G_debug(2, "Insert new record");
-	db_set_string(&html, "<HTML><HEAD><TITLE>Form</TITLE><BODY>");
+	db_set_string(&html, "<HTML><HEAD><TITLE>");
+	db_append_string(&html, _("Form"));
+	db_append_string(&html, "</TITLE><BODY>");
 
 	field = var_geti(VAR_FIELD);
 	ret = new_record(field, cat);
@@ -58,11 +61,11 @@
 	    return -1;
 	}
 	else if (ret == 0) {
-	    db_append_string(&html, "New record was created.<BR>");
+	    db_append_string(&html, _("New record was created.<BR>"));
 	}
 	else {			/* record already existed */
 	    db_append_string(&html,
-			     "Record for this category already existed.<BR>");
+			     _("Record for this category already existed.<BR>"));
 	}
 
 	/* Open form */
@@ -80,7 +83,7 @@
 	if (first_form)
 	    driver_close();
 	F_clear();
-	F_open("Attributes", db_get_string(&html));
+	F_open(_("Attributes"), db_get_string(&html));
 	if (first_form) {
 	    driver_open();
 	    first_form = 0;
@@ -132,9 +135,9 @@
     nl->Points = Vect_new_line_struct();
     nl->Cats = Vect_new_cats_struct();
 
-    sprintf(buf, "Digitize new %s:", get_line_type_name(nl->type));
+    sprintf(buf, _("Digitize new %s:"), get_line_type_name(nl->type));
     i_prompt(buf);
-    i_prompt_buttons("New point", "", "Quit tool");
+    i_prompt_buttons(_("New point"), "", _("Quit tool"));
 
     i_new_line_options(1);
 
@@ -159,8 +162,8 @@
 	return 1;
     }
     
-    if (button > 3) /* Do nothing on mouse scroll */
-	return 0;
+    if (button > 3) /* Do nothing on mouse scroll */ 
+        return 0; 
 
     if (nl->type & GV_POINTS && (button == 1 ||  button == 2)) {
 	snap(&x, &y);
@@ -185,7 +188,7 @@
 		}
 	    }
 	    if (Vect_append_point(nl->Points, x, y, 0) == -1) {
-		G_warning("Out of memory! Point not added.");
+		G_warning("%s", _("Out of memory! Point not added."));
 		return 0;
 	    }
 
@@ -218,7 +221,7 @@
 		    );
 	    }
 	    if (nl->Points->n_points == 0) {
-		i_prompt_buttons("New point", "", "Quit tool");
+		i_prompt_buttons(_("New point"), "", _("Quit tool"));
 		nl->first = 1;
 		set_mode(MOUSE_POINT);
 	    }
@@ -240,14 +243,14 @@
 		updated_lines_and_nodes_erase_refresh_display();
 	    }
 	    else
-		G_warning("Less than 2 points for line -> nothing written");
+		G_warning("%s", _("Less than 2 points for line -> nothing written"));
 
 	    return 1;
 	}
 	G_debug(2, "n_points = %d", nl->Points->n_points);
     }
 
-    i_prompt_buttons("New point", "Undo last point", "Close line");
+    i_prompt_buttons(_("New point"), _("Undo last point"), _("Close line"));
     return 0;
 }
 
@@ -331,7 +334,7 @@
 
     display_node(node1, SYMB_BACKGROUND, 1);
     display_node(node2, SYMB_BACKGROUND, 1);
-    i_prompt_buttons("New Point", "Undo Last Point", "Close line");
+    i_prompt_buttons(_("New Point"), _("Undo Last Point"), _("Close line"));
 
     set_location(D_u_to_d_col(el->Points->x[el->Points->n_points - 1]),
 		 D_u_to_d_row(el->Points->y[el->Points->n_points - 1])
@@ -380,7 +383,7 @@
 
 	    display_points(el->Points, 1);
 	    set_location(sxn, syn);
-	    i_prompt_buttons("New Point", "Undo Last Point", "Close line");
+	    i_prompt_buttons(_("New Point"), _("Undo Last Point"), _("Close line"));
 	}
 	else if (button == 2) {	/* Undo last point */
 	    if (el->Points->n_points > 1) {
@@ -401,7 +404,7 @@
 					  y[el->Points->n_points - 1])
 		    );
 		if (el->Points->n_points == 1)
-		    i_prompt_buttons("New Point", "", "Delete line and exit");
+		    i_prompt_buttons(_("New Point"), "", _("Delete line and exit"));
 	    }
 	}
 	break;
@@ -474,8 +477,8 @@
     dl->Points = Vect_new_line_struct();
     dl->Cats = Vect_new_cats_struct();
 
-    i_prompt("Delete point, line, boundary, or centroid:");
-    i_prompt_buttons("Select", "Unselect", "Quit tool");
+    i_prompt(_("Delete point, line, boundary, or centroid:"));
+    i_prompt_buttons(_("Select"), _("Unselect"), _("Quit tool"));
 
     dl->thresh = get_thresh();
     G_debug(2, "thresh = %f", dl->thresh);
@@ -558,9 +561,9 @@
     }
 
     if (dl->line > 0)
-	i_prompt_buttons("Confirm and select next", "Unselect", "Quit tool");
+	i_prompt_buttons(_("Confirm and select next"), _("Unselect"), _("Quit tool"));
     else
-	i_prompt_buttons("Select", "Unselect", "Quit tool");
+	i_prompt_buttons(_("Select"), _("Unselect"), _("Quit tool"));
 
     dl->last_line = dl->line;
     dl->first = 0;
@@ -613,8 +616,8 @@
     ml->Points = Vect_new_line_struct();
     ml->Cats = Vect_new_cats_struct();
 
-    i_prompt("Move point, line, boundary, or centroid:");
-    i_prompt_buttons("Select", "", "Quit tool");
+    i_prompt(_("Move point, line, boundary, or centroid:"));
+    i_prompt_buttons(_("Select"), "", _("Quit tool"));
 
     ml->thresh = get_thresh();
     G_debug(2, "thresh = %f", ml->thresh);
@@ -665,7 +668,7 @@
 				   NULL, NULL, NULL, NULL);
 		set_location(D_u_to_d_col(ml->xo), D_u_to_d_row(ml->yo));
 
-		i_prompt_buttons("New location", "Unselect", "Quit tool");
+		i_prompt_buttons(_("New location"), _("Unselect"), _("Quit tool"));
 	    }
 	    ml->last_line = ml->line;
 	}
@@ -699,7 +702,7 @@
     }
 
     if (ml->last_line == 0) {
-	i_prompt_buttons("Select", "", "Quit tool");
+	i_prompt_buttons(_("Select"), "", _("Quit tool"));
 	set_mode(MOUSE_POINT);
     }
     else

Modified: grass/branches/releasebranch_6_4/vector/v.digit/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/main.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/main.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -147,7 +147,7 @@
     mapset = G_find_vector2(map_opt->answer, G_mapset());
     if (mapset == NULL) {
 	if (new_f->answer) {
-	    G_message(_("New empty map created."));
+	    G_message("%s", _("New empty map created."));
 	    Vect_open_new(&Map, map_opt->answer, 0);
 	    Vect_build(&Map);
 	    Vect_close(&Map);

Modified: grass/branches/releasebranch_6_4/vector/v.digit/var.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/var.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/var.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -21,6 +21,7 @@
 #include <grass/colors.h>
 #include <grass/raster.h>
 #include <grass/display.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "proto.h"
 
@@ -76,7 +77,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot set variable code = %d", code);
+    G_warning(_("Cannot set variable code = %d"), code);
     return -1;
 }
 
@@ -97,7 +98,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot set variable code = %d", code);
+    G_warning(_("Cannot set variable code = %d"), code);
     return -1;
 }
 
@@ -118,7 +119,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot set variable code = %d", code);
+    G_warning(_("Cannot set variable code = %d"), code);
     return -1;
 }
 
@@ -139,7 +140,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot get type of variable %s", name);
+    G_warning(_("Cannot get type of variable %s"), name);
     return -1;
 }
 
@@ -160,7 +161,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot get code of variable %s", name);
+    G_warning(_("Cannot get code of variable %s"), name);
     return -1;
 }
 
@@ -180,7 +181,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot get name of variable %d", code);
+    G_warning(_("Cannot get name of variable %d"), code);
     return NULL;
 }
 
@@ -195,7 +196,7 @@
 	}
 	i++;
     }
-    G_warning("Cannot get value of variable code = %d", code);
+    G_warning(_("Cannot get value of variable code = %d"), code);
     return 0;
 }
 
@@ -211,7 +212,7 @@
 	i++;
     }
 
-    G_warning("Cannot get value of variable code = %d", code);
+    G_warning(_("Cannot get value of variable code = %d"), code);
     return 0;
 }
 
@@ -227,6 +228,6 @@
 	i++;
     }
 
-    G_warning("Cannot get value of variable code = %d", code);
+    G_warning(_("Cannot get value of variable code = %d"), code);
     return NULL;
 }

Modified: grass/branches/releasebranch_6_4/vector/v.digit/vertex.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/vertex.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/vertex.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -8,6 +8,7 @@
 #include <grass/display.h>
 #include <grass/colors.h>
 #include <grass/form.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "proto.h"
 
@@ -31,8 +32,8 @@
     sl->NPoints = Vect_new_line_struct();
     sl->Cats = Vect_new_cats_struct();
 
-    i_prompt("Split line:");
-    i_prompt_buttons("Select", "", "Quit tool");
+    i_prompt(_("Split line:"));
+    i_prompt_buttons(_("Select"), "", _("Quit tool"));
 
     sl->thresh = get_thresh();
     G_debug(2, "thresh = %f", sl->thresh);
@@ -52,7 +53,7 @@
     double y = D_d_to_u_row(syn);
 
     if (sl->last_line == 0) {
-	i_prompt_buttons("Select", "", "Quit tool");
+	i_prompt_buttons(_("Select"), "", _("Quit tool"));
     }
 
     if (sl->last_line > 0) {
@@ -126,8 +127,8 @@
 	    symb_set_driver_color(SYMB_HIGHLIGHT);
 	    display_icon(sl->xo, sl->yo, G_ICON_CROSS, 0, 10, 1);
 
-	    i_prompt_buttons("Confirm and select next", "Unselect",
-			     "Quit tool");
+	    i_prompt_buttons(_("Confirm and select next"), _("Unselect"),
+			     _("Quit tool"));
 	    sl->last_line = line;
 	    sl->last_seg = seg;
 	}
@@ -148,7 +149,7 @@
     struct split_line *sl = closure;
 
     if (sl->last_line == 0) {
-	i_prompt_buttons("Select", "", "Quit tool");
+	i_prompt_buttons(_("Select"), "", _("Quit tool"));
     }
 
     if (sl->last_line > 0) {
@@ -195,8 +196,8 @@
     rv->Points = Vect_new_line_struct();
     rv->Cats = Vect_new_cats_struct();
 
-    i_prompt("Remove vertex:");
-    i_prompt_buttons("Select vertex", "", "Quit tool");
+    i_prompt(_("Remove vertex:"));
+    i_prompt_buttons(_("Select vertex"), "", _("Quit tool"));
 
     rv->thresh = get_thresh();
     G_debug(2, "thresh = %f", rv->thresh);
@@ -216,7 +217,7 @@
     double y = D_d_to_u_row(syn);
 
     if (rv->last_line == 0) {
-	i_prompt_buttons("Select vertex", "", "Quit tool");
+	i_prompt_buttons(_("Select vertex"), "", _("Quit tool"));
     }
 
     if (rv->last_line > 0) {
@@ -299,8 +300,8 @@
 	    symb_set_driver_color(SYMB_HIGHLIGHT);
 	    display_icon(rv->xo, rv->yo, G_ICON_BOX, 0, 10, 1);
 
-	    i_prompt_buttons("Confirm and select next", "Unselect",
-			     "Quit tool");
+	    i_prompt_buttons(_("Confirm and select next"), _("Unselect"),
+			     _("Quit tool"));
 	    rv->last_line = line;
 	    rv->last_seg = seg;
 	}
@@ -321,7 +322,7 @@
     struct rm_vertex *rv = closure;
 
     if (rv->last_line == 0) {
-	i_prompt_buttons("Select vertex", "", "Quit tool");
+	i_prompt_buttons(_("Select vertex"), "", _("Quit tool"));
     }
 
     if (rv->last_line > 0) {
@@ -368,8 +369,8 @@
     av->Points = Vect_new_line_struct();
     av->Cats = Vect_new_cats_struct();
 
-    i_prompt("Add vertex:");
-    i_prompt_buttons("Select", "", "Quit tool");
+    i_prompt(_("Add vertex:"));
+    i_prompt_buttons(_("Select"), "", _("Quit tool"));
 
     av->thresh = get_thresh();
     G_debug(2, "thresh = %f", av->thresh);
@@ -467,7 +468,7 @@
 
 		set_location(D_u_to_d_col(xo), D_u_to_d_row(yo));
 
-		i_prompt_buttons("New vertex", "Unselect", "Quit tool");
+		i_prompt_buttons(_("New vertex"), _("Unselect"), _("Quit tool"));
 		av->last_line = line;
 		av->last_seg = seg;
 	    }
@@ -512,7 +513,7 @@
     }
 
     if (av->last_line == 0) {
-	i_prompt_buttons("Select", "", "Quit tool");
+	i_prompt_buttons(_("Select"), "", _("Quit tool"));
 	set_mode(MOUSE_POINT);
     }
     else
@@ -565,8 +566,8 @@
     mv->Points = Vect_new_line_struct();
     mv->Cats = Vect_new_cats_struct();
 
-    i_prompt("Move vertex:");
-    i_prompt_buttons("Select", "", "Quit tool");
+    i_prompt(_("Move vertex:"));
+    i_prompt_buttons(_("Select"), "", _("Quit tool"));
 
     mv->thresh = get_thresh();
     G_debug(2, "thresh = %f", mv->thresh);
@@ -629,7 +630,7 @@
 		set_location(D_u_to_d_col(mv->xo), D_u_to_d_row(mv->yo));
 
 
-		i_prompt_buttons("New location", "Unselect", "Quit tool");
+		i_prompt_buttons(_("New location"), _("Unselect"), _("Quit tool"));
 		mv->last_line = line;
 		mv->last_seg = seg;
 	    }
@@ -665,7 +666,7 @@
 
 
     if (mv->last_line == 0) {
-	i_prompt_buttons("Select", "", "Quit tool");
+	i_prompt_buttons(_("Select"), "", _("Quit tool"));
 	set_mode(MOUSE_POINT);
     }
     else

Modified: grass/branches/releasebranch_6_4/vector/v.digit/zoom.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/zoom.c	2011-06-09 00:19:56 UTC (rev 46623)
+++ grass/branches/releasebranch_6_4/vector/v.digit/zoom.c	2011-06-09 00:26:23 UTC (rev 46624)
@@ -5,6 +5,7 @@
 #include <grass/raster.h>
 #include <grass/display.h>
 #include <grass/colors.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "proto.h"
 
@@ -22,8 +23,8 @@
 
     G_debug(2, "zoom_window()");
 
-    i_prompt("Zoom by window");
-    i_prompt_buttons("1. corner", "1. corner", "Quit");
+    i_prompt(_("Zoom by window"));
+    i_prompt_buttons(_("1. corner"), _("1. corner"), _("Quit"));
 
     zw->mode = 1;
     zw->next_mode = 1;
@@ -40,7 +41,7 @@
     struct zoom_window *zw = closure;
 
     if (zw->mode == 1) {
-	i_prompt_buttons("1. corner", "2. corner", "Quit");
+	i_prompt_buttons(_("1. corner"), _("2. corner"), _("Quit"));
 	zw->next_mode = 2;
     }
 
@@ -71,7 +72,7 @@
 
 	display_redraw();
 
-	i_prompt_buttons("1. corner", "1. corner", "Quit");
+	i_prompt_buttons(_("1. corner"), _("1. corner"), _("Quit"));
 	zw->next_mode = 1;
     }
 
@@ -153,8 +154,8 @@
 {
     G_debug(2, "zoom_pan()");
 
-    i_prompt("Pan");
-    i_prompt_buttons("New center", "", "Quit");
+    i_prompt(_("Pan"));
+    i_prompt_buttons(_("New center"), "", _("Quit"));
 
     set_mode(MOUSE_POINT);
 
@@ -243,7 +244,7 @@
 
     mapset = G_find_file2("windows", var_getc(VAR_ZOOM_REGION), NULL);
     if (mapset == NULL) {
-	G_warning("Cannot find window '%s'", var_getc(VAR_ZOOM_REGION));
+	G_warning(_("Cannot find window '%s'"), var_getc(VAR_ZOOM_REGION));
 	return 0;
     }
     G__get_window(&win, "windows", var_getc(VAR_ZOOM_REGION), mapset);



More information about the grass-commit mailing list