[GRASS-SVN] r29468 - grass/trunk/general/g.setproj
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 18 06:21:32 EST 2007
Author: martinl
Date: 2007-12-18 06:21:31 -0500 (Tue, 18 Dec 2007)
New Revision: 29468
Modified:
grass/trunk/general/g.setproj/get_stp.c
grass/trunk/general/g.setproj/main.c
grass/trunk/general/g.setproj/proj.c
Log:
Fixing bug (Trac #1): latitude_of_center and longitude_of_center ignored.
Message standardization, i18n.
Modified: grass/trunk/general/g.setproj/get_stp.c
===================================================================
--- grass/trunk/general/g.setproj/get_stp.c 2007-12-18 08:22:12 UTC (rev 29467)
+++ grass/trunk/general/g.setproj/get_stp.c 2007-12-18 11:21:31 UTC (rev 29468)
@@ -2,6 +2,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <grass/gis.h>
+#include <grass/glocale.h>
#include "local_proto.h"
void get_stp_proj(char string[])
@@ -35,7 +36,7 @@
fprintf(stderr, "\nInvalid Co-ordinate System Specification\n");
}
if (get_stp_code(code, string, buff) == 0)
- G_fatal_error("This should not happen see your system admin");
+ G_fatal_error(_("This should not happen see your system admin"));
return;
}
@@ -91,7 +92,7 @@
fipsfile = fopen(FIPSfile, "r");
if (fipsfile == NULL) {
- G_fatal_error("Can not open FIPS code file");
+ G_fatal_error(_("Unable to open FIPS code file"));
}
ask_fips(fipsfile, &SFIPS, &CFIPS, &special_case);
if (special_case == -1) {
@@ -116,8 +117,8 @@
if (icode != 0)
break;
else { /* no match */
- fprintf(stderr, "\nNo match of fips state %d county %d \n", SFIPS, CFIPS);
- fclose(fipsfile);
+ G_warning(_("No match of fips state %d county %d"), SFIPS, CFIPS);
+ fclose(fipsfile);
}
}
@@ -152,11 +153,12 @@
*c = 0;
Tmp_file1 = G_tempfile();
if (NULL == (Tmp_fd1 = fopen(Tmp_file1, "w")))
- G_fatal_error("Cannot open temp file");
+ G_fatal_error(_("Unable to open temporary file <%s>"),
+ Tmp_file1);
Tmp_file2 = G_tempfile();
if (NULL == (Tmp_fd2 = fopen(Tmp_file2, "w")))
- G_fatal_error("Cannot open temp file");
-
+ G_fatal_error(_("Unable to open temporary file <%s>"),
+ Tmp_file2);
while (fgets(buff, 80, fp) != NULL) {
sscanf(buff, "%d%d%s%s%d", &sfips, &cfips, STabbr, COname, &NUM_ZON);
if (strncmp(STabbr, STabbr_prev, 2) != 0) { /* TODO CHECK THIS */
@@ -170,7 +172,7 @@
sf_keys = G_read_key_value_file(Tmp_file2, &in_stat);
if (in_stat != 0)
- G_fatal_error("reading sf key_value temp file");
+ G_fatal_error(_("Reading sf key_value temp file"));
for (;;) {
@@ -200,7 +202,7 @@
a = G_find_key_value(answer, sf_keys);
sprintf(buff, "You have chosen state %s, Correct", a);
if (a == NULL)
- fprintf(stderr, "\nInvalid State FIPS code\n");
+ G_warning(_("Invalid State FIPS code"));
else if (G_yes(buff, 1))
break;
}
@@ -267,13 +269,13 @@
Tmp_file1 = G_tempfile();
if (NULL == (Tmp_fd1 = fopen(Tmp_file1, "w"))) {
- sprintf(buff, "Cannot open %s", Tmp_file1);
- G_fatal_error(buff);
+ G_fatal_error(_("Unable to open temporary file <%s>"),
+ Tmp_file1);
}
Tmp_file2 = G_tempfile();
if (NULL == (Tmp_fd2 = fopen(Tmp_file2, "w"))) {
- sprintf(buff, "Cannot open %s", Tmp_file2);
- G_fatal_error(buff);
+ G_fatal_error(_("Unable to open temporary file <%s>"),
+ Tmp_file2);
}
while (fgets(buff, 80, fp) != NULL) {
sscanf(buff, "%d%d%s%[A-Z ]%d", &sfips, &cfips, STabbr, COname, &NUM_ZON);
@@ -288,7 +290,7 @@
cf_keys = G_read_key_value_file(Tmp_file2, &in_stat);
if (in_stat != 0)
- G_fatal_error("reading cf key_value temp file");
+ G_fatal_error(_("Reading cf key_value temp file"));
for (;;) {
do {
@@ -317,7 +319,7 @@
b = G_find_key_value(answer, cf_keys);
sprintf(buff, "You have chosen %s county, correct", b);
if (b == NULL)
- fprintf(stderr, "\nInvalid County FIPS code\n");
+ G_warning(_("Invalid County FIPS code"));
else if (G_yes(buff, 1))
break;
}
Modified: grass/trunk/general/g.setproj/main.c
===================================================================
--- grass/trunk/general/g.setproj/main.c 2007-12-18 08:22:12 UTC (rev 29467)
+++ grass/trunk/general/g.setproj/main.c 2007-12-18 11:21:31 UTC (rev 29468)
@@ -75,7 +75,7 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("general");
+ module->keywords = _("general, projection");
module->description =
_("Interactively reset the location's projection settings.");
@@ -98,11 +98,11 @@
/* Check for ownership here */
stat = G__mapset_permissions(set_name);
if (stat == 0) {
- G_fatal_error(_("PERMANENT: permission denied."));
+ G_fatal_error(_("PERMANENT: permission denied"));
}
G_get_default_window(&cellhd);
if (-1 == G_set_window(&cellhd))
- G_fatal_error(_("Current region cannot be set."));
+ G_fatal_error(_("Current region cannot be set"));
if (G_get_set_window(&cellhd) == -1)
G_fatal_error(_("Retrieving and setting region failed"));
@@ -118,7 +118,7 @@
fclose(FPROJ);
buf = G_find_key_value("name", old_proj_keys);
fprintf(stderr,
- "\nWARNING! A projection file already exists for this location\n(Filename '%s')\n",
+ "\nWARNING: A projection file already exists for this location\n(Filename '%s')\n",
path);
fprintf(stderr,
"\nThis file contains all the parameters for the\nlocation's projection: %s\n", buf);
@@ -130,7 +130,7 @@
" GRASS will not re-project your data automatically\n");
if (!G_yes(_("Would you still like to change some of the parameters?"), 0)) {
- G_message(_("The projection information will not be updated."));
+ G_message(_("The projection information will not be updated"));
leave(SP_NOCHANGE);
}
}
@@ -142,8 +142,8 @@
sscanf(buf, "%d", &zone);
if (zone != old_zone) {
G_warning(_("Zone in default geographic region definition: %d\n"
- " is different from zone in PROJ_INFO file: %d\n"),
- old_zone, zone);
+ " is different from zone in PROJ_INFO file: %d"),
+ old_zone, zone);
old_zone = zone;
}
}
@@ -151,7 +151,7 @@
case 0: /* No projection/units */
if (!exist) {
/* leap frog over code, and just make sure we remove the file */
- fprintf(stderr, "XY-location cannot be projected.\n");
+ G_warning (_("XY-location cannot be projected"));
goto write_file;
break;
}
@@ -204,7 +204,7 @@
2)) {
G_strip(lbuf);
if ((i = G_get_datum_by_name(lbuf)) > 0) {
- G_message(_("The current datum is %s (%s)."),
+ G_message(_("The current datum is %s (%s)"),
G_datum_name(i), G_datum_description(i));
if (G_yes(
_("Do you wish to change the datum (or datum transformation parameters)?"), 0))
@@ -214,7 +214,7 @@
sprintf(dat_params, lbufa);
sprintf(dat_ellps, G_datum_ellipsoid(i));
sph_check = 1;
- G_message(_("The datum information has not been changed."));
+ G_message(_("The datum information has not been changed"));
}
}
else
@@ -279,7 +279,7 @@
if (G_yes(_("Do you want to change ellipsoid parameter?"), 0))
sph_check = G_ask_ellipse_name(spheroid);
else {
- G_message(_("The ellipse information has not been changed."));
+ G_message(_("The ellipse information has not been changed"));
sph_check = 1;
}
} /* the val is legal */
@@ -427,15 +427,15 @@
if ((Out_proj == PROJECTION_UTM) && (old_zone != 0)) {
G_message(_("The UTM zone is now set to %d"), old_zone);
if (!G_yes(_("Do you want to change the UTM zone?"), 0)) {
- G_message(_("UTM zone information has not been updated."));
+ G_message(_("UTM zone information has not been updated"));
zone = old_zone;
break;
}
else {
G_message(_("But if you change zone, all the existing "
- "data will be interpreted by projection software. "
- "GRASS will not automatically re-project or even "
- "change the headers for existing maps."));
+ "data will be interpreted by projection software. "
+ "GRASS will not automatically re-project or even "
+ "change the headers for existing maps."));
if (!G_yes(_("Would you still like to change the UTM zone?"),
0)) {
zone = old_zone;
@@ -454,7 +454,9 @@
else if (parm->def_exists) {
/* don't ask, use the default */
- if (G_strcasecmp(desc->type, "float") == 0) {
+ if (G_strcasecmp(desc->type, "float") == 0 ||
+ G_strcasecmp(desc->type, "lat") == 0 ||
+ G_strcasecmp(desc->type, "lon") == 0) {
sprintf(tmp_buff, "%.10f", parm->deflt);
G_set_key_value(desc->key, tmp_buff, out_proj_keys);
}
@@ -470,8 +472,7 @@
G_write_key_value_file(path, out_proj_keys, &out_stat);
if (out_stat != 0) {
- sprintf(buffb, "Error writing PROJ_INFO file: %s\n", path);
- G_fatal_error(buffb);
+ G_fatal_error(_("Error writing PROJ_INFO file <%s>"), path);
}
G_free_key_value(out_proj_keys);
@@ -608,18 +609,18 @@
G_write_key_value_file(path, in_unit_keys, &out_stat);
if (out_stat != 0)
- G_fatal_error(_("Error writing into UNITS output file: %s"), path);
+ G_fatal_error(_("Error writing into UNITS output file <%s>"), path);
G_free_key_value(in_unit_keys);
} /* if */
if (G__put_window(&cellhd, "", "DEFAULT_WIND") < 0)
- G_fatal_error(_("Could not write to DEFAULT_WIND region file"));
+ G_fatal_error(_("Unable to write to DEFAULT_WIND region file"));
fprintf(stderr,
_("\nProjection information has been recorded for this location\n\n"));
if ((old_zone != zone) | (old_proj != cellhd.proj)) {
- G_message(_("The geographic region information in WIND is now obsolete."));
- G_message(_("Run g.region -d to update it."));
+ G_message(_("The geographic region information in WIND is now obsolete"));
+ G_message(_("Run g.region -d to update it"));
}
leave(0);
}
Modified: grass/trunk/general/g.setproj/proj.c
===================================================================
--- grass/trunk/general/g.setproj/proj.c 2007-12-18 08:22:12 UTC (rev 29467)
+++ grass/trunk/general/g.setproj/proj.c 2007-12-18 11:21:31 UTC (rev 29468)
@@ -3,6 +3,7 @@
#include <string.h>
#include <grass/gis.h>
+#include <grass/glocale.h>
#include "local_proto.h"
@@ -172,7 +173,7 @@
else
{
parm->ask = 1;
- G_warning("Unrecognized 'ask' value in proj-parms.table: %s", ask);
+ G_warning(_("Unrecognized 'ask' value in proj-parms.table: %s"), ask);
}
if (strcmp(dfl, "nodfl") == 0)
@@ -182,7 +183,7 @@
else
{
parm->def_exists = 0;
- G_warning("Unrecognized default value in proj-parms.table: %s", dfl);
+ G_warning(_("Unrecognized default value in proj-parms.table: %s"), dfl);
}
}
More information about the grass-commit
mailing list