Ver código fonte

scripts: use _() macro around messages

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38602 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 anos atrás
pai
commit
c163f38d20
57 arquivos alterados com 366 adições e 366 exclusões
  1. 1 1
      scripts/d.correlate/d.correlate.py
  2. 9 9
      scripts/d.polar/d.polar.py
  3. 2 2
      scripts/d.rast.leg/d.rast.leg.py
  4. 6 6
      scripts/db.dropcolumn/db.dropcolumn.py
  5. 6 6
      scripts/db.droptable/db.droptable.py
  6. 5 5
      scripts/db.in.ogr/db.in.ogr.py
  7. 2 2
      scripts/db.out.ogr/db.out.ogr.py
  8. 2 2
      scripts/db.test/db.test.py
  9. 18 18
      scripts/g.extension/g.extension.py
  10. 5 5
      scripts/g.manual/g.manual.py
  11. 7 7
      scripts/i.fusion.brovey/i.fusion.brovey.py
  12. 3 3
      scripts/i.image.mosaic/i.image.mosaic.py
  13. 15 15
      scripts/i.in.spotvgt/i.in.spotvgt.py
  14. 2 2
      scripts/i.landsat.rgb/i.landsat.rgb.py
  15. 3 3
      scripts/i.spectral/i.spectral.py
  16. 5 5
      scripts/i.tasscap/i.tasscap.py
  17. 13 13
      scripts/m.proj/m.proj.py
  18. 4 4
      scripts/r.blend/r.blend.py
  19. 1 1
      scripts/r.buffer/r.buffer.py
  20. 17 17
      scripts/r.fillnulls/r.fillnulls.py
  21. 1 1
      scripts/r.grow/r.grow.py
  22. 7 7
      scripts/r.in.aster/r.in.aster.py
  23. 11 11
      scripts/r.in.srtm/r.in.srtm.py
  24. 28 28
      scripts/r.in.wms/gdalwarp.py
  25. 10 10
      scripts/r.in.wms/r.in.wms.py
  26. 7 7
      scripts/r.in.wms/wms_download.py
  27. 5 5
      scripts/r.in.wms/wms_request.py
  28. 7 7
      scripts/r.mask/r.mask.py
  29. 3 3
      scripts/r.plane/r.plane.py
  30. 10 10
      scripts/r.reclass.area/r.reclass.area.py
  31. 2 2
      scripts/r.regression.line/r.regression.line.py
  32. 1 1
      scripts/r.rgb/r.rgb.py
  33. 6 6
      scripts/r.shaded.relief/r.shaded.relief.py
  34. 3 3
      scripts/r.tileset/r.tileset.py
  35. 2 2
      scripts/v.build.all/v.build.all.py
  36. 1 1
      scripts/v.centroids/v.centroids.py
  37. 18 18
      scripts/v.colors/v.colors.py
  38. 4 4
      scripts/v.convert.all/v.convert.all.py
  39. 4 4
      scripts/v.db.addcol/v.db.addcol.py
  40. 10 10
      scripts/v.db.addtable/v.db.addtable.py
  41. 5 5
      scripts/v.db.dropcolumn/v.db.dropcolumn.py
  42. 9 9
      scripts/v.db.droptable/v.db.droptable.py
  43. 5 5
      scripts/v.db.join/v.db.join.py
  44. 5 5
      scripts/v.db.reconnect.all/v.db.reconnect.all.py
  45. 5 5
      scripts/v.db.renamecolumn/v.db.renamecolumn.py
  46. 6 6
      scripts/v.db.univar/v.db.univar.py
  47. 5 5
      scripts/v.db.update/v.db.update.py
  48. 3 3
      scripts/v.dissolve/v.dissolve.py
  49. 12 12
      scripts/v.in.e00/v.in.e00.py
  50. 4 4
      scripts/v.in.geonames/v.in.geonames.py
  51. 2 2
      scripts/v.in.gns/v.in.gns.py
  52. 5 5
      scripts/v.in.mapgen/v.in.mapgen.py
  53. 5 5
      scripts/v.in.sites.all/v.in.sites.all.py
  54. 2 2
      scripts/v.in.wfs/v.in.wfs.py
  55. 13 13
      scripts/v.out.gps/v.out.gps.py
  56. 11 11
      scripts/v.rast.stats/v.rast.stats.py
  57. 3 3
      scripts/v.report/v.report.py

+ 1 - 1
scripts/d.correlate/d.correlate.py

@@ -44,7 +44,7 @@ def main():
 
     for map in layers:
 	if not grass.find_file(map, element = 'cell')['file']:
-	    grass.fatal("Input map <%s> not found" % map)
+	    grass.fatal(_("Input map <%s> not found") % map)
 
     grass.write_command('d.text', color = 'black', size = 4, line = 1, stdin = "CORRELATION")
 

+ 9 - 9
scripts/d.polar/d.polar.py

@@ -180,7 +180,7 @@ def plot_dgraph():
 
 def plot_eps(psout):
     # EPS output (by M.Neteler and Bruno Caprile, ITC-irst)
-    grass.message("Generating %s ..." % psout)
+    grass.message(_("Generating %s ...") % psout)
 
     outerradius = maxradius
     epsscale = 0.1
@@ -381,7 +381,7 @@ col1                                    %% colAVERAGE-DIRECTION-COLOR
 
     outf.close()
 
-    grass.message("Done.")
+    grass.message(_("Done."))
 
 def main():
     global tmp
@@ -396,11 +396,11 @@ def main():
     tmp = grass.tempfile()
 
     if eps and xgraph:
-	grass.fatal("Please select only one output method")
+	grass.fatal(_("Please select only one output method"))
 
     #### check if we have xgraph (if no EPS output requested)
     if xgraph and not grass.find_program('xgraph'):
-	grass.fatal("xgraph required, please install first (www.xgraph.org)")
+	grass.fatal(_("xgraph required, please install first (www.xgraph.org)"))
 
     #################################
     # this file contains everthing:
@@ -415,7 +415,7 @@ def main():
 	totalnumber += 1
     rawf.close()
 
-    grass.message("Calculating statistics for polar diagram... (be patient)")
+    grass.message(_("Calculating statistics for polar diagram... (be patient)"))
 
     #wipe out NULL data and undef data if defined by user
     # - generate degree binned to integer, eliminate NO DATA (NULL):
@@ -445,7 +445,7 @@ def main():
 
     totalvalidnumber = nvals
     if totalvalidnumber == 0:
-	grass.fatal("No data pixel found")
+	grass.fatal(_("No data pixel found"))
 
     #################################
     # unit vector on raw data converted to radians without no data:
@@ -494,9 +494,9 @@ def main():
     else:
 	plot_dgraph()
 
-    grass.message("Average vector:")
-    grass.message("direction: %.1f degrees CCW from East" % math.degrees(math.atan2(unitvector[1], unitvector[0])))
-    grass.message("magnitude: %.1f percent of fullscale" % (100 * math.hypot(unitvector[0], unitvector[1])))
+    grass.message(_("Average vector:"))
+    grass.message(_("direction: %.1f degrees CCW from East") % math.degrees(math.atan2(unitvector[1], unitvector[0])))
+    grass.message(_("magnitude: %.1f percent of fullscale") % (100 * math.hypot(unitvector[0], unitvector[1])))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 2 - 2
scripts/d.rast.leg/d.rast.leg.py

@@ -97,11 +97,11 @@ def main():
 
     #for -n flag of d.legend
     if not grass.find_file(map)['file']:
-	grass.fatal("Raster map <%s> not found in mapset search path" % map)
+	grass.fatal(_("Raster map <%s> not found in mapset search path") % map)
 
     # for rast=
     if rast and not grass.find_file(rast)['file']:
-	grass.fatal("Raster map <%s> not found in mapset search path" % rast)
+	grass.fatal(_("Raster map <%s> not found in mapset search path") % rast)
 
     s = grass.read_command('d.info', flags = 'f')
     f = tuple([float(x) for x in s.split()[1:5]])

+ 6 - 6
scripts/db.dropcolumn/db.dropcolumn.py

@@ -64,19 +64,19 @@ def main():
     # schema needed for PG?
 
     if force:
-	grass.message("Forcing ...")
+	grass.message(_("Forcing ..."))
 
     if column == "cat":
-	grass.warning("Deleting <%s> column which may be needed to keep table connected to a vector map" % column)
+	grass.warning(_("Deleting <%s> column which may be needed to keep table connected to a vector map") % column)
 
     cols = [f[0] for f in grass.db_describe()['cols']]
     if column not in cols:
-	grass.fatal("Column <%s> not found in table" % column)
+	grass.fatal(_("Column <%s> not found in table") % column)
 
     if not force:
-	grass.message("Column <%s> would be deleted." % column)
+	grass.message(_("Column <%s> would be deleted.") % column)
 	grass.message("")
-	grass.message("You must use the force flag to actually remove it. Exiting.")
+	grass.message(_("You must use the force flag to actually remove it. Exiting."))
 	sys.exit(0)
 
     if driver == "sqlite":
@@ -110,7 +110,7 @@ def main():
 
     if grass.write_command('db.execute', input = '-', database = database, driver = driver,
 			   stdin = sql) != 0:
-	grass.fatal("Cannot continue (problem deleting column).")
+	grass.fatal(_("Cannot continue (problem deleting column)."))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 6 - 6
scripts/db.droptable/db.droptable.py

@@ -52,12 +52,12 @@ def main():
     # schema needed for PG?
 
     if force:
-	grass.message("Forcing ...")
+	grass.message(_("Forcing ..."))
 
     # check if table exists
     nuldev = file(os.devnull, 'w')
     if not grass.db_describe(table, stdout = nuldev, stderr = nuldev):
-	grass.fatal("Table <%s> not found in current mapset" % table)
+	grass.fatal(_("Table <%s> not found in current mapset") % table)
 
     # check if table is used somewhere (connected to vector map)
     used = []
@@ -70,14 +70,14 @@ def main():
 		used.append(vect)
 		break
     if used:
-	grass.warning("Deleting table <%s> which is attached to following map(s):" % table)
+	grass.warning(_("Deleting table <%s> which is attached to following map(s):") % table)
 	for vect in used:
 	    grass.message(vect)
 
     if not force:
-	grass.message("The table <%s> would be deleted." % table)
+	grass.message(_("The table <%s> would be deleted.") % table)
 	grass.message("")
-	grass.message("You must use the force flag to actually remove it. Exiting.")
+	grass.message(_("You must use the force flag to actually remove it. Exiting."))
 	sys.exit(0)
 
     p = grass.feed_command('db.execute', input = '-', database = database, driver = driver)
@@ -85,7 +85,7 @@ def main():
     p.stdin.close()
     p.wait()
     if p.returncode != 0:
-  	grass.fatal("Cannot continue (problem deleting table).")
+  	grass.fatal(_("Cannot continue (problem deleting table)."))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 5 - 5
scripts/db.in.ogr/db.in.ogr.py

@@ -76,7 +76,7 @@ def main():
 	s = grass.read_command('db.tables', flags = 'p')
 	for l in s.splitlines():
 	    if l == output:
-		grass.fatal("Table <%s> already exists" % output)
+		grass.fatal(_("Table <%s> already exists") % output)
     else:
 	grass.write_command('db.execute', input = '-', stdin = "DROP TABLE %s" % output)
 
@@ -89,9 +89,9 @@ def main():
     if grass.run_command('v.in.ogr', flags = 'o', dsn = dsn, output = output,
 			 layer = layer, quiet = True) != 0:
 	if db_table:
-	    grass.fatal("Input table <%s> not found or not readable" % input)
+	    grass.fatal(_("Input table <%s> not found or not readable") % input)
 	else:
-	    grass.fatal("Input DSN <%s> not found or not readable" % input)
+	    grass.fatal(_("Input DSN <%s> not found or not readable") % input)
 
     nuldev = file(os.devnull, 'w')
 
@@ -107,7 +107,7 @@ def main():
     # ... and immediately drop the empty geometry
     vectfile = grass.find_file(output, element = 'vector', mapset = mapset)['file']
     if not vectfile:
-	grass.fatal("Something went wrong. Should not happen")
+	grass.fatal(_("Something went wrong. Should not happen"))
     else:
 	# remove the vector part
 	grass.try_remove(vectfile)
@@ -117,7 +117,7 @@ def main():
 		      colum = 'cat', stdout = nuldev, stderr = nuldev)
 
     records = grass.db_describe(output)['nrows']
-    grass.message("Imported table <%s> with %d rows" % (output, records))
+    grass.message(_("Imported table <%s> with %d rows") % (output, records))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 2 - 2
scripts/db.out.ogr/db.out.ogr.py

@@ -75,7 +75,7 @@ def main():
     #is there a simpler way of testing for --overwrite?
     dbffile = input + '.dbf'
     if os.path.exists(dbffile) and not grass.overwrite():
-	grass.fatal("File <%s> already exists" % dbffile)
+	grass.fatal(_("File <%s> already exists") % dbffile)
 
     if grass.run_command('v.out.ogr', quiet = True, input = input, dsn = dsn,
 			 format = format, type = 'point', olayer = olayer) != 0:
@@ -97,7 +97,7 @@ def main():
     else:
 	outname = input
 
-    grass.message("Exported table <%s>" % outname)
+    grass.message(_("Exported table <%s>") % outname)
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 2 - 2
scripts/db.test/db.test.py

@@ -60,7 +60,7 @@ def main():
 	if r != 0:
 	    grass.error("EXECUTE: ******** ERROR ********")
 	else:
-	    grass.message("EXECUTE: OK")
+	    grass.message(_("EXECUTE: OK"))
 
 	expf = file(expected, 'w')
 	while True:
@@ -74,7 +74,7 @@ def main():
 	    if grass.call(['diff', result, expected]) != 0:
 		grass.error("RESULT: ******** ERROR ********")
 	    else:
-		grass.message("RESULT: OK")
+		grass.message(_("RESULT: OK"))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 18 - 18
scripts/g.extension/g.extension.py

@@ -88,7 +88,7 @@ os.mkdir(tmpdir)
 def check():
     # check if we have the svn client
     if not grass.find_program('svn'):
