From e88b22937e81e08a9ac3592a5e04ed5a094ff058 Mon Sep 17 00:00:00 2001 From: Sergey Chernyaev Date: Tue, 22 Oct 2024 10:35:49 +0200 Subject: [PATCH] [QuickAccent]Add support for Serbian Cyrillic (#35500) * **Languages.cs** - Add `GetDefaultLetterKeySRCyrillic` method for Serbian Cyrillic letters. - Add `SR_CYRL` entry to `Language` enum. - Update `GetDefaultLetterKey` method to include `Language.SR_CYRL`. * **PowerAccentPage.xaml** - Add `ComboBoxItem` for Serbian Cyrillic in `SelectedLanguage` `ComboBox`. * **Resources.resw** - Add entry for Serbian Cyrillic. * **PowerAccentViewModel.cs** - Add `SR_CYRL` to the list of supported languages. --- .../poweraccent/PowerAccent.Core/Languages.cs | 16 ++++++++++++++++ .../SettingsXAML/Views/PowerAccentPage.xaml | 3 ++- .../Settings.UI/Strings/en-us/Resources.resw | 5 ++++- .../ViewModels/PowerAccentViewModel.cs | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/modules/poweraccent/PowerAccent.Core/Languages.cs b/src/modules/poweraccent/PowerAccent.Core/Languages.cs index d72a7bf486..d02afd2c85 100644 --- a/src/modules/poweraccent/PowerAccent.Core/Languages.cs +++ b/src/modules/poweraccent/PowerAccent.Core/Languages.cs @@ -47,6 +47,7 @@ namespace PowerAccent.Core SL, SP, SR, + SR_CYRL, SV, TK, } @@ -94,6 +95,7 @@ namespace PowerAccent.Core Language.SL => GetDefaultLetterKeySL(letter), // Slovenian Language.SP => GetDefaultLetterKeySP(letter), // Spain Language.SR => GetDefaultLetterKeySR(letter), // Serbian + Language.SR_CYRL => GetDefaultLetterKeySRCyrillic(letter), // Serbian Cyrillic Language.SV => GetDefaultLetterKeySV(letter), // Swedish Language.TK => GetDefaultLetterKeyTK(letter), // Turkish _ => throw new ArgumentException("The language {0} is not known in this context", lang.ToString()), @@ -144,6 +146,7 @@ namespace PowerAccent.Core .Union(GetDefaultLetterKeySL(letter)) .Union(GetDefaultLetterKeySP(letter)) .Union(GetDefaultLetterKeySR(letter)) + .Union(GetDefaultLetterKeySRCyrillic(letter)) .Union(GetDefaultLetterKeySV(letter)) .Union(GetDefaultLetterKeyTK(letter)) .Union(GetDefaultLetterKeyAllLanguagesOnly(letter)) @@ -771,6 +774,19 @@ namespace PowerAccent.Core }; } + // Serbian Cyrillic + private static string[] GetDefaultLetterKeySRCyrillic(LetterKey letter) + { + return letter switch + { + LetterKey.VK_D => new[] { "ђ", "џ" }, + LetterKey.VK_L => new[] { "љ" }, + LetterKey.VK_N => new[] { "њ" }, + LetterKey.VK_C => new[] { "ћ" }, + _ => Array.Empty(), + }; + } + // Macedonian private static string[] GetDefaultLetterKeyMK(LetterKey letter) { diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml index 0c75c60c92..77c96b15f6 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml @@ -1,4 +1,4 @@ - + diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index ed662f87d0..781a89ae88 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -1,4 +1,4 @@ - +