Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quick Accent] Add new language - Math #34428

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 58 additions & 32 deletions src/modules/poweraccent/PowerAccent.Core/Languages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public enum Language
LT,
MK,
MI,
MATH,
NL,
NO,
PI,
Expand Down Expand Up @@ -81,6 +82,7 @@ public static string[] GetDefaultLetterKey(LetterKey letter, Language lang)
Language.LT => GetDefaultLetterKeyLT(letter), // Lithuanian
Language.MK => GetDefaultLetterKeyMK(letter), // Macedonian
Language.MI => GetDefaultLetterKeyMI(letter), // Maori
Language.MATH => GetDefaultLetterKeyMATH(letter), // Mathematics
Language.NL => GetDefaultLetterKeyNL(letter), // Dutch
Language.NO => GetDefaultLetterKeyNO(letter), // Norwegian
Language.PI => GetDefaultLetterKeyPI(letter), // Pinyin
Expand Down Expand Up @@ -115,7 +117,6 @@ private static string[] GetDefaultLetterKeyALL(LetterKey letter)
.Union(GetDefaultLetterKeyGA(letter))
.Union(GetDefaultLetterKeyGD(letter))
.Union(GetDefaultLetterKeyDE(letter))
.Union(GetDefaultLetterKeyEL(letter))
.Union(GetDefaultLetterKeyEST(letter))
.Union(GetDefaultLetterKeyEPO(letter))
.Union(GetDefaultLetterKeyFI(letter))
Expand All @@ -130,6 +131,7 @@ private static string[] GetDefaultLetterKeyALL(LetterKey letter)
.Union(GetDefaultLetterKeyLT(letter))
.Union(GetDefaultLetterKeyMK(letter))
.Union(GetDefaultLetterKeyMI(letter))
.Union(GetDefaultLetterKeyMATH(letter))
.Union(GetDefaultLetterKeyNL(letter))
.Union(GetDefaultLetterKeyNO(letter))
.Union(GetDefaultLetterKeyPI(letter))
Expand Down Expand Up @@ -157,50 +159,76 @@ private static string[] GetDefaultLetterKeyAllLanguagesOnly(LetterKey letter)
{
return letter switch
{
LetterKey.VK_0 => new[] { "₀", "⁰", "↉" },
LetterKey.VK_1 => new[] { "₁", "¹", "½", "⅓", "¼", "⅕", "⅙", "⅐", "⅛", "⅑", "⅒" },
LetterKey.VK_2 => new[] { "₂", "²", "⅔", "⅖" },
LetterKey.VK_3 => new[] { "₃", "³", "¾", "⅗", "⅜" },
LetterKey.VK_4 => new[] { "₄", "⁴", "⅘" },
LetterKey.VK_5 => new[] { "₅", "⁵", "⅚", "⅝" },
LetterKey.VK_6 => new[] { "₆", "⁶" },
LetterKey.VK_7 => new[] { "₇", "⁷", "⅞" },
LetterKey.VK_8 => new[] { "₈", "⁸", "∞" },
LetterKey.VK_9 => new[] { "₉", "⁹" },
LetterKey.VK_A => new[] { "ȧ", "ǽ", "∀" },
LetterKey.VK_A => new[] { "ȧ", "ǽ" },
LetterKey.VK_B => new[] { "ḃ" },
LetterKey.VK_C => new[] { "ċ", "°C", "©", "ℂ", "∁" },
LetterKey.VK_D => new[] { "ḍ", "ḋ", "∂" },
LetterKey.VK_E => new[] { "∈", "∃", "∄", "∉", "ĕ" },
LetterKey.VK_C => new[] { "ċ", "°C", "©" },
LetterKey.VK_D => new[] { "ḍ", "ḋ" },
LetterKey.VK_E => new[] { "ĕ" },
LetterKey.VK_F => new[] { "ḟ", "°F" },
LetterKey.VK_G => new[] { "ģ", "ǧ", "ġ", "ĝ", "ǥ" },
LetterKey.VK_H => new[] { "ḣ", "ĥ", "ħ" },
LetterKey.VK_J => new[] { "ĵ" },
LetterKey.VK_K => new[] { "ķ", "ǩ" },
LetterKey.VK_L => new[] { "ļ", "₺" }, // ₺ is in VK_T for other languages, but not VK_L, so we add it here.
LetterKey.VK_M => new[] { "ṁ" },
LetterKey.VK_N => new[] { "ņ", "ṅ", "ⁿ", "ℕ", "№" },
LetterKey.VK_O => new[] { "ȯ", "∅" },
LetterKey.VK_P => new[] { "ṗ", "℗", "∏", "¶" },
LetterKey.VK_Q => new[] { "ℚ" },
LetterKey.VK_R => new[] { "ṙ", "®", "ℝ" },
LetterKey.VK_S => new[] { "ṡ", "§", "∑" },
LetterKey.VK_N => new[] { "ņ", "ṅ", "№" },
LetterKey.VK_O => new[] { "ȯ" },
LetterKey.VK_P => new[] { "ṗ", "℗", "¶" },
LetterKey.VK_R => new[] { "ṙ", "®" },
LetterKey.VK_S => new[] { "ṡ", "§" },
LetterKey.VK_T => new[] { "ţ", "ṫ", "ŧ", "™" },
LetterKey.VK_U => new[] { "ŭ" },
LetterKey.VK_V => new[] { "V̇" },
LetterKey.VK_W => new[] { "ẇ" },
LetterKey.VK_X => new[] { "ẋ", "×" },
LetterKey.VK_X => new[] { "ẋ" },
LetterKey.VK_Y => new[] { "ẏ", "ꝡ" },
LetterKey.VK_Z => new[] { "ʒ", "ǯ", "ℤ" },
LetterKey.VK_COMMA => new[] { "∙", "₋", "⁻", "–", "√" }, // – is in VK_MINUS for other languages, but not VK_COMMA, so we add it here.
LetterKey.VK_Z => new[] { "ʒ", "ǯ" },
LetterKey.VK_COMMA => new[] { "₋", "⁻", "–" }, // – is in VK_MINUS for other languages, but not VK_COMMA, so we add it here.
LetterKey.VK_PERIOD => new[] { "…", "\u0300", "\u0301", "\u0302", "\u0303", "\u0304", "\u0308", "\u030B", "\u030C" },
LetterKey.VK_MINUS => new[] { "~", "‐", "‑", "‒", "—", "―", "⁓", "−", "⸺", "⸻", "∓" },
LetterKey.VK_SLASH_ => new[] { "÷", "√" },
LetterKey.VK_DIVIDE_ => new[] { "÷", "√" },
LetterKey.VK_MULTIPLY_ => new[] { "×", "⋅" },
LetterKey.VK_PLUS => new[] { "≤", "≥", "≠", "≈", "≙", "⊕", "⊗", "∓", "≅", "≡" },
LetterKey.VK_MINUS => new[] { "‐", "‑", "‒", "—", "―", "⁓", "−", "⸺", "⸻" },
_ => Array.Empty<string>(),
};
}