-        grass.fatal('svn client required. Please install subversion first.')
+        grass.fatal(_('svn client required. Please install subversion first.'))
 
 def expand_module_class_name(c):
     name = { 'd'  : 'display',
@@ -109,7 +109,7 @@ def expand_module_class_name(c):
     return c
 
 def list_available_modules(svnurl):
-    grass.message('Fetching list of modules from GRASS-Addons SVN (be patient)...')
+    grass.message(_('Fetching list of modules from GRASS-Addons SVN (be patient)...'))
     pattern = re.compile(r'(<li><a href=".+">)(.+)(</a></li>)', re.IGNORECASE)
     for d in ['d', 'db', 'g', 'i', 'ps',
               'p', 'r', 'r3', 'v']:
@@ -117,7 +117,7 @@ def list_available_modules(svnurl):
         url = svnurl + '/' + modclass
         f = urllib.urlopen(url)
         if not f:
-            grass.warning("Unable to fetch '%s'" % url)
+            grass.warning(_("Unable to fetch '%s'") % url)
             continue
         for line in f.readlines():
             sline = pattern.search(line)
@@ -131,29 +131,29 @@ def cleanup():
 def install_extension(svnurl, prefix, module):
     gisbase = os.getenv('GISBASE')
     if not gisbase:
-        grass.fatal('$GISBASE not defined')
+        grass.fatal(_('$GISBASE not defined'))
     
     if grass.find_program(module):
-        grass.warning("Extension '%s' already installed. Will be updated..." % module)
+        grass.warning(_("Extension '%s' already installed. Will be updated...") % module)
     
     classchar = module.split('.', 1)[0]
     moduleclass = expand_module_class_name(classchar)
     url = svnurl + '/' + moduleclass + '/' + module
         
-    grass.message("Fetching '%s' from GRASS-Addons SVN (be patient)..." % module)
+    grass.message(_("Fetching '%s' from GRASS-Addons SVN (be patient)...") % module)
     global tmpdir
     os.chdir(tmpdir)
     if grass.call(['svn', 'checkout',
                    url]) != 0:
-        grass.fatal("GRASS Addons '%s' not found in repository" % module)
+        grass.fatal(_("GRASS Addons '%s' not found in repository") % module)
 
     os.chdir(os.path.join(tmpdir, module))
-    grass.message("Compiling '%s'..." % module)
+    grass.message(_("Compiling '%s'...") % module)
     if grass.call(['make',
                    'MODULE_TOPDIR=%s' % gisbase]) != 0:
-        grass.fatal('Compilation failed, sorry. Please check above error messages.')
+        grass.fatal(_('Compilation failed, sorry. Please check above error messages.'))
     
-    grass.message("Installing '%s'..." % module)
+    grass.message(_("Installing '%s'...") % module)
     # can we write ?
     try:
         # replace with something better
@@ -173,14 +173,14 @@ def install_extension(svnurl, prefix, module):
                           'install'])
     
     if ret != 0:
-        grass.warning('Installation failed, sorry. Please check above error messages.')
+        grass.warning(_('Installation failed, sorry. Please check above error messages.'))
     else:
-        grass.message("Installation of '%s' successfully finished." % module)
+        grass.message(_("Installation of '%s' successfully finished.") % module)
 
 def remove_extension(prefix, module):
     # is module available?
     if not grass.find_program(module):
