Fix internatialization in UriLocationEditor, PYRO dialog and Modbus configurator
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 07 Jun 2018 16:58:13 +0300
changeset 2179 84c4e56b38d6
parent 2178 bd0d13d10b8e
child 2180 017ad9cc20b9
Fix internatialization in UriLocationEditor, PYRO dialog and Modbus configurator
connectors/PYRO/dialog.py
controls/UriLocationEditor.py
modbus/modbus.py
--- a/connectors/PYRO/dialog.py	Thu Jun 07 16:53:21 2018 +0300
+++ b/connectors/PYRO/dialog.py	Thu Jun 07 16:58:13 2018 +0300
@@ -39,12 +39,12 @@
             self.uriSizer = wx.BoxSizer(wx.HORIZONTAL)
             self.portSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-            self.uriSizer.Add(wx.StaticText(self, wx.ID_ANY, "URI host:", size = wx.Size(70, -1)), proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
+            self.uriSizer.Add(wx.StaticText(self, wx.ID_ANY, _("URI host:"), size = wx.Size(70, -1)), proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
             self.uriSizer.AddSpacer((0,0))
             self.uriSizer.Add(self.IpText, proportion=1, flag=wx.ALIGN_RIGHT)
             self.mainSizer.Add(self.uriSizer, border=2, flag=wx.ALL)
 
-            self.portSizer.Add(wx.StaticText(self, wx.ID_ANY, "URI port:", size = wx.Size(70, -1)), proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
+            self.portSizer.Add(wx.StaticText(self, wx.ID_ANY, _("URI port:"), size = wx.Size(70, -1)), proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
             self.portSizer.AddSpacer((0,0))
             self.portSizer.Add(self.PortText, proportion=1, flag=wx.ALIGN_RIGHT)
             self.mainSizer.Add(self.portSizer, border=2, flag=wx.ALL)
--- a/controls/UriLocationEditor.py	Thu Jun 07 16:53:21 2018 +0300
+++ b/controls/UriLocationEditor.py	Thu Jun 07 16:58:13 2018 +0300
@@ -32,7 +32,7 @@
     def _init_sizers(self):
         self.mainSizer = wx.BoxSizer(wx.VERTICAL)
         typeSizer = wx.BoxSizer(wx.HORIZONTAL)
-        typeSizer.Add(wx.StaticText(self,wx.ID_ANY,"URI type:"), border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
+        typeSizer.Add(wx.StaticText(self,wx.ID_ANY, _("URI type:")), border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
         typeSizer.Add(self.UriTypeChoice, border=5, flag=wx.ALL)
         self.mainSizer.Add(typeSizer)
 
@@ -43,7 +43,7 @@
         self.Fit()
 
     def __init__(self, parent, uri):
-        self.URITYPES = ["- Select URI type -"]
+        self.URITYPES = [_("- Select URI type -")]
         for connector_type, connector_function in connectors_dialog.iteritems():
             try:
                 connector_function['function']()
--- a/modbus/modbus.py	Thu Jun 07 16:53:21 2018 +0300
+++ b/modbus/modbus.py	Thu Jun 07 16:58:13 2018 +0300
@@ -598,10 +598,11 @@
             for j in range(i + 1, len(IPServer_port_numbers)):
                 if IPServer_port_numbers[i][1] == IPServer_port_numbers[j][1]:
                     self.GetCTRoot().logger.write_warning(
-                        _("Error: Modbus/IP Servers %s.x and %s.x use the same port number %s.\n") % (
-                            _lt_to_str(IPServer_port_numbers[i][0]),
-                            _lt_to_str(IPServer_port_numbers[j][0]),
-                            IPServer_port_numbers[j][1]))
+                        _("Error: Modbus/IP Servers %{a1}.x and %{a2}.x use the same port number {a3}.\n").\
+                        format(
+                            a1=_lt_to_str(IPServer_port_numbers[i][0]),
+                            a2=_lt_to_str(IPServer_port_numbers[j][0]),
+                            a3=IPServer_port_numbers[j][1]))
                     raise Exception
                     # TODO: return an error code instead of raising an
                     # exception