7163453 part of disk screen stays in English in both fdisk mode and GPT mode
authorNiall Power <niall.power@oracle.com>
Tue, 03 Jul 2012 19:00:47 +0100
changeset 1744 0e0023aa7b39
parent 1743 e9b0490ed3e8
child 1745 ef7885eccc1c
7163453 part of disk screen stays in English in both fdisk mode and GPT mode
usr/src/cmd/gui-install/src/__init__.py
usr/src/cmd/gui-install/src/screen_manager.py
usr/src/cmd/gui-install/src/timezone.py
--- a/usr/src/cmd/gui-install/src/__init__.py	Mon Jul 02 20:41:49 2012 -0600
+++ b/usr/src/cmd/gui-install/src/__init__.py	Tue Jul 03 19:00:47 2012 +0100
@@ -41,6 +41,7 @@
 
 import g11nsvc
 import gtk
+import gtk.glade
 
 import osol_install.errsvc as errsvc
 from solaris_install import ApplicationData, CalledProcessError, Popen, \
@@ -232,11 +233,19 @@
 
 def _init_locale():
     '''Initialize the locale for gui-install'''
+
+    gettext_domain = "solaris_install_guiinstall"
+    locale_path = os.path.join('/usr', 'share', 'locale')
+
     locale.setlocale(locale.LC_ALL, "")
-    gettext.install("solaris_install_guiinstall",
-                    "/usr/share/locale",
+    gettext.install(gettext_domain,
+                    locale_path,
                     unicode=True)
 
+    # set up the glade gettext system and locale
+    gtk.glade.bindtextdomain(gettext_domain, locale_path)
+    gtk.glade.textdomain(gettext_domain)
+
 
 def main():
     '''Main routine for the gui-install-er'''
--- a/usr/src/cmd/gui-install/src/screen_manager.py	Mon Jul 02 20:41:49 2012 -0600
+++ b/usr/src/cmd/gui-install/src/screen_manager.py	Tue Jul 03 19:00:47 2012 +0100
@@ -100,8 +100,6 @@
             exit_gui_install(errcode=1)
         LOGGER.info('Done loading GLADE files.')
 
-        self.translate_labels()
-
         # Some of the windows imported from Glade may already have
         # Visible=True set, so we unmap them all here to prevent them
         # getting displayed before we want them to be
@@ -270,78 +268,6 @@
         # add the window to the quitapp list
         self.quitapp.append(self._window)
 
-    def translate_labels(self):
-        '''Temporary function to hack around translation errors.
-        '''
-        for object_name in ["welcomesummarylabel", "label13",
-                            "label5", "backlabel", "regionlabel",
-                            "countrylabel", "timezonescreenlabel", "timelabel",
-                            "datelabel", "yyyymmddlabel", "userlabel",
-                            "userpassword1label", "userpassword2label",
-                            "loginnamelabel", "usernamelabel", "hostlabel",
-                            "hostnamelabel", "disklabel", "softwarelabel",
-                            "timezonelabel", "languagelsabel", "accountlabel",
-                            "finishlabel1", "rebootlabel", "label14",
-                            "finishlogbuttonlabel", "failureinfolabel",
-                            "failuredetaillabel", "logbuttonlabel", "label16",
-                            "label6", "label3", "partitioningchoicelabel",
-                            "label4", "unreadablepartslabel",
-                            "partsfoundlabel", "custominfolabel", "label20",
-                            "partitionsizelabel", "partitiontypelabel",
-                            "partitionavaillabel", "diskwarninglabel",
-                            "discovery_local_check_label",
-                            "discovery_iscsi_check_label",
-                            "discovery_dhcp_label",
-                            "discovery_dhcp_unavail_label",
-                            "discovery_criteria_radio_label",
-                            "discovery_target_ip_label",
-                            "discovery_required_label",
-                            "discovery_lun_label",
-                            "discovery_target_name_label",
-                            "discovery_port_label",
-                            "discovery_initiator_name_label",
-                            "discovery_iscsi_boot_label",
-                            "discovery_chap_label",
-                            "discovery_chap_name_label",
-                            "discovery_chap_pass_label",
-                            "support_header_line1",
-                            "support_header_line3",
-                            "support_email_label",
-                            "support_email_subtitle_label",
-                            "support_authenticate_checkbox_label",
-                            "support_password_label",
-                            "support_net_access_title_label",
-                            "support_no_proxy_label",
-                            "support_proxy_label",
-                            "support_proxy_hostname_label",
-                            "support_proxy_port_label",
-                            "support_proxy_username_label",
-                            "support_proxy_password_label",
-                            "support_aggregation_radio_label",
-                            "support_ocm_label",
-                            "support_asr_label",
-                            ]:
-            # get a handle to the label
-            needs_translation = self.builder.get_object(object_name)
-            # replace the current label text with the translated text
-            if needs_translation:
-                needs_translation.set_label(_(needs_translation.get_label()))
-
-        # the AM/PM/24 hour time combo box needs to be handled differently
-        ampmcombobox = self.builder.get_object("ampmcombobox")
-        if ampmcombobox:
-            # make a list of translated labels excluding trailing '\n'
-            labels = _("AM\nPM\n24 Hour\n").split('\n')[:-1]
-            # get the store and iterate over the labels replacing them with
-            # the translated labels
-            store = ampmcombobox.get_model()
-            if store:
-                store_iter = store.get_iter('0')
-                for label in labels:
-                    if store_iter:
-                        store.set(store_iter, 0, label)
-                        store_iter = store.iter_next(store_iter)
-
     # Read-only properties
     @property
     def disk_screen(self):
--- a/usr/src/cmd/gui-install/src/timezone.py	Mon Jul 02 20:41:49 2012 -0600
+++ b/usr/src/cmd/gui-install/src/timezone.py	Tue Jul 03 19:00:47 2012 +0100
@@ -190,6 +190,21 @@
         # when a different time zone is selected.
         self.parent_screen = parent_screen
 
+        # the AM/PM/24 hour time combo box i18n is a bit quirky
+        ampmcombobox = self.builder.get_object("ampmcombobox")
+        if ampmcombobox:
+            # make a list of translated labels excluding trailing '\n'
+            labels = _("AM\nPM\n24 Hour\n").split('\n')[:-1]
+            # get the store and iterate over the labels replacing them with
+            # the translated labels
+            store = ampmcombobox.get_model()
+            if store:
+                store_iter = store.get_iter('0')
+                for label in labels:
+                    if store_iter:
+                        store.set(store_iter, 0, label)
+                        store_iter = store.iter_next(store_iter)
+
         self.map = Map()
         self.map.load_timezones()
         self.map.modify_bg(gtk.STATE_NORMAL, COLOR_WHITE)