From 44e66c1318221a8eb398dba1a6d7f9ff6903a918 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Sep 2021 13:16:23 +0200 Subject: [PATCH] [keyboard] Fix mapping for India + English - India (when in English) should use the English variant, not Hindi - While here, fix up minor items in code: - Typo in comment - Asturian doesn't need a special case (which didn't match, anyway) - Don't debug-log a country-name that might be entirely wrong (the layout is English, variant "in" but "in" interpreted as a country is Indonesia, and the actually-desired name is eng_in which isn't a QLocale name at all -- just like the Hausa and Igbo special cases) --- src/modules/keyboard/Config.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index b77282a18..7140bd790 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -467,12 +467,12 @@ Config::guessLocaleKeyboardLayout() { "ar_TN", arabic }, { "ar_YE", arabic }, { "ca_ES", "cat_ES" }, /* Catalan */ - { "as_ES", "ast_ES" }, /* Asturian */ { "en_CA", "us" }, /* Canadian English */ { "el_CY", "gr" }, /* Greek in Cyprus */ - { "el_GR", "gr" }, /* Greek in Greeze */ + { "el_GR", "gr" }, /* Greek in Greece */ { "ig_NG", "igbo_NG" }, /* Igbo in Nigeria */ - { "ha_NG", "hausa_NG" } /* Hausa */ + { "ha_NG", "hausa_NG" }, /* Hausa */ + { "en_IN", "eng_in" }, /* India, English with Rupee */ } ); // Try to preselect a layout, depending on language and locale @@ -508,14 +508,7 @@ Config::guessLocaleKeyboardLayout() } if ( !lang.isEmpty() ) { - const auto langParts = lang.split( '_', SplitSkipEmptyParts ); - - // Note that this his string is not fit for display purposes! - // It doesn't come from QLocale::nativeCountryName. - QString country = QLocale::countryToString( QLocale( lang ).country() ); - cDebug() << Logger::SubEntry << "extracted country" << country << "::" << langParts; - - guessLayout( langParts, m_keyboardLayoutsModel, m_keyboardVariantsModel ); + guessLayout( lang.split( '_', SplitSkipEmptyParts ), m_keyboardLayoutsModel, m_keyboardVariantsModel ); } }