// Mathematics
private static string[] GetDefaultLetterKeyMATH(LetterKey letter)
{
string[] characters = letter switch
{
LetterKey.VK_0 => new[] { "₀", "⁰", "°", "∅", "↉" },
LetterKey.VK_1 => new[] { "₁", "¹", "½", "⅓", "¼", "⅕", "⅙", "⅐", "⅛", "⅑", "⅒" },
LetterKey.VK_2 => new[] { "₂", "²", "⅔", "⅖", "√" },
LetterKey.VK_3 => new[] { "₃", "³", "¾", "⅗", "⅜", "∛" },
LetterKey.VK_4 => new[] { "₄", "⁴", "⅘", "∜" },
LetterKey.VK_5 => new[] { "₅", "⁵", "⅚", "⅝" },
LetterKey.VK_6 => new[] { "₆", "⁶" },
LetterKey.VK_7 => new[] { "₇", "⁷", "⅞" },
LetterKey.VK_8 => new[] { "₈", "⁸", "∞", "∝" },
LetterKey.VK_9 => new[] { "₉", "⁹" },
LetterKey.VK_A => new[] { "∀" },
LetterKey.VK_C => new[] { "ℂ", "∁" },
LetterKey.VK_D => new[] { "∂", "◇" },
LetterKey.VK_E => new[] { "∃", "∄", "∈", "∉" },
LetterKey.VK_F => new[] { "ƒ" },
LetterKey.VK_N => new[] { "ⁿ", "ℕ" },
LetterKey.VK_P => new[] { "∏", "⊥", "⊢", "⊬" },
LetterKey.VK_Q => new[] { "ℚ" },
LetterKey.VK_R => new[] { "ℝ" },
LetterKey.VK_S => new[] { "∑", "∫", "∮" },
LetterKey.VK_T => new[] { "⊨", "⊭" },
LetterKey.VK_X => new[] { "×", "⋅" },
LetterKey.VK_Z => new[] { "ℤ" },
LetterKey.VK_PLUS => new[] { "≤", "≥", "±", "⇔", "₊", "⁺", "≠", "≅", "≈", "≙", "≜", "≔", "≝", "≡", "⊕", "⊗", "⊙" },
LetterKey.VK_COMMA => new[] { "≤", "⇐", "⋃", "⋁", "⊆", "⊂", "⊄", "∌", "∋", "≪" },
LetterKey.VK_PERIOD => new[] { "≥", "⇒", "⋂", "⋀", "⊇", "⊃", "⊅", "∉", "∈", "≫" },
LetterKey.VK_SLASH_ => new[] { "÷", "‰", "½", "⅓", "⅔", "¼", "¾", "√" },
LetterKey.VK_MINUS => new[] { "∓", "~" },
LetterKey.VK_MULTIPLY_ => new[] { "×", "⋅", "^", "¬", "∴", "∵" },
LetterKey.VK_DIVIDE_ => new[] { "÷", "√", "∠", "∡", "∢", "⦝", "⦜" },
_ => Array.Empty<string>(),
};

return characters.Union(GetDefaultLetterKeyEL(letter)).ToArray();
}

