[QuickAccent]Add Middle Eastern Romanization (#31905)

* [Quick Accent] Add support for Middle Eastern Romanization

* Update ToUpper() (PowerAccent.cs)

* Add right single quotation mark

* rework ToUpper()

* rework ToUpper()

* Update ToUpper()

* Internal strings more about Romanization
This commit is contained in:
PesBandi 2024-09-24 10:18:44 +02:00 committed by GitHub
parent 6415afc27d
commit cc586a0357
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 1 deletions

View File

@ -42,6 +42,7 @@ namespace PowerAccent.Core
PL,
PT,
RO,
ROM,
SK,
SL,
SP,
@ -88,6 +89,7 @@ namespace PowerAccent.Core
Language.PL => GetDefaultLetterKeyPL(letter), // Polish
Language.PT => GetDefaultLetterKeyPT(letter), // Portuguese
Language.RO => GetDefaultLetterKeyRO(letter), // Romanian
Language.ROM => GetDefaultLetterKeyROM(letter), // Middle Eastern Romanization
Language.SK => GetDefaultLetterKeySK(letter), // Slovak
Language.SL => GetDefaultLetterKeySL(letter), // Slovenian
Language.SP => GetDefaultLetterKeySP(letter), // Spain
@ -129,6 +131,7 @@ namespace PowerAccent.Core
.Union(GetDefaultLetterKeyIT(letter))
.Union(GetDefaultLetterKeyKU(letter))
.Union(GetDefaultLetterKeyLT(letter))
.Union(GetDefaultLetterKeyROM(letter))
.Union(GetDefaultLetterKeyMK(letter))
.Union(GetDefaultLetterKeyMI(letter))
.Union(GetDefaultLetterKeyNL(letter))
@ -494,6 +497,37 @@ namespace PowerAccent.Core
};
}
// Middle Eastern Romanization
private static string[] GetDefaultLetterKeyROM(LetterKey letter)
{
return letter switch
{
LetterKey.VK_A => new[] { "á", "â", "ă", "ā" },
LetterKey.VK_B => new[] { "ḇ" },
LetterKey.VK_C => new[] { "č", "ç" },
LetterKey.VK_D => new[] { "ḑ", "ḍ", "ḏ", "ḏ\u0323" },
LetterKey.VK_E => new[] { "ê", "ě", "ĕ", "ē", "é", "ə" },
LetterKey.VK_G => new[] { "ġ", "ǧ", "ğ", "ḡ", "g\u0303", "g\u0331" },
LetterKey.VK_H => new[] { "ḧ", "ḩ", "ḥ", "ḫ", "h\u0331" },
LetterKey.VK_I => new[] { "í", "ı", "î", "ī", "ı\u0307\u0304" },
LetterKey.VK_J => new[] { "ǰ", "j\u0331" },
LetterKey.VK_K => new[] { "ḳ", "ḵ" },
LetterKey.VK_L => new[] { "ł" },
LetterKey.VK_N => new[] { "ⁿ", "ñ" },
LetterKey.VK_O => new[] { "ó", "ô", "ö", "ŏ", "ō", "ȫ" },
LetterKey.VK_P => new[] { "p\u0304" },
LetterKey.VK_R => new[] { "ṙ", "ṛ" },
LetterKey.VK_S => new[] { "ś", "š", "ş", "ṣ", "s\u0331", "ṣ\u0304" },
LetterKey.VK_T => new[] { "ẗ", "ţ", "ṭ", "ṯ" },
LetterKey.VK_U => new[] { "ú", "û", "ü", "ū", "ǖ" },
LetterKey.VK_V => new[] { "v\u0307", "ṿ", "ᵛ" },
LetterKey.VK_Y => new[] { "̀y" },
LetterKey.VK_Z => new[] { "ż", "ž", "z\u0304", "z\u0327", "ẓ", "z\u0324", "ẕ" },
LetterKey.VK_PERIOD => new[] { "", "ʾ", "ʿ", "", "…" },
_ => Array.Empty<string>(),
};
}
// Slovak
private static string[] GetDefaultLetterKeySK(LetterKey letter)
{

View File

@ -348,7 +348,15 @@ public class PowerAccent : IDisposable
string[] result = new string[array.Length];
for (int i = 0; i < array.Length; i++)
{
result[i] = array[i].Contains('ß') ? "ẞ" : array[i].ToUpper(System.Globalization.CultureInfo.InvariantCulture);
switch (array[i])
{
case "ß": result[i] = "ẞ"; break;
case "ǰ": result[i] = "J\u030c"; break;
case "ı\u0307\u0304": result[i] = "İ\u0304"; break;
case "ı": result[i] = "İ"; break;
case "ᵛ": result[i] = "ⱽ"; break;
default: result[i] = array[i].ToUpper(System.Globalization.CultureInfo.InvariantCulture); break;
}
}
return result;

View File

@ -83,6 +83,7 @@
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Polish" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Portuguese" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Romanian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Romanization" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovak" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovenian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Spanish" />

View File

@ -3584,6 +3584,9 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="QuickAccent_SelectedLanguage_Maori.Content" xml:space="preserve">
<value>Maori</value>
</data>
<data name="QuickAccent_SelectedLanguage_Romanization.Content" xml:space="preserve">
<value>Middle Eastern Romanization</value>
</data>
<data name="QuickAccent_SelectedLanguage_Dutch.Content" xml:space="preserve">
<value>Dutch</value>
</data>

View File

@ -54,6 +54,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
"PL",
"PT",
"RO",
"ROM",
"SK",
"SL",
"SP",