[GRASS-SVN] r52589 - in grass/trunk/gui/wxpython: core gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 7 23:40:25 PDT 2012


Author: marisn
Date: 2012-08-07 23:40:25 -0700 (Tue, 07 Aug 2012)
New Revision: 52589

Modified:
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/gui_core/preferences.py
Log:
Add C locale as alias of EN for GUI language switcher

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2012-08-07 18:58:30 UTC (rev 52588)
+++ grass/trunk/gui/wxpython/core/settings.py	2012-08-08 06:40:25 UTC (rev 52589)
@@ -58,6 +58,7 @@
         
         try:
             self.locs = os.listdir(os.path.join(os.environ['GISBASE'], 'locale'))
+            self.locs.append('en') # GRASS doesn't ship EN po files
             self.locs.sort()
             # Add a default choice to not override system locale
             self.locs.insert(0, 'system')

Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py	2012-08-07 18:58:30 UTC (rev 52588)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py	2012-08-08 06:40:25 UTC (rev 52589)
@@ -165,11 +165,17 @@
         Posts event EVT_SETTINGS_CHANGED.
         """
         if self._updateSettings():
-            if self.settings.Get(group = 'language', key = 'locale', subkey = 'lc_all') == 'system':
+            lang = self.settings.Get(group = 'language', key = 'locale', subkey = 'lc_all')
+            if lang == 'system':
+                # Most fool proof way to use system locale is to not provide any locale info at all
                 self.settings.Set(group = 'language', key = 'locale', subkey = 'lc_all', value = None)
+                lang = None
+            if lang == 'en':
+                # GRASS doesn't ship EN translation, default texts have to be used instead
+                self.settings.Set(group = 'language', key = 'locale', subkey = 'lc_all', value = 'C')
+                lang = 'C'
             self.settings.SaveToFile()
             self.parent.goutput.WriteLog(_('Settings saved to file \'%s\'.') % self.settings.filePath)
-            lang = UserSettings.Get(group = 'language', key = 'locale', subkey = 'lc_all')
             if lang:
                 RunCommand('g.gisenv', set = 'LANG=%s' % lang)
             else:
@@ -449,6 +455,8 @@
                                 choices = locales, name = "GetStringSelection")
         if loc in locales:
             elementList.SetStringSelection(loc)
+        if loc == 'C':
+            elementList.SetStringSelection('en')
         self.winId['language:locale:lc_all'] = elementList.GetId()
 
         gridSizer.Add(item = elementList,



More information about the grass-commit mailing list