fix translation strings with multiple parameters
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 28 Nov 2016 16:47:01 +0300
changeset 1581 2295fdc5c271
parent 1580 f37b88d3edc6
child 1582 dee51e22a9aa
fix translation strings with multiple parameters


this fixes a lot of warnings given by msgmerge:

../PLCOpenEditor.py:196: warning: 'msgid' format string with unnamed arguments cannot be properly localized:
The translator cannot reorder the arguments.
Please consider using a format string with named arguments,
CodeFileTreeNode.py
ConfigTreeNode.py
PLCControler.py
PLCGenerator.py
PLCOpenEditor.py
ProjectController.py
canfestival/config_utils.py
connectors/PYRO/__init__.py
controls/SearchResultPanel.py
controls/VariablePanel.py
dialogs/ForceVariableDialog.py
editors/Viewer.py
plcopen/plcopen.py
util/ProcessLogger.py
--- a/CodeFileTreeNode.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/CodeFileTreeNode.py	Mon Nov 28 16:47:01 2016 +0300
@@ -117,11 +117,12 @@
             try:
                 self.CodeFile, error = self.CodeFileParser.LoadXMLString(codefile_xml)
                 if error is not None:
-                    self.GetCTRoot().logger.write_warning(
-                        XSDSchemaErrorMessage % ((self.CODEFILE_NAME,) + error))
+                    (fname, lnum, src) = ((self.CODEFILE_NAME,) + error)
+                    self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname, a2 = lnum, a3 = src))
                 self.CreateCodeFileBuffer(True)
             except Exception, exc:
-                self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (CTNName, unicode(exc)))
+                msg = _("Couldn't load confnode parameters {a1} :\n {a2}").format(a1 = CTNName, a2 = unicode(exc))
+                self.GetCTRoot().logger.write_error(msg)
                 self.GetCTRoot().logger.write_error(traceback.format_exc())
         else:
             self.CodeFile = self.CodeFileParser.CreateRoot()
--- a/ConfigTreeNode.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/ConfigTreeNode.py	Mon Nov 28 16:47:01 2016 +0300
@@ -53,7 +53,7 @@
         </xsd:schema>""")
 
 NameTypeSeparator = '@'
-XSDSchemaErrorMessage = _("%s XML file doesn't follow XSD schema at line %d:\n%s")
+XSDSchemaErrorMessage = _("{a1} XML file doesn't follow XSD schema at line %{a2}:\n{a3}")
 
 class ConfigTreeNode:
     """
@@ -421,7 +421,8 @@
             shutil.move(oldname, self.CTNPath())
         # warn user he has two left hands
         if DesiredName != res:
-            self.GetCTRoot().logger.write_warning(_("A child named \"%s\" already exist -> \"%s\"\n")%(DesiredName,res))
+            msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1 = DesiredName, a2 = res)
+            self.GetCTRoot().logger.write_warning(msg)
         return res
 
     def GetAllChannels(self):
@@ -525,7 +526,7 @@
         try:
             CTNClass, CTNHelp = CTNChildrenTypes[CTNType]
         except KeyError:
-            raise Exception, _("Cannot create child %s of type %s ")%(CTNName, CTNType)
+            raise Exception, _("Cannot create child {a1} of type {a2} ").format(a1 = CTNName, a2 = CTNType)
         
         # if CTNClass is a class factory, call it. (prevent unneeded imports)
         if type(CTNClass) == types.FunctionType:
@@ -535,7 +536,8 @@
         ChildrenWithSameClass = self.Children.setdefault(CTNType, list())
         # Check count
         if getattr(CTNClass, "CTNMaxCount", None) and len(ChildrenWithSameClass) >= CTNClass.CTNMaxCount:
-            raise Exception, _("Max count (%d) reached for this confnode of type %s ")%(CTNClass.CTNMaxCount, CTNType)
+            msg = _("Max count ({a1}) reached for this confnode of type {a2} ").format(a1 = CTNClass.CTNMaxCount, a2 = CTNType)
+            raise Exception, msg
         
         # create the final class, derived of provided confnode and template
         class FinalCTNClass(CTNClass, ConfigTreeNode):
@@ -561,7 +563,9 @@
                     _self.LoadXMLParams(NewCTNName)
                     # Basic check. Better to fail immediately.
                     if (_self.BaseParams.getName() != NewCTNName):
-                        raise Exception, _("Project tree layout do not match confnode.xml %s!=%s ")%(NewCTNName, _self.BaseParams.getName())
+                        msg = _("Project tree layout do not match confnode.xml {a1}!={a2} ").\
+                              format(a1 = NewCTNName, a2 = _self.BaseParams.getName())
+                        raise Exception, msg
 
                     # Now, self.CTNPath() should be OK
                     
@@ -614,12 +618,13 @@
                 basexmlfile = open(self.ConfNodeBaseXmlFilePath(CTNName), 'r')
                 self.BaseParams, error = _BaseParamsParser.LoadXMLString(basexmlfile.read())
                 if error is not None:
-                    self.GetCTRoot().logger.write_warning(
-                        XSDSchemaErrorMessage % ((ConfNodeName + " BaseParams",) + error))
+                    (fname, lnum, src) = ((ConfNodeName + " BaseParams",) + error)
+                    self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname, a2 = lnum, a3 = src))
                 self.MandatoryParams = ("BaseParams", self.BaseParams)
                 basexmlfile.close()
             except Exception, exc:
-                self.GetCTRoot().logger.write_error(_("Couldn't load confnode base parameters %s :\n %s") % (ConfNodeName, unicode(exc)))
+                msg = _("Couldn't load confnode base parameters {a1} :\n {a2}").format(a1 =  ConfNodeName, a2 = unicode(exc))
+                self.GetCTRoot().logger.write_error(msg)
                 self.GetCTRoot().logger.write_error(traceback.format_exc())
         
         # Get the xml tree
@@ -628,14 +633,15 @@
                 xmlfile = open(self.ConfNodeXmlFilePath(CTNName), 'r')
                 obj, error = self.Parser.LoadXMLString(xmlfile.read())
                 if error is not None:
-                    self.GetCTRoot().logger.write_warning(
-                        XSDSchemaErrorMessage % ((ConfNodeName,) + error))
+                    (fname, lnum, src) = ((ConfNodeName,) + error)
+                    self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname, a2 = lnum, a3 = src))
                 name = obj.getLocalTag()
                 setattr(self, name, obj)
                 self.CTNParams = (name, obj)
                 xmlfile.close()
             except Exception, exc:
-                self.GetCTRoot().logger.write_error(_("Couldn't load confnode parameters %s :\n %s") % (ConfNodeName, unicode(exc)))
+                msg = _("Couldn't load confnode parameters {a1} :\n {a2}").format(a1 = ConfNodeName, a2 = unicode(exc))
+                self.GetCTRoot().logger.write_error(msg)
                 self.GetCTRoot().logger.write_error(traceback.format_exc())
         
     def LoadChildren(self):
@@ -647,6 +653,7 @@
                 try:
                     self.CTNAddChild(pname, ptype)
                 except Exception, exc:
-                    self.GetCTRoot().logger.write_error(_("Could not add child \"%s\", type %s :\n%s\n")%(pname, ptype, unicode(exc)))
+                    msg = _("Could not add child \"{a1}\", type {a2} :\n{a3}\n").format(a1 = pname, a2 = ptype, a3 = unicode(exc))
+                    self.GetCTRoot().logger.write_error(msg)
                     self.GetCTRoot().logger.write_error(traceback.format_exc())
 
--- a/PLCControler.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/PLCControler.py	Mon Nov 28 16:47:01 2016 +0300
@@ -967,7 +967,8 @@
             # programs cannot be pasted as functions or function blocks
             if orig_type == 'functionBlock' and pou_type == 'function' or \
                orig_type == 'program' and pou_type in ['function', 'functionBlock']:
-                return _('''%s "%s" can't be pasted as a %s.''') % (orig_type, name, pou_type)
+                msg = _('''{a1} "{a2}" can't be pasted as a {a3}.''').format(a1 = orig_type, a2 = name, a3 = pou_type)
+                return msg
 
             new_pou.setpouType(pou_type)
 
--- a/PLCGenerator.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/PLCGenerator.py	Mon Nov 28 16:47:01 2016 +0300
@@ -775,7 +775,8 @@
                     for element in body.getcontentInstances():
                         if isinstance(element, ConnectorClass) and element.getname() == name:
                             if connector is not None:
-                                raise PLCGenException, _("More than one connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
+                                msg = _("More than one connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+                                raise PLCGenException, msg
                             connector = element
                     if connector is not None:
                         undefined = [instance.connectionPointOut, connector.connectionPointIn]
@@ -794,7 +795,8 @@
                             for connection in related:
                                 self.ConnectionTypes[connection] = var_type
                     else:
-                        raise PLCGenException, _("No connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
+                        msg = _("No connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+                        raise PLCGenException, msg
                 elif isinstance(instance, BlockClass):
                     block_infos = self.GetBlockType(instance.gettypeName(), "undefined")
                     if block_infos is not None:
@@ -948,7 +950,7 @@
                     if block_infos is None:
                         block_infos = self.GetBlockType(block_type)
                     if block_infos is None:
-                        raise PLCGenException, _("Undefined block type \"%s\" in \"%s\" POU")%(block_type, self.Name)
+                        raise PLCGenException, _("Undefined block type \"{a1}\" in \"{a2}\" POU").format(a1 = block_type, a2 = self.Name)
                     try:
                         self.GenerateBlock(instance, block_infos, body, None)
                     except ValueError, e:
@@ -1088,7 +1090,8 @@
                     self.Program += JoinList([(", ", ())], vars)
                     self.Program += [(");\n", ())]
                 else:
-                    self.Warnings.append(_("\"%s\" function cancelled in \"%s\" POU: No input connected")%(type, self.TagName.split("::")[-1]))
+                    msg = _("\"{a1}\" function cancelled in \"{a2}\" POU: No input connected").format(a1 = type, a2 = self.TagName.split("::")[-1])
+                    self.Warnings.append(msg)
         elif block_infos["type"] == "functionBlock":
             if not self.ComputedBlocks.get(block, False) and not order:
                 self.ComputedBlocks[block] = True
@@ -1177,11 +1180,12 @@
             if output_parameter is None:
                 output_parameter = ""
             if name:
-                blockname = "%s(%s)" % (name, type)
+                blockname = "{a1}({a2})".format(a1 = name, a2 = type)
             else:
                 blockname = type
-            raise ValueError, _("No output %s variable found in block %s in POU %s. Connection must be broken")  % \
-                              (output_parameter, blockname, self.Name)
+            msg = _("No output {a1} variable found in block {a2} in POU {a3}. Connection must be broken").\
+                              format(a1 = output_parameter, a2 = blockname, a3 = self.Name)
+            raise ValueError, msg
 
     def GeneratePaths(self, connections, body, order = False, to_inout = False):
         paths = []
@@ -1199,7 +1203,8 @@
                 if block_infos is None:
                     block_infos = self.GetBlockType(block_type)
                 if block_infos is None:
-                    raise PLCGenException, _("Undefined block type \"%s\" in \"%s\" POU")%(block_type, self.Name)
+                    msg = _("Undefined block type \"{a1}\" in \"{a2}\" POU").format(a1 = block_type, a2 = self.Name)
+                    raise PLCGenException, msg
                 try:
                     paths.append(str(self.GenerateBlock(next, block_infos, body, connection, order, to_inout)))
                 except ValueError, e:
@@ -1214,7 +1219,8 @@
                     for instance in body.getcontentInstances():
                         if isinstance(instance, ConnectorClass) and instance.getname() == name:
                             if connector is not None:
-                                raise PLCGenException, _("More than one connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
+                                msg = _("More than one connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+                                raise PLCGenException, msg
                             connector = instance
                     if connector is not None:
                         connections = connector.connectionPointIn.getconnections()
@@ -1224,7 +1230,8 @@
                                 self.ComputedConnectors[name] = expression
                                 paths.append(str(expression))
                     else:
-                        raise PLCGenException, _("No connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
+                        msg = _("No connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+                        raise PLCGenException, msg
             elif isinstance(next, ContactClass):
                 contact_info = (self.TagName, "contact", next.getlocalId())
                 variable = str(self.ExtractModifier(next, [(next.getvariable(), contact_info + ("reference",))], contact_info))
@@ -1576,7 +1583,9 @@
             elif len(transition_infos["from"]) == 1:
                 self.Program += transition_infos["from"][0]
             else:
-                raise PLCGenException, _("Transition with content \"%s\" not connected to a previous step in \"%s\" POU")%(transition_infos["content"], self.Name)
+                msg = _("Transition with content \"{a1}\" not connected to a previous step in \"{a2}\" POU").\
+                      format(a1 = transition_infos["content"], a2 = self.Name)
+                raise PLCGenException, msg
             self.Program += [(" TO ", ())]
             if len(transition_infos["to"]) > 1:
                 self.Program += [("(", ())]
@@ -1585,7 +1594,9 @@
             elif len(transition_infos["to"]) == 1:
                 self.Program += transition_infos["to"][0]
             else:
-                raise PLCGenException, _("Transition with content \"%s\" not connected to a next step in \"%s\" POU")%(transition_infos["content"], self.Name)
+                msg = _("Transition with content \"{a1}\" not connected to a next step in \"{a2}\" POU").\
+                      format(a1 = transition_infos["content"], a2 = self.Name)
+                raise PLCGenException, msg
             self.Program += transition_infos["content"]
             self.Program += [("%sEND_TRANSITION\n\n"%self.CurrentIndent, ())]
             for [(step_name, step_infos)] in transition_infos["to"]:
--- a/PLCOpenEditor.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/PLCOpenEditor.py	Mon Nov 28 16:47:01 2016 +0300
@@ -192,8 +192,8 @@
         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
 
         if result is not None:
-            self.ShowErrorMessage(
-                _("PLC syntax error at line %d:\n%s") % result)
+            (num, line) = result
+            self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1 = num, a2 = line))
 
     def OnCloseFrame(self, event):
         if self.Controler is None or self.CheckSaveBeforeClosing(_("Close Application")):
@@ -305,8 +305,8 @@
         dialog.Destroy()
 
         if result is not None:
-            self.ShowErrorMessage(
-                _("PLC syntax error at line %d:\n%s") % result)
+            (num, line) = result
+            self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1 = num, a2 = line))
 
     def OnCloseProjectMenu(self, event):
         if not self.CheckSaveBeforeClosing():
--- a/ProjectController.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/ProjectController.py	Mon Nov 28 16:47:01 2016 +0300
@@ -360,8 +360,8 @@
         error = self.OpenXMLFile(plc_file)
         if error is not None:
             if self.Project is not None:
-                self.logger.write_warning(
-                    XSDSchemaErrorMessage % (("PLC",) + error))
+                (fname_err, lnum, src) = (("PLC",) + error)
+                self.logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname_err, a2 = lnum, a3 = src))
             else:
                 return error
         if len(self.GetProjectConfigNames()) == 0:
--- a/canfestival/config_utils.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/canfestival/config_utils.py	Mon Nov 28 16:47:01 2016 +0300
@@ -352,14 +352,16 @@
                 
                 # Check Id is in slave node list
                 if nodeid not in self.NodeList.SlaveNodes.keys():
-                    raise PDOmappingException, _("Non existing node ID : %d (variable %s)") % (nodeid,name)
+                    raise PDOmappingException, _("Non existing node ID : {a1} (variable {a2})").format(a1 = nodeid, a2 = name)
                 
                 # Get the model for this node (made from EDS)
                 node = self.NodeList.SlaveNodes[nodeid]["Node"]
                 
                 # Extract and check index and subindex
                 if not node.IsEntry(index, subindex):
-                    raise PDOmappingException, _("No such index/subindex (%x,%x) in ID : %d (variable %s)") % (index,subindex,nodeid,name)
+                    msg = _("No such index/subindex ({a1},{a2}) in ID : {a3} (variable {a4})").\
+                          format(a1 = "%x" % index, a2 ="%x" % subindex, a3 = nodeid, a4 = name)
+                    raise PDOmappingException, msg
                 
                 # Get the entry info
                 subentry_infos = node.GetSubentryInfos(index, subindex)
@@ -369,19 +371,23 @@
                     if sizelocation == "X" and len(loc) > 3:
                         numbit = loc[3]
                     elif sizelocation != "X" and len(loc) > 3:
-                        raise PDOmappingException, _("Cannot set bit offset for non bool '%s' variable (ID:%d,Idx:%x,sIdx:%x))") % (name,nodeid,index,subindex)
+                        msg = _("Cannot set bit offset for non bool '{a1}' variable (ID:{a2},Idx:{a3},sIdx:{a4}))").\
+                              format(a1 = name, a2 = nodeid, a3 = "%x" % index, a4 = "%x" % subindex)
+                        raise PDOmappingException, msg
                     else:
                         numbit = None
                     
                     if location["IEC_TYPE"] != "BOOL" and subentry_infos["type"] != COlocationtype:
-                        raise PDOmappingException, _("Invalid type \"%s\"-> %d != %d  for location\"%s\"") % (location["IEC_TYPE"], COlocationtype, subentry_infos["type"] , name)
+                        raise PDOmappingException, _("Invalid type \"{a1}\"-> {a2} != {a3}  for location\"{a4}\"").\
+                            format(a1 = location["IEC_TYPE"], a2 = COlocationtype, a3 = subentry_infos["type"] , a4 = name)
                     
                     typeinfos = node.GetEntryInfos(COlocationtype)
                     self.IECLocations[name] = {"type":COlocationtype, "pdotype":SlavePDOType[direction],
                                                 "nodeid": nodeid, "index": index,"subindex": subindex,
                                                 "bit": numbit, "size": typeinfos["size"], "sizelocation": sizelocation}
                 else:
-                    raise PDOmappingException, _("Not PDO mappable variable : '%s' (ID:%d,Idx:%x,sIdx:%x))") % (name,nodeid,index,subindex)
+                    raise PDOmappingException, _("Not PDO mappable variable : '{a1}' (ID:{a2},Idx:{a3},sIdx:{a4}))").\
+                        format(a1 = name, a2 = nodeid, a3 = "%x" % index, a4 = "%x" % subindex)
         
         #-------------------------------------------------------------------------------
         #                         Search for locations already mapped
@@ -630,12 +636,14 @@
             
             # Extract and check index and subindex
             if not slave.IsEntry(index, subindex):
-                raise PDOmappingException, _("No such index/subindex (%x,%x) (variable %s)") % (index, subindex, name)
+                raise PDOmappingException, _("No such index/subindex ({a1},{a2}) (variable {a3})").\
+                    format(a1 = "%x" % index, a2 = "%x" % subindex, a3 = name)
             
             # Get the entry info
             subentry_infos = slave.GetSubentryInfos(index, subindex)    
             if subentry_infos["type"] != COlocationtype:
-                raise PDOmappingException, _("Invalid type \"%s\"-> %d != %d  for location\"%s\"") % (location["IEC_TYPE"], COlocationtype, subentry_infos["type"] , name)
+                raise PDOmappingException, _("Invalid type \"{a1}\"-> {a2} != {a3} for location \"{a4}\"").\
+                    format( a1 = location["IEC_TYPE"], a2 = COlocationtype, a3 = subentry_infos["type"] , a4 = name)
             
             IECLocations[name] = COlocationtype
             pointers[(index, subindex)] = name
--- a/connectors/PYRO/__init__.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/connectors/PYRO/__init__.py	Mon Nov 28 16:47:01 2016 +0300
@@ -87,7 +87,7 @@
             ip = str(socket.inet_ntoa(i.getAddress()))
             port = str(i.getPort())
             newlocation = ip + ':' + port
-            confnodesroot.logger.write(_("'%s' is located at %s\n") % (location, newlocation))
+            confnodesroot.logger.write(_("'{a1}' is located at {a2}\n").format(a1 = location, a2 = newlocation))
             location = newlocation
             r.close()
         except Exception, msg:
--- a/controls/SearchResultPanel.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/controls/SearchResultPanel.py	Mon Nov 28 16:47:01 2016 +0300
@@ -249,11 +249,11 @@
                     search_results_tree_children.append(element_infos)
             
             if matches_number < 2:
-                header_format = _("'%s' - %d match in project")
+                header_format = _("'{a1}' - {a2} match in project")
             else:
-                header_format = _("'%s' - %d matches in project")
-            
-            self.HeaderLabel.SetLabel(header_format % (self.Criteria["find_pattern"], matches_number))
+                header_format = _("'{a1}' - {a2} matches in project")
+            
+            self.HeaderLabel.SetLabel(header_format.format(a1 = self.Criteria["find_pattern"], a2 = matches_number))
             self.ResetButton.Enable(True)
             
             if matches_number > 0:
--- a/controls/VariablePanel.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/controls/VariablePanel.py	Mon Nov 28 16:47:01 2016 +0300
@@ -273,7 +273,8 @@
                         if values[2] is not None:
                             base_location_type = self.ParentWindow.Controler.GetBaseType(values[2])
                             if values[2] != variable_type and base_type != base_location_type:
-                                message = _("Incompatible data types between \"%s\" and \"%s\"")%(values[2], variable_type)
+                                message = _("Incompatible data types between \"{a1}\" and \"{a2}\"").\
+                                          format(a1 = values[2], a2 = variable_type)
 
                         if message is None:
                             if not location.startswith("%"):
@@ -282,7 +283,8 @@
                                 elif location[0] not in LOCATIONDATATYPES:
                                     message = _("Unrecognized data size \"%s\"")%location[0]
                                 elif base_type not in LOCATIONDATATYPES[location[0]]:
-                                    message = _("Incompatible size of data between \"%s\" and \"%s\"")%(location, variable_type)
+                                    message = _("Incompatible size of data between \"{a1}\" and \"{a2}\"").\
+                                              format(a1 = location, a2 = variable_type)
                                 else:
                                     dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
                                           _("Select a variable class:"), _("Variable class"),
--- a/dialogs/ForceVariableDialog.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/dialogs/ForceVariableDialog.py	Mon Nov 28 16:47:01 2016 +0300
@@ -174,7 +174,7 @@
         if value == "":
             message = _("You must type a value!")
         elif GetTypeValue[self.IEC_Type](value) is None:
-            message = _("Invalid value \"%s\" for \"%s\" variable!") % (value, self.IEC_Type)
+            message = _("Invalid value \"{a1}\" for \"{a2}\" variable!").format(a1 = value, a2 = self.IEC_Type)
         if message is not None:
             dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
             dialog.ShowModal()
--- a/editors/Viewer.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/editors/Viewer.py	Mon Nov 28 16:47:01 2016 +0300
@@ -243,7 +243,7 @@
                 elif pou_type == "function" and values[1] != "function":
                     message = _("Function Blocks can't be used in Functions!")
                 elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug):
-                    message = _("\"%s\" is already used by \"%s\"!")%(pou_name, values[0])
+                    message = _("\"{a1}\" is already used by \"{a2}\"!").format(a1 = pou_name, a2 = values[0])
                 else:
                     blockname = values[2]
                     if len(values) > 3:
--- a/plcopen/plcopen.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/plcopen/plcopen.py	Mon Nov 28 16:47:01 2016 +0300
@@ -497,7 +497,8 @@
 
     def addconfigurationResource(self, config_name, name):
         if self.getconfigurationResource(config_name, name) is not None:
-            raise ValueError, _("\"%s\" resource already exists in \"%s\" configuration !!!") % (name, config_name)
+            msg = _("\"{a1}\" resource already exists in \"{a2}\" configuration !!!").format(a1 = name, a2 = config_name)
+            raise ValueError, msg
         configuration = self.getconfiguration(config_name)
         if configuration is not None:
             new_resource = PLCOpenParser.CreateElement("resource", "configuration")
@@ -514,7 +515,8 @@
                 configuration.remove(resource)
                 found = True
         if not found:
-            raise ValueError, _("\"%s\" resource doesn't exist in \"%s\" configuration !!!")%(name, config_name)
+            msg = _("\"{a1}\" resource doesn't exist in \"{a2}\" configuration !!!").format(a1 = name, a2 = config_name)
+            raise ValueError, msg
     setattr(cls, "removeconfigurationResource", removeconfigurationResource)
 
     def updateElementName(self, old_name, new_name):
--- a/util/ProcessLogger.py	Mon Nov 28 16:27:24 2016 +0300
+++ b/util/ProcessLogger.py	Mon Nov 28 16:47:01 2016 +0300
@@ -166,7 +166,7 @@
 
     def log_the_end(self,ecode,pid):
         self.logger.write(self.Command_str + "\n")
-        self.logger.write_warning(_("exited with status %s (pid %s)\n")%(str(ecode),str(pid)))
+        self.logger.write_warning(_("exited with status {a1} (pid {a2})\n").format(a1 = str(ecode), a2 = str(pid)))
 
     def finish(self, pid,ecode):
         # avoid running function before start is finished