[PATCH newui] Mark more strings for translation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 pyanaconda/ui/gui/__init__.py                |    3 ++-
 pyanaconda/ui/gui/categories/__init__.py     |    4 +++-
 pyanaconda/ui/gui/categories/localization.py |    4 +++-
 pyanaconda/ui/gui/categories/software.py     |    4 +++-
 pyanaconda/ui/gui/hubs/__init__.py           |    9 ++++++---
 pyanaconda/ui/gui/spokes/language.py         |    8 ++++++--
 pyanaconda/ui/gui/spokes/software.py         |    8 ++++++--
 pyanaconda/ui/gui/spokes/source.py           |   14 +++++++++-----
 widgets/src/BaseWindow.c                     |    4 ++--
 widgets/src/DiskOverview.c                   |    8 ++++----
 widgets/src/SpokeSelector.c                  |    4 ++--
 widgets/src/intl.h                           |    1 +
 12 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index c0ad531..ca08edc 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -84,7 +84,8 @@ class GraphicalUserInterface(UserInterface):
         self._actions[0].setup()
 
         self._actions[0].window.set_beta(not isFinal)
-        self._actions[0].window.set_property("distribution", _("%s %s INSTALLATION") % (productName, productVersion))
+        self._actions[0].window.set_property("distribution", _("%(productName)s %(productVersion)s INSTALLATION") % \
+                                             {"productName": productName, "productVersion": productVersion})
 
         self._actions[0].window.show_all()
         Gtk.main()
diff --git a/pyanaconda/ui/gui/categories/__init__.py b/pyanaconda/ui/gui/categories/__init__.py
index 10b6d25..31739d7 100644
--- a/pyanaconda/ui/gui/categories/__init__.py
+++ b/pyanaconda/ui/gui/categories/__init__.py
@@ -19,6 +19,8 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+N_ = lambda x: x
+
 from pyanaconda.ui.gui import collect
 
 __all__ = ["SpokeCategory", "collect_categories"]
@@ -38,7 +40,7 @@ class SpokeCategory(object):
                         the grid.
     """
     displayOnHub = None
-    title = "DEFAULT TITLE"
+    title = N_("DEFAULT TITLE")
 
     def grid(self, selectors):
         """Construct a Gtk.Grid consisting of two columns from the provided
diff --git a/pyanaconda/ui/gui/categories/localization.py b/pyanaconda/ui/gui/categories/localization.py
index 787f4d2..577efdc 100644
--- a/pyanaconda/ui/gui/categories/localization.py
+++ b/pyanaconda/ui/gui/categories/localization.py
@@ -19,6 +19,8 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+N_ = lambda x: x
+
 from pyanaconda.ui.gui.categories import SpokeCategory
 from pyanaconda.ui.gui.hubs.summary import SummaryHub
 
@@ -26,4 +28,4 @@ __all__ = ["LocalizationCategory"]
 
 class LocalizationCategory(SpokeCategory):
     displayOnHub = SummaryHub
-    title = "LOCALIZATION"
+    title = N_("LOCALIZATION")
diff --git a/pyanaconda/ui/gui/categories/software.py b/pyanaconda/ui/gui/categories/software.py
index b0e2c5b..0b84499 100644
--- a/pyanaconda/ui/gui/categories/software.py
+++ b/pyanaconda/ui/gui/categories/software.py
@@ -19,6 +19,8 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+N_ = lambda x: x
+
 from pyanaconda.ui.gui.categories import SpokeCategory
 from pyanaconda.ui.gui.hubs.summary import SummaryHub
 
@@ -26,4 +28,4 @@ __all__ = ["SoftwareCategory"]
 
 class SoftwareCategory(SpokeCategory):
     displayOnHub = SummaryHub
-    title = "SOFTWARE"
+    title = N_("SOFTWARE")
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index 9a2e3ac..bb559d5 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -19,6 +19,9 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+
 from pyanaconda.ui.gui import UIObject
 from pyanaconda.ui.gui.categories import collect_categories
 from pyanaconda.ui.gui.spokes import StandaloneSpoke, collect_spokes
