diff --git a/src/modules/poweraccent/PowerAccent.Core/Languages.cs b/src/modules/poweraccent/PowerAccent.Core/Languages.cs index 57a48675c0..efee303d9c 100644 --- a/src/modules/poweraccent/PowerAccent.Core/Languages.cs +++ b/src/modules/poweraccent/PowerAccent.Core/Languages.cs @@ -33,7 +33,7 @@ namespace PowerAccent.Core internal class Languages { - public static char[] GetDefaultLetterKey(LetterKey letter, Language lang) + public static string[] GetDefaultLetterKey(LetterKey letter, Language lang) { switch (lang) { @@ -63,575 +63,587 @@ namespace PowerAccent.Core } // All - private static char[] GetDefaultLetterKeyALL(LetterKey letter) + private static string[] GetDefaultLetterKeyALL(LetterKey letter) { switch (letter) { case LetterKey.VK_0: - return new char[] { '₀', '⁰' }; + return new string[] { "₀", "⁰" }; case LetterKey.VK_1: - return new char[] { '₁', '¹' }; + return new string[] { "₁", "¹" }; case LetterKey.VK_2: - return new char[] { '₂', '²' }; + return new string[] { "₂", "²" }; case LetterKey.VK_3: - return new char[] { '₃', '³' }; + return new string[] { "₃", "³" }; case LetterKey.VK_4: - return new char[] { '₄', '⁴' }; + return new string[] { "₄", "⁴" }; case LetterKey.VK_5: - return new char[] { '₅', '⁵' }; + return new string[] { "₅", "⁵" }; case LetterKey.VK_6: - return new char[] { '₆', '⁶' }; + return new string[] { "₆", "⁶" }; case LetterKey.VK_7: - return new char[] { '₇', '⁷' }; + return new string[] { "₇", "⁷" }; case LetterKey.VK_8: - return new char[] { '₈', '⁸' }; + return new string[] { "₈", "⁸" }; case LetterKey.VK_9: - return new char[] { '₉', '⁹' }; + return new string[] { "₉", "⁹" }; case LetterKey.VK_A: - return new char[] { 'á', 'à', 'ä', 'â', 'ă', 'å', 'α', 'ā', 'ą', 'ȧ', 'ã', 'æ' }; + return new string[] { "á", "à", "ä", "â", "ă", "å", "α", "ā", "ą", "ȧ", "ã", "æ" }; case LetterKey.VK_B: - return new char[] { 'ḃ', 'β' }; + return new string[] { "ḃ", "β" }; case LetterKey.VK_C: - return new char[] { 'ç', 'ć', 'ĉ', 'č', 'ċ', '¢', 'χ' }; + return new string[] { "ç", "ć", "ĉ", "č", "ċ", "¢", "χ" }; case LetterKey.VK_D: - return new char[] { 'ď', 'ḋ', 'đ', 'δ', 'ð' }; + return new string[] { "ď", "ḋ", "đ", "δ", "ð" }; case LetterKey.VK_E: - return new char[] { 'é', 'è', 'ê', 'ë', 'ě', 'ē', 'ę', 'ė', 'ε', 'η', '€' }; + return new string[] { "é", "è", "ê", "ë", "ě", "ē", "ę", "ė", "ε", "η", "€" }; case LetterKey.VK_F: - return new char[] { 'ƒ', 'ḟ' }; + return new string[] { "ƒ", "ḟ" }; case LetterKey.VK_G: - return new char[] { 'ğ', 'ģ', 'ǧ', 'ġ', 'ĝ', 'ǥ', 'γ' }; + return new string[] { "ğ", "ģ", "ǧ", "ġ", "ĝ", "ǥ", "γ" }; case LetterKey.VK_H: - return new char[] { 'ḣ', 'ĥ', 'ħ' }; + return new string[] { "ḣ", "ĥ", "ħ" }; case LetterKey.VK_I: - return new char[] { 'ï', 'î', 'í', 'ì', 'ī', 'į', 'i', 'ı', 'İ', 'ι' }; + return new string[] { "ï", "î", "í", "ì", "ī", "į", "i", "ı", "İ", "ι" }; case LetterKey.VK_J: - return new char[] { 'ĵ' }; + return new string[] { "ĵ" }; case LetterKey.VK_K: - return new char[] { 'ķ', 'ǩ', 'κ' }; + return new string[] { "ķ", "ǩ", "κ" }; case LetterKey.VK_L: - return new char[] { 'ĺ', 'ľ', 'ļ', 'ł', '₺', 'λ' }; + return new string[] { "ĺ", "ľ", "ļ", "ł", "₺", "λ" }; case LetterKey.VK_M: - return new char[] { 'ṁ', 'μ' }; + return new string[] { "ṁ", "μ" }; case LetterKey.VK_N: - return new char[] { 'ñ', 'ń', 'ŋ', 'ň', 'ņ', 'ṅ', 'ⁿ', 'ν' }; + return new string[] { "ñ", "ń", "ŋ", "ň", "ņ", "ṅ", "ⁿ", "ν" }; case LetterKey.VK_O: - return new char[] { 'ô', 'ó', 'ö', 'ő', 'ò', 'ō', 'ȯ', 'ø', 'õ', 'œ', 'ω', 'ο' }; + return new string[] { "ô", "ó", "ö", "ő", "ò", "ō", "ȯ", "ø", "õ", "œ", "ω", "ο" }; case LetterKey.VK_P: - return new char[] { 'ṗ', '₽', 'π', 'φ', 'ψ' }; + return new string[] { "ṗ", "₽", "π", "φ", "ψ" }; case LetterKey.VK_R: - return new char[] { 'ŕ', 'ř', 'ṙ', '₹', 'ρ' }; + return new string[] { "ŕ", "ř", "ṙ", "₹", "ρ" }; case LetterKey.VK_S: - return new char[] { 'ś', 'ş', 'š', 'ș', 'ṡ', 'ŝ', 'ß', 'σ', '$' }; + return new string[] { "ś", "ş", "š", "ș", "ṡ", "ŝ", "ß", "σ", "$" }; case LetterKey.VK_T: - return new char[] { 'ţ', 'ť', 'ț', 'ṫ', 'ŧ', 'θ', 'τ', 'þ' }; + return new string[] { "ţ", "ť", "ț", "ṫ", "ŧ", "θ", "τ", "þ" }; case LetterKey.VK_U: - return new char[] { 'û', 'ú', 'ü', 'ŭ', 'ű', 'ù', 'ů', 'ū', 'ų', 'υ' }; + return new string[] { "û", "ú", "ü", "ŭ", "ű", "ù", "ů", "ū", "ų", "υ" }; case LetterKey.VK_W: - return new char[] { 'ẇ', 'ŵ', '₩' }; + return new string[] { "ẇ", "ŵ", "₩" }; case LetterKey.VK_X: - return new char[] { 'ẋ', 'ξ' }; + return new string[] { "ẋ", "ξ" }; case LetterKey.VK_Y: - return new char[] { 'ÿ', 'ŷ', 'ý', 'ẏ' }; + return new string[] { "ÿ", "ŷ", "ý", "ẏ" }; case LetterKey.VK_Z: - return new char[] { 'ź', 'ž', 'ż', 'ʒ', 'ǯ', 'ζ' }; + return new string[] { "ź", "ž", "ż", "ʒ", "ǯ", "ζ" }; case LetterKey.VK_COMMA: - return new char[] { '¿', '¡', '∙', '₋', '⁻', '–', '≤', '≥', '≠', '≈', '≙', '±', '₊', '⁺' }; + return new string[] { "¿", "¡", "∙", "₋", "⁻", "–", "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }; } - return Array.Empty(); + return Array.Empty(); } // Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money) - private static char[] GetDefaultLetterKeyCUR(LetterKey letter) + private static string[] GetDefaultLetterKeyCUR(LetterKey letter) { switch (letter) { case LetterKey.VK_B: - return new char[] { '฿', 'в' }; + return new string[] { "฿", "в" }; case LetterKey.VK_C: - return new char[] { '¢', '₡', 'č' }; + return new string[] { "¢", "₡", "č" }; case LetterKey.VK_D: - return new char[] { '₫' }; + return new string[] { "₫" }; case LetterKey.VK_E: - return new char[] { '€' }; + return new string[] { "€" }; case LetterKey.VK_F: - return new char[] { 'ƒ' }; + return new string[] { "ƒ" }; case LetterKey.VK_H: - return new char[] { '₴' }; + return new string[] { "₴" }; case LetterKey.VK_K: - return new char[] { '₭' }; + return new string[] { "₭" }; case LetterKey.VK_L: - return new char[] { 'ł' }; + return new string[] { "ł" }; case LetterKey.VK_N: - return new char[] { 'л' }; + return new string[] { "л" }; case LetterKey.VK_M: - return new char[] { '₼' }; + return new string[] { "₼" }; case LetterKey.VK_P: - return new char[] { '£', '₽' }; + return new string[] { "£", "₽" }; case LetterKey.VK_R: - return new char[] { '₹', '៛', '﷼' }; + return new string[] { "₹", "៛", "﷼" }; case LetterKey.VK_S: - return new char[] { '$', '₪' }; + return new string[] { "$", "₪" }; case LetterKey.VK_T: - return new char[] { '₮', '₺' }; + return new string[] { "₮", "₺" }; case LetterKey.VK_W: - return new char[] { '₩' }; + return new string[] { "₩" }; case LetterKey.VK_Y: - return new char[] { '¥' }; + return new string[] { "¥" }; case LetterKey.VK_Z: - return new char[] { 'z' }; + return new string[] { "z" }; } - return Array.Empty(); + return Array.Empty(); } // Croatian - private static char[] GetDefaultLetterKeyHR(LetterKey letter) + private static string[] GetDefaultLetterKeyHR(LetterKey letter) { switch (letter) { case LetterKey.VK_C: - return new char[] { 'ć', 'č' }; + return new string[] { "ć", "č" }; case LetterKey.VK_D: - return new char[] { 'đ' }; + return new string[] { "đ" }; case LetterKey.VK_S: - return new char[] { 'š' }; + return new string[] { "š" }; case LetterKey.VK_Z: - return new char[] { 'ž' }; + return new string[] { "ž" }; } - return Array.Empty(); + return Array.Empty(); } // French - private static char[] GetDefaultLetterKeyFR(LetterKey letter) + private static string[] GetDefaultLetterKeyFR(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'à', 'â', 'á', 'ä', 'ã', 'æ' }; + return new string[] { "à", "â", "á", "ä", "ã", "æ" }; case LetterKey.VK_C: - return new char[] { 'ç' }; + return new string[] { "ç" }; case LetterKey.VK_E: - return new char[] { 'é', 'è', 'ê', 'ë', '€' }; + return new string[] { "é", "è", "ê", "ë", "€" }; case LetterKey.VK_I: - return new char[] { 'î', 'ï', 'í', 'ì' }; + return new string[] { "î", "ï", "í", "ì" }; case LetterKey.VK_O: - return new char[] { 'ô', 'ö', 'ó', 'ò', 'õ', 'œ' }; + return new string[] { "ô", "ö", "ó", "ò", "õ", "œ" }; case LetterKey.VK_U: - return new char[] { 'û', 'ù', 'ü', 'ú' }; + return new string[] { "û", "ù", "ü", "ú" }; case LetterKey.VK_Y: - return new char[] { 'ÿ', 'ý' }; + return new string[] { "ÿ", "ý" }; } - return Array.Empty(); + return Array.Empty(); } // Iceland - private static char[] GetDefaultLetterKeyIS(LetterKey letter) + private static string[] GetDefaultLetterKeyIS(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'á', 'æ' }; + return new string[] { "á", "æ" }; case LetterKey.VK_D: - return new char[] { 'ð' }; + return new string[] { "ð" }; case LetterKey.VK_E: - return new char[] { 'é' }; + return new string[] { "é" }; case LetterKey.VK_O: - return new char[] { 'ó', 'ö' }; + return new string[] { "ó", "ö" }; case LetterKey.VK_U: - return new char[] { 'ú' }; + return new string[] { "ú" }; case LetterKey.VK_Y: - return new char[] { 'ý' }; + return new string[] { "ý" }; case LetterKey.VK_T: - return new char[] { 'þ' }; + return new string[] { "þ" }; } - return Array.Empty(); + return Array.Empty(); } // Spain - private static char[] GetDefaultLetterKeySP(LetterKey letter) + private static string[] GetDefaultLetterKeySP(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'á' }; + return new string[] { "á" }; case LetterKey.VK_E: - return new char[] { 'é', '€' }; + return new string[] { "é", "€" }; case LetterKey.VK_I: - return new char[] { 'í' }; + return new string[] { "í" }; case LetterKey.VK_N: - return new char[] { 'ñ' }; + return new string[] { "ñ" }; case LetterKey.VK_O: - return new char[] { 'ó' }; + return new string[] { "ó" }; case LetterKey.VK_U: - return new char[] { 'ú', 'ü' }; + return new string[] { "ú", "ü" }; case LetterKey.VK_COMMA: - return new char[] { '¿', '?' }; + return new string[] { "¿", "?" }; } - return Array.Empty(); + return Array.Empty(); } // Maori - private static char[] GetDefaultLetterKeyMI(LetterKey letter) + private static string[] GetDefaultLetterKeyMI(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'ā' }; + return new string[] { "ā" }; case LetterKey.VK_E: - return new char[] { 'ē' }; + return new string[] { "ē" }; case LetterKey.VK_I: - return new char[] { 'ī' }; + return new string[] { "ī" }; case LetterKey.VK_O: - return new char[] { 'ō' }; + return new string[] { "ō" }; case LetterKey.VK_S: - return new char[] { '$' }; + return new string[] { "$" }; case LetterKey.VK_U: - return new char[] { 'ū' }; + return new string[] { "ū" }; } - return Array.Empty(); + return Array.Empty(); } // Dutch - private static char[] GetDefaultLetterKeyNL(LetterKey letter) + private static string[] GetDefaultLetterKeyNL(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'á', 'à', 'ä' }; + return new string[] { "á", "à", "ä" }; case LetterKey.VK_C: - return new char[] { 'ç' }; + return new string[] { "ç" }; case LetterKey.VK_E: - return new char[] { 'é', 'è', 'ë', 'ê', '€' }; + return new string[] { "é", "è", "ë", "ê", "€" }; case LetterKey.VK_I: - return new char[] { 'í', 'ï', 'î' }; + return new string[] { "í", "ï", "î" }; case LetterKey.VK_N: - return new char[] { 'ñ' }; + return new string[] { "ñ" }; case LetterKey.VK_O: - return new char[] { 'ó', 'ö', 'ô' }; + return new string[] { "ó", "ö", "ô" }; case LetterKey.VK_U: - return new char[] { 'ú', 'ü', 'û' }; + return new string[] { "ú", "ü", "û" }; } - return Array.Empty(); + return Array.Empty(); } // Pinyin - private static char[] GetDefaultLetterKeyPI(LetterKey letter) + private static string[] GetDefaultLetterKeyPI(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'ā', 'á', 'ǎ', 'à', 'a' }; + return new string[] { "ā", "á", "ǎ", "à", "a", "ɑ̄", "ɑ́", "ɑ̌", "ɑ̀" }; + case LetterKey.VK_C: + return new string[] { "ĉ", "c" }; case LetterKey.VK_E: - return new char[] { 'ē', 'é', 'ě', 'è', 'e' }; + return new string[] { "ē", "é", "ě", "è", "e" }; case LetterKey.VK_I: - return new char[] { 'ī', 'í', 'ǐ', 'ì', 'i' }; + return new string[] { "ī", "í", "ǐ", "ì", "i" }; + case LetterKey.VK_M: + return new string[] { "m̄", "ḿ", "m̌", "m̀", "m" }; + case LetterKey.VK_N: + return new string[] { "n̄", "ń", "ň", "ǹ", "n", "ŋ", "ŋ̄", "ŋ́", "ŋ̌", "ŋ̀" }; case LetterKey.VK_O: - return new char[] { 'ō', 'ó', 'ǒ', 'ò', 'o' }; + return new string[] { "ō", "ó", "ǒ", "ò", "o" }; + case LetterKey.VK_S: + return new string[] { "ŝ", "s" }; case LetterKey.VK_U: - return new char[] { 'ū', 'ú', 'ǔ', 'ù', 'u' }; + return new string[] { "ū", "ú", "ǔ", "ù", "u" }; case LetterKey.VK_V: - return new char[] { 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'ü' }; + return new string[] { "ǖ", "ǘ", "ǚ", "ǜ", "ü" }; + case LetterKey.VK_Y: + return new string[] { "¥", "y" }; + case LetterKey.VK_Z: + return new string[] { "ẑ", "z" }; } - return Array.Empty(); + return Array.Empty(); } // Turkish - private static char[] GetDefaultLetterKeyTK(LetterKey letter) + private static string[] GetDefaultLetterKeyTK(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'â' }; + return new string[] { "â" }; case LetterKey.VK_C: - return new char[] { 'ç' }; + return new string[] { "ç" }; case LetterKey.VK_E: - return new char[] { 'ë', '€' }; + return new string[] { "ë", "€" }; case LetterKey.VK_G: - return new char[] { 'ğ' }; + return new string[] { "ğ" }; case LetterKey.VK_I: - return new char[] { 'ı', 'İ', 'î', }; + return new string[] { "ı", "İ", "î", }; case LetterKey.VK_O: - return new char[] { 'ö', 'ô' }; + return new string[] { "ö", "ô" }; case LetterKey.VK_S: - return new char[] { 'ş' }; + return new string[] { "ş" }; case LetterKey.VK_T: - return new char[] { '₺' }; + return new string[] { "₺" }; case LetterKey.VK_U: - return new char[] { 'ü', 'û' }; + return new string[] { "ü", "û" }; } - return Array.Empty(); + return Array.Empty(); } // Polish - private static char[] GetDefaultLetterKeyPL(LetterKey letter) + private static string[] GetDefaultLetterKeyPL(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'ą' }; + return new string[] { "ą" }; case LetterKey.VK_C: - return new char[] { 'ć' }; + return new string[] { "ć" }; case LetterKey.VK_E: - return new char[] { 'ę', '€' }; + return new string[] { "ę", "€" }; case LetterKey.VK_L: - return new char[] { 'ł' }; + return new string[] { "ł" }; case LetterKey.VK_N: - return new char[] { 'ń' }; + return new string[] { "ń" }; case LetterKey.VK_O: - return new char[] { 'ó' }; + return new string[] { "ó" }; case LetterKey.VK_S: - return new char[] { 'ś' }; + return new string[] { "ś" }; case LetterKey.VK_Z: - return new char[] { 'ż', 'ź' }; + return new string[] { "ż", "ź" }; } - return Array.Empty(); + return Array.Empty(); } // Portuguese - private static char[] GetDefaultLetterKeyPT(LetterKey letter) + private static string[] GetDefaultLetterKeyPT(LetterKey letter) { switch (letter) { case LetterKey.VK_0: - return new char[] { '₀', '⁰' }; + return new string[] { "₀", "⁰" }; case LetterKey.VK_1: - return new char[] { '₁', '¹' }; + return new string[] { "₁", "¹" }; case LetterKey.VK_2: - return new char[] { '₂', '²' }; + return new string[] { "₂", "²" }; case LetterKey.VK_3: - return new char[] { '₃', '³' }; + return new string[] { "₃", "³" }; case LetterKey.VK_4: - return new char[] { '₄', '⁴' }; + return new string[] { "₄", "⁴" }; case LetterKey.VK_5: - return new char[] { '₅', '⁵' }; + return new string[] { "₅", "⁵" }; case LetterKey.VK_6: - return new char[] { '₆', '⁶' }; + return new string[] { "₆", "⁶" }; case LetterKey.VK_7: - return new char[] { '₇', '⁷' }; + return new string[] { "₇", "⁷" }; case LetterKey.VK_8: - return new char[] { '₈', '⁸' }; + return new string[] { "₈", "⁸" }; case LetterKey.VK_9: - return new char[] { '₉', '⁹' }; + return new string[] { "₉", "⁹" }; case LetterKey.VK_A: - return new char[] { 'á', 'à', 'â', 'ã' }; + return new string[] { "á", "à", "â", "ã" }; case LetterKey.VK_C: - return new char[] { 'ç' }; + return new string[] { "ç" }; case LetterKey.VK_E: - return new char[] { 'é', 'ê', '€' }; + return new string[] { "é", "ê", "€" }; case LetterKey.VK_I: - return new char[] { 'í' }; + return new string[] { "í" }; case LetterKey.VK_O: - return new char[] { 'ô', 'ó', 'õ' }; + return new string[] { "ô", "ó", "õ" }; case LetterKey.VK_P: - return new char[] { 'π' }; + return new string[] { "π" }; case LetterKey.VK_S: - return new char[] { '$' }; + return new string[] { "$" }; case LetterKey.VK_U: - return new char[] { 'ú' }; + return new string[] { "ú" }; case LetterKey.VK_COMMA: - return new char[] { '≤', '≥', '≠', '≈', '≙', '±', '₊', '⁺' }; + return new string[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }; } - return Array.Empty(); + return Array.Empty(); } // Slovak - private static char[] GetDefaultLetterKeySK(LetterKey letter) + private static string[] GetDefaultLetterKeySK(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'á', 'ä' }; + return new string[] { "á", "ä" }; case LetterKey.VK_C: - return new char[] { 'č' }; + return new string[] { "č" }; case LetterKey.VK_D: - return new char[] { 'ď' }; + return new string[] { "ď" }; case LetterKey.VK_E: - return new char[] { 'é', '€' }; + return new string[] { "é", "€" }; case LetterKey.VK_I: - return new char[] { 'í' }; + return new string[] { "í" }; case LetterKey.VK_L: - return new char[] { 'ľ', 'ĺ' }; + return new string[] { "ľ", "ĺ" }; case LetterKey.VK_N: - return new char[] { 'ň' }; + return new string[] { "ň" }; case LetterKey.VK_O: - return new char[] { 'ó', 'ô' }; + return new string[] { "ó", "ô" }; case LetterKey.VK_R: - return new char[] { 'ŕ' }; + return new string[] { "ŕ" }; case LetterKey.VK_S: - return new char[] { 'š' }; + return new string[] { "š" }; case LetterKey.VK_T: - return new char[] { 'ť' }; + return new string[] { "ť" }; case LetterKey.VK_U: - return new char[] { 'ú' }; + return new string[] { "ú" }; case LetterKey.VK_Y: - return new char[] { 'ý' }; + return new string[] { "ý" }; case LetterKey.VK_Z: - return new char[] { 'ž' }; + return new string[] { "ž" }; } - return Array.Empty(); + return Array.Empty(); } // Czech - private static char[] GetDefaultLetterKeyCZ(LetterKey letter) + private static string[] GetDefaultLetterKeyCZ(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'á' }; + return new string[] { "á" }; case LetterKey.VK_C: - return new char[] { 'č' }; + return new string[] { "č" }; case LetterKey.VK_D: - return new char[] { 'ď' }; + return new string[] { "ď" }; case LetterKey.VK_E: - return new char[] { 'ě', 'é' }; + return new string[] { "ě", "é" }; case LetterKey.VK_I: - return new char[] { 'í' }; + return new string[] { "í" }; case LetterKey.VK_N: - return new char[] { 'ň' }; + return new string[] { "ň" }; case LetterKey.VK_O: - return new char[] { 'ó' }; + return new string[] { "ó" }; case LetterKey.VK_R: - return new char[] { 'ř' }; + return new string[] { "ř" }; case LetterKey.VK_S: - return new char[] { 'š' }; + return new string[] { "š" }; case LetterKey.VK_T: - return new char[] { 'ť' }; + return new string[] { "ť" }; case LetterKey.VK_U: - return new char[] { 'ů', 'ú' }; + return new string[] { "ů", "ú" }; case LetterKey.VK_Y: - return new char[] { 'ý' }; + return new string[] { "ý" }; case LetterKey.VK_Z: - return new char[] { 'ž' }; + return new string[] { "ž" }; } - return Array.Empty(); + return Array.Empty(); } // German - private static char[] GetDefaultLetterKeyDE(LetterKey letter) + private static string[] GetDefaultLetterKeyDE(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'ä' }; + return new string[] { "ä" }; case LetterKey.VK_E: - return new char[] { '€' }; + return new string[] { "€" }; case LetterKey.VK_O: - return new char[] { 'ö' }; + return new string[] { "ö" }; case LetterKey.VK_S: - return new char[] { 'ß' }; + return new string[] { "ß" }; case LetterKey.VK_U: - return new char[] { 'ü' }; + return new string[] { "ü" }; } - return Array.Empty(); + return Array.Empty(); } // Hungarian - private static char[] GetDefaultLetterKeyHU(LetterKey letter) + private static string[] GetDefaultLetterKeyHU(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'á' }; + return new string[] { "á" }; case LetterKey.VK_E: - return new char[] { 'é' }; + return new string[] { "é" }; case LetterKey.VK_I: - return new char[] { 'í' }; + return new string[] { "í" }; case LetterKey.VK_O: - return new char[] { 'ó', 'ő', 'ö' }; + return new string[] { "ó", "ő", "ö" }; case LetterKey.VK_U: - return new char[] { 'ú', 'ű', 'ü' }; + return new string[] { "ú", "ű", "ü" }; } - return Array.Empty(); + return Array.Empty(); } // Romanian - private static char[] GetDefaultLetterKeyRO(LetterKey letter) + private static string[] GetDefaultLetterKeyRO(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'ă', 'â' }; + return new string[] { "ă", "â" }; case LetterKey.VK_I: - return new char[] { 'î' }; + return new string[] { "î" }; case LetterKey.VK_S: - return new char[] { 'ș' }; + return new string[] { "ș" }; case LetterKey.VK_T: - return new char[] { 'ț' }; + return new string[] { "ț" }; } - return Array.Empty(); + return Array.Empty(); } // Italian - private static char[] GetDefaultLetterKeyIT(LetterKey letter) + private static string[] GetDefaultLetterKeyIT(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'à' }; + return new string[] { "à" }; case LetterKey.VK_E: - return new char[] { 'è', 'é', '€' }; + return new string[] { "è", "é", "€" }; case LetterKey.VK_I: - return new char[] { 'ì', 'í' }; + return new string[] { "ì", "í" }; case LetterKey.VK_O: - return new char[] { 'ò', 'ó' }; + return new string[] { "ò", "ó" }; case LetterKey.VK_U: - return new char[] { 'ù', 'ú' }; + return new string[] { "ù", "ú" }; } - return Array.Empty(); + return Array.Empty(); } // Welsh - private static char[] GetDefaultLetterKeyCY(LetterKey letter) + private static string[] GetDefaultLetterKeyCY(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'â' }; + return new string[] { "â" }; case LetterKey.VK_E: - return new char[] { 'ê' }; + return new string[] { "ê" }; case LetterKey.VK_I: - return new char[] { 'î' }; + return new string[] { "î" }; case LetterKey.VK_O: - return new char[] { 'ô' }; + return new string[] { "ô" }; case LetterKey.VK_U: - return new char[] { 'û' }; + return new string[] { "û" }; case LetterKey.VK_Y: - return new char[] { 'ŷ' }; + return new string[] { "ŷ" }; } - return Array.Empty(); + return Array.Empty(); } // Swedish - private static char[] GetDefaultLetterKeySV(LetterKey letter) + private static string[] GetDefaultLetterKeySV(LetterKey letter) { switch (letter) { case LetterKey.VK_A: - return new char[] { 'å', 'ä' }; + return new string[] { "å", "ä" }; case LetterKey.VK_O: - return new char[] { 'ö' }; + return new string[] { "ö" }; } - return Array.Empty(); + return Array.Empty(); } } } diff --git a/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs b/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs index ffcca324c1..eb89dc8d66 100644 --- a/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs +++ b/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs @@ -14,12 +14,14 @@ public class PowerAccent : IDisposable private readonly SettingsService _settingService; private bool _visible; - private char[] _characters = Array.Empty(); + + private string[] _characters = Array.Empty(); + private int _selectedIndex = -1; - public event Action OnChangeDisplay; + public event Action OnChangeDisplay; - public event Action OnSelectCharacter; + public event Action OnSelectCharacter; private KeyboardListener _keyboardListener; @@ -84,7 +86,7 @@ public class PowerAccent : IDisposable { case InputType.Space: { - WindowsFunctions.Insert(' '); + WindowsFunctions.Insert(" "); break; } @@ -191,18 +193,18 @@ public class PowerAccent : IDisposable GC.SuppressFinalize(this); } - public static char[] ToUpper(char[] array) + public static string[] ToUpper(string[] array) { - char[] result = new char[array.Length]; + string[] result = new string[array.Length]; for (int i = 0; i < array.Length; i++) { - if (array[i] == 'ß') + if (array[i].Contains('ß')) { - result[i] = 'ẞ'; + result[i] = "ẞ"; } else { - result[i] = char.ToUpper(array[i], System.Globalization.CultureInfo.InvariantCulture); + result[i] = array[i].ToUpper(System.Globalization.CultureInfo.InvariantCulture); } } diff --git a/src/modules/poweraccent/PowerAccent.Core/Tools/WindowsFunctions.cs b/src/modules/poweraccent/PowerAccent.Core/Tools/WindowsFunctions.cs index ccecc2ac3e..506254f304 100644 --- a/src/modules/poweraccent/PowerAccent.Core/Tools/WindowsFunctions.cs +++ b/src/modules/poweraccent/PowerAccent.Core/Tools/WindowsFunctions.cs @@ -9,7 +9,7 @@ namespace PowerAccent.Core.Tools; internal static class WindowsFunctions { - public static void Insert(char c, bool back = false) + public static void Insert(string s, bool back = false) { unsafe { @@ -26,13 +26,16 @@ internal static class WindowsFunctions System.Threading.Thread.Sleep(1); // Some apps, like Terminal, need a little wait to process the sent backspace or they'll ignore it. } - // Letter - var inputsInsert = new User32.INPUT[] + for (int i = 0; i < s.Length; i++) { - new User32.INPUT { type = User32.INPUTTYPE.INPUT_KEYBOARD, ki = new User32.KEYBDINPUT { wVk = 0, dwFlags = User32.KEYEVENTF.KEYEVENTF_UNICODE, wScan = c } }, - new User32.INPUT { type = User32.INPUTTYPE.INPUT_KEYBOARD, ki = new User32.KEYBDINPUT { wVk = 0, dwFlags = User32.KEYEVENTF.KEYEVENTF_UNICODE | User32.KEYEVENTF.KEYEVENTF_KEYUP, wScan = c } }, - }; - var temp2 = User32.SendInput((uint)inputsInsert.Length, inputsInsert, sizeof(User32.INPUT)); + // Letter + var inputsInsert = new User32.INPUT[] + { + new User32.INPUT { type = User32.INPUTTYPE.INPUT_KEYBOARD, ki = new User32.KEYBDINPUT { wVk = 0, dwFlags = User32.KEYEVENTF.KEYEVENTF_UNICODE, wScan = (char)i } }, + new User32.INPUT { type = User32.INPUTTYPE.INPUT_KEYBOARD, ki = new User32.KEYBDINPUT { wVk = 0, dwFlags = User32.KEYEVENTF.KEYEVENTF_UNICODE | User32.KEYEVENTF.KEYEVENTF_KEYUP, wScan = (char)i } }, + }; + var temp2 = User32.SendInput((uint)inputsInsert.Length, inputsInsert, sizeof(User32.INPUT)); + } } } diff --git a/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs b/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs index d3b58870c8..ebef1609e4 100644 --- a/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs +++ b/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs @@ -28,12 +28,12 @@ public partial class Selector : Window, IDisposable this.Visibility = Visibility.Hidden; } - private void PowerAccent_OnSelectionCharacter(int index, char character) + private void PowerAccent_OnSelectionCharacter(int index, string character) { characters.SelectedIndex = index; } - private void PowerAccent_OnChangeDisplay(bool isActive, char[] chars) + private void PowerAccent_OnChangeDisplay(bool isActive, string[] chars) { this.Visibility = isActive ? Visibility.Visible : Visibility.Collapsed; if (isActive)