patch to improve display of keyboard layouts

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

 



Hi, I wanted to have this patch for some releases now
and finally found time now to work on it this week.

(Also attached to https://bugzilla.redhat.com/show_bug.cgi?id=1021907)

Short summary is that this changes the display of
keyboard layouts from "English (English (US))" to
"English (US)", ie it avoids the unnecessary repetition.

The final patch is actually quite simple,
almost simpler than the current code perhaps.
It checks is if the translated xkb layout description
starts with translation of the language and
if so just displays the translated description,
otherwise it displays "lang (description)" as now.

I feel this makes the layout display less confusing
and easier to read so I hope this small patch could be
reviewed and accepted for Fedora 20.

I have tested it pretty carefully for most of
the major languages and it seems to work well.

Thanks, Jens
--- anaconda-20.25.1/pyanaconda/keyboard.py.origin	2013-10-16 05:43:45.000000000 +0900
+++ anaconda-20.25.1/pyanaconda/keyboard.py	2013-10-22 17:45:58.676566103 +0900
@@ -551,20 +551,18 @@
         """
 
         layout_info = self._layout_infos[layout_variant]
+
+        # translate language and upcase its first letter, translate the
+        # layout-variant description
         if xlated:
+            lang = iutil.upcase_first_letter(iso_(layout_info.lang).decode("utf-8"))
             description = Xkb_(layout_info.desc).decode("utf-8")
         else:
+            lang = iutil.upcase_first_letter(layout_info.lang)
             description = layout_info.desc
 
-        if with_lang and layout_info.lang:
-            # translate language and upcase its first letter, translate the
-            # layout-variant description
-            if xlated:
-                lang = iso_(layout_info.lang).decode("utf-8")
-            else:
-                lang = layout_info.lang
-
-            return "%s (%s)" % (iutil.upcase_first_letter(lang), description)
+        if with_lang and lang and not description.startswith(lang):
+            return "%s (%s)" % (lang, description)
         else:
             return description
 
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux