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

[PATCH] Make the "comps" translation domain dynamic.



In Fedora, for instance, there's no comps localization file (there's
neither a product.img).

This patch should make the installation tasks look translated

Related: rhbz#681404
---
 pyanaconda/installclass.py          |    8 ++++++++
 pyanaconda/installclasses/fedora.py |    2 ++
 pyanaconda/installclasses/rhel.py   |    2 ++
 pyanaconda/iw/task_gui.py           |    9 ++++++---
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 8bc2e53..5227ac3 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -55,6 +55,7 @@ class BaseInstallClass(object):
     showUpgrade = True
     bootloaderTimeoutDefault = None
     bootloaderExtraArgs = ""
+    _l10n_domain = None
 
     # list of of (txt, grplist) tuples for task selection screen
     tasks = []
@@ -70,6 +71,13 @@ class BaseInstallClass(object):
         return _(self._description) % self._descriptionFields
     description = property(_get_description)
 
+    @property
+    def l10n_domain(self):
+        if self._l10n_domain is None:
+            raise RuntimeError("Localization domain for '%s' not set." %
+                               self.name)
+        return self._l10n_domain
+
     def postAction(self, anaconda):
         anaconda.backend.postAction(anaconda)
 
diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
index a2d9a97..3f7243f 100644
--- a/pyanaconda/installclasses/fedora.py
+++ b/pyanaconda/installclasses/fedora.py
@@ -62,6 +62,8 @@ class InstallClass(BaseInstallClass):
                "java", "text-internet", "web-server"]),
              (N_("Minimal"), ["core"])]
 
+    _l10n_domain = "anaconda"
+
     def getPackagePaths(self, uri):
         if not type(uri) == types.ListType:
             uri = [uri,]
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
index 0a88796..19b2d8c 100644
--- a/pyanaconda/installclasses/rhel.py
+++ b/pyanaconda/installclasses/rhel.py
@@ -44,6 +44,8 @@ class InstallClass(BaseInstallClass):
     tasks = [(N_("Minimal"),
               ["core"])]
 
+    _l10n_domain = "anaconda"
+
     def getPackagePaths(self, uri):
         if not type(uri) == types.ListType:
             uri = [uri,]
diff --git a/pyanaconda/iw/task_gui.py b/pyanaconda/iw/task_gui.py
index 75d0910..0a1f180 100644
--- a/pyanaconda/iw/task_gui.py
+++ b/pyanaconda/iw/task_gui.py
@@ -621,7 +621,8 @@ class TaskWindow(InstallWindow):
                 continue
 
             enabled = self.backend.groupListDefault(grps)
-            store.append([not anyEnabled and enabled, gettext.ldgettext("comps", txt), grps])
+            trans_txt = gettext.ldgettext(self.anaconda.instClass.l10n_domain, txt)
+            store.append([not anyEnabled and enabled, trans_txt, grps])
 
             if enabled:
                 anyEnabled = True
@@ -661,9 +662,11 @@ class TaskWindow(InstallWindow):
         tl.append_column(col)
 
         for (reponame, repo) in self.repos.repos.items():
+            repo_name = gettext.ldgettext(self.anaconda.instClass.l10n_domain,
+                                          repo.name)
             store.append([repo.isEnabled(),
-                         gettext.ldgettext("comps", repo.name),
-                         repo])
+                          repo_name,
+                          repo])
 
         store.set_sort_column_id(1, gtk.SORT_ASCENDING)
         store.set_sort_func(1, self.__sortRepos)
-- 
1.7.3.3


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