-        grass.fatal("'%s' not found" % module)
+        grass.fatal(_("'%s' not found") % module)
     
     for file in [os.path.join(prefix, 'bin', module),
                  os.path.join(prefix, 'scripts', module),
@@ -188,10 +188,10 @@ def remove_extension(prefix, module):
         if os.path.isfile(file):
             os.remove(file)
                     
-    grass.message("'%s' successfully uninstalled." % module)
+    grass.message(_("'%s' successfully uninstalled.") % module)
     
 def update_menu(menuitem, module, operation):
-    grass.warning('Not implemented')
+    grass.warning(_('Not implemented'))
     if operation == 'add':
         pass
     else: # remove
@@ -207,7 +207,7 @@ def main():
         return 0
     else:
         if not options['extension']:
-            grass.fatal('You need to define an extension name or use -l')
+            grass.fatal(_('You need to define an extension name or use -l'))
     
     # TODO: check more variable
     if '$(HOME)' in options['prefix']:
@@ -217,9 +217,9 @@ def main():
         try:
             os.makedirs(options['prefix'])
         except OSError, e:
-            grass.fatal("Unable to create '%s'\n%s" % (options['prefix'], e))
+            grass.fatal(_("Unable to create '%s'\n%s") % (options['prefix'], e))
             
-        grass.warning("'%s' created" % options['prefix'])
+        grass.warning(_("'%s' created") % options['prefix'])
     
     if options['operation'] == 'add':
         install_extension(options['svnurl'], options['prefix'], options['extension'])

+ 5 - 5
scripts/g.manual/g.manual.py

@@ -42,20 +42,20 @@ from grass.script import core as grass
 def start_browser(entry):
     path = os.path.join(gisbase, 'docs', 'html', entry + '.html')
     if not os.path.exists(path):
-	grass.fatal("No HTML manual page entry for <%s>." % entry)
+	grass.fatal(_("No HTML manual page entry for <%s>.") % entry)
     verbose = os.getenv("GRASS_VERBOSE")
     if not verbose or int(verbose) > 1:
-	grass.message("Starting browser <%s> for module %s..." % (browser_name, entry))
+	grass.message(_("Starting browser <%s> for module %s...") % (browser_name, entry))
     os.execlp(browser, browser_name, "file://%s/docs/html/%s.html" % (gisbase, entry))
-    grass.fatal("Error starting browser <%s> for HTML file <%s>" % (browser, entry))
+    grass.fatal(_("Error starting browser <%s> for HTML file <%s>") % (browser, entry))
 
 def start_man(entry):
     path = os.path.join(gisbase, 'man', 'man1', entry + '.1')
     for ext in ['', '.gz', '.bz2']:
 	if os.path.exists(path + ext):
 	    os.execlp('man', 'man', path + ext)
-	    grass.fatal("Error starting 'man' for <%s>" % path)
-    grass.fatal("No manual page entry for <%s>." % entry)
+	    grass.fatal(_("Error starting 'man' for <%s>") % path)
+    grass.fatal(_("No manual page entry for <%s>.") % entry)
 
 def main():
     global gisbase, browser, browser_name

+ 7 - 7
scripts/i.fusion.brovey/i.fusion.brovey.py

@@ -104,7 +104,7 @@ def main():
     tmp = str(os.getpid())
 
     if not landsat and not quickbird and not spot:
-	grass.fatal("Please select a flag to specify the satellite sensor")
+	grass.fatal(_("Please select a flag to specify the satellite sensor"))
 
     #get PAN resolution:
     kv = grass.raster_info(map = pan)
@@ -133,7 +133,7 @@ def main():
     # r.mapcalc "brov.blue= 1. * spot.ms.1 / (spot.ms.1 + spot.ms.2 + spot.ms.3) * spot.p"
     # note: for RGB composite then revert brov.red and brov.green!
 
-    grass.message("Calculating %s.{red,green,blue}: ..." % out)
+    grass.message(_("Calculating %s.{red,green,blue}: ...") % out)
     e = '''eval(k = float("$pan") / ("$ms1" + "$ms2" + "$ms3"))
 	   "$out.red"   = "$ms3" * k
 	   "$out.green" = "$ms2" * k
@@ -154,23 +154,23 @@ def main():
 
     if spot:
         #apect table is nice for SPOT:
-	grass.message("Assigning color tables for SPOT...")
+	grass.message(_("Assigning color tables for SPOT..."))
 	for ch in ['red', 'green', 'blue']:
 	    grass.run_command('r.colors', map = "%s.%s" % (out, ch), col = 'aspect')
-	grass.message("Fixing output names...")
+	grass.message(_("Fixing output names..."))
 	for s, d in [('green','tmp'),('red','green'),('tmp','red')]:
 	    src = "%s.%s" % (out, s)
 	    dst = "%s.%s" % (out, d)
 	    grass.run_command('g.rename', rast = (src, dst), quiet = True)
     else:
 	#aspect table is nice for LANDSAT and QuickBird:
-	grass.message("Assigning color tables for LANDSAT or QuickBird...")
+	grass.message(_("Assigning color tables for LANDSAT or QuickBird..."))
 	for ch in ['red', 'green', 'blue']:
 	    grass.run_command('r.colors', map = "%s.%s" % (out, ch), col = 'aspect')
 
-    grass.message("Following pan-sharpened output maps have been generated:")
+    grass.message(_("Following pan-sharpened output maps have been generated:"))
     for ch in ['red', 'green', 'blue']:
-	grass.message("%s.%s" % (out, ch))
+	grass.message(_("%s.%s") % (out, ch))
 
     grass.verbose("To visualize output, run:")
     grass.verbose("g.region -p rast=%s.red" % out)

+ 3 - 3
scripts/i.image.mosaic/i.image.mosaic.py

@@ -78,7 +78,7 @@ def main():
 
     count = len(images)
 
-    grass.warning('Do not forget to set region properly to cover all images.')
+    grass.warning(_('Do not forget to set region properly to cover all images.'))
 
     offset = 0
     offsets = []
@@ -89,7 +89,7 @@ def main():
 	parms['offset%d' % (n + 1)] = offset
 	offset += get_limit(img) + 1
 
-    grass.message("Mosaicing %d images..." % count)
+    grass.message(_("Mosaicing %d images...") % count)
 
     grass.mapcalc("$output = " + make_expression(1, count),
 		  output = output, **parms)
@@ -102,7 +102,7 @@ def main():
     p.stdin.close()
     p.wait()
 
-    grass.message("Ready. File %s created." % output)
+    grass.message(_("Ready. File %s created.") % output)
 
     # write cmd history:
     grass.raster_history(output)

+ 15 - 15
scripts/i.in.spotvgt/i.in.spotvgt.py

@@ -121,7 +121,7 @@ def main():
 
     #### check for gdalinfo (just to check if installation is complete)
     if not grass.find_program('gdalinfo', ['--version']):
-	grass.fatal("'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)")
+	grass.fatal(_("'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)"))
 
     pid = str(os.getpid())
     tmpfile = grass.tempfile()
@@ -137,17 +137,17 @@ def main():
 	name = spotname
 
     if not grass.overwrite() and grass.find_file(name)['file']:
-	grass.fatal("<%s> already exists. Aborting." % name)
+	grass.fatal(_("<%s> already exists. Aborting.") % name)
 
     # still a ZIP file?  (is this portable?? see the r.in.srtm script for ideas)
     if infile.lower().endswith('.zip'):
-	grass.fatal("Please extract %s before import." % infile)
+	grass.fatal(_("Please extract %s before import.") % infile)
 
     try:
 	p = grass.Popen(['file', '-ib', infile], stdout = grass.PIPE)
 	s = p.communicate()[0]
 	if s == "application/x-zip":
-	    grass.fatal("Please extract %s before import." % infile)
+	    grass.fatal(_("Please extract %s before import.") % infile)
     except:
 	pass
 
@@ -161,11 +161,11 @@ def main():
     create_VRT_file(projfile, vrtfile, infile)
 
     ## let's import the NDVI map...
-    grass.message("Importing SPOT VGT NDVI map...")
+    grass.message(_("Importing SPOT VGT NDVI map..."))
     if grass.run_command('r.in.gdal', input = vrtfile, output = name) != 0:
-	grass.fatal("An error occurred. Stop.")
+	grass.fatal(_("An error occurred. Stop."))
 
-    grass.message("Imported SPOT VEGETATION NDVI map <%s>." % name)
+    grass.message(_("Imported SPOT VEGETATION NDVI map <%s>.") % name)
 
     #################
     ## http://www.vgt.vito.be/faq/FAQS/faq19.html
@@ -182,7 +182,7 @@ def main():
 
     grass.run_command('g.region', rast = name, quiet = True)
 
-    grass.message("Remapping digital numbers to NDVI...")
+    grass.message(_("Remapping digital numbers to NDVI..."))
     tmpname = "%s_%s" % (name, pid)
     grass.mapcalc("$tmpname = 0.004 * $name - 0.1", tmpname = tmpname, name = name)
     grass.run_command('g.remove', rast = name, quiet = True)
@@ -220,7 +220,7 @@ def main():
     # A good map threshold: >= 248
 
     if also:
-	grass.message("Importing SPOT VGT NDVI quality map...")
+	grass.message(_("Importing SPOT VGT NDVI quality map..."))
 	grass.try_remove(vrtfile)
 	qfile = infile.replace('NDV','SM')
 	create_VRT_file(projfile, vrtfile, qfile)
@@ -228,7 +228,7 @@ def main():
     ## let's import the SM quality map...
     smfile = name + '.sm'
     if grass.run_command('r.in.gdal', input = vrtfile, output = smfile) != 0:
-	grass.fatal("An error occurred. Stop.")
+	grass.fatal(_("An error occurred. Stop."))
 
     # some of the possible values:
     rules = [r + '\n' for r in [
@@ -246,23 +246,23 @@ def main():
 	]]
     grass.write_command('r.colors', map = smfile, rules = '-', stdin = rules)
 
-    grass.message("Imported SPOT VEGETATION SM quality map <%s>." % smfile)
-    grass.message("Note: A snow map can be extracted by category 252 (d.rast %s cat=252)" % smfile)
+    grass.message(_("Imported SPOT VEGETATION SM quality map <%s>.") % smfile)
+    grass.message(_("Note: A snow map can be extracted by category 252 (d.rast %s cat=252)") % smfile)
     grass.message("")
-    grass.message("Filtering NDVI map by Status Map quality layer...")
+    grass.message(_("Filtering NDVI map by Status Map quality layer..."))
 
     filtfile = "%s_filt" % name
     grass.mapcalc("$filtfile = if($smfile >= 248, $name, null())",
 		  filtfile = filtfile, smfile = smfile, name = name)
     grass.run_command('r.colors', map = filtfile, color = 'ndvi', quiet = True)
-    grass.message("Filtered SPOT VEGETATION NDVI map <%s>." % filtfile)
+    grass.message(_("Filtered SPOT VEGETATION NDVI map <%s>.") % filtfile)
 
     # write cmd history:
     grass.raster_history(name)
     grass.raster_history(smfile)
     grass.raster_history(filtfile)
 
-    grass.message("Done.")
+    grass.message(_("Done."))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 2 - 2
scripts/i.landsat.rgb/i.landsat.rgb.py

@@ -113,7 +113,7 @@ def main():
 
     if not preserve:
 	for i in [red, green, blue]:
-	    grass.message("Processing <%s>..." % i)
+	    grass.message(_("Processing <%s>...") % i)
 	    v0 = get_percentile(i, 2)
 	    v1 = get_percentile(i, brightness)
 	    grass.debug("<%s>:  min=%f   max=%f" % (i, v0, v1))
@@ -122,7 +122,7 @@ def main():
 	all_max = 0
 	all_min = 255
 	for i in [red, green, blue]:
-	    grass.message("Processing <%s>..." % i)
+	    grass.message(_("Processing <%s>...") % i)
 	    v0 = get_percentile(i, 2)
 	    v1 = get_percentile(i, brightness)
 	    grass.debug("<%s>:  min=%f   max=%f" % (i, v0, v1))

+ 3 - 3
scripts/i.spectral/i.spectral.py

@@ -176,14 +176,14 @@ def main():
     gnuplot = flags['g']
 
     if not group and not raster:
-	grass.fatal("Either group= or raster= is required")
+	grass.fatal(_("Either group= or raster= is required"))
 
     if group and raster:
-	grass.fatal("group= and raster= are mutually exclusive")
+	grass.fatal(_("group= and raster= are mutually exclusive"))
 
     #check if present
     if gnuplot and not grass.find_program('gnuplot', ['-V']):
-	grass.fatal("gnuplot required, please install first")
+	grass.fatal(_("gnuplot required, please install first"))
 
     tmp1 = grass.tempfile()
     tmp2 = grass.tempfile()

+ 5 - 5
scripts/i.tasscap/i.tasscap.py

@@ -125,7 +125,7 @@ def calc1(out, bands, k1, k2, k3, k4, k5, k7, k0 = 0):
 
 def calcN(options, i, n):
     outpre = options['outprefix']
-    grass.message("LANDSAT-%d..." % n)
+    grass.message(_("LANDSAT-%d...") % n)
     for j, p in enumerate(parms[i]):
 	out = "%s.%d" % (outpre, j + 1)
 	ord = ordinals[j]
@@ -133,7 +133,7 @@ def calcN(options, i, n):
 	    name = ''
 	else:
 	    name = " (%s)" % names[j]
-	grass.message("Calculating %s TC component %s%s ..." % (ord, out, name))
+	grass.message(_("Calculating %s TC component %s%s ...") % (ord, out, name))
 	calc1(out, options, *p)
 
 def main():
@@ -142,7 +142,7 @@ def main():
     flag7 = flags['7']
 
     if (flag4 and flag5) or (flag4 and flag7) or (flag5 and flag7):
-	grass.fatal("Select only one flag")
+	grass.fatal(_("Select only one flag"))
 
     if flag4:
 	calcN(options, 0, 4)
@@ -151,9 +151,9 @@ def main():
     elif flag7:
 	calcN(options, 2, 7)
     else:
-	grass.fatal("Select LANDSAT satellite by flag!")
+	grass.fatal(_("Select LANDSAT satellite by flag!"))
 
-    grass.message("Tasseled Cap components calculated.")
+    grass.message(_("Tasseled Cap components calculated."))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 13 - 13
scripts/m.proj/m.proj.py

@@ -106,20 +106,20 @@ def main():
 
     #### check for cs2cs
     if not grass.find_program('cs2cs'):
-	grass.fatal("cs2cs program not found, install PROJ.4 first: http://proj.maptools.org")
+	grass.fatal(_("cs2cs program not found, install PROJ.4 first: http://proj.maptools.org"))
 
     #### check for overenthusiasm
     if proj_in and ll_in:
-	grass.fatal("Choose only one input parameter method")
+	grass.fatal(_("Choose only one input parameter method"))
 
     if proj_out and ll_out:
-	grass.fatal("Choose only one output parameter method") 
+	grass.fatal(_("Choose only one output parameter method")) 
 
     if ll_in and ll_out:
-	grass.fatal("Choise only one auto-projection parameter method")
+	grass.fatal(_("Choise only one auto-projection parameter method"))
 
     if output and not grass.overwrite() and os.path.exists(output):
-	grass.fatal("Output file already exists") 
+	grass.fatal(_("Output file already exists")) 
 
     #### parse field separator
     # FIXME: input_x,y needs to split on multiple whitespace between them
@@ -140,11 +140,11 @@ def main():
         ifs = ','
     else:
         if len(ifs) > 1:
-            grass.warning("Invalid field separator, using '%s'" % ifs[0])
+            grass.warning(_("Invalid field separator, using '%s'") % ifs[0])
         try:
             ifs = ifs[0]
         except IndexError:
-            grass.fatal("Invalid field separator '%s'" % ifs)
+            grass.fatal(_("Invalid field separator '%s'") % ifs)
    
     if ofs.lower() == 'space':
         ofs = ' '
@@ -154,17 +154,17 @@ def main():
         ofs = ','
     else:
         if len(ofs) > 1:
-            grass.warning("Invalid field separator, using '%s'" % ofs[0])
+            grass.warning(_("Invalid field separator, using '%s'") % ofs[0])
         try:
             ofs = ofs[0]
         except IndexError:
-            grass.fatal("Invalid field separator '%s'" % ifs)
+            grass.fatal(_("Invalid field separator '%s'") % ifs)
 
     #### set up projection params
     s = grass.read_command("g.proj", flags='j')
     kv = grass.parse_key_val(s)
     if "XY location" in kv['+proj'] and (ll_in or ll_out):
-	grass.fatal("Unable to project to or from a XY location") 
+	grass.fatal(_("Unable to project to or from a XY location")) 
 
     in_proj = None
 
@@ -198,7 +198,7 @@ def main():
 	out_proj = proj_out
 
     if not out_proj:
-	grass.fatal("Missing output projection parameters ")
+	grass.fatal(_("Missing output projection parameters "))
     out_proj = out_proj.strip()
     grass.verbose("Output parameters: '%s'" % out_proj)
 
@@ -209,7 +209,7 @@ def main():
     else:
 	infile = input
 	if not os.path.exists(infile):
-	    grass.fatal("Unable to read input data")
+	    grass.fatal(_("Unable to read input data"))
 	inf = file(infile)
 	grass.debug("input file=[%s]" % infile)
 
@@ -253,7 +253,7 @@ def main():
     exitcode = p.wait()
 
     if exitcode != 0:
-	grass.warning("Projection transform probably failed, please investigate")
+	grass.warning(_("Projection transform probably failed, please investigate"))
 
 
     if not copy_input:

+ 4 - 4
scripts/r.blend/r.blend.py

@@ -67,7 +67,7 @@ def main():
 	for ch in ['r','g','b']:
 	    map = '%s.%s' % (output, ch)
 	    if grass.find_file(map, element = 'cell', mapset = mapset)['file']:
-		grass.fatal("Raster map <%s> already exists." % map)
+		grass.fatal(_("Raster map <%s> already exists.") % map)
 
     percent = int(percent)
     perc_inv = 100 - percent
@@ -75,7 +75,7 @@ def main():
     frac1 = percent / 100.0
     frac2 = perc_inv / 100.0
 
-    grass.message("Calculating the three component maps...")
+    grass.message(_("Calculating the three component maps..."))
 
     template = string.Template("$$output.$ch = $$frac1 * $ch#$$first + $$frac2 * $ch#$$second")
     cmd = [template.substitute(ch = ch) for ch in ['r','g','b']]
@@ -97,8 +97,8 @@ def main():
 			  history = "  %d%% of %s, %d%% of %s" % (percent, first, perc_inv, second))
 	grass.run_command('r.support', map = map, history = os.environ['CMDLINE'])
 
-    grass.message("Done. Use the following command to visualize the result:")
-    grass.message("d.rgb r=%s.r g=%s.g b=%s.b" % (output, output, output))
+    grass.message(_("Done. Use the following command to visualize the result:"))
+    grass.message(_("d.rgb r=%s.r g=%s.g b=%s.b") % (output, output, output))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 1 - 1
scripts/r.buffer/r.buffer.py

@@ -92,7 +92,7 @@ def main():
 
     #check if input file exists
     if not grass.find_file(input)['file']:
-	grass.fatal("<%s> does not exist." % input)
+	grass.fatal(_("<%s> does not exist.") % input)
 
     scale = scales[units]
 

+ 17 - 17
scripts/r.fillnulls/r.fillnulls.py

@@ -80,7 +80,7 @@ def main():
 
     #check if input file exists
     if not grass.find_file(input)['file']:
-	grass.fatal("<%s> does not exist." % input)
+	grass.fatal(_("<%s> does not exist.") % input)
 
     mapset = grass.gisenv()['MAPSET']
     unique = str(os.getpid())
@@ -88,7 +88,7 @@ def main():
     # check if a MASK is already present:
     usermask = "usermask_mask." + unique
     if grass.find_file('MASK', mapset = mapset)['file']:
-	grass.message("A user raster mask (MASK) is present. Saving it...")
+	grass.message(_("A user raster mask (MASK) is present. Saving it..."))
 	grass.run_command('g.rename', rast = ('MASK',usermask))
 
     #make a mask of NULL cells
@@ -97,7 +97,7 @@ def main():
     # idea: filter all NULLS and grow that area(s) by 3 pixel, then
     # interpolate from these surrounding 3 pixel edge
 
-    grass.message("Locating and isolating NULL areas...")
+    grass.message(_("Locating and isolating NULL areas..."))
     #creating 0/1 map:
     grass.mapcalc("$tmp1 = if(isnull($input),1,null())",
 		  tmp1 = tmp1, input = input)
@@ -113,65 +113,65 @@ def main():
     res = (float(reg['nsres']) + float(reg['ewres'])) * 3 / 2
 
     if grass.run_command('r.buffer', input = tmp1, distances = res, out = tmp1 + '.buf') != 0:
-	grass.fatal("abandoned. Removing temporary map, restoring user mask if needed:")
+	grass.fatal(_("abandoned. Removing temporary map, restoring user mask if needed:"))
 
     grass.mapcalc("MASK=if($tmp1.buf==2,1,null())", tmp1 = tmp1)
 
     # now we only see the outlines of the NULL areas if looking at INPUT.
     # Use this outline (raster border) for interpolating the fill data:
     vecttmp = "vecttmp_fillnulls_" + unique
-    grass.message("Creating interpolation points...")
+    grass.message(_("Creating interpolation points..."))
     if grass.run_command('r.to.vect', input = input, output = vecttmp, feature = 'point'):
-	grass.fatal("abandoned. Removing temporary maps, restoring user mask if needed:")
+	grass.fatal(_("abandoned. Removing temporary maps, restoring user mask if needed:"))
 
     # count number of points to control segmax parameter for interpolation:
     pointsnumber = grass.vector_info_topo(map = vecttmp)['points']
 
-    grass.message("Interpolating %d points" % pointsnumber)
+    grass.message(_("Interpolating %d points") % pointsnumber)
 
     if pointsnumber < 2:
-	grass.fatal("Not sufficient points to interpolate. Maybe no hole(s) to fill in the current map region?")
+	grass.fatal(_("Not sufficient points to interpolate. Maybe no hole(s) to fill in the current map region?"))
 
-    grass.message("Note: The following warnings may be ignored.")
+    grass.message(_("Note: The following warnings may be ignored."))
 
     # remove internal MASK first -- WHY???? MN 10/2005
     grass.run_command('g.remove', rast = 'MASK')
 
     if grass.find_file(usermask, mapset = mapset)['file']:
-	grass.message("Using user mask while interpolating")
+	grass.message(_("Using user mask while interpolating"))
 	maskmap = usermask
     else:
 	maskmap = None
 
     segmax = 600
     if pointsnumber > segmax:
-	grass.message("Using segmentation for interpolation...")
+	grass.message(_("Using segmentation for interpolation..."))
 	segmax = None
     else:
-	grass.message("Using no segmentation for interpolation as not needed...")
+	grass.message(_("Using no segmentation for interpolation as not needed..."))
 
     grass.run_command('v.surf.rst', input = vecttmp, elev = tmp1 + '_filled',
 		      zcol = 'value', tension = tension, smooth = smooth,
 		      maskmap = maskmap, segmax = segmax)
 
-    grass.message("Note: Above warnings may be ignored.")
+    grass.message(_("Note: Above warnings may be ignored."))
 
     # restoring user's mask, if present:
     if grass.find_file(usermask, mapset = mapset)['file']:
-	grass.message("Restoring user mask (MASK)...")
+	grass.message(_("Restoring user mask (MASK)..."))
 	grass.run_command('g.rename', rast = (usermask, 'MASK'))
 
     # patch orig and fill map
-    grass.message("Patching fill data into NULL areas...")
+    grass.message(_("Patching fill data into NULL areas..."))
     # we can use --o here as g.parser already checks on startup
     grass.run_command('r.patch', input = (input,tmp1 + '_filled'), output = output, overwrite = True)
 
-    grass.message("Filled raster map is: %s" % output)
+    grass.message(_("Filled raster map is: %s") % output)
 
     # write cmd history:
     grass.raster_history(output)
 
-    grass.message("Done.")
+    grass.message(_("Done."))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 1 - 1
scripts/r.grow/r.grow.py

@@ -119,7 +119,7 @@ def main():
 
     #check if input file exists
     if not grass.find_file(input)['file']:
-	grass.fatal("<%s> does not exist." % input)
+	grass.fatal(_("<%s> does not exist.") % input)
 
     grass.run_command('r.grow.distance',  input = input, metric = metric,
 		      distance = temp_dist, value = temp_val)

+ 7 - 7
scripts/r.in.aster/r.in.aster.py

@@ -110,7 +110,7 @@ def main():
 
     #check whether gdalwarp is in path and executable
     if not grass.find_program('gdalwarp', ['--version']):
-        grass.fatal("gdalwarp is not in the path and executable")
+        grass.fatal(_("gdalwarp is not in the path and executable"))
 
     #create temporary file to hold gdalwarp output before importing to GRASS
     tempfile = grass.read_command("g.tempfile", pid = os.getpid()).strip() + '.tif'
@@ -120,7 +120,7 @@ def main():
 
     #currently only runs in projected location
     if "XY location" in proj:
-      grass.fatal("This module needs to be run in a projected location (found: %s)" % proj)
+      grass.fatal(_("This module needs to be run in a projected location (found: %s)") % proj)
 
 
     #process list of bands
@@ -138,22 +138,22 @@ def main():
                 srcfile = "HDF4_EOS:EOS_SWATH:%s:%s" % (input, dataset)
                 import_aster(proj, srcfile, tempfile, band)
             else:
-                grass.fatal('band %s is not an available Terra/ASTER band' % band)
+                grass.fatal(_('band %s is not an available Terra/ASTER band') % band)
     elif proctype == "DEM": 
         srcfile = input
         import_aster(proj, srcfile, tempfile, "DEM")
 
     #cleanup
-    grass.message("Cleaning up ...")
+    grass.message(_("Cleaning up ..."))
     grass.try_remove(tempfile)
-    grass.message("Done.")
+    grass.message(_("Done."))
 
     return
 
 def import_aster(proj, srcfile, tempfile, band):
     #run gdalwarp with selected options (must be in $PATH)
     #to translate aster image to geotiff
-    grass.message("Georeferencing aster image ...")
+    grass.message(_("Georeferencing aster image ..."))
     grass.debug("gdalwarp -t_srs %s %s %s" % (proj, srcfile, tempfile))
 
     if platform.system() == "Darwin":
@@ -166,7 +166,7 @@ def import_aster(proj, srcfile, tempfile, band):
         return
 
     #import geotiff to GRASS
-    grass.message("Importing into GRASS ...")
+    grass.message(_("Importing into GRASS ..."))
     outfile = "%s.%s" % (output, band)
     grass.run_command("r.in.gdal", overwrite = flags['o'], input = tempfile, output = outfile)
 

+ 11 - 11
scripts/r.in.srtm/r.in.srtm.py

@@ -136,7 +136,7 @@ def main():
     s = grass.read_command("g.proj", flags='j')
     kv = grass.parse_key_val(s)
     if kv['+proj'] != 'longlat':
-	grass.fatal("This module only operates in LatLong locations")
+	grass.fatal(_("This module only operates in LatLong locations"))
 
     # use these from now on:
     infile = input
@@ -154,21 +154,21 @@ def main():
     if os.path.isfile(zipfile):
         #### check if we have unzip
 	if not grass.find_program('unzip'):
-	    grass.fatal('The "unzip" program is required, please install it first')
+	    grass.fatal(_('The "unzip" program is required, please install it first'))
 
 	# really a ZIP file?
 	# make it quiet in a safe way (just in case -qq isn't portable)
 	tenv = os.environ.copy()
 	tenv['UNZIP'] = '-qq'
 	if grass.call(['unzip', '-t', zipfile], env = tenv) != 0:
-	    grass.fatal("'%s' does not appear to be a valid zip file." % zipfile)
+	    grass.fatal(_("'%s' does not appear to be a valid zip file.") % zipfile)
 
 	is_zip = True
     elif os.path.isfile(hgtfile):
 	# try and see if it's already unzipped
 	is_zip = False
     else:
-	grass.fatal("File '%s' or '%s' not found" % (zipfile, hgtfile))
+	grass.fatal(_("File '%s' or '%s' not found") % (zipfile, hgtfile))
 
     #make a temporary directory
     tmpdir = grass.tempfile()
@@ -190,11 +190,11 @@ def main():
 
     if is_zip:
         #unzip & rename data file:
-	grass.message("Extracting '%s'..." % infile)
+	grass.message(_("Extracting '%s'...") % infile)
 	if grass.call(['unzip', zipfile], env = tenv) != 0:
-	    grass.fatal("Unable to unzip file.")
+	    grass.fatal(_("Unable to unzip file."))
 
-    grass.message("Converting input file to BIL...")
+    grass.message(_("Converting input file to BIL..."))
     os.rename(hgtfile, bilfile)
 
     north = tile[0]
@@ -218,7 +218,7 @@ def main():
     if not one:
 	tmpl = tmpl3sec
     else:
-	grass.message("Attempting to import 1-arcsec data.")
+	grass.message(_("Attempting to import 1-arcsec data."))
 	tmpl = tmpl1sec
 
     header = tmpl % (ulxmap, ulymap)
@@ -234,7 +234,7 @@ def main():
     outf.close()
 
     if grass.run_command('r.in.gdal', input = bilfile, out = tileout) != 0:
-	grass.fatal("Unable to import data")
+	grass.fatal(_("Unable to import data"))
 
     # nice color table
     grass.run_command('r.colors', map = tileout, color = 'srtm')
@@ -242,8 +242,8 @@ def main():
     # write cmd history:
     grass.raster_history(tileout)
 
-    grass.message("Done: generated map " + tileout)
-    grass.message("(Note: Holes in the data can be closed with 'r.fillnulls' using splines)")
+    grass.message(_("Done: generated map ") + tileout)
+    grass.message(_("(Note: Holes in the data can be closed with 'r.fillnulls' using splines)"))
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 28 - 28
scripts/r.in.wms/gdalwarp.py

@@ -54,9 +54,9 @@ class GDALWarp:
         for input in self.options['input'].split(','):
             tmptilename = self.options['output'] + '_tile_' + str(tiler)
             if not os.path.exists(input):
-                grass.warning("Missing input '%s'" % input)
+                grass.warning(_("Missing input '%s'") % input)
                 continue
-            grass.info("Importing tile '%s'..." % os.path.basename(input))
+            grass.info(_("Importing tile '%s'...") % os.path.basename(input))
             if self.flags['p']:
                 self.nowarp_import(input, tmptilename)
             else:
@@ -66,7 +66,7 @@ class GDALWarp:
             tiler += 1
         
         if tiler < 1:
-            grass.message("Nothing imported")
+            grass.message(_("Nothing imported"))
             return 0
         
         # if there's more than one tile patch them together, otherwise
@@ -81,14 +81,14 @@ class GDALWarp:
                     if grass.run_command('g.rename',
                                          quiet = True,
                                          rast = ffile + ',' + tfile) != 0:
-                        grass.fatal('g.rename failed')
+                        grass.fatal(_('g.rename failed'))
             else: # single-band, single-tile
                 ffile = self.options['output'] + '_tile_0' # + sfx ?
                 tfile = self.options['output'] # + sfx ?
                 if grass.run_command('g.rename',
                                      quiet = True,
                                      rast = ffile + ',' + tfile) != 0:
-                    grass.fatal('g.rename failed')
+                    grass.fatal(_('g.rename failed'))
         else:
             # patch together each channel
             grass.debug('suffixes: %s' % ','.join(suffixes))
@@ -97,21 +97,21 @@ class GDALWarp:
                 for suffix in suffixes:
                     suffix = suffix.replace('.', '_')
                     # patch these together (using nulls only)
-                    grass.message("Patching '%s' channel..." % suffix)
+                    grass.message(_("Patching '%s' channel...") % suffix)
                     if grass.run_command('r.patch',
                                          quiet = True,
                                          input = patches, # ???
                                          output = self.options['output'] + suffix) != 0:
-                        grass.fatal('r.patch failed')
+                        grass.fatal(_('r.patch failed'))
                         
                     # remove the temporary patches we made
                     if grass.run_command('g.remove',
                                          quiet = True,
                                          rast = patches) != 0:
-                        grass.fatal('g.remove failed')
+                        grass.fatal(_('g.remove failed'))
             else:
                 # single-band data
-                grass.info("Patching tiles (this may take some time)...")
+                grass.info(_("Patching tiles (this may take some time)..."))
                 grass.debug("patch list = %s" % ','.join(maplist))
 
                 # HACK: for 8bit PNG, GIF all the different tiles can have
@@ -128,22 +128,22 @@ class GDALWarp:
                         if grass.run_command('r.mapcalc',
                                              quiet = True,
                                              expression = '%s = %s#%s' % (outmap, color, map)) != 0:
-                            grass.fatal('r.mapcalc failed')
+                            grass.fatal(_('r.mapcalc failed'))
                         if grass.run_command('r.colors',
                                              quiet = True,
                                              map = outmap,
                                              color = 'grey255') != 0:
-                            grass.fatal('r.colors failed')
+                            grass.fatal(_('r.colors failed'))
                         if grass.run_command('r.null',
                                              quiet = True,
                                              map = outmap,
                                              setnull = 255) != 0:
-                            grass.fatal('r.null failed')
+                            grass.fatal(_('r.null failed'))
                 
                         if grass.run_command('r.patch',
                                              input = ','.join(maplist_color),
                                              output = outmap + '_all') != 0:
-                            grass.fatal('r.patch failed')
+                            grass.fatal(_('r.patch failed'))
                 
                 if grass.run_command('r.composite',
                                      quiet = True,
@@ -151,13 +151,13 @@ class GDALWarp:
                                      green = map + '_g_all',
                                      blue = map + '_b_all',
                                      output = self.options['output']) != 0:
-                    grass.fatal('r.composite failed')
+                    grass.fatal(_('r.composite failed'))
 
                 if grass.run_command('g.mremove',
                                      quiet = True,
                                      flags = 'f',
                                      rast = map + '*') != 0:
-                    grass.fatal('g.remove failed')
+                    grass.fatal(_('g.remove failed'))
 
         # there's already a no suffix, can't make colors
         # can only go up from here ;)
@@ -168,14 +168,14 @@ class GDALWarp:
         
         # make a composite image if asked for and colors exist
         if colors == 3 and self.flags['c']:
-            grass.message("Building color image <%s>..." % self.options['output'])
+            grass.message(_("Building color image <%s>...") % self.options['output'])
             if grass.run_command('r.composite',
                                  quiet = True,
                                  red = self.options['output'] + '.red',
                                  green = self.options['output'] + '.green',
                                  blue = self.options['output'] + '.blue',
                                  output = self.options['output']) != 0:
-                grass.fatal('r.composite failed')
+                grass.fatal(_('r.composite failed'))
         
         return 0
     
@@ -189,7 +189,7 @@ class GDALWarp:
                                    quiet = True,
                                    flags = 'jf').rstrip('\n')
         if not t_srs:
-            grass.fatal('g.proj failed')
+            grass.fatal(_('g.proj failed'))
         
         grass.debug("gdalwarp -s_srs '%s' -t_srs '%s' -r %s %s %s %s" % \
                         (self.options['srs'], t_srs,
@@ -213,16 +213,16 @@ class GDALWarp:
         ps.wait()
         if ps.returncode != 0 or \
                 not os.path.exists(warpfile):
-            grass.fatal('gdalwarp failed')
+            grass.fatal(_('gdalwarp failed'))
     
         # import it into a temporary map
-        grass.info('Importing raster map...')
+        grass.info(_('Importing raster map...'))
         if grass.run_command('r.in.gdal',
                              quiet = True,
                              flags = self.gdal_flags,
                              input = warpfile,
                              output = tmpmapname) != 0:
-            grass.fatal('r.in.gdal failed')
+            grass.fatal(_('r.in.gdal failed'))
         
         os.remove(warpfile)
 
@@ -272,20 +272,20 @@ class GDALWarp:
                                      quiet = True,
                                      expression = "%s%s = if(%s, %s%s, null())" % \
                                          (map, sfx, alphalayer, tmpmapname, sfx)) != 0:
-                    grass.fatal('r.mapcalc failed')
+                    grass.fatal(_('r.mapcalc failed'))
             else:
                 if grass.run_command('g.copy',
                                      quiet = True,
                                      rast = "%s%s,%s%s" % \
                                          (tmpmapname, suffix, map, suffix)) != 0:
-                    grass.fatal('g.copy failed')
+                    grass.fatal(_('g.copy failed'))
         
             # copy the color tables
             if grass.run_command('r.colors',
                                  quiet = True,
                                  map = map + suffix,
                                  rast = tmpmapname + suffix) != 0:
-                grass.fatal('g.copy failed')
+                grass.fatal(_('g.copy failed'))
 
             # make patch lists
             suffix = suffix.replace('.', '_')
@@ -302,19 +302,19 @@ class GDALWarp:
                                  quiet = True,
                                  expression = "%s = %s" % \
                                      (map, tmpmapname)) != 0:
-                grass.fatal('r.mapcalc failed')
+                grass.fatal(_('r.mapcalc failed'))
             
             if grass.run_command('r.colors',
                                  quiet = True,
                                  map = map,
                                  rast = tmpmapname) != 0:
-                grass.fatal('r.colors failed')
+                grass.fatal(_('r.colors failed'))
     
         # remove the old channels
         if grass.run_command('g.remove',
                              quiet = True,
                              rast = ','.join(channel_list)) != 0:
-            grass.fatal('g.remove failed')
+            grass.fatal(_('g.remove failed'))
         
     def nowarp_import(self, file, map):
         """Import raster file into GRASS"""
@@ -323,7 +323,7 @@ class GDALWarp:
                              flags = 'o' + self.gdal_flags,
                              input = file,
                              output = map) != 0:
-            grass.fatal('r.in.gdal failed')
+            grass.fatal(_('r.in.gdal failed'))
 
         # get a list of channels:
         pattern = map + '*'

+ 10 - 10
scripts/r.in.wms/r.in.wms.py

@@ -206,23 +206,23 @@ def list_layers():
         else:
             cap_file = urllib.urlopen(url, options['mapserver'] + '?' + qstring)
     except IOError:
-        grass.fatal("Unable to get capabilities of '%s'" % options['mapserver'])
+        grass.fatal(_("Unable to get capabilities of '%s'") % options['mapserver'])
     
     # check DOCTYPE first
     if options['cap_file']:
         if headers['content-type'] != 'application/vnd.ogc.wms_xml':
-            grass.fatal("Unable to get capabilities: %s" % url)
+            grass.fatal(_("Unable to get capabilities: %s") % url)
     else:
         if cap_file.info()['content-type'] != 'application/vnd.ogc.wms_xml':
-            grass.fatal("Unable to get capabilities: %s" % url)
+            grass.fatal(_("Unable to get capabilities: %s") % url)
 
     # parse file with sax
     cap_xml = wms_parse.ProcessCapFile()
     try:
         xml.sax.parse(cap_file, cap_xml)
     except xml.sax.SAXParseException, err:
-        grass.fatal("Reading capabilities failed. "
-                    "Unable to parse XML document: %s" % err)
+        grass.fatal(_("Reading capabilities failed. "
+                      "Unable to parse XML document: %s") % err)
     
     cap_xml.getLayers()
     
@@ -232,10 +232,10 @@ def main():
         list_layers()
         return 0
     elif not options['output']:
-        grass.fatal("No output map specified")
+        grass.fatal(_("No output map specified"))
     
     if options['cap_file'] and not flags['l']:
-        grass.warning("Option <cap_file> ignored. It requires '-l' flag.")
+        grass.warning(_("Option <cap_file> ignored. It requires '-l' flag."))
     
     # set directory for download
     if not options['folder']:
@@ -244,20 +244,20 @@ def main():
     # region settings
     if options['region']:
         if not grass.find_file(name = options['region'], element = 'windows')['name']:
-            grass.fatal("Region <%s> not found" % options['region'])
+            grass.fatal(_("Region <%s> not found") % options['region'])
 
     request = wms_request.WMSRequest(flags, options)    
     if not flags['d']:
         # request data first
         request.GetTiles()
     if not request:
-        grass.fatal("WMS request failed")
+        grass.fatal(_("WMS request failed"))
     
     if flags['a']:
         # use GDAL WMS driver
         ### TODO: use GDAL Python bindings instead
         if not wms_gdal.checkGdalWms():
-            grass.fatal("GDAL WMS driver is not available")
+            grass.fatal(_("GDAL WMS driver is not available"))
 
         # create local service description XML file
         gdalWms = wms_gdal.GdalWms(options, request)

+ 7 - 7
scripts/r.in.wms/wms_download.py

@@ -27,7 +27,7 @@ class WMSDownload:
         self.options = options
         
     def GetTiles(self, requests):
-        grass.message("Downloading tiles...")
+        grass.message(_("Downloading tiles..."))
         
         i = 0
         for item in requests:
@@ -40,30 +40,30 @@ class WMSDownload:
         
     def GetData(self, idx, server, query, output):
         """Download data"""
-        grass.message("Downloading data (tile %d)..." % idx)
+        grass.message(_("Downloading data (tile %d)...") % idx)
         grass.verbose("Requesting data: %s" % self.options['mapserver'])
 
         if not self.flags['g']: # -> post
             try:
                 urllib.urlretrieve(server, output, data = query)
             except IOError:
-                grass.fatal("Failed while downloading the data")
+                grass.fatal(_("Failed while downloading the data"))
             
             if not os.path.exists(output):
-                grass.fatal("Failed while downloading the data")
+                grass.fatal(_("Failed while downloading the data"))
             
             # work-around for brain-dead ArcIMS servers which want POST-data as part of the GET URL
             #   (this is technically allowed by OGC WMS def v1.3.0 Sec6.3.4)
             if os.path.getsize(output) == 0:
-                grass.warning("Downloaded image file is empty -- trying another method")
+                grass.warning(_("Downloaded image file is empty -- trying another method"))
                 self.flags['g'] = True
             
         if self.flags['g']: # -> get
             try:
                 urllib.urlretrieve(server + '?' + query, output, data = None)
             except IOError:
-                grass.fatal("Failed while downloading the data")
+                grass.fatal(_("Failed while downloading the data"))
             
             if not os.path.exists(output) or os.path.getsize(output) == 0:
-                grass.fatal("Failed while downloading the data")
+                grass.fatal(_("Failed while downloading the data"))
 

+ 5 - 5
scripts/r.in.wms/wms_request.py

@@ -36,7 +36,7 @@ class WMSRequest:
         if self.flags['p']:
             self.proj_srs = grass.read_command('g.proj', flags='j')
             if not self.proj_srs:
-                grass.fatal('g.proj failed')
+                grass.fatal(_('g.proj failed'))
             self.srs_scale = int(grass.parse_key_val(proj_srs['+to_meter']))
         else:
             self.proj_srs = '+init=%s' % self.options['srs'].lower()
@@ -76,7 +76,7 @@ class WMSRequest:
             self.worldfile   = ".gfw"
             self.file_extent = ".gif"
         else:
-            grass.fatal("Uknown image format '%s'" % format_opt)
+            grass.fatal(_("Uknown image format '%s'") % format_opt)
         
         # create download directory
         if not os.path.exists(self.options['folder']):
@@ -106,7 +106,7 @@ class WMSRequest:
         return ret
     
     def GetTiles(self):
-        grass.message("Calculating tiles...")
+        grass.message(_("Calculating tiles..."))
         tiles = grass.read_command('r.tileset',
                                 quiet = True,
                                 flags = 'g',
@@ -117,7 +117,7 @@ class WMSRequest:
                                 maxrows = int(self.options['maxrows']),
                                 **self.tileset_options)
         if not tiles:
-            grass.fatal("r.tileset failed")
+            grass.fatal(_("r.tileset failed"))
         tiles = tiles.splitlines()
         
         if self.flags['c']:
@@ -173,7 +173,7 @@ class WMSRequest:
             i += 1
             
         rf.close()
-        grass.message("Done: requesting %d tiles" % len(tiles))
+        grass.message(_("Done: requesting %d tiles") % len(tiles))
         if len(tiles) > 200:
 	    grass.warning("Proceed with care. This number of tiles may \
 	      exceed the maximum command line arguments available from \

+ 7 - 7
scripts/r.mask/r.mask.py

@@ -58,7 +58,7 @@ def main():
     invert = flags['i']
 
     if not remove and not input:
-	grass.fatal("Required parameter <input> not set")
+	grass.fatal(_("Required parameter <input> not set"))
 
     mapset = grass.gisenv()['MAPSET']
     exists = bool(grass.find_file('MASK', element = 'cell', mapset = mapset)['file'])
@@ -66,12 +66,12 @@ def main():
     if remove:
 	if exists:
 	    grass.run_command('g.remove', rast = 'MASK')
-	    grass.message("Raster MASK removed")
+	    grass.message(_("Raster MASK removed"))
  	else:
-	    grass.warning("No existing MASK to remove")
+	    grass.warning(_("No existing MASK to remove"))
     else:
 	if exists and not grass.overwrite():
-	    grass.fatal("MASK already found in current mapset. Delete first or overwrite")
+	    grass.fatal(_("MASK already found in current mapset. Delete first or overwrite"))
 
 	p = grass.feed_command('r.reclass', input = input, output = 'MASK', overwrite = True)
 	p.stdin.write("%s = 1" % maskcats)
@@ -84,11 +84,11 @@ def main():
 	    grass.run_command('g.rename', rast = ('MASK',tmp), quiet = True)
 	    grass.mapcalc("MASK=if(isnull($tmp),1,null())", tmp = tmp)
 	    grass.run_command('g.remove', rast = tmp, quiet = True)
-	    grass.message("Inverted MASK created.")
+	    grass.message(_("Inverted MASK created."))
 	else:
-	    grass.message("MASK created.")
+	    grass.message(_("MASK created."))
 
-        grass.message("All subsequent raster operations will be limited to MASK area" +
+        grass.message(_("All subsequent raster operations will be limited to MASK area") +
 		      "Removing or renaming raster file named MASK will" +
 		      "restore raster operations to normal")
 

+ 3 - 3
scripts/r.plane/r.plane.py

@@ -89,10 +89,10 @@ def main():
 
     ### test input values ###
     if abs(dip) >= 90:
-	grass.fatal("dip must be between -90 and 90.")
+	grass.fatal(_("dip must be between -90 and 90."))
 
     if az < 0 or az >= 360:
-	grass.fatal("azimuth must be between 0 and 360")
+	grass.fatal(_("azimuth must be between 0 and 360"))
 
     ### now the actual algorithm
     az_r  = math.radians(-az)
@@ -116,7 +116,7 @@ def main():
 
     grass.raster_history(name)
 
-    grass.message("Done.")
+    grass.message(_("Done."))
     t = string.Template("Raster map <$name> generated by r.plane " +
 			"at point $ea E, $no N, elevation $el with dip = $dip degrees and " +
 			"aspect = $az degrees ccw from north.")

+ 10 - 10
scripts/r.reclass.area/r.reclass.area.py

@@ -68,34 +68,34 @@ def main():
     kv = grass.parse_key_val(s, sep = ':')
     s = kv['projection'].strip().split()
     if s == '0':
-	grass.fatal("xy-locations are not supported")
-	grass.fatal("Need projected data with grids in meters")
+	grass.fatal(_("xy-locations are not supported"))
+	grass.fatal(_("Need projected data with grids in meters"))
 
     if not lesser and not greater:
-	grass.fatal("You have to specify either lesser= or greater=")
+	grass.fatal(_("You have to specify either lesser= or greater="))
     if lesser and greater:
-	grass.fatal("lesser= and greater= are mutually exclusive")
+	grass.fatal(_("lesser= and greater= are mutually exclusive"))
     if lesser:
 	limit = float(lesser)
     if greater:
 	limit = float(greater)
 
     if not grass.find_file(infile)['name']:
-	grass.fatal("Raster map <%s> not found" % infile)
+	grass.fatal(_("Raster map <%s> not found") % infile)
 
     clumpfile = "%s.clump.%s" % (infile.split('@')[0], outfile)
 
     if not grass.overwrite():
 	if grass.find_file(clumpfile)['name']:
-	    grass.fatal("Temporary raster map <%s> exists" % clumpfile)
+	    grass.fatal(_("Temporary raster map <%s> exists") % clumpfile)
 
-    grass.message("Generating a clumped raster file ...")
+    grass.message(_("Generating a clumped raster file ..."))
     grass.run_command('r.clump', input = infile, output = clumpfile)
 
     if lesser:
-	grass.message("Generating a reclass map with area size less than or equal to %f hectares..." % limit)
+	grass.message(_("Generating a reclass map with area size less than or equal to %f hectares...") % limit)
     else:
-	grass.message("Generating a reclass map with area size greater than or equal to %f hectares..." % limit)
+	grass.message(_("Generating a reclass map with area size greater than or equal to %f hectares...") % limit)
 
     recfile = outfile + '.recl'
 
@@ -116,7 +116,7 @@ def main():
     p2.stdin.close()
     p2.wait()
 
-    grass.message("Generating output raster map <$outfile>..." % outfile)
+    grass.message(_("Generating output raster map <$outfile>...") % outfile)
 
     grass.mapcalc("$outfile = $recfile", outfile = outfile, recfile = recfile)
     grass.run_command('g.remove', rast = [recfile, clumpfile], quiet = True)

+ 2 - 2
scripts/r.regression.line/r.regression.line.py

@@ -64,9 +64,9 @@ def main():
     output = options['output']
 
     if not grass.find_file(map1)['name']:
-	grass.fatal("Raster map <%s> not found" % map1)
+	grass.fatal(_("Raster map <%s> not found") % map1)
     if not grass.find_file(map2)['name']:
-	grass.fatal("Raster map <%s> not found" % map2)
+	grass.fatal(_("Raster map <%s> not found") % map2)
 
     #calculate regression equation
     if slow:

+ 1 - 1
scripts/r.rgb/r.rgb.py

@@ -41,7 +41,7 @@ def main():
     output = options['output']
 
     if not grass.find_file(input)['file']:
-	grass.fatal("Map <%s> not found." % input)
+	grass.fatal(_("Map <%s> not found.") % input)
 
     if not output:
 	output = input

+ 6 - 6
scripts/r.shaded.relief/r.shaded.relief.py

@@ -121,10 +121,10 @@ def main():
     units = options['units']
 
     if not grass.find_file(input)['file']:
-	grass.fatal("Map <%s> not found." % input)
+	grass.fatal(_("Map <%s> not found.") % input)
 
     if input == output:
-	grass.fatal("Input elevation map and output relief map must have different names")
+	grass.fatal(_("Input elevation map and output relief map must have different names"))
 
     elev = input
 
@@ -152,7 +152,7 @@ def main():
     #  this seems to be backwards, but in fact it works so leave it.
     az = float(azimuth) - 90
 
-    grass.message("Calculating shading, please stand by.")
+    grass.message(_("Calculating shading, please stand by."))
 
     t = string.Template(
 	r'''eval( \
@@ -173,7 +173,7 @@ def main():
     p.stdin.close()
 
     if p.wait() != 0:
-	grass.fatal("In calculation, script aborted.")
+	grass.fatal(_("In calculation, script aborted."))
 
     grass.run_command('r.colors', map = elevshade, color = 'grey')
 
@@ -187,9 +187,9 @@ def main():
 	grass.run_command('r.support', map = elevshade, history = "  units=%s (adjusted scale=%s)" % (units, scale))
 
     if output:
-	grass.message("Shaded relief map created and named <%s>." % elevshade)
+	grass.message(_("Shaded relief map created and named <%s>.") % elevshade)
     else:
-	grass.message("Shaded relief map created and named <%s>. Consider renaming." % elevshade)
+	grass.message(_("Shaded relief map created and named <%s>. Consider renaming.") % elevshade)
 
     # write cmd history:
     grass.raster_history(elevshade)

+ 3 - 3
scripts/r.tileset/r.tileset.py

@@ -239,7 +239,7 @@ def main():
                                        quiet = True,
                                        flags = 'jf').rstrip('\n')
         if not dest_proj:
-            grass.fatal('g.proj failed')
+            grass.fatal(_('g.proj failed'))
     else:
         dest_proj = options['destproj']
     grass.debug("Getting destination projection -> '%s'" % dest_proj)
@@ -250,7 +250,7 @@ def main():
                                  quiet = True,
                                  flags = 'j')
         if not ret:
