Przeglądaj źródła

wxGUI: fix gettext warning

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50515 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 lat temu
rodzic
commit
815c9f0480

+ 2 - 2
gui/wxpython/gmodeler/model.py

@@ -385,7 +385,7 @@ class Model(object):
                                 report = False
                                 break
                         if report:
-                            errList.append(_("%s: undefined variable '%s'") % (cmd[0], var))
+                            errList.append(cmd[0] + ": " + _("undefined variable '%s'") % var)
             ### TODO: check variables in file only optionally
             ### errList += self._substituteFile(action, checkOnly = True)
         
@@ -447,7 +447,7 @@ class Model(object):
             if sval:
                 var = sval.group(2).strip()[1:] # ignore '%'
                 cmd = item.GetLog(string = False)[0]
-                errList.append(_("%s: undefined variable '%s'") % (cmd, var))
+                errList.append(cmd + ": " + _("undefined variable '%s'") % var)
             
             if not checkOnly:
                 if write:

+ 18 - 23
gui/wxpython/gui_core/goutput.py

@@ -763,35 +763,30 @@ class GMConsole(wx.SplitterWindow):
         """!Command done (or aborted)"""
         if self.parent.GetName() == 'Modeler':
             self.parent.OnCmdDone(event)
+            
+        # Process results here
+        try:
+            ctime = time.time() - event.time
+            if ctime < 60:
+                stime = _("%d sec") % int(ctime)
+            else:
+                mtime = int(ctime / 60)
+                stime = _("%(min)d min %(sec)d sec") %  { 'min' : mtime, 
+                                                          'sec' : int(ctime - (mtime * 60)) }
+        except KeyError:
+            # stopped deamon
+            stime = _("unknown")
         
         if event.aborted:
             # Thread aborted (using our convention of None return)
             self.WriteLog(_('Please note that the data are left in inconsistent state '
                             'and may be corrupted'), self.cmdOutput.StyleWarning)
-            self.WriteCmdLog('(%s) %s (%d sec)' % (str(time.ctime()),
-                                                   _('Command aborted'),
-                                                   (time.time() - event.time)))
-            # pid=self.cmdThread.requestId)
-            self.btnCmdAbort.Enable(False)
+            msg = _('Command aborted')
         else:
-            try:
-                # Process results here
-                ctime = time.time() - event.time
-                if ctime < 60:
-                    stime = _("%d sec") % int(ctime)
-                else:
-                    mtime = int(ctime / 60)
-                    stime = _("%d min %d sec") % (mtime, 
-                                                  int(ctime - (mtime * 60)))
-                
-                self.WriteCmdLog('(%s) %s (%s)' % (str(time.ctime()),
-                                                   _('Command finished'),
-                                                   (stime)))
-            except KeyError:
-                # stopped deamon
-                pass
-
-            self.btnCmdAbort.Enable(False)
+            msg = _('Command finished')
+            
+        self.WriteCmdLog('(%s) %s (%s)' % (str(time.ctime()), msg, stime))
+        self.btnCmdAbort.Enable(False)
         
         if event.onDone:
             event.onDone(cmd = event.cmd, returncode = event.returncode)

+ 4 - 2
gui/wxpython/iclass/frame.py

@@ -665,8 +665,10 @@ class IClassMapFrame(DoubleMapFrame):
         nLayers = len(groupLayers)
         if nLayers <= 1:
             GMessage(parent = self,
-                     message = _("Group <%s> does not have enough files "
-                                 "(it has %d files). Operation canceled.") % (group, nLayers))
+                     message = _("Group <%(group)s> does not have enough files "
+                                 "(it has %(files)d files). Operation canceled.") % \
+                         { 'group' : group,
+                           'files' : nLayers })
             return False
         
         #check if vector has any areas

+ 7 - 4
gui/wxpython/modules/colorrules.py

@@ -1172,9 +1172,10 @@ class VectorColorTable(ColorTable):
         if not self.CheckMapset():
             # v.colors doesn't need the map to be in current mapset
             if not (self.version7 and self.attributeType == 'color'):
-                message = _("Selected map <%s> is not in current mapset <%s>. "
+                message = _("Selected map <%(map)s> is not in current mapset <%(mapset)s>. "
                             "Attribute table cannot be edited.") % \
-                            (self.inmap, grass.gisenv()['MAPSET'])
+                            { 'map' : self.inmap,
+                              'mapset' : grass.gisenv()['MAPSET'] }
                 wx.CallAfter(GMessage, parent = self, message = message)
                 self.DisableClearAll()
                 return
@@ -1451,9 +1452,11 @@ class VectorColorTable(ColorTable):
         range = ''
         if self.properties['min'] or self.properties['max']:
             if ctype == float:
-                range = _("(range: %.1f to %.1f)") % (self.properties['min'], self.properties['max'])
+                range = "%s: %.1f - %.1f)" % (_("range"),
+                                              self.properties['min'], self.properties['max'])
             elif ctype == int:
-                range = _("(range: %d to %d)") % (self.properties['min'], self.properties['max'])
+                range = "%s: %d - %d)" % (_("range"),
+                                          self.properties['min'], self.properties['max'])
         if range:
             if self.colorTable:
                 self.cr_label.SetLabel(_("Enter vector attribute values or percents %s:") % range)

+ 6 - 2
gui/wxpython/psmap/dialogs.py

@@ -1106,7 +1106,9 @@ class Image(InstructionObject):
                 GError(_("Failed to read instruction %s") % instruction)
                 return False
         if not os.path.exists(instr['epsfile']):
-            GError(_("Failed to read instruction %s: file %s not found.") % instruction, instr['epsfile'])
+            GError(_("Failed to read instruction %(inst)s: "
+                     "file %(file)s not found.") % { 'inst' : instruction,
+                                                     'file' : instr['epsfile'] })
             return False
         
         instr['epsfile'] = os.path.abspath(instr['epsfile'])
@@ -6013,7 +6015,9 @@ class ImageDialog(PsmapDialog):
             
     def SetSizeInfoLabel(self, image):
         """!Update image size label"""
-        self.imagePanel.image['sizeInfo'].SetLabel(_("size: %s x %s pts") % (image.GetWidth(), image.GetHeight()))
+        self.imagePanel.image['sizeInfo'].SetLabel(_("size: %(width)s x %(height)s pts") % \
+                                                       { 'width'  : image.GetWidth(),
+                                                         'height' : image.GetHeight() })
         self.imagePanel.image['sizeInfo'].GetContainingSizer().Layout()
         
     def ClearPreview(self):

+ 3 - 2
gui/wxpython/vdigit/toolbars.py

@@ -764,8 +764,9 @@ class VDigitToolbar(BaseToolbar):
                 self.EnableTool(tool, False)
         elif fType:
             GError(parent = self,
-                   message = _("Unsupported feature type '%s'. Unable to edit "
-                               "OGR layer <%s>.") % (fType, mapLayer.GetName()))
+                   message = _("Unsupported feature type '%(type)s'. Unable to edit "
+                               "OGR layer <%(layer)s>.") % { 'type' : fType,
+                                                             'layer' : mapLayer.GetName() })
             self.digit.CloseMap()
             self.mapLayer = None
             self.StopEditing()

+ 2 - 2
gui/wxpython/wxplot/base.py

@@ -396,8 +396,8 @@ class BasePlotFrame(wx.Frame):
         self.client.SaveFile()
 
     def OnMouseLeftDown(self,event):
-        self.SetStatusText(_("Left Mouse Down at Point: (%.4f, %.4f)") % \
-                               self.client._getXY(event))
+        self.SetStatusText(_("Left Mouse Down at Point:") + \
+                               " (%.4f, %.4f)" % self.client._getXY(event))
         event.Skip() # allows plotCanvas OnMouseLeftDown to be called
 
     def OnMotion(self, event):

+ 3 - 4
gui/wxpython/wxplot/histogram.py

@@ -214,12 +214,11 @@ class Histogram2Frame(BasePlotFrame):
         message = []
         title = _('Statistics for Map(s) Histogrammed')
 
-        for r in self.rasterList:
-            rast = r.split('@')[0] 
+        for rast in self.rasterList:
             ret = grass.read_command('r.univar', map = r, flags = 'e', quiet = True)
-            stats = _('Statistics for %s\n\n%s\n') % (rast, ret)
+            stats = _('Statistics for raster map <%s>') % rast + ':\n%s\n' % ret
             message.append(stats)
-            
+        
         stats = PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
                                title = title)
 

+ 8 - 6
gui/wxpython/wxplot/scatter.py

@@ -253,12 +253,14 @@ class ScatterFrame(BasePlotFrame):
                                       map2 = rast2, 
                                       flags = 'g', quiet = True,
                                       parse = (grass.parse_key_val, { 'sep' : '=' }))
-            eqtitle = _('Regression equation for %s vs. %s:\n\n')  % (rast1, rast2)
-            eq = _('   %s = %s + %s(%s)\n\n') % (rast2, ret['a'], ret['b'], rast1)
-            num = _('N = %s\n') % ret['N']
-            rval = _('R = %s\n') % ret['R']
-            rsq = _('R-squared = %f\n') % pow(float(ret['R']), 2)
-            ftest = _('F = %s\n') % ret['F']
+            eqtitle = _('Regression equation for raster map <%(rast1)s> vs. <%(rast2)s>:\n\n') % \
+                { 'rast1' : rast1,
+                  'rast2' : rast2 }
+            eq = '   %s = %s + %s(%s)\n\n' % (rast2, ret['a'], ret['b'], rast1)
+            num = 'N = %s\n' % ret['N']
+            rval = 'R = %s\n' % ret['R']
+            rsq = 'R-squared = %f\n' % pow(float(ret['R']), 2)
+            ftest = 'F = %s\n' % ret['F']
             str = eqtitle + eq + num + rval + rsq + ftest
             message.append(str)