[PATCH 4/4] Match layouts with stripped accents in AddLayout dialog

Vratislav Podzimek vpodzime at redhat.com
Sat Nov 9 14:45:28 UTC 2013


Now that we have the layout descriptions translated, the matching function
should also try to strip accents to allow matching e.g. "české" with "ceske".

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/keyboard.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 0952c8f..f41992a 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -30,6 +30,7 @@ from pyanaconda import keyboard
 from pyanaconda import flags
 from pyanaconda.i18n import _, N_, CN_
 from pyanaconda.constants import DEFAULT_KEYBOARD
+from pyanaconda.iutil import strip_accents
 
 import locale as locale_mod
 
@@ -83,9 +84,12 @@ class AddLayoutDialog(GUIObject):
         value = model[itr][0]
         eng_value = self._xkl_wrapper.get_layout_variant_description(value, xlated=False)
         xlated_value = self._xkl_wrapper.get_layout_variant_description(value)
+        translit_value = strip_accents(xlated_value).lower()
         entry_text = self._entry.get_text()
+        translit_text = strip_accents(unicode(entry_text, "utf-8")).lower()
 
-        return have_word_match(entry_text, eng_value) or have_word_match(entry_text, xlated_value)
+        return have_word_match(entry_text, eng_value) or have_word_match(entry_text, xlated_value) \
+            or have_word_match(translit_text, translit_value)
 
     def compare_layouts(self, model, itr1, itr2, user_data=None):
         """
-- 
1.8.3.1



More information about the anaconda-patches mailing list