[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.
This commit is contained in:
Sergey Chernyaev 2024-10-22 10:35:49 +02:00 committed by Clint Rutkas
parent dc7c7ef2b7
commit e88b22937e
4 changed files with 23 additions and 2 deletions

View File

@ -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<string>(),
};
}
// Macedonian
private static string[] GetDefaultLetterKeyMK(LetterKey letter)
{

View File

@ -1,4 +1,4 @@
<Page
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerAccentPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -88,6 +88,7 @@
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovenian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Spanish" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Serbian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Serbian_Cyrillic" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Swedish" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Turkish" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Welsh" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
@ -3648,6 +3648,9 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="QuickAccent_SelectedLanguage_Serbian.Content" xml:space="preserve">
<value>Serbian</value>
</data>
<data name="QuickAccent_SelectedLanguage_Serbian_Cyrillic.Content" xml:space="preserve">
<value>Serbian Cyrillic</value>
</data>
<data name="QuickAccent_SelectedLanguage_Hungarian.Content" xml:space="preserve">
<value>Hungarian</value>
</data>

View File

@ -60,6 +60,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
"SL",
"SP",
"SR",
"SR_CYRL",
"SV",
"TK",
"CY",