[PATCH] Prevent incomplete translations from making the TUI unusable (#1235617)

David Shea dshea at redhat.com
Tue Jul 28 16:58:50 UTC 2015


On 07/28/2015 11:56 AM, 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,
> for example:
>
> return _("  Please make your choice from above ['%(quit)s' to quit | '%(begin)s' to begin installation |\n  '%(refresh)s' to refresh]: ") % {
>      # TRANSLATORS: 'q' to quit
>      'quit': C_('TUI|Spoke Navigation', 'q'),
>      # TRANSLATORS: 'b' to begin installation
>      'begin': C_('TUI|Spoke Navigation', 'b'),
>      # TRANSLATORS: 'r' to refresh
>      'refresh': C_('TUI|Spoke Navigation', 'r')
> }
>
> This makes sure that we will always ask the user to type the same
> keystroke that is actually displayed. It also assures that the translators will actually know
> by using the TRANSLATORS: comments, translations contexts and dictionary substitution.
>
> Resolves: rhbz#1235617
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>   pyanaconda/ui/tui/hubs/__init__.py      | 13 ++++++++++---
>   pyanaconda/ui/tui/hubs/summary.py       | 15 +++++++++++----
>   pyanaconda/ui/tui/simpleline/base.py    | 10 +++++++++-
>   pyanaconda/ui/tui/spokes/langsupport.py | 13 ++++++++++---
>   pyanaconda/ui/tui/spokes/time_spoke.py  | 12 +++++++++---
>   pyanaconda/ui/tui/tuiobject.py          | 15 +++++++++++----
>   6 files changed, 60 insertions(+), 18 deletions(-)
>
>


Ack.


More information about the anaconda-patches mailing list