[PATCH 02/10] The initial welcome screen is the only one that needs to do retranslation.
Chris Lumens
clumens at redhat.com
Fri Nov 30 16:28:18 UTC 2012
It might as well do it on its own.
---
pyanaconda/ui/gui/spokes/welcome.glade | 4 ++--
pyanaconda/ui/gui/spokes/welcome.py | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/welcome.glade b/pyanaconda/ui/gui/spokes/welcome.glade
index b9761b9..f0c63d9 100644
--- a/pyanaconda/ui/gui/spokes/welcome.glade
+++ b/pyanaconda/ui/gui/spokes/welcome.glade
@@ -59,7 +59,7 @@
<property name="row_spacing">12</property>
<property name="column_spacing">6</property>
<child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="betaWarnTitle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
@@ -91,7 +91,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="GtkLabel" id="betaWarnDesc">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
index 71093c7..5668d1e 100644
--- a/pyanaconda/ui/gui/spokes/welcome.py
+++ b/pyanaconda/ui/gui/spokes/welcome.py
@@ -136,7 +136,26 @@ class LanguageMixIn(object):
self._languageStoreFilter.set_visible_func(self._matchesEntry, None)
+ def _retranslate_one(self, widgetName):
+ widget = self.builder.get_object(widgetName)
+ if not widget:
+ return
+
+ if not widget in self._origStrings:
+ self._origStrings[widget] = widget.get_label()
+
+ before = self._origStrings[widget]
+ widget.set_label(_(before))
+
def retranslate(self):
+ # Change the translations on labels and buttons that do not have
+ # substitution text.
+ for name in ["pickLanguageLabel", "betaWarnTitle", "betaWarnDesc",
+ "quitButton", "continueButton"]:
+ self._retranslate_one(name)
+
+ # The welcome label is special - it has text that needs to be
+ # substituted.
welcomeLabel = self.builder.get_object(self._labelName)
if not welcomeLabel in self._origStrings:
@@ -146,6 +165,9 @@ class LanguageMixIn(object):
xlated = _(before) % (productName.upper(), productVersion)
welcomeLabel.set_label(xlated)
+ # And of course, don't forget the underlying window.
+ self.window.retranslate()
+
def refresh(self, displayArea):
store = self.builder.get_object("languageStore")
self._selectLanguage(store, self.data.lang.lang)
--
1.7.11.2
More information about the anaconda-patches
mailing list