[PATCH 3/3] Move translatable format strings into python.

David Shea dshea at redhat.com
Mon Feb 17 18:52:06 UTC 2014


Bonus: no more weird tricks for retranslating the WELCOME TO message.
---
 pyanaconda/ui/gui/hubs/progress.glade  | 4 ++--
 pyanaconda/ui/gui/hubs/progress.py     | 7 +++++--
 pyanaconda/ui/gui/spokes/welcome.glade | 2 +-
 pyanaconda/ui/gui/spokes/welcome.py    | 8 ++------
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/pyanaconda/ui/gui/hubs/progress.glade b/pyanaconda/ui/gui/hubs/progress.glade
index cd39e4c..1b1f94b 100644
--- a/pyanaconda/ui/gui/hubs/progress.glade
+++ b/pyanaconda/ui/gui/hubs/progress.glade
@@ -129,7 +129,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">end</property>
-                                <property name="label" translatable="yes">%s is now successfully installed, but some configuration still needs to be done.
+                                <property name="label">%s is now successfully installed, but some configuration still needs to be done.
 Finish it and then click the Finish configuration button please.</property>
                                 <property name="justify">right</property>
                                 <property name="wrap">True</property>
@@ -183,7 +183,7 @@ Finish it and then click the Finish configuration button please.</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">end</property>
-                                <property name="label" translatable="yes">%s is now successfully installed  and ready for you to use!
+                                <property name="label">%s is now successfully installed  and ready for you to use!
 Go ahead and reboot to start using it!</property>
                                 <property name="justify">right</property>
                                 <property name="wrap">True</property>
diff --git a/pyanaconda/ui/gui/hubs/progress.py b/pyanaconda/ui/gui/hubs/progress.py
index 9fb3412..08fc5e2 100644
--- a/pyanaconda/ui/gui/hubs/progress.py
+++ b/pyanaconda/ui/gui/hubs/progress.py
@@ -211,10 +211,13 @@ class ProgressHub(Hub):
         self._progressNotebook = self.builder.get_object("progressNotebook")
 
         lbl = self.builder.get_object("configurationLabel")
-        lbl.set_text(lbl.get_text() % productName)
+        lbl.set_text(_("%s is now successfully installed, but some configuration still needs to be done.\n"
+            "Finish it and then click the Finish configuration button please.") %
+            productName)
 
         lbl = self.builder.get_object("rebootLabel")
-        lbl.set_text(lbl.get_text() % productName)
+        lbl.set_text(_("%s is now successfully installed  and ready for you to use!\n"
+                "Go ahead and reboot to start using it!") % productName)
 
         rnotes = self._get_rnotes()
         # Get the start of the pages we're about to add to the notebook
diff --git a/pyanaconda/ui/gui/spokes/welcome.glade b/pyanaconda/ui/gui/spokes/welcome.glade
index bf1e5ac..0de940c 100644
--- a/pyanaconda/ui/gui/spokes/welcome.glade
+++ b/pyanaconda/ui/gui/spokes/welcome.glade
@@ -323,7 +323,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="ypad">6</property>
-                    <property name="label" translatable="yes">WELCOME TO %(name)s %(version)s.</property>
+                    <property name="label">WELCOME TO %(name)s %(version)s.</property>
                     <attributes>
                       <attribute name="font-desc" value="Cantarell Bold 16"/>
                     </attributes>
diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
index 5f2ca5e..d169872 100644
--- a/pyanaconda/ui/gui/spokes/welcome.py
+++ b/pyanaconda/ui/gui/spokes/welcome.py
@@ -243,12 +243,8 @@ class WelcomeLanguageSpoke(LangLocaleHandler, StandaloneSpoke):
         # substituted.
         welcomeLabel = self.builder.get_object("welcomeLabel")
 
-        if not welcomeLabel in self._origStrings:
-            self._origStrings[welcomeLabel] = welcomeLabel.get_label()
-
-        before = self._origStrings[welcomeLabel]
-        xlated = _(before) % {"name" : productName.upper(), "version" : productVersion}
-        welcomeLabel.set_label(xlated)
+        welcomeLabel.set_text(_("WELCOME TO %(name)s %(version)s.") %
+                {"name" : productName.upper(), "version" : productVersion})
 
         # Retranslate the language (filtering) entry's placeholder text
         languageEntry = self.builder.get_object("languageEntry")
-- 
1.8.5.3



More information about the anaconda-patches mailing list