[GRASS-SVN] r44025 - grass/branches/develbranch_6/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 24 06:43:12 EDT 2010


Author: martinl
Date: 2010-10-24 03:43:12 -0700 (Sun, 24 Oct 2010)
New Revision: 44025

Modified:
   grass/branches/develbranch_6/lib/python/array.py
   grass/branches/develbranch_6/lib/python/core.py
   grass/branches/develbranch_6/lib/python/db.py
   grass/branches/develbranch_6/lib/python/raster.py
   grass/branches/develbranch_6/lib/python/vector.py
Log:
pythonlib: i18n
(merge r44023 from trunk)


Modified: grass/branches/develbranch_6/lib/python/array.py
===================================================================
--- grass/branches/develbranch_6/lib/python/array.py	2010-10-24 10:40:55 UTC (rev 44024)
+++ grass/branches/develbranch_6/lib/python/array.py	2010-10-24 10:43:12 UTC (rev 44025)
@@ -17,7 +17,6 @@
 for details.
 
 @author Glynn Clements
-
 """
 
 import os
@@ -25,6 +24,10 @@
 
 import core as grass
 
+# i18N
+import gettext
+gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+
 class array(numpy.memmap):
     def __new__(cls, dtype = numpy.double):
 	reg = grass.region()
@@ -58,10 +61,10 @@
 	elif kind in 'biu':
 	    flags = 'i'
 	else:
-	    raise ValueError('invalid kind <%s>' % kind)
+	    raise ValueError(_('invalid kind <%s>') % kind)
 
 	if size not in [1,2,4,8]:
-	    raise ValueError('invalid size <%d>' % size)
+	    raise ValueError(_('invalid size <%d>') % size)
 
 	return grass.run_command(
 	    'r.out.bin',
@@ -83,14 +86,14 @@
 	    elif size == 8:
 		flags = 'd'
 	    else:
-		raise ValueError('invalid FP size <%d>' % size)
+		raise ValueError(_('invalid FP size <%d>') % size)
 	    size = None
 	elif kind in 'biu':
 	    if size not in [1,2,4]:
-		raise ValueError('invalid integer size <%d>' % size)
+		raise ValueError(_('invalid integer size <%d>') % size)
 	    flags = None
 	else:
-	    raise ValueError('invalid kind <%s>' % kind)
+	    raise ValueError(_('invalid kind <%s>') % kind)
 
 	reg = grass.region()
 

Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py	2010-10-24 10:40:55 UTC (rev 44024)
+++ grass/branches/develbranch_6/lib/python/core.py	2010-10-24 10:43:12 UTC (rev 44025)
@@ -32,7 +32,7 @@
 
 # i18N
 import gettext
-gettext.install('grassmods', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
 
 # subprocess wrapper that uses shell on Windows
 

Modified: grass/branches/develbranch_6/lib/python/db.py
===================================================================
--- grass/branches/develbranch_6/lib/python/db.py	2010-10-24 10:40:55 UTC (rev 44024)
+++ grass/branches/develbranch_6/lib/python/db.py	2010-10-24 10:43:12 UTC (rev 44025)
@@ -26,6 +26,10 @@
 
 from core import *
 
+# i18N
+import gettext
+gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+
 def db_describe(table, **args):
     """!Return the list of columns for a database table
     (interface to `db.describe -c'). Example:

Modified: grass/branches/develbranch_6/lib/python/raster.py
===================================================================
--- grass/branches/develbranch_6/lib/python/raster.py	2010-10-24 10:40:55 UTC (rev 44024)
+++ grass/branches/develbranch_6/lib/python/raster.py	2010-10-24 10:43:12 UTC (rev 44025)
@@ -27,6 +27,10 @@
 
 from core import *
 
+# i18N
+import gettext
+gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+
 # add raster history
 
 def raster_history(map):
@@ -43,7 +47,8 @@
         run_command('r.support', map = map, history = os.environ['CMDLINE'])
         return True
     
-    warning("Unable to write history for <%s>. Raster map <%s> not found in current mapset." % (map, map))
+    warning(_("Unable to write history for <%(map)s>. "
+              "Raster map <%(map)s> not found in current mapset." % { 'map' : map, 'map' : map}))
     return False
 
 # run "r.info -rgstmpud ..." and parse output
@@ -93,4 +98,4 @@
         env['GRASS_OVERWRITE'] = '1'
 
     if write_command('r.mapcalc', stdin = e, env = env) != 0:
-	fatal("An error occurred while running r.mapcalc")
+	fatal(_("An error occurred while running r.mapcalc"))

Modified: grass/branches/develbranch_6/lib/python/vector.py
===================================================================
--- grass/branches/develbranch_6/lib/python/vector.py	2010-10-24 10:40:55 UTC (rev 44024)
+++ grass/branches/develbranch_6/lib/python/vector.py	2010-10-24 10:43:12 UTC (rev 44025)
@@ -26,6 +26,10 @@
 
 from core import *
 
+# i18N
+import gettext
+gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+
 # run "v.db.connect -g ..." and parse output
 
 def vector_db(map, **args):
@@ -82,7 +86,7 @@
     try:
         f = vector_db(map)[int(layer)]
     except KeyError:
-	fatal("Database connection not defined for layer %s" % layer)
+	fatal(_("Database connection not defined for layer %s") % layer)
 
     return f
 
@@ -179,7 +183,8 @@
     try:
         key = vector_db(map = map)[layer]['key']
     except KeyError:
-        error('Missing layer %d in vector map <%s>' % (layer, map))
+        error(_('Missing layer %(layer)d in vector map <%(map)s>') % \
+                  { 'layer' : layer, 'map' : map })
         return { 'columns' : [], 'values' : {} }
         
     if kwargs.has_key('columns'):
@@ -194,7 +199,7 @@
                        fs = '|', **kwargs)
     
     if not ret:
-        error('vector_select() failed')
+        error(_('vector_select() failed'))
         return { 'columns' : [], 'values' : {} }
     
     columns = []



More information about the grass-commit mailing list