// Bulgarian
Expand Down Expand Up @@ -485,10 +513,8 @@ private static string[] GetDefaultLetterKeyPT(LetterKey letter)
LetterKey.VK_E => new[] { "é", "ê", "€" },
LetterKey.VK_I => new[] { "í" },
LetterKey.VK_O => new[] { "ô", "ó", "õ", "º" },
LetterKey.VK_P => new[] { "π" },
LetterKey.VK_S => new[] { "$" },
LetterKey.VK_U => new[] { "ú" },
LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" },
_ => Array.Empty<string>(),
};
}
Expand Down Expand Up @@ -605,7 +631,7 @@ private static string[] GetDefaultLetterKeyEL(LetterKey letter)
LetterKey.VK_T => new string[] { "τ", "θ", "ϑ" },
LetterKey.VK_U => new string[] { "υ", "ύ" },
LetterKey.VK_X => new string[] { "ξ" },
LetterKey.VK_Y => new string[] { "υ" },
LetterKey.VK_Y => new string[] { "υ", "ύ" },
LetterKey.VK_Z => new string[] { "ζ" },
_ => Array.Empty<string>(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Lithuanian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Macedonian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Maori" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Mathematics" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Norwegian" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Pinyin" />
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Polish" />
Expand Down
3 changes: 3 additions & 0 deletions src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -3580,6 +3580,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_Mathematics.Content" xml:space="preserve">
<value>Mathematics</value>
</data>
<data name="QuickAccent_SelectedLanguage_Dutch.Content" xml:space="preserve">
<value>Dutch</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class PowerAccentViewModel : Observable
"LT",
"MK",
"MI",
"MATH",
"NO",
"PI",
"PL",
Expand Down
Loading