-            grass.fatal('g.proj failed')
+            grass.fatal(_('g.proj failed'))
         
         dest_scale = ret['+to_meter'].strip()
     else:
@@ -319,7 +319,7 @@ def main():
     # I'm going to make the numbers all simpler and add this extra cell to
     # every tile.
     
-    grass.message('Computing tiling...')
+    grass.message(_('Computing tiling...'))
     tiles = [-1, -1]
     tile_base_size = [-1, -1]
     tiles_extra_1 = [-1, -1]

+ 2 - 2
scripts/v.build.all/v.build.all.py

@@ -26,8 +26,8 @@ def main():
     ret = 0
     for vect in grass.list_grouped('vect')[mapset]:
 	map = "%s@%s" % (vect, mapset)
-	grass.message("Build topology for vector '%s'" % map)
-	grass.message("v.build map=%s" % map)
+	grass.message(_("Build topology for vector '%s'") % map)
+	grass.message(_("v.build map=%s") % map)
 	if grass.run_command("v.build", map = map) != 0:
 	    ret = 1
     sys.exit(ret)

+ 1 - 1
scripts/v.centroids/v.centroids.py

@@ -79,7 +79,7 @@ def main():
     if options['option'] == 'add':
         num_bound = grass.vector_info_topo(map = options['input'])['boundaries']
 	if num_bound == 0:
-	    grass.fatal("Input vector map contains no boundaries.")
+	    grass.fatal(_("Input vector map contains no boundaries."))
 
 	grass.exec_command("v.category", type = 'area', **options)
 

+ 18 - 18
scripts/v.colors/v.colors.py

@@ -150,7 +150,7 @@ def main():
     else:
 	vect_mapset = vect_mapset[0]
     if not kv['file'] or vect_mapset != mapset:
-	grass.fatal("Vector map <%s> not found in current mapset" % map)
+	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
 
     vector = map_split[0]
 
@@ -160,7 +160,7 @@ def main():
 	if options[opt]:
 	    ctest += 1
     if ctest != 1:
-	grass.fatal("Pick one of color, rules, or raster options")
+	grass.fatal(_("Pick one of color, rules, or raster options"))
 
     if color:
 	#### check the color rule is valid
@@ -171,19 +171,19 @@ def main():
 			("Valid options are: %s" % ' '.join(color_opts)))
     elif raster:
 	if not grass.find_file(raster)['name']:
-	    grass.fatal("Unable to open raster map <%s>" % raster)
+	    grass.fatal(_("Unable to open raster map <%s>") % raster)
     elif rules:
 	if not os.access(rules, os.R_OK):
-	    grass.fatal("Unable to read color rules file <%s>" % rules)
+	    grass.fatal(_("Unable to read color rules file <%s>") % rules)
 
     #### column checks
     # check input data column
     cols = grass.vector_columns(map, layer = layer)
     if column not in cols:
-	grass.fatal("Column <%s> not found" % column)
+	grass.fatal(_("Column <%s> not found") % column)
     ncolumn_type = cols[column]
     if ncolumn_type not in ["INTEGER", "DOUBLE PRECISION"]:
-	grass.fatal("Column <%s> is not numeric" % column)
+	grass.fatal(_("Column <%s> is not numeric") % column)
 
     #g.message "column <$GIS_OPT_COLUMN> is type [$NCOLUMN_TYPE]"
 
@@ -191,17 +191,17 @@ def main():
     table = grass.vector_db(map)[layer]['table']
     if rgb_column not in cols:
         # RGB Column not found, create it
-	grass.message("Creating column <%s> ..." % rgb_column)
+	grass.message(_("Creating column <%s> ...") % rgb_column)
 	if 0 != grass.run_command('v.db.addcol', map = map, layer = layer, column = "%s varchar(11)" % rgb_column):
-	    grass.fatal("Creating color column")
+	    grass.fatal(_("Creating color column"))
     else:
 	column_type = cols[rgb_column]
 	if column_type not in ["CHARACTER", "TEXT"]:
-	    grass.fatal("Column <%s> is not of compatible type (found %s)" % (rgb_column, column_type))
+	    grass.fatal(_("Column <%s> is not of compatible type (found %s)") % (rgb_column, column_type))
 	else:
 	    num_chars = dict([(v[0], int(v[2])) for v in grass.db_describe(table)['cols']])[rgb_column]
 	    if num_chars < 11:
-		grass.fatal("Color column <%s> is not wide enough (needs 11 characters)", rgb_column)
+		grass.fatal(_("Color column <%s> is not wide enough (needs 11 characters)"), rgb_column)
 
     cvals = grass.vector_db_select(map, layer = layer, column = column)['values'].values()
 
@@ -210,15 +210,15 @@ def main():
 	#order doesn't matter
 	vals = range.split(',')
     else:
-	grass.message("Scanning values ...")
+	grass.message(_("Scanning values ..."))
 	vals = [float(x[0]) for x in cvals]
 
     minval = min(vals)
     maxval = max(vals)
 
-    grass.message(" min=[%s]  max=[$%s]" % (minval, maxval))
+    grass.message(_(" min=[%s]  max=[$%s]") % (minval, maxval))
     if not minval or not maxval:
-	grass.fatal("Scanning data range")
+	grass.fatal(_("Scanning data range"))
 
     # setup internal region
     use_temp_region()
@@ -251,7 +251,7 @@ def main():
     tmp = grass.tempfile()
 
     # calculate colors and write SQL command file
-    grass.message("Looking up colors ...")
+    grass.message(_("Looking up colors ..."))
 
     f = open(tmp, 'w')
     p = grass.feed_command('r.what.color', flags = 'i', input = tmp_colr, stdout = f)
@@ -281,18 +281,18 @@ def main():
     fo.close()
     
     if not found:
-	grass.fatal("No values found in color range")
+	grass.fatal(_("No values found in color range"))
 
     # apply SQL commands to update the table with values
-    grass.message("Writing %s colors ..." % found)
+    grass.message(_("Writing %s colors ...") % found)
     # less "$TMP"
     if 0 != grass.run_command('db.execute', input = tmp_vcol):
-	grass.fatal("Processing SQL transaction")
+	grass.fatal(_("Processing SQL transaction"))
 
     if flags['s']:
 	vcolors = "vcolors_%d" % pid
 	grass.run_command('g.rename', rast = (tmp_colr, vcolors))
-	grass.message("Raster map containing color rules saved to <%s>" % vcolors)
+	grass.message(_("Raster map containing color rules saved to <%s>") % vcolors)
 	# TODO save full v.colors command line history
 	grass.run_command('r.support', map = vcolors,
 			  history = "",

+ 4 - 4
scripts/v.convert.all/v.convert.all.py

@@ -34,14 +34,14 @@ def main():
 	if grass.run_command("v.convert", input = inmap, output = outmap) == 0:
 	    converted += 1
 	else:
-	    grass.warning("Error converting map %s to %s" % (inmap, outmap))
+	    grass.warning(_("Error converting map %s to %s") % (inmap, outmap))
 	    ret = 1
 
 	if converted < 1:
-	    grass.warning("No vector maps converted as no old vector maps present in current mapset.")
+	    grass.warning(_("No vector maps converted as no old vector maps present in current mapset."))
 	else:
-	    grass.message("Total %u vector maps in current mapset converted." % converted)
-	    grass.message("Please verify new vector map(s) before deleting old vector map(s).")
+	    grass.message(_("Total %u vector maps in current mapset converted.") % converted)
+	    grass.message(_("Please verify new vector map(s) before deleting old vector map(s)."))
 
 	sys.exit(ret)
 

+ 4 - 4
scripts/v.db.addcol/v.db.addcol.py

@@ -62,12 +62,12 @@ def main():
     exists = bool(grass.find_file(map, element = 'vector', mapset = mapset)['file'])
 
     if not exists:
-	grass.fatal("Vector map <%s> not found in current mapset" % map)
+	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
 
     try:
         f = grass.vector_db(map)[int(layer)]
     except KeyError:
-	grass.fatal("There is no table connected to this map. Run v.db.connect or v.db.addtable first.")
+	grass.fatal(_("There is no table connected to this map. Run v.db.connect or v.db.addtable first."))
     table = f['table']
     database = f['database']
     driver = f['driver']
@@ -76,13 +76,13 @@ def main():
 
     for col in columns:
 	if not col:
-	    grass.fatal("There is an empty column. Did you leave a trailing comma?")
+	    grass.fatal(_("There is an empty column. Did you leave a trailing comma?"))
 
 	p = grass.feed_command('db.execute', input = '-', database = database, driver = driver)
 	p.stdin.write("ALTER TABLE %s ADD COLUMN %s" % (table, col))
 	p.stdin.close()
 	if p.wait() != 0:
-	    grass.fatal("Unable to add column <%s>." % col)
+	    grass.fatal(_("Unable to add column <%s>.") % col)
 
     # write cmd history:
     grass.vector_history(map)

+ 10 - 10
scripts/v.db.addtable/v.db.addtable.py

@@ -65,20 +65,20 @@ def main():
 
     # does map exist in CURRENT mapset?
     if not grass.find_file(map, element = 'vector', mapset = mapset)['file']:
-	grass.fatal("Vector map <%s> not found in current mapset" % map)
+	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
 
     map_name = map.split('@')[0]
 
     if not table:
 	if layer == '1':
-	    grass.message("Using vector map name as table name: " + map_name)
+	    grass.message(_("Using vector map name as table name: ") + map_name)
 	    table = map_name
 	else:
 	    # to avoid tables with identical names on higher layers
-	    grass.message("Using vector map name extended by layer number as table name: %s_%s" % (map_name, layer))
+	    grass.message(_("Using vector map name extended by layer number as table name: %s_%s") % (map_name, layer))
 	    table = "%s_%s" % (map_name, layer)
     else:
-	grass.message("Using user specified table name: " + table)
+	grass.message(_("Using user specified table name: ") + table)
 
     # check if DB parameters are set, and if not set them.
     grass.run_command('db.connect', flags = 'c')
@@ -92,7 +92,7 @@ def main():
 	driver = f['driver']
     else:
 	# nothing defined
-	grass.message("Creating new DB connection based on default mapset settings...")
+	grass.message(_("Creating new DB connection based on default mapset settings..."))
 	kv = grass.db_connection()
 	database = kv['database']
 	driver = kv['driver']
@@ -100,7 +100,7 @@ def main():
     # maybe there is already a table linked to the selected layer?
     try:
         grass.vector_db(map, stderr = nuldev)[int(layer)]
-	grass.fatal("There is already a table linked to layer <%s>" % layer)
+	grass.fatal(_("There is already a table linked to layer <%s>") % layer)
     except KeyError:
         pass
     
@@ -121,21 +121,21 @@ def main():
 	    column_def.append("cat integer")
 	column_def = ','.join(column_def)
 
-	grass.message("Creating table with columns (%s)" % column_def)
+	grass.message(_("Creating table with columns (%s)") % column_def)
 
 	# take care if the DBF directory is missing (heck, the DBF driver should take care!)
 	if driver == "dbf":
 	    env = grass.gisenv()
 	    path = os.path.join(env['GISDBASE'], env['LOCATION_NAME'], env['MAPSET'], "dbf")
 	    if not os.path.isdir(path):
-		grass.message("Creating missing DBF directory in mapset <%s>" % env['MAPSET'])
+		grass.message(_("Creating missing DBF directory in mapset <%s>") % env['MAPSET'])
 		os.mkdir(path)
 		grass.run_command('db.connect', driver = dbf, database = '$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/')
 
     sql = "CREATE TABLE %s (%s)" % (table, column_def)
 
     if grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql) != 0:
-	grass.fatal("Cannot continue.")
+	grass.fatal(_("Cannot continue."))
 
     # connect the map to the DB:
     grass.run_command('v.db.connect', map = map, database = database, driver = driver,
@@ -147,7 +147,7 @@ def main():
                       option = 'cat', column = 'cat', qlayer = layer)
 
     if grass.verbosity() > 0:
-	grass.message("Current attribute table links:")
+	grass.message(_("Current attribute table links:"))
 	grass.run_command('v.db.connect', flags = 'p', map = map)
 
     # write cmd history:

+ 5 - 5
scripts/v.db.dropcolumn/v.db.dropcolumn.py

@@ -63,7 +63,7 @@ def main():
 
     # does map exist in CURRENT mapset?
     if not grass.find_file(map, element = 'vector', mapset = mapset):
-	grass.fatal("Vector map <%s> not found in current mapset" % map)
+	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
 
     f = grass.vector_layer_db(map, layer)
 
@@ -73,13 +73,13 @@ def main():
     driver = f['driver']
 
     if not table:
-	grass.fatal("There is no table connected to the input vector map Cannot delete any column")
+	grass.fatal(_("There is no table connected to the input vector map Cannot delete any column"))
 
     if column == keycol:
-	grass.fatal("Cannot delete <$col> column as it is needed to keep table <%s> connected to the input vector map <%s>" % (table, map))
+	grass.fatal(_("Cannot delete <$col> column as it is needed to keep table <%s> connected to the input vector map <%s>") % (table, map))
 
     if not grass.vector_columns(map, layer).has_key(column):
-	grass.fatal("Column <%s> not found in table <%s>" % (column, table))
+	grass.fatal(_("Column <%s> not found in table <%s>") % (column, table))
 
     if driver == "sqlite":
 	#echo "Using special trick for SQLite"
@@ -112,7 +112,7 @@ def main():
 
     if grass.write_command('db.execute', input = '-', database = database, driver = driver,
 			   stdin = sql) != 0:
-	grass.fatal("Cannot continue (problem deleting column).")
+	grass.fatal(_("Cannot continue (problem deleting column)."))
 
     # write cmd history:
     grass.vector_history(map)

+ 9 - 9
scripts/v.db.droptable/v.db.droptable.py

@@ -63,39 +63,39 @@ def main():
 	# Removing table name connected to selected layer
 	table = f['table']
 	if not table:
-	    grass.fatal("No table assigned to layer <%s>" % layer)
+	    grass.fatal(_("No table assigned to layer <%s>") % layer)
     else:
 	# Removing user specified table
 	existingtable = f['table']
 	if existingtable != table:
