[PATCH 3/3] Added translation contexts to the TUI.

David Shea dshea at redhat.com
Fri Oct 18 15:50:54 UTC 2013


The TUI uses 'q', 'c', and 'r', as abbreviations for 'quit', 'continue'
and 'refresh'. Currently, these are the only abbreviations used, and
they all appear in the same context. Added a context string to the
translation of the abbreviations in case we add additional contexts in
the future.
---
 pyanaconda/ui/tui/hubs/__init__.py   | 4 ++--
 pyanaconda/ui/tui/simpleline/base.py | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py
index 8d2d79d..59a7f2c 100644
--- a/pyanaconda/ui/tui/hubs/__init__.py
+++ b/pyanaconda/ui/tui/hubs/__init__.py
@@ -23,7 +23,7 @@ from pyanaconda.ui.tui.tuiobject import TUIObject
 from pyanaconda.ui.tui.spokes import collect_spokes
 from pyanaconda.ui import common
 
-from pyanaconda.i18n import _
+from pyanaconda.i18n import _, C_
 
 class TUIHub(TUIObject, common.Hub):
     """Base Hub class implementing the pyanaconda.ui.common.Hub interface.
@@ -109,7 +109,7 @@ class TUIHub(TUIObject, common.Hub):
             # If we get a continue, check for unfinished spokes.  If unfinished
             # don't continue
             # TRANSLATORS: 'c' to continue
-            if key == _('c'):
+            if key == C_('TUI|Spoke Navigation', 'c'):
                 for spoke in self._spokes.values():
                     if not spoke.completed and spoke.mandatory:
                         print(_("Please complete all spokes before continuing"))
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index e26d317..469c2a0 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -28,7 +28,7 @@ import threading
 from pyanaconda.threads import threadMgr, AnacondaThread
 from pyanaconda.ui.communication import hubQ
 from pyanaconda import constants
-from pyanaconda.i18n import _, N_
+from pyanaconda.i18n import _, N_, C_
 
 RAW_INPUT_LOCK = threading.Lock()
 
@@ -448,19 +448,19 @@ class App(object):
 
         # global refresh command
         # TRANSLATORS: 'r' to refresh
-        if self._screens and (key == _('r')):
+        if self._screens and (key == C_('TUI|Spoke Navigation', 'r')):
             self._do_redraw()
             return True
 
         # global close command
         # TRANSLATORS: 'c' to continue
-        if self._screens and (key == _('c')):
+        if self._screens and (key == C_('TUI|Spoke Navigation', 'c')):
             self.close_screen()
             return True
 
         # global quit command
         # TRANSLATORS: 'q' to quit
-        elif self._screens and (key == _('q')):
+        elif self._screens and (key == C_('TUI|Spoke Navigation', 'q')):
             if self.quit_question:
                 d = self.quit_question(self, _(self.quit_message))
                 self.switch_screen_modal(d)
-- 
1.8.3.1



More information about the anaconda-patches mailing list