[anaconda][rhel7-branch][PATCH] Prevent incomplete translations from making the TUI unusable (#1235617)
Brian C. Lane
bcl at redhat.com
Sat Jul 25 00:05:07 UTC 2015
On Fri, Jul 24, 2015 at 02:06:07PM +0200, Martin Kolman wrote:
> What happens is that we have the following translatable strings:
> - "Please make your choice from above ['q' to quit | 'c' to continue | 'r' to refresh]"
> - "q"
> - "c"
> - "r"
> All of these strings can be translated *separately* and in many partial
> translations *some of them are translated while some are not*.
>
> The end result is that we might be telling the user to press say "p"
> for "pokračovat" but me might actually expect "c" for continue,
> because the "c" string was not translated to "p".
>
> This affects both the Anaconda and Initial Setup TUIs and can make the
> UI totally unusable.
>
> The fix for this is to remove the keystrokes from the long strings and replace
> them by string formatting operators & do the keystroke transformation separately:
>
> _("Please make your choice from above ['%s' to quit | '%s' to continue | '%s' to refresh]") % \
> (_("q"), _("c"), _("r"))
>
> This makes sure that we will always ask the user to type the same
> keystroke that is actually displayed.
>
> Resolves: rhbz#1235617
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
> pyanaconda/ui/tui/hubs/__init__.py | 6 ++++--
> pyanaconda/ui/tui/hubs/summary.py | 5 ++++-
> pyanaconda/ui/tui/simpleline/base.py | 4 +++-
> pyanaconda/ui/tui/spokes/langsupport.py | 4 +++-
> pyanaconda/ui/tui/spokes/time_spoke.py | 3 ++-
> pyanaconda/ui/tui/tuiobject.py | 2 +-
> 6 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/pyanaconda/ui/tui/tuiobject.py b/pyanaconda/ui/tui/tuiobject.py
> index 9fbb726..58d3664 100644
> --- a/pyanaconda/ui/tui/tuiobject.py
> +++ b/pyanaconda/ui/tui/tuiobject.py
> @@ -128,7 +128,7 @@ class YesNoDialog(tui.UIScreen):
> return True
>
> def prompt(self, args = None):
> - return _("Please respond 'yes' or 'no': ")
> + return _("Please respond '%s' or '%s': ") % (_("yes"), _("no"))
Does this also need a translator comment?
I like this patch, barring problems from the translation team it has my
ack.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list