[node-patches] Change in ovirt-node[master]: ui: Fix incorrect i18n on buttons

fabiand at fedoraproject.org fabiand at fedoraproject.org
Fri Jun 27 08:47:43 UTC 2014


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Fix incorrect i18n on buttons
......................................................................

ui: Fix incorrect i18n on buttons

Previously the defaults of the button labels were overwritten by
translation messages. This lead to incorrect button labels for some
dialogs.
To solve this the translation was pulled into the correct place.
Now the buttons either show the sane default or a custom label.

Change-Id: I55c09116e2e43511ff9b7f2513016ace7d1b6b8c
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/ui/__init__.py
1 file changed, 15 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/30/29330/1

diff --git a/src/ovirt/node/ui/__init__.py b/src/ovirt/node/ui/__init__.py
index ce1c94a..bddacd8 100644
--- a/src/ovirt/node/ui/__init__.py
+++ b/src/ovirt/node/ui/__init__.py
@@ -439,7 +439,8 @@
     """This derived class is primarily needed to allow an easy disabling of the
     save button when the changed data is invalid.
     """
-    def __init__(self, path, label="Save", enabled=True):
+    def __init__(self, path, label=None, enabled=True):
+        label = label or _("Save")
         super(SaveButton, self).__init__(path, label, enabled)
 
 
@@ -447,7 +448,8 @@
     """This button calls the ResetAction to reset all UI data to the current
     model, discrading all pending changes.
     """
-    def __init__(self, path, label="Reset", enabled=True):
+    def __init__(self, path, label=None, enabled=True):
+        label = label or _("Reset")
         super(ResetButton, self).__init__(path, label, enabled)
         self.on_activate.clear()
         self.on_activate.connect(ResetAction())
@@ -457,7 +459,8 @@
 class CloseButton(Button):
     """The close button can be used to close the top-most dialog
     """
-    def __init__(self, path, label="Close", enabled=True):
+    def __init__(self, path, label=None, enabled=True):
+        label = label or _("Close")
         super(CloseButton, self).__init__(path, label, enabled)
         self.on_activate.clear()
         self.on_activate.connect(CloseAction())
@@ -466,7 +469,8 @@
 class QuitButton(Button):
     """The quit button can be used to quit the whole application
     """
-    def __init__(self, path, label="Quit", enabled=True):
+    def __init__(self, path, label=None, enabled=True):
+        label = label or _("Quit")
         super(QuitButton, self).__init__(path, label, enabled)
         self.on_activate.clear()
         self.on_activate.connect(QuitAction())
@@ -825,10 +829,8 @@
 
     def __init__(self, path, children, title=None):
         super(Page, self).__init__(path, children, title)
-        self.buttons = self.buttons or [SaveButton("%s.save" % path,
-                                                   _("Save")),
-                                        ResetButton("%s.reset" % path,
-                                                    _("Reset"))
+        self.buttons = self.buttons or [SaveButton("%s.save" % path),
+                                        ResetButton("%s.reset" % path)
                                         ]
 
     def elements(self):
@@ -847,8 +849,8 @@
 
     def __init__(self, path, title, children):
         super(Dialog, self).__init__(path, children, title)
-        self.buttons = [SaveButton("%s.save" % path, _("Save")),
-                        CloseButton("%s.close" % path, _("Reset"))
+        self.buttons = [SaveButton("%s.save" % path),
+                        CloseButton("%s.close" % path)
                         ]
         self.on_close_change = self.new_signal()
         self.close(False)
@@ -865,7 +867,7 @@
     def __init__(self, path, title, text, buttons=None):
         super(InfoDialog, self).__init__(path, title, [])
         self.children = [Label(path + ".label", text)]
-        self.buttons = buttons or [CloseButton(path + ".close", _("Close"))]
+        self.buttons = buttons or [CloseButton(path + ".close")]
 
 
 class TextViewDialog(Dialog):
@@ -875,7 +877,7 @@
         super(TextViewDialog, self).__init__(path, title, [])
         self.children = [Table("contents", "", _("Contents"),
                                contents, height=height)]
-        self.buttons = [CloseButton("dialog.close", _("Close"))]
+        self.buttons = [CloseButton("dialog.close")]
 
 
 class ConfirmationDialog(InfoDialog):
@@ -909,7 +911,7 @@
         self.texts = [initial_text, ""]
         self.plugin = plugin
 
-        self._close_button = CloseButton("button.close", _("Close"))
+        self._close_button = CloseButton("button.close")
         self.buttons = [self._close_button]
 
     def add_update(self, txt):


-- 
To view, visit http://gerrit.ovirt.org/29330
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I55c09116e2e43511ff9b7f2513016ace7d1b6b8c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list