浏览代码

wxGUI: fix gettext warnings

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52149 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 13 年之前
父节点
当前提交
b0c66afd0b
共有 2 个文件被更改,包括 16 次插入12 次删除
  1. 14 10
      gui/wxpython/gui_core/goutput.py
  2. 2 2
      lib/python/db.py

+ 14 - 10
gui/wxpython/gui_core/goutput.py

@@ -482,13 +482,14 @@ class GMConsole(wx.SplitterWindow):
         # update history file
         # update history file
         env = grass.gisenv()
         env = grass.gisenv()
         try:
         try:
-            fileHistory = codecs.open(os.path.join(env['GISDBASE'],
-                                                   env['LOCATION_NAME'],
-                                                   env['MAPSET'],
-                                                   '.bash_history'),
-                                      encoding = 'utf-8', mode = 'a')
+            filePath = os.path.join(env['GISDBASE'],
+                                    env['LOCATION_NAME'],
+                                    env['MAPSET'],
+                                    '.bash_history')
+            fileHistory = codecs.open(filePath, encoding = 'utf-8', mode = 'a')
         except IOError, e:
         except IOError, e:
-            GError(_("Unable to write file '%s'.\n\nDetails: %s") % (path, e),
+            GError(_("Unable to write file '%(filePath)s'.\n\nDetails: %(error)s") % 
+                    {filePath: filePath, error : e },
                    parent = self.parent)
                    parent = self.parent)
             fileHistory = None
             fileHistory = None
         
         
@@ -656,7 +657,8 @@ class GMConsole(wx.SplitterWindow):
         
         
         dlg = wx.FileDialog(self, message = _("Save file as..."),
         dlg = wx.FileDialog(self, message = _("Save file as..."),
                             defaultFile = "grass_cmd_output.txt",
                             defaultFile = "grass_cmd_output.txt",
-                            wildcard = _("%s (*.txt)|*.txt|%s (*)|*") % (_("Text files"), _("Files")),
+                            wildcard = _("%(txt)s (*.txt)|*.txt|%(files)s (*)|*") % 
+                            {txt: _("Text files"), files: _("Files")},
                             style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
                             style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
         
         
         # Show the dialog and retrieve the user response. If it is the OK response,
         # Show the dialog and retrieve the user response. If it is the OK response,
@@ -668,7 +670,7 @@ class GMConsole(wx.SplitterWindow):
                 output = open(path, "w")
                 output = open(path, "w")
                 output.write(text)
                 output.write(text)
             except IOError, e:
             except IOError, e:
-                GError(_("Unable to write file '%s'.\n\nDetails: %s") % (path, e))
+                GError(_("Unable to write file '%(path)s'.\n\nDetails: %(error)s") % {path: path, error: e})
             finally:
             finally:
                 output.close()
                 output.close()
             self.parent.SetStatusText(_("Commands output saved into '%s'") % path)
             self.parent.SetStatusText(_("Commands output saved into '%s'") % path)
@@ -781,7 +783,8 @@ class GMConsole(wx.SplitterWindow):
             if len(cmds) > 0:
             if len(cmds) > 0:
                 output.write('\n')
                 output.write('\n')
         except IOError, e:
         except IOError, e:
-            GError(_("Unable to write file '%s'.\n\nDetails: %s") % (path, e))
+            GError(_("Unable to write file '%(filePath)s'.\n\nDetails: %(error)s") % 
+                    {filePath: self.cmdFileProtocol, error: e})
         finally:
         finally:
             output.close()
             output.close()
             
             
@@ -800,7 +803,8 @@ class GMConsole(wx.SplitterWindow):
             # ask for the file
             # ask for the file
             dlg = wx.FileDialog(self, message = _("Save file as..."),
             dlg = wx.FileDialog(self, message = _("Save file as..."),
                                 defaultFile = "grass_cmd_protocol.txt",
                                 defaultFile = "grass_cmd_protocol.txt",
-                                wildcard = _("%s (*.txt)|*.txt|%s (*)|*") % (_("Text files"), _("Files")),
+                                wildcard = _("%(txt)s (*.txt)|*.txt|%(files)s (*)|*") % 
+                                            {txt: _("Text files"), files: _("Files")},
                                 style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
                                 style = wx.SAVE | wx.FD_OVERWRITE_PROMPT)
             if dlg.ShowModal() == wx.ID_OK:
             if dlg.ShowModal() == wx.ID_OK:
                 self.cmdFileProtocol = dlg.GetPath()
                 self.cmdFileProtocol = dlg.GetPath()

+ 2 - 2
lib/python/db.py

@@ -132,8 +132,8 @@ def db_select(sql = None, filename = None, table = None, **args):
     elif table:
     elif table:
         args['table'] = table
         args['table'] = table
     else:
     else:
-        fatal(_("Programmer error: '%s', '%s', or '%s' must be provided") %
-              'sql', 'filename', 'table')
+        fatal(_("Programmer error: '%(sql)s', '%(filename)s', or '%(table)s' must be provided") %
+              {sql: 'sql', filename: 'filename', table: 'table'} )
     
     
     if 'fs' not in args:
     if 'fs' not in args:
         args['fs'] = '|'
         args['fs'] = '|'