If there is no layout matching both language and country, prefer country over language. E.g. the 'ch' (Swiss) layout is not listed for the German language, but it is, of course, listed for the 'CH' as a country.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/keyboard.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index e865f08..403d42e 100755 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -476,7 +476,7 @@ class XklWrapper(object):
language_layouts = self.get_language_layouts(language) country_layouts = self._country_keyboard_variants.get(country, None) - if not language_layouts: + if not language_layouts and not country_layouts: return None
matches_both = (layout for layout in language_layouts @@ -485,7 +485,10 @@ class XklWrapper(object): try: return matches_both.next().name except StopIteration: - return language_layouts[0].name + if country_layouts: + return country_layouts[0].name + else: + return language_layouts[0].name
def get_current_layout_name(self): """
On Mon, Jan 07, 2013 at 01:58:12PM +0100, Vratislav Podzimek wrote:
If there is no layout matching both language and country, prefer country over language. E.g. the 'ch' (Swiss) layout is not listed for the German language, but it is, of course, listed for the 'CH' as a country.
Looks good to me.
Samantha
anaconda-patches@lists.fedorahosted.org