[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)
This commit is contained in:
Adriaan de Groot 2021-09-06 13:16:23 +02:00
parent 4948f634ed
commit 44e66c1318

View File

@ -467,12 +467,12 @@ Config::guessLocaleKeyboardLayout()
{ "ar_TN", arabic }, { "ar_TN", arabic },
{ "ar_YE", arabic }, { "ar_YE", arabic },
{ "ca_ES", "cat_ES" }, /* Catalan */ { "ca_ES", "cat_ES" }, /* Catalan */
{ "as_ES", "ast_ES" }, /* Asturian */
{ "en_CA", "us" }, /* Canadian English */ { "en_CA", "us" }, /* Canadian English */
{ "el_CY", "gr" }, /* Greek in Cyprus */ { "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 */ { "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 // Try to preselect a layout, depending on language and locale
@ -508,14 +508,7 @@ Config::guessLocaleKeyboardLayout()
} }
if ( !lang.isEmpty() ) if ( !lang.isEmpty() )
{ {
const auto langParts = lang.split( '_', SplitSkipEmptyParts ); guessLayout( lang.split( '_', SplitSkipEmptyParts ), m_keyboardLayoutsModel, m_keyboardVariantsModel );
// 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 );
} }
} }