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

Martin Kolman mkolman at redhat.com
Tue Jul 28 15:14:50 UTC 2015


On Mon, 2015-07-27 at 16:44 -0400, David Shea wrote:
> On 07/27/2015 02:42 PM, 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,
> > simplified example:
> > 
> > _("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      | 11 +++++++++--
> >   pyanaconda/ui/tui/hubs/summary.py       | 16 ++++++++++++----
> >   pyanaconda/ui/tui/simpleline/base.py    | 11 ++++++++++-
> >   pyanaconda/ui/tui/spokes/langsupport.py | 15 ++++++++++++---
> >   pyanaconda/ui/tui/spokes/time_spoke.py  | 12 +++++++++---
> >   pyanaconda/ui/tui/tuiobject.py          | 15 +++++++++++----
> >   6 files changed, 63 insertions(+), 17 deletions(-)
> 
> 
> 
> My only complaint now is the stuff that gettext_warnings.sh is going 
> to 
> complain about:
There was no gettext_warnings.sh when I wrote this. ;-)

>  for each for the "Please make your choice..."/"Please 
> select..." strings, use named format parameters and a dictionary 
> instead 
> of just bare %s's.
On to v3! :D
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list