-	    grass.fatal("User selected table <%s> but the table <%s> is linked to layer <%s>"
+	    grass.fatal(_("User selected table <%s> but the table <%s> is linked to layer <%s>")
 			% (table, existingtable, layer))
 
     # we use the DB settings selected layer 
     database = f['database']
     driver = f['driver']
 
-    grass.message("Removing table <%s> linked to layer <%s> of vector map <%s>"
+    grass.message(_("Removing table <%s> linked to layer <%s> of vector map <%s>")
 		  % (table, layer, map)) 
 
     if not force:
-	grass.message("You must use the -f (force) flag to actually remove the table. Exiting.")
-	grass.message("Leaving map/table unchanged.")
+	grass.message(_("You must use the -f (force) flag to actually remove the table. Exiting."))
+	grass.message(_("Leaving map/table unchanged."))
 	sys.exit(0)
 
-    grass.message("Dropping table <%s>..." % table)
+    grass.message(_("Dropping table <%s>...") % table)
 
     if grass.write_command('db.execute', stdin = "DROP TABLE %s" % table, input = '-') != 0:
-	grass.fatal("An error occured while running db.execute")
+	grass.fatal(_("An error occured while running db.execute"))
 
     grass.run_command('v.db.connect', flags = 'd', map = map, layer = layer)
 
-    grass.message("Current attribute table link(s):") 
+    grass.message(_("Current attribute table link(s):")) 
     # silently test first to avoid confusing error messages
     nuldev = file(os.devnull, 'w')
     if grass.run_command('v.db.connect', flags ='p', map = map, quiet = True,
 			 stdout = nuldev, stderr = nuldev) != 0:
-	grass.message("(No database links remaining)")
+	grass.message(_("(No database links remaining)"))
     else:
 	grass.run_command('v.db.connect', flags ='p', map = map)
 

+ 5 - 5
scripts/v.db.join/v.db.join.py

@@ -85,13 +85,13 @@ def main():
     driver = f['driver']
 
     if driver == 'dbf':
-	grass.fatal("JOIN is not supported for tables stored in DBF format.")
+	grass.fatal(_("JOIN is not supported for tables stored in DBF format."))
 
     if not maptable:
-	grass.fatal("There is no table connected to this map. Cannot join any column.")
+	grass.fatal(_("There is no table connected to this map. Cannot join any column."))
 
     if not grass.vector_columns(map, layer).has_key(column):
-	grass.fatal("Column <%> not found in table <%s> at layer <%s>" % (column, map, layer))
+	grass.fatal(_("Column <%> not found in table <%s> at layer <%s>") % (column, map, layer))
 
     cols = grass.db_describe(otable, driver = driver, database = database)['cols']
 
@@ -107,14 +107,14 @@ def main():
 	colspec = "%s %s" % (colname, coltype)
 
 	if grass.run_command('v.db.addcol', map = map, columns = colspec, layer = layer) != 0:
-	    grass.fatal("Error creating column <%s>." % colname)
+	    grass.fatal(_("Error creating column <%s>.") % colname)
 
 	stmt = template.substitute(table = maptable, column = column,
 				   otable = otable, ocolumn = ocolumn,
 				   colname = colname)
 
 	if grass.write_command('db.execute', stdin = stmt, input = '-', database = database, driver = driver) != 0:
-	    grass.fatal("Error filling column <%s>." % colname)
+	    grass.fatal(_("Error filling column <%s>.") % colname)
 
     # write cmd history:
     grass.vector_history(map)

+ 5 - 5
scripts/v.db.reconnect.all/v.db.reconnect.all.py

@@ -60,7 +60,7 @@ def main():
 
     for vect in grass.list_grouped('vect')[mapset]:
 	vect = "%s@%s" % (vect, mapset)
-	grass.message("Reconnecting vector <%s>" % vect)
+	grass.message(_("Reconnecting vector <%s>") % vect)
 	for f in grass.vector_db(map, stderr = nuldev).itervalues():
 	    layer = f['layer']
 	    schema_table = f['table']
@@ -80,16 +80,16 @@ def main():
 	    else:
 		new_schema_table = table
 
-	    grass.message("SCHEMA = %s TABLE = %s NEW_SCHEMA_TABLE = %s" % (schema, table, new_schema_table))
+	    grass.message(_("SCHEMA = %s TABLE = %s NEW_SCHEMA_TABLE = %s") % (schema, table, new_schema_table))
 	    if database == old_database and schema == old_schema:
-		grass.message("Reconnecting layer " + layer)
-		grass.message("v.db.connect -o map=%s layer=%s driver=%s database=%s table=%s key=%s" %
+		grass.message(_("Reconnecting layer ") + layer)
+		grass.message(_("v.db.connect -o map=%s layer=%s driver=%s database=%s table=%s key=%s") %
 			      (vect, layer, driver, new_database, new_schema_table, key))
 		grass.run_command('v.db.connect', flags = 'o', map = vect,
 				  layer = layer, driver = driver, database = new_database,
 				  table = new_schema_table, key = key)
 	    else:
-		grass.message("Layer <%s> will not be reconnected, database or schema do not match." % layer)
+		grass.message(_("Layer <%s> will not be reconnected, database or schema do not match.") % layer)
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 5 - 5
scripts/v.db.renamecolumn/v.db.renamecolumn.py

@@ -62,7 +62,7 @@ def main():
     mapset = grass.gisenv()['MAPSET']
 
     if not grass.find_file(map, element = 'vector', mapset = mapset):
-	grass.fatal("Vector map <%s> not found in current mapset" % map)
+	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
 
     f = grass.vector_layer_db(map, layer)
 
@@ -72,7 +72,7 @@ def main():
     driver = f['driver']
 
     if not table:
-	grass.fatal("There is no table connected to the input vector map. Cannot rename any column")
+	grass.fatal(_("There is no table connected to the input vector map. Cannot rename any column"))
 
     cols = column.split(',')
     oldcol = cols[0]
@@ -80,10 +80,10 @@ def main():
 
     if driver == "dbf":
 	if len(newcol) > 10:
-	    grass.fatal("Column name <%s> too long. The DBF driver supports column names not longer than 10 characters" % newcol)
+	    grass.fatal(_("Column name <%s> too long. The DBF driver supports column names not longer than 10 characters") % newcol)
 
     if oldcol == keycol:
-	grass.fatal("Cannot rename column <%s> as it is needed to keep table <%s> connected to the input vector map" % (oldcol, table))
+	grass.fatal(_("Cannot rename column <%s> as it is needed to keep table <%s> connected to the input vector map") % (oldcol, table))
 
     # describe old col
     oldcoltype = None
@@ -95,7 +95,7 @@ def main():
 
     # old col there?
     if not oldcol:
-	grass.fatal("Column <%s> not found in table <%s>" % (coldcol, table))
+	grass.fatal(_("Column <%s> not found in table <%s>") % (coldcol, table))
 
     # some tricks
     if driver in ['sqlite', 'dbf']:

+ 6 - 6
scripts/v.db.univar/v.db.univar.py

@@ -74,7 +74,7 @@ def sortfile(infile, outfile):
 	grass.run_command('sort', flags = 'n', stdin = inf, stdout = outf)
     else:
 	# FIXME: we need a large-file sorting function
-	grass.warning("'sort' not found: sorting in memory")
+	grass.warning(_("'sort' not found: sorting in memory"))
 	lines = inf.readlines()
 	for i in range(len(lines)):
 	    lines[i] = float(lines[i].rstrip('\r\n'))
@@ -96,8 +96,8 @@ def main():
     driver = options['driver']
     where = options['where']
 
-    grass.message("Calculation for column <%s> of table <%s>..." % (column, table))
-    grass.message("Reading column values...")
+    grass.message(_("Calculation for column <%s> of table <%s>...") % (column, table))
+    grass.message(_("Reading column values..."))
 
     sql = "SELECT %s FROM %s" % (column, table)
     if where:
@@ -118,11 +118,11 @@ def main():
     # check if result is empty
     tmpf = file(tmp)
     if tmpf.read(1) == '':
-	grass.fatal("Table <%s> contains no data.", table)
+	grass.fatal(_("Table <%s> contains no data."), table)
     tmpf.close()
 
     # calculate statistics
-    grass.message("Calculating statistics...")
+    grass.message(_("Calculating statistics..."))
 
     N = 0
     sum = 0.0
@@ -143,7 +143,7 @@ def main():
     tmpf.close()
 
     if N <= 0:
-	grass.fatal("No non-null values found")
+	grass.fatal(_("No non-null values found"))
 
     print ""
     print "Number of values:", N

+ 5 - 5
scripts/v.db.update/v.db.update.py

@@ -79,12 +79,12 @@ def main():
 
     # does map exist in CURRENT mapset?
     if not grass.find_file(map, element = 'vector', mapset = mapset)['file']:
-	grass.fatal("Vector map '$GIS_OPT_MAP' not found in current mapset")
+	grass.fatal(_("Vector map '$GIS_OPT_MAP' not found in current mapset"))
 
     try:
         f = grass.vector_db(map)[int(layer)]
     except KeyError:
-	grass.fatal('There is no table connected to this map. Run v.db.connect or v.db.addtable first.')
+	grass.fatal(_('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
 
     table = f['table']
     database = f['database']
@@ -94,16 +94,16 @@ def main():
     try:
         coltype = grass.vector_columns(map, layer)[column]
     except KeyError:
-	grass.fatal('Column <%s> not found' % column)
+	grass.fatal(_('Column <%s> not found') % column)
 
     if qcolumn:
 	if value:
-	    grass.fatal('value= and qcolumn= are mutually exclusive')
+	    grass.fatal(_('value= and qcolumn= are mutually exclusive'))
 	# special case: we copy from another column
 	value = qcolumn
     else:
 	if not value:
-	    grass.fatal('Either value= or qcolumn= must be given')
+	    grass.fatal(_('Either value= or qcolumn= must be given'))
 	# we insert a value
 	if coltype.upper() not in ["INTEGER", "DOUBLE PRECISION"]:
 	    value = "'%s'" % value

+ 3 - 3
scripts/v.dissolve/v.dissolve.py

@@ -77,7 +77,7 @@ def main():
 
     # does map exist?
     if not grass.find_file(input, element = 'vector')['file']:
-	grass.fatal("Vector map <%s> not found" % input)
+	grass.fatal(_("Vector map <%s> not found") % input)
     
     if not column:
 	grass.run_command('v.extract', flags = 'd', input = input,
@@ -86,10 +86,10 @@ def main():
         try:
             coltype = grass.vector_columns(input, layer)[column]
         except KeyError:
-            grass.fatal('Column <%s> not found' % column)
+            grass.fatal(_('Column <%s> not found') % column)
         
 	if coltype not in ('INTEGER', 'CHARACTER'):
-	    grass.fatal("Key column must be of type integer or string")
+	    grass.fatal(_("Key column must be of type integer or string"))
 
         f = grass.vector_layer_db(input, layer)
 

+ 12 - 12
scripts/v.in.e00/v.in.e00.py

@@ -67,19 +67,19 @@ def main():
 
     #### check for avcimport
     if not grass.find_program('avcimport'):
-	grass.fatal("'avcimport' program not found, install it first" +
+	grass.fatal(_("'avcimport' program not found, install it first") +
 		    "\n" +
 		    "http://avce00.maptools.org")
 
     #### check for e00conv
     if not grass.find_program('e00conv'):
-	grass.fatal("'e00conv' program not found, install it first" +
+	grass.fatal(_("'e00conv' program not found, install it first") +
 		    "\n" +
 		    "http://avce00.maptools.org")
 
     # check that the user didn't use all three, which gets past the parser.
     if type not in ['point','line','area']:
-	grass.fatal('Must specify one of "point", "line", or "area".')
+	grass.fatal(_('Must specify one of "point", "line", or "area".'))
 
     e00name = grass.basename(filename, 'e00')
     # avcimport only accepts 13 chars:
@@ -88,7 +88,7 @@ def main():
     #check if this is a split E00 file (.e01, .e02 ...):
     merging = False
     if os.path.exists(e00name + '.e01') or os.path.exists(e00name + '.E01'):
-	grass.message("Found that E00 file is split into pieces (.e01, ...). Merging...")
+	grass.message(_("Found that E00 file is split into pieces (.e01, ...). Merging..."))
 	merging = True
 
     if vect:
@@ -125,22 +125,22 @@ def main():
 
     nuldev = file(os.devnull, 'w+')
 
-    grass.message("An error may appear next which will be ignored...")
+    grass.message(_("An error may appear next which will be ignored..."))
     if grass.call(['avcimport', filename, e00shortname], stdout = nuldev, stderr = nuldev) == 1:
-	grass.message("E00 ASCII found and converted to Arc Coverage in current directory")
+	grass.message(_("E00 ASCII found and converted to Arc Coverage in current directory"))
     else:
-	grass.message("E00 Compressed ASCII found. Will uncompress first...")
+	grass.message(_("E00 Compressed ASCII found. Will uncompress first..."))
 	grass.try_remove(e00shortname)
 	grass.try_remove(info)
 	grass.call(['e00conv', filename, e00tmp + '.e00'])
-	grass.message("...converted to Arc Coverage in current directory")
+	grass.message(_("...converted to Arc Coverage in current directory"))
 	grass.call(['avcimport', e00tmp + '.e00', e00shortname], stderr = nuldev)
 
     #SQL name fix:
     name = name.replace('-', '_')
 
     ## let's import...
-    grass.message("Importing %ss..." % type)
+    grass.message(_("Importing %ss...") % type)
 
     layer = dict(point = 'LAB', line = 'ARC', area = ['LAB','ARC'])
     itype = dict(point = 'point', line = 'line', area = 'centroid')
@@ -148,9 +148,9 @@ def main():
     if grass.run_command('v.in.ogr', flags = 'o', dsn = e00shortname,
 			 layer = layer[type], type = itype[type],
 			 output = name) != 0:
-	grass.fatal("An error occurred while running v.in.ogr")
+	grass.fatal(_("An error occurred while running v.in.ogr"))
 
-    grass.message("Imported <%s> vector map <%s>." % (type, name))
+    grass.message(_("Imported <%s> vector map <%s>.") % (type, name))
 
     #### clean up the mess
     for root, dirs, files in os.walk('.', False):
@@ -165,7 +165,7 @@ def main():
     os.rmdir(tmpdir)
 	
     #### end
-    grass.message("Done.")
+    grass.message(_("Done."))
 
     # write cmd history:
     grass.vector_history(name)

+ 4 - 4
scripts/v.in.geonames/v.in.geonames.py

@@ -61,17 +61,17 @@ def main():
     s = grass.read_command("g.proj", flags='j')
     kv = grass.parse_key_val(s)
     if kv['+proj'] != 'longlat':
-	grass.fatal("This module only operates in LatLong/WGS84 locations")
+	grass.fatal(_("This module only operates in LatLong/WGS84 locations"))
 
     # input test
     if not os.access(infile, os.R_OK):
-	grass.fatal("File <%s> not found" % infile)
+	grass.fatal(_("File <%s> not found") % infile)
 
     # DBF doesn't support lengthy text fields
     kv = grass.db_connection()
     dbfdriver = kv['driver'] == 'dbf'
     if dbfdriver:
-	grass.warning("Since DBF driver is used, the content of the 'alternatenames' column might be cut with respect to the original Geonames.org column content")
+	grass.warning(_("Since DBF driver is used, the content of the 'alternatenames' column might be cut with respect to the original Geonames.org column content"))
 
     #let's go
     #change TAB to vertical bar
@@ -86,7 +86,7 @@ def main():
     outf.close()
     inf.close()
 
-    grass.message("Converted %d place names." % num_places)
+    grass.message(_("Converted %d place names.") % num_places)
 
     # pump data into GRASS:
     #  http://download.geonames.org/export/dump/readme.txt

+ 2 - 2
scripts/v.in.gns/v.in.gns.py

@@ -60,7 +60,7 @@ def main():
     s = grass.read_command("g.proj", flags='j')
     kv = grass.parse_key_val(s)
     if kv['+proj'] != 'longlat':
-	grass.fatal("This module only operates in LatLong/WGS84 locations")
+	grass.fatal(_("This module only operates in LatLong/WGS84 locations"))
 
     #### setup temporary file
     tmpfile = grass.tempfile()
@@ -122,7 +122,7 @@ def main():
     outf.close()
     inf.close()
 
-    grass.message("Converted %d place names." % num_places)
+    grass.message(_("Converted %d place names.") % num_places)
 
     #TODO: fix dms_lat,dms_long DDMMSS -> DD:MM:SS
     # Solution:

+ 5 - 5
scripts/v.in.mapgen/v.in.mapgen.py

@@ -78,7 +78,7 @@ def main():
     opts = ""
 
     if not os.path.isfile(infile):
-	grass.fatal("Input file <%s> not found." % infile)
+	grass.fatal(_("Input file <%s> not found.") % infile)
 
     if output:
 	name = output
@@ -179,18 +179,18 @@ VERTI:
 
     if not name:
         #### if no name for vector file given, cat to stdout
-	grass.message("Output to stdout") 
+	grass.message(_("Output to stdout")) 
 	inf = file(digfile)
 	shutil.copyfileobj(inf, sys.stdout)
 	inf.close()
     else:
         #### import to binary vector file
-	grass.message("Importing with v.in.ascii ...") 
+	grass.message(_("Importing with v.in.ascii ...")) 
 	if grass.run_command('v.in.ascii', flags = do3D, input = digfile,
 			     output = name, format = 'standard') == 0:
-	    grass.message('"%s" successfully created' % name) 
+	    grass.message(_('"%s" successfully created') % name) 
 	else:
-	    grass.fatal('An error occured on creating "%s", please check' % name)
+	    grass.fatal(_('An error occured on creating "%s", please check') % name)
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 5 - 5
scripts/v.in.sites.all/v.in.sites.all.py

@@ -31,18 +31,18 @@ def main():
     for site in grass.list_grouped('sites')[mapset]:
 	inmap = "%s@%s" % (site, mapset)
 	outmap = site.replace(".", "_") + "_points"
-	grass.message("Processing %s -> %s" % (inmap, outmap))
+	grass.message(_("Processing %s -> %s") % (inmap, outmap))
 	if grass.run_command("v.in.sites", input = inmap, output = outmap) == 0:
 	    converted += 1
 	else:
-	    grass.warning("Error converting map %s to %s" % (inmap, outmap))
+	    grass.warning(_("Error converting map %s to %s") % (inmap, outmap))
 	    ret = 1
 
 	if converted < 1:
-	    grass.warning("No sites maps converted as no old sites maps present in current mapset.")
+	    grass.warning(_("No sites maps converted as no old sites maps present in current mapset."))
 	else:
-	    grass.message("Total %u sites maps in current mapset converted to vector maps (original names extended by '_points')" % converted)
-	    grass.message("Please verify new vector map(s) before deleting old sites map(s).")
+	    grass.message(_("Total %u sites maps in current mapset converted to vector maps (original names extended by '_points')") % converted)
+	    grass.message(_("Please verify new vector map(s) before deleting old sites map(s)."))
 
 	sys.exit(ret)
 

+ 2 - 2
scripts/v.in.wfs/v.in.wfs.py

@@ -44,7 +44,7 @@ def main():
     tmp = grass.tempfile()
     tmpxml = tmp + '.xml'
 
-    grass.message("Retrieving data ...")
+    grass.message(_("Retrieving data ..."))
     inf = urllib.urlopen(wfs_url)
     outf = file(tmpxml, 'wb')
     while True:
@@ -58,7 +58,7 @@ def main():
     grass.run_command('v.in.ogr', flags = 'o', dsn = tmpxml, out = out)
     grass.try_remove(tmpxml)
 
-    grass.message("Vector points map <%s> imported from WFS." % out)
+    grass.message(_("Vector points map <%s> imported from WFS.") % out)
 
 if __name__ == "__main__":
     options, flags = grass.parser()

+ 13 - 13
scripts/v.out.gps/v.out.gps.py

@@ -146,9 +146,9 @@ def main():
 
     nflags = len(filter(None, [wpt, rte, trk]))
     if nflags > 1:
-	grass.fatal("One feature at a time please.")
+	grass.fatal(_("One feature at a time please."))
     if nflags < 1:
-	grass.fatal("No features requested for export.")
+	grass.fatal(_("No features requested for export."))
 
     # set some reasonable defaults
     if not type:
@@ -160,17 +160,17 @@ def main():
     #### check for gpsbabel
     ### FIXME: may need --help or similar?
     if not grass.find_program("gpsbabel"):
-	grass.fatal("The gpsbabel program was not found, please install it first.\n" +
+	grass.fatal(_("The gpsbabel program was not found, please install it first.\n") +
 		    "http://gpsbabel.sourceforge.net")
 
     #### check for cs2cs
     if not grass.find_program("cs2cs"):
-	grass.fatal("The cs2cs program was not found, please install it first.\n" +
+	grass.fatal(_("The cs2cs program was not found, please install it first.\n") +
 		    "http://proj.osgeo.org")
 
     # check if we will overwrite data
     if os.path.exists(output) and not grass.overwrite():
-	grass.fatal("Output file already exists.")
+	grass.fatal(_("Output file already exists."))
 
     #### set temporary files
     tmp = grass.tempfile()
@@ -183,11 +183,11 @@ def main():
 				output = tmp_extr, type = type, layer = layer,
 				where = where, quiet = True)
 	if ret != 0:
-	    grass.fatal("Error executing SQL query")
+	    grass.fatal(_("Error executing SQL query"))
 
 	kv = grass.vector_info_topo(tmp_extr)
 	if kv['primitives'] == 0:
-	    grass.fatal("SQL query returned an empty map (no %s features?)" % type)
+	    grass.fatal(_("SQL query returned an empty map (no %s features?)") % type)
 
 	inmap = tmp_extr
     else:
@@ -232,7 +232,7 @@ def main():
     p2.wait()
 
     if p1.returncode != 0 or p2.returncode != 0:
-	grass.fatal("Error reprojecting data")
+	grass.fatal(_("Error reprojecting data"))
 
     tmp_vogb = "tmp_vogb_epsg4326_%d" % os.getpid()
     p3 = grass.feed_command('v.in.ascii', out = tmp_vogb, format = 'standard', flags = 'n', quiet = True)
@@ -249,7 +249,7 @@ def main():
     p3.wait()
 
     if p3.returncode != 0:
-	grass.fatal("Error reprojecting data")
+	grass.fatal(_("Error reprojecting data"))
 
     # don't v.db.connect directly as source table will be removed with
     # temporary map in that case. So we make a temp copy of it to work with.
@@ -268,11 +268,11 @@ def main():
 				from_table = db_table,
 				to_table = tmp_vogb)
 	if ret != 0:
-	    grass.fatal("Error copying temporary DB")
+	    grass.fatal(_("Error copying temporary DB"))
 
 	ret = grass.run_command('v.db.connect', map = tmp_vogb, table = tmp_vogb, quiet = True)
 	if ret != 0:
-	    grass.fatal("Error reconnecting temporary DB")
+	    grass.fatal(_("Error reconnecting temporary DB"))
 
     # export as GPX using v.out.ogr
     if trk:
@@ -298,7 +298,7 @@ def main():
 			    type = type, format = 'GPX', lco = linetype,
 			    dsco = "GPX_USE_EXTENSIONS=YES", quiet = True)
     if ret != 0:
-	grass.fatal("Error exporting data")
+	grass.fatal(_("Error exporting data"))
 
     if format == 'gpx':
 	# short circuit, we have what we came for.
@@ -327,7 +327,7 @@ def main():
 		      '-F', output])
 
     if ret != 0:
-	grass.fatal("Error running GpsBabel")
+	grass.fatal(_("Error running GpsBabel"))
 
     grass.verbose("Done.")
 

+ 11 - 11
scripts/v.rast.stats/v.rast.stats.py

@@ -79,7 +79,7 @@ def cleanup():
     grass.run_command('g.remove', rast = '%s_%s' % (vector, tmpname), quiet = True)
     grass.run_command('g.remove', rast = 'MASK', quiet = True, stderr = nuldev)
     if mask_found:
-	grass.message("Restoring previous MASK...")
+	grass.message(_("Restoring previous MASK..."))
 	grass.run_command('g.rename', rast = (tmpname + "_origmask", 'MASK'), quiet = True)
 #    for f in [tmp, tmpname, sqltmp]:
 #	grass.try_remove(f)
@@ -113,18 +113,18 @@ def main():
 
     # does map exist in CURRENT mapset?
     if vect_mapset != mapset or not grass.find_file(vector, 'vector', mapset)['file']:
-	grass.fatal("Vector map <%s> not found in current mapset" % vector)
+	grass.fatal(_("Vector map <%s> not found in current mapset") % vector)
 
     vector = vs[0]
 
     #check the input raster map
     if not grass.find_file(raster, 'cell')['file']:
-	grass.fatal("Raster map <%s> not found" % raster)
+	grass.fatal(_("Raster map <%s> not found") % raster)
 
     #check presence of raster MASK, put it aside
     mask_found = bool(grass.find_file('MASK', 'cell')['file'])
     if mask_found:
-	grass.message("Raster MASK found, temporarily disabled")
+	grass.message(_("Raster MASK found, temporarily disabled"))
 	grass.run_command('g.rename', rast = ('MASK', tmpname + "_origmask"), quiet = True)
 
     #get RASTER resolution of map which we want to query:
@@ -143,7 +143,7 @@ def main():
     #prepare raster MASK
     if grass.run_command('v.to.rast', input = vector, output = "%s_%s" % (vector, tmpname),
 			 use = 'cat', quiet = True) != 0:
-	grass.fatal("An error occurred while converting vector to raster")
+	grass.fatal(_("An error occurred while converting vector to raster"))
 
     #dump cats to file to avoid "too many argument" problem:
     p = grass.pipe_command('r.category', map = '%s_%s' % (vector, tmpname), fs = ';', quiet = True)
@@ -155,19 +155,19 @@ def main():
     #echo "List of categories found: $CATSLIST"
     number = len(cats)
     if number < 1:
-	grass.fatal("No categories found in raster map")
+	grass.fatal(_("No categories found in raster map"))
 
     #check if DBF driver used, in this case cut to 10 chars col names:
     try:
         fi = grass.vector_db(map = vector)[int(layer)]
     except KeyError:
-	grass.fatal('There is no table connected to this map. Run v.db.connect or v.db.addtable first.')
+	grass.fatal(_('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
     # we need this for non-DBF driver:
     dbfdriver = fi['driver'] == 'dbf'
 
     #Find out which table is linked to the vector map on the given layer
     if not fi['table']:
-	grass.fatal('There is no table connected to this map. Run v.db.connect or v.db.addtable first.')
+	grass.fatal(_('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
 
     basecols = ['n', 'min', 'max', 'range', 'mean', 'stddev', 'variance', 'cf_var', 'sum']
 
@@ -208,7 +208,7 @@ def main():
     if addcols:
 	grass.verbose("Adding columns <%s>" % addcols)
 	if grass.run_command('v.db.addcol', map = vector, columns = addcols) != 0:
-	    grass.fatal("Cannot continue (problem adding columns).")
+	    grass.fatal(_("Cannot continue (problem adding columns)."))
 
     #loop over cats and calculate statistics:
     grass.verbose("Processing data ...")
@@ -226,7 +226,7 @@ def main():
     currnum = 1
 
     for i in cats:
-	grass.message("Processing category %s (%d/%d)..." % (i, currnum, number))
+	grass.message(_("Processing category %s (%d/%d)...") % (i, currnum, number))
 	grass.run_command('g.remove', rast = 'MASK', quiet = True, stderr = nuldev)
 	grass.mapcalc("MASK = if($name == $i, 1, null())",
 		      name = "%s_%s" % (vector, tmpname), i = i)
@@ -255,7 +255,7 @@ def main():
 
     f.close()
 
-    grass.message("Updating the database ...")
+    grass.message(_("Updating the database ..."))
     exitcode = grass.run_command('db.execute', input = sqltmp,
 				 database = fi['database'], driver = fi['driver'])
     

+ 3 - 3
scripts/v.report/v.report.py

@@ -71,7 +71,7 @@ def uniq(l):
 
 def main():
     if flags['r'] and flags['s']:
-	grass.fatal("Either -r or -s flag")
+	grass.fatal(_("Either -r or -s flag"))
 
     mapname = options['map']
     option = options['option']
@@ -81,7 +81,7 @@ def main():
     nuldev = file(os.devnull, 'w')
 
     if not grass.find_file(mapname, 'vector')['file']:
-	grass.fatal("Vector map '%s' not found in mapset search path." % mapname)
+	grass.fatal(_("Vector map '%s' not found in mapset search path.") % mapname)
 
     table_exists = grass.vector_columns(mapname, layer, stderr = nuldev)
 
@@ -120,7 +120,7 @@ def main():
 	if len(records1) == 0:
             try:
                 f = grass.vector_db(map = mapname)[int(layer)]
-                grass.fatal("There is a table connected to input vector map '%s', but" +
+                grass.fatal(_("There is a table connected to input vector map '%s', but") +
                             "there are no categories present in the key column '%s'. Consider using" +
                             "v.to.db to correct this." % (mapname, f['key']))
             except KeyError: