PLCGenerator.py
changeset 391 07447ee3538e
parent 389 6a72016d721a
child 408 0e389fa5b160
--- a/PLCGenerator.py	Fri Jul 24 12:49:57 2009 +0200
+++ b/PLCGenerator.py	Fri Jul 24 17:12:59 2009 +0200
@@ -229,7 +229,7 @@
                 program = pou_program.GenerateProgram(pou)
                 self.Program += program
             else:
-                raise PLCGenException, "Undefined pou type \"%s\""%pou_type
+                raise PLCGenException, _("Undefined pou type \"%s\"")%pou_type
     
     # Generate a POU defined and used in text
     def GeneratePouProgramInText(self, text):
@@ -669,7 +669,7 @@
                     for element in body.getcontentInstances():
                         if isinstance(element, plcopen.commonObjects_connector) 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)
+                                raise PLCGenException, _("More than one connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
                             connector = element
                     if connector is not None:
                         undefined = [instance.connectionPointOut, connector.connectionPointIn]
@@ -688,7 +688,7 @@
                             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)
+                        raise PLCGenException, _("No connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
                 elif isinstance(instance, plcopen.fbdObjects_block):
                     block_infos = self.GetBlockType(instance.gettypeName())
                     if block_infos is not None:
@@ -873,7 +873,7 @@
                     for instance in body.getcontentInstances():
                         if isinstance(instance, plcopen.commonObjects_connector) 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)
+                                raise PLCGenException, _("More than one connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
                             connector = instance
                     if connector is not None:
                         connections = connector.connectionPointIn.getconnections()
@@ -882,7 +882,7 @@
                             self.ComputedConnectors[name] = expression
                             paths.append(str(expression))
                     else:
-                        raise PLCGenException, "No connector found corresponding to \"%s\" continuation in \"%s\" POU"%(name, self.Name)
+                        raise PLCGenException, _("No connector found corresponding to \"%s\" continuation in \"%s\" POU")%(name, self.Name)
             elif isinstance(next, plcopen.ldObjects_contact):
                 contact_info = (self.TagName, "contact", next.getlocalId())
                 variable = str(self.ExtractModifier(next, [(next.getvariable(), contact_info + ("reference",))], contact_info))
@@ -1225,7 +1225,7 @@
             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)
+                raise PLCGenException, _("Transition with content \"%s\" not connected to a previous step in \"%s\" POU")%(transition_infos["content"], self.Name)
             self.Program += [(" TO ", ())]
             if len(transition_infos["to"]) > 1:
                 self.Program += [("(", ())]
@@ -1234,7 +1234,7 @@
             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)
+                raise PLCGenException, _("Transition with content \"%s\" not connected to a next step in \"%s\" POU")%(transition_infos["content"], self.Name)
             self.Program += transition_infos["content"]
             self.Program += [("%sEND_TRANSITION\n\n"%self.CurrentIndent, ())]
             for [(step_name, step_infos)] in transition_infos["to"]:
@@ -1252,9 +1252,9 @@
                         (self.ReturnType, (self.TagName, "return"))]
         program += [("\n", ())]
         if len(self.Interface) == 0:
-            raise PLCGenException, "No variable defined in \"%s\" POU"%self.Name
+            raise PLCGenException, _("No variable defined in \"%s\" POU")%self.Name
         if len(self.Program) == 0 :
-            raise PLCGenException, "No body defined in \"%s\" POU"%self.Name
+            raise PLCGenException, _("No body defined in \"%s\" POU")%self.Name
         var_number = 0
         for list_type, retain, constant, located, variables in self.Interface:
             program += [("  %s"%list_type, ())]