[GRASS-dev] [GRASS GIS] #1739: Language switch on wxGUI doesn't affect all strings (was: Language switch on wxGUI doesn't care about all the "mo" files)

GRASS GIS trac at osgeo.org
Sun Sep 23 05:37:21 PDT 2012


#1739: Language switch on wxGUI doesn't affect all strings
---------------------+------------------------------------------------------
 Reporter:  MilenaN  |       Owner:  grass-dev@…              
     Type:  defect   |      Status:  new                      
 Priority:  normal   |   Milestone:  6.4.3                    
Component:  Python   |     Version:  unspecified              
 Keywords:           |    Platform:  All                      
      Cpu:  x86-32   |  
---------------------+------------------------------------------------------
Changes (by marisn):

  * keywords:  wingrass =>
  * platform:  MSWindows XP => All
  * component:  wxGUI => Python


Comment:

 If I understood correctly from non-helpful bug report, issue is with
 strings reported by Python parser preprocessor (or whatever it is).

 Issue is twofold:
  * /lib/python strings are not extracted for translation
  * /lib/python/task.py isn't using gettext

 First part can be solved by (diff for 6.4 svn):
 {{{
 Index: locale/Makefile
 ===================================================================
 --- locale/Makefile     (revision 53236)
 +++ locale/Makefile     (working copy)
 @@ -39,6 +39,7 @@
  TCL_POTFILES = find ../ -name '*.tcl' ! -path '../dist*' ! -path
 '../visualization/nviz/*' | xargs grep -l "\\[_ \|\\[G_msg"
  NVIZTCL_POTFILES = find ../visualization/nviz/scripts \( ! -regex
 '.*/\..*' \) | xargs grep -l "\\[_ \|\\[G_msg"
  WXPY_POTFILES = find ../gui/wxpython -name '*.py' | xargs grep -l "_(\""
 +PYLIB_POTFILES = find ../lib/python -name '*.py' | xargs grep -l "_(\""

  #The xgettext utility is used to automate the creation of
  #portable message files (.po)
 @@ -49,6 +50,7 @@
         fi
         @echo "Generating $(LIBDOMAIN)..."
         xgettext -k_ -o ./templates/$(LIBDOMAIN).pot `$(LIB_POTFILES)`
 +       xgettext -j -k_ -o ./templates/$(LIBDOMAIN).pot
 `$(PYLIB_POTFILES)`
         @echo "Generating $(MODDOMAIN)..."
         xgettext -k_ -o ./templates/$(MODDOMAIN).pot `$(MOD_POTFILES)`
         @echo "Generating $(TCLDOMAIN)..."
 Index: lib/python/task.py
 ===================================================================
 --- lib/python/task.py  (revision 53236)
 +++ lib/python/task.py  (working copy)
 @@ -32,6 +32,10 @@

  from core import *

 +# i18N
 +import os, gettext
 +gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"),
 'locale'), unicode=True)
 +
  class grassTask:
      """!This class holds the structures needed for filling by the
      parser
 }}}

 Still even after applying supplied patch, translated strings are ignored
 in module error dialogs. My guess - something with passing LANG to child
 processes. Somebody with better understanding of Python+parser magic
 should look into it.

 Steps to reproduce issue:
  * start GRASS with non-english interface (can change in WXGUI settings)
  * start any GRASS module with required parameters and press RUN to
 generate "parameter missing" error
  * to see correct behaviour, testing languages grasslibs_LANG.po file must
 be upgraded to contain translation for "parameter missing" etc. strings.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1739#comment:2>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list