[GRASS-SVN] r44023 - grass/trunk/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 24 06:37:48 EDT 2010


Author: martinl
Date: 2010-10-24 03:37:48 -0700 (Sun, 24 Oct 2010)
New Revision: 44023

Modified:
   grass/trunk/lib/python/array.py
   grass/trunk/lib/python/core.py
   grass/trunk/lib/python/db.py
   grass/trunk/lib/python/raster.py
   grass/trunk/lib/python/vector.py
Log:
pythonlib: i18n


Modified: grass/trunk/lib/python/array.py
===================================================================
--- grass/trunk/lib/python/array.py	2010-10-24 10:27:29 UTC (rev 44022)
+++ grass/trunk/lib/python/array.py	2010-10-24 10:37:48 UTC (rev 44023)
@@ -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/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py	2010-10-24 10:27:29 UTC (rev 44022)
+++ grass/trunk/lib/python/core.py	2010-10-24 10:37:48 UTC (rev 44023)
@@ -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/trunk/lib/python/db.py
===================================================================
--- grass/trunk/lib/python/db.py	2010-10-24 10:27:29 UTC (rev 44022)
+++ grass/trunk/lib/python/db.py	2010-10-24 10:37:48 UTC (rev 44023)
@@ -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/trunk/lib/python/raster.py
===================================================================
--- grass/trunk/lib/python/raster.py	2010-10-24 10:27:29 UTC (rev 44022)
+++ grass/trunk/lib/python/raster.py	2010-10-24 10:37:48 UTC (rev 44023)
@@ -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 <%s>. "
+              "Raster map <%s> not found in current mapset." % (map, map)))
     return False
 
 # run "r.info -rgstmpud ..." and parse output
@@ -88,5 +93,4 @@
                    quiet = quiet,
                    verbose = verbose,
                    overwrite = overwrite) != 0:
-	fatal("An error occurred while running r.mapcalc")
-    
+	fatal(_("An error occurred while running r.mapcalc"))

Modified: grass/trunk/lib/python/vector.py
===================================================================
--- grass/trunk/lib/python/vector.py	2010-10-24 10:27:29 UTC (rev 44022)
+++ grass/trunk/lib/python/vector.py	2010-10-24 10:37:48 UTC (rev 44023)
@@ -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,7 @@
     try:
         key = vector_db(map = map)[layer]['key']
     except KeyError:
-        error('Missing layer %d in vector map <%s>' % (layer, map))
+        error(_('Missing layer %d in vector map <%s>') % (layer, map))
         return { 'columns' : [], 'values' : {} }
         
     if kwargs.has_key('columns'):
@@ -194,7 +198,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