@@ -116,7 +119,7 @@ class Hub(UIObject):
 
                 # And then create its associated selector, and set some default
                 # values that affect its display on the hub.
-                selector = AnacondaWidgets.SpokeSelector(spoke.title, spoke.icon)
+                selector = AnacondaWidgets.SpokeSelector(_(spoke.title), spoke.icon)
                 selector.set_property("status", spoke.status)
                 selector.set_incomplete(not spoke.completed)
                 self._handleCompleteness(spoke)
@@ -133,7 +136,7 @@ class Hub(UIObject):
             if not selectors:
                 continue
 
-            label = Gtk.Label("<span font-desc=\"Sans 14\">%s</span>" % obj.title)
+            label = Gtk.Label("<span font-desc=\"Sans 14\">%s</span>" % _(obj.title))
             label.set_use_markup(True)
             label.set_halign(Gtk.Align.START)
             label.set_margin_bottom(12)
@@ -162,7 +165,7 @@ class Hub(UIObject):
         if len(self._incompleteSpokes) == 0:
             self.window.clear_info()
         else:
-            self.window.set_info(Gtk.MessageType.WARNING, "Please complete items marked with this icon first.")
+            self.window.set_info(Gtk.MessageType.WARNING, _("Please complete items marked with this icon first."))
 
     def setup(self):
         UIObject.setup(self)
diff --git a/pyanaconda/ui/gui/spokes/language.py b/pyanaconda/ui/gui/spokes/language.py
index 3a92374..0b9d0a2 100644
--- a/pyanaconda/ui/gui/spokes/language.py
+++ b/pyanaconda/ui/gui/spokes/language.py
@@ -19,6 +19,10 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+N_ = lambda x: x
+
 from gi.repository import Gtk
 
 from pyanaconda.ui.gui import UIObject
@@ -52,7 +56,7 @@ class LanguageSpoke(NormalSpoke):
     category = LocalizationCategory
 
     icon = "accessories-character-map"
-    title = "LANGUAGE"
+    title = N_("LANGUAGE")
 
     def apply(self):
         pass
@@ -65,7 +69,7 @@ class LanguageSpoke(NormalSpoke):
 
     @property
     def status(self):
-        return "Something selected"
+        return _("Something selected")
 
     def populate(self):
         NormalSpoke.populate(self)
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index ed9a5dc..3cb71a4 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -19,6 +19,10 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+N_ = lambda x: x
+
 from gi.repository import Gtk
 
 from pyanaconda.ui.gui.spokes import NormalSpoke
@@ -34,7 +38,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
     category = SoftwareCategory
 
     icon = "package-x-generic-symbolic"
-    title = "SOFTWARE SELECTION"
+    title = N_("SOFTWARE SELECTION")
 
     def apply(self):
         pass
@@ -47,7 +51,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
     def status(self):
         row = self._get_selected_desktop()
         if not row:
-            return "Nothing selected"
+            return _("Nothing selected")
 
         return row[2]
 
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index d5cefe5..a5a8d8e 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -19,6 +19,10 @@
 # Red Hat Author(s): Chris Lumens <clumens@xxxxxxxxxx>
 #
 
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+N_ = lambda x: x
+
 import os.path
 
 from gi.repository import Gtk, AnacondaWidgets
@@ -112,7 +116,7 @@ class SourceSpoke(NormalSpoke):
     category = SoftwareCategory
 
     icon = "media-optical-symbolic"
-    title = "INSTALL SOURCE"
+    title = N_("INSTALL SOURCE")
 
     def __init__(self, *args, **kwargs):
         NormalSpoke.__init__(self, *args, **kwargs)
@@ -167,7 +171,7 @@ class SourceSpoke(NormalSpoke):
 
     @property
     def completed(self):
-        return self.status and self.status != "Nothing selected"
+        return self.status and self.status != _("Nothing selected")
 
     @property
     def status(self):
@@ -177,13 +181,13 @@ class SourceSpoke(NormalSpoke):
             else:
                 return self.data.method.url
         elif self.data.method.method == "nfs":
-            return "NFS server %s" % self.data.method.server
+            return _("NFS server %s") % self.data.method.server
         elif self.data.method.method == "cdrom":
-            return "CD/DVD drive"
+            return _("CD/DVD drive")
         elif self.data.method.method == "harddrive":
             return os.path.basename(self._currentIsoFile)
         else:
-            return "Nothing selected"
+            return _("Nothing selected")
 
     def _grabObjects(self):
         self._autodetectButton = self.builder.get_object("autodetectRadioButton")
diff --git a/widgets/src/BaseWindow.c b/widgets/src/BaseWindow.c
index 63fef9c..44c60ef 100644
--- a/widgets/src/BaseWindow.c
+++ b/widgets/src/BaseWindow.c
@@ -73,8 +73,8 @@ enum {
     PROP_WINDOW_NAME
 };
 
-#define DEFAULT_DISTRIBUTION  "DISTRIBUTION INSTALLATION"
-#define DEFAULT_WINDOW_NAME   "SPOKE NAME"
+#define DEFAULT_DISTRIBUTION  N_("DISTRIBUTION INSTALLATION")
+#define DEFAULT_WINDOW_NAME   N_("SPOKE NAME")
 
 struct _AnacondaBaseWindowPrivate {
     gboolean    is_beta, info_shown;
diff --git a/widgets/src/DiskOverview.c b/widgets/src/DiskOverview.c
index 85ce348..bb78f1d 100644
--- a/widgets/src/DiskOverview.c
+++ b/widgets/src/DiskOverview.c
@@ -46,9 +46,9 @@ enum {
 };
 
 /* Defaults for each property. */
-#define DEFAULT_DESCRIPTION   "New Device"
-#define DEFAULT_KIND          "drive-harddisk"
-#define DEFAULT_CAPACITY      "0 MB"
+#define DEFAULT_DESCRIPTION   N_("New Device")
+#define DEFAULT_KIND          N_("drive-harddisk")
+#define DEFAULT_CAPACITY      N_("0 MB")
 #define DEFAULT_OS            ""
 #define DEFAULT_POPUP_INFO    ""
 
@@ -189,7 +189,7 @@ static void anaconda_disk_overview_init(AnacondaDiskOverview *widget) {
 
     /* Create the capacity label. */
     widget->priv->capacity_label = gtk_label_new(NULL);
-    markup = g_markup_printf_escaped("<span size='large'>%s</span>", DEFAULT_CAPACITY);
+    markup = g_markup_printf_escaped("<span size='large'>%s</span>", _(DEFAULT_CAPACITY));
     gtk_label_set_markup(GTK_LABEL(widget->priv->capacity_label), markup);
     g_free(markup);
 
diff --git a/widgets/src/SpokeSelector.c b/widgets/src/SpokeSelector.c
index 904a15f..92f7fa7 100644
--- a/widgets/src/SpokeSelector.c
+++ b/widgets/src/SpokeSelector.c
@@ -50,8 +50,8 @@ enum {
 };
 
 #define DEFAULT_ICON    "gtk-missing-image"
-#define DEFAULT_STATUS  "None"
-#define DEFAULT_TITLE   "New Selector"
+#define DEFAULT_STATUS  N_("None")
+#define DEFAULT_TITLE   N_("New Selector")
 
 struct _AnacondaSpokeSelectorPrivate {
     gboolean   is_incomplete;
diff --git a/widgets/src/intl.h b/widgets/src/intl.h
index 30bca59..b39ee60 100644
--- a/widgets/src/intl.h
+++ b/widgets/src/intl.h
@@ -24,6 +24,7 @@
 #include "gettext.h"
 
 #define _(x) gettext(x)
+#define N_(String) String
 
 #ifdef ENABLE_NLS
 #define P_(String) g_dgettext(GETTEXT_PACKAGE "-properties",String)
-- 
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux