From 6cc6dfc3f791025e91dbf5f3fbf93981219637e1 Mon Sep 17 00:00:00 2001 From: Amadeo Alex <68441479+amadeo-alex@users.noreply.github.com> Date: Wed, 1 May 2024 22:55:36 +0200 Subject: [PATCH] added additional check for mixed german keyboard layouts --- .../HASS.Agent/Functions/HelperFunctions.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/HASS.Agent/HASS.Agent/Functions/HelperFunctions.cs b/src/HASS.Agent/HASS.Agent/Functions/HelperFunctions.cs index b1f7bc85..877b4e57 100644 --- a/src/HASS.Agent/HASS.Agent/Functions/HelperFunctions.cs +++ b/src/HASS.Agent/HASS.Agent/Functions/HelperFunctions.cs @@ -546,13 +546,24 @@ internal static bool InputLanguageCheckDiffers(out bool knownToCollide, out stri var inputLanguage = InputLanguage.CurrentInputLanguage.Handle; // check for known OK languages - if (KnownOkInputLanguage.ContainsKey(inputLanguage)) return false; - + if (KnownOkInputLanguage.ContainsKey(inputLanguage)) + return false; + // check for known NOT OK languages - if (KnownNotOkInputLanguage.ContainsKey(inputLanguage)) + var germanLayoutDetected = false; + foreach(InputLanguage language in InputLanguage.InstalledInputLanguages) + { + if(language.Culture.TwoLetterISOLanguageName == "de") + { + germanLayoutDetected = true; + break; + } + } + + if (KnownNotOkInputLanguage.ContainsKey(inputLanguage) || germanLayoutDetected) { // get human-readable name - var langName = KnownNotOkInputLanguage[inputLanguage]; + var langName = germanLayoutDetected ? "German" : KnownNotOkInputLanguage[inputLanguage]; message = string.Format(Languages.HelperFunctions_InputLanguageCheckDiffers_ErrorMsg1, langName); return true;