add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 24 Nov 2016 18:33:56 +0300
changeset 1578 f8e2a04c4445
parent 1577 6a3c29fdcfea
child 1579 418e6bac22e8
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
controls/DebugVariablePanel/DebugVariablePanel.py
controls/LocationCellEditor.py
controls/VariablePanel.py
editors/TextViewer.py
editors/Viewer.py
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Thu Nov 24 15:46:17 2016 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Thu Nov 24 18:33:56 2016 +0300
@@ -50,10 +50,10 @@
 # List of values possible for graph range
 # Format is [(time_in_plain_text, value_in_nanosecond),...]
 RANGE_VALUES = \
-    [("%dms" % i, i * MILLISECOND) for i in (10, 20, 50, 100, 200, 500)] + \
-    [("%ds" % i, i * SECOND) for i in (1, 2, 5, 10, 20, 30)] + \
-    [("%dm" % i, i * MINUTE) for i in (1, 2, 5, 10, 20, 30)] + \
-    [("%dh" % i, i * HOUR) for i in (1, 2, 3, 6, 12, 24)]
+    [(_("%dms") % i, i * MILLISECOND) for i in (10, 20, 50, 100, 200, 500)] + \
+    [(_("%ds") % i, i * SECOND) for i in (1, 2, 5, 10, 20, 30)] + \
+    [(_("%dm") % i, i * MINUTE) for i in (1, 2, 5, 10, 20, 30)] + \
+    [(_("%dh") % i, i * HOUR) for i in (1, 2, 3, 6, 12, 24)]
 
 # Scrollbar increment in pixel
 SCROLLBAR_UNIT = 10
@@ -566,16 +566,16 @@
             tick_duration = int(tick * self.Ticktime)
             not_null = False
             duration = ""
-            for value, format in [(tick_duration / DAY, "%dd"),
-                                  ((tick_duration % DAY) / HOUR, "%dh"),
-                                  ((tick_duration % HOUR) / MINUTE, "%dm"),
-                                  ((tick_duration % MINUTE) / SECOND, "%ds")]:
+            for value, format in [(tick_duration / DAY, _("%dd")),
+                                  ((tick_duration % DAY) / HOUR, _("%dh")),
+                                  ((tick_duration % HOUR) / MINUTE, _("%dm")),
+                                  ((tick_duration % MINUTE) / SECOND, _("%ds"))]:
                 
                 if value > 0 or not_null:
                     duration += format % value
                     not_null = True
             
-            duration += "%gms" % (float(tick_duration % SECOND) / MILLISECOND) 
+            duration += _("%03gms") % (float(tick_duration % SECOND) / MILLISECOND) 
             self.TickTimeLabel.SetLabel("t: %s" % duration)
         else:
             self.TickLabel.SetLabel("")
--- a/controls/LocationCellEditor.py	Thu Nov 24 15:46:17 2016 +0300
+++ b/controls/LocationCellEditor.py	Thu Nov 24 18:33:56 2016 +0300
@@ -95,7 +95,7 @@
             if not infos["location"].startswith("%"):
                 dialog = wx.SingleChoiceDialog(self, 
                       _("Select a variable class:"), _("Variable class"), 
-                      ["Input", "Output", "Memory"], 
+                      [_("Input"), _("Output"), _("Memory")], 
                       wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                 if dialog.ShowModal() == wx.ID_OK:
                     selected = dialog.GetSelection()
--- a/controls/VariablePanel.py	Thu Nov 24 15:46:17 2016 +0300
+++ b/controls/VariablePanel.py	Thu Nov 24 18:33:56 2016 +0300
@@ -286,7 +286,7 @@
                                 else:
                                     dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
                                           _("Select a variable class:"), _("Variable class"),
-                                          ["Input", "Output", "Memory"],
+                                          [_("Input"), _("Output"), _("Memory")],
                                           wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                                     if dialog.ShowModal() == wx.ID_OK:
                                         selected = dialog.GetSelection()
@@ -324,7 +324,7 @@
                 dlg = wx.TextEntryDialog(
                     self.ParentWindow.ParentWindow.ParentWindow,
                     _("Confirm or change variable name"),
-                    'Variable Drop', var_name)
+                    _('Variable Drop'), var_name)
                 dlg.SetValue(var_name)
                 var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                 dlg.Destroy()
@@ -346,7 +346,7 @@
                         if not location.startswith("%"):
                             dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
                                   _("Select a variable class:"), _("Variable class"),
-                                  ["Input", "Output", "Memory"],
+                                  [_("Input"), _("Output"), _("Memory")],
                                   wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                             if dialog.ShowModal() == wx.ID_OK:
                                 selected = dialog.GetSelection()
--- a/editors/TextViewer.py	Thu Nov 24 15:46:17 2016 +0300
+++ b/editors/TextViewer.py	Thu Nov 24 18:33:56 2016 +0300
@@ -289,7 +289,7 @@
                     dlg = wx.TextEntryDialog(
                         self.ParentWindow,
                         _("Confirm or change variable name"),
-                        'Variable Drop', var_name)
+                        _('Variable Drop'), var_name)
                     dlg.SetValue(var_name)
                     var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                     dlg.Destroy()
@@ -304,7 +304,7 @@
                         if not location.startswith("%"):
                             dialog = wx.SingleChoiceDialog(self.ParentWindow,
                                   _("Select a variable class:"), _("Variable class"),
-                                  ["Input", "Output", "Memory"],
+                                  [_("Input"), _("Output"), _("Memory")],
                                   wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                             if dialog.ShowModal() == wx.ID_OK:
                                 selected = dialog.GetSelection()
@@ -340,7 +340,7 @@
                     dlg = wx.TextEntryDialog(
                         self.ParentWindow,
                         _("Confirm or change variable name"),
-                        'Variable Drop', var_name)
+                        _('Variable Drop'), var_name)
                     dlg.SetValue(var_name)
                     var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                     dlg.Destroy()
@@ -363,7 +363,7 @@
                 dlg = wx.TextEntryDialog(
                     self.ParentWindow,
                     _("Confirm or change variable name"),
-                    'Variable Drop', var_name)
+                    _('Variable Drop'), var_name)
                 dlg.SetValue(var_name)
                 var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                 dlg.Destroy()
--- a/editors/Viewer.py	Thu Nov 24 15:46:17 2016 +0300
+++ b/editors/Viewer.py	Thu Nov 24 18:33:56 2016 +0300
@@ -282,7 +282,7 @@
                     if not location.startswith("%"):
                         dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow,
                               _("Select a variable class:"), _("Variable class"),
-                              ["Input", "Output", "Memory"],
+                              [_("Input"), _("Output"), _("Memory")],
                               wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                         if dialog.ShowModal() == wx.ID_OK:
                             selected = dialog.GetSelection()
@@ -301,7 +301,7 @@
                     dlg = wx.TextEntryDialog(
                         self.ParentWindow.ParentWindow,
                         _("Confirm or change variable name"),
-                        'Variable Drop', var_name)
+                        _('Variable Drop'), var_name)
                     dlg.SetValue(var_name)
                     var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                     dlg.Destroy()
@@ -331,7 +331,7 @@
                     dlg = wx.TextEntryDialog(
                         self.ParentWindow.ParentWindow,
                         _("Confirm or change variable name"),
-                        'Variable Drop', var_name)
+                        _('Variable Drop'), var_name)
                     dlg.SetValue(var_name)
                     var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                     dlg.Destroy()
@@ -353,7 +353,7 @@
                 dlg = wx.TextEntryDialog(
                     self.ParentWindow.ParentWindow,
                     _("Confirm or change variable name"),
-                    'Variable Drop', var_name)
+                    _('Variable Drop'), var_name)
                 dlg.SetValue(var_name)
                 var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                 dlg.Destroy()