[QuickAccent] Added Portuguese (BR) language (#21127)

* [QuickAccent] Added Portuguese (BR) language

* Fix- Correct indentation

* Fix - Added proper indentation to EOF

* Removed "(BR)" from text

* chore: Changed index switch to array

* Correct German and French order
This commit is contained in:
Philippe Canavarro
2022-10-16 18:36:16 +01:00
committed by GitHub
parent bbe020bb37
commit 87720ef701
4 changed files with 94 additions and 167 deletions

View File

@@ -20,6 +20,7 @@ namespace PowerAccent.Core
MI,
PI,
PL,
PT,
RO,
SK,
SP,
@@ -43,6 +44,7 @@ namespace PowerAccent.Core
case Language.MI: return GetDefaultLetterKeyMI(letter); // Maori
case Language.PI: return GetDefaultLetterKeyPI(letter); // Pinyin
case Language.PL: return GetDefaultLetterKeyPL(letter); // Polish
case Language.PT: return GetDefaultLetterKeyPT(letter); // Portuguese
case Language.RO: return GetDefaultLetterKeyRO(letter); // Romanian
case Language.SK: return GetDefaultLetterKeySK(letter); // Slovak
case Language.SP: return GetDefaultLetterKeySP(letter); // Spain
@@ -346,6 +348,54 @@ namespace PowerAccent.Core
return Array.Empty<char>();
}
// Portuguese
private static char[] GetDefaultLetterKeyPT(LetterKey letter)
{
switch (letter)
{
case LetterKey.VK_0:
return new char[] { '₀', '⁰' };
case LetterKey.VK_1:
return new char[] { '₁', '¹' };
case LetterKey.VK_2:
return new char[] { '₂', '²' };
case LetterKey.VK_3:
return new char[] { '₃', '³' };
case LetterKey.VK_4:
return new char[] { '₄', '⁴' };
case LetterKey.VK_5:
return new char[] { '₅', '⁵' };
case LetterKey.VK_6:
return new char[] { '₆', '⁶' };
case LetterKey.VK_7:
return new char[] { '₇', '⁷' };
case LetterKey.VK_8:
return new char[] { '₈', '⁸' };
case LetterKey.VK_9:
return new char[] { '₉', '⁹' };
case LetterKey.VK_A:
return new char[] { 'á', 'à', 'â', 'ã' };
case LetterKey.VK_C:
return new char[] { 'ç' };
case LetterKey.VK_E:
return new char[] { 'é', 'ê', '€' };
case LetterKey.VK_I:
return new char[] { 'í' };
case LetterKey.VK_O:
return new char[] { 'ô', 'ó', 'õ' };
case LetterKey.VK_P:
return new char[] { 'π' };
case LetterKey.VK_S:
return new char[] { '$' };
case LetterKey.VK_U:
return new char[] { 'ú' };
case LetterKey.VK_COMMA:
return new char[] { '≤', '≥', '≠', '≈', '≙', '±', '₊', '⁺' };
}
return Array.Empty<char>();
}
// Slovak
private static char[] GetDefaultLetterKeySK(LetterKey letter)
{

View File

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -18,6 +18,40 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private readonly ISettingsUtils _settingsUtils;
// These should be in the same order as the ComboBoxItems in PowerAccentPage.xaml
private readonly string[] _languageOptions =
{
"ALL",
"CUR",
"CZ",
"FR",
"DE",
"HU",
"IS",
"IT",
"MI",
"PI",
"PL",
"PT",
"RO",
"SK",
"SP",
"TK",
};
private readonly string[] _toolbarOptions =
{
"Top center",
"Bottom center",
"Left",
"Right",
"Top right corner",
"Top left corner",
"Bottom right corner",
"Bottom left corner",
"Center",
};
private Func<string, int> SendConfigMSG { get; }
public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
@@ -43,85 +77,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_inputTimeMs = _powerAccentSettings.Properties.InputTime.Value;
switch (_powerAccentSettings.Properties.ToolbarPosition.Value)
{
case "Top center":
_toolbarPositionIndex = 0;
break;
case "Bottom center":
_toolbarPositionIndex = 1;
break;
case "Left":
_toolbarPositionIndex = 2;
break;
case "Right":
_toolbarPositionIndex = 3;
break;
case "Top right corner":
_toolbarPositionIndex = 4;
break;
case "Top left corner":
_toolbarPositionIndex = 5;
break;
case "Bottom right corner":
_toolbarPositionIndex = 6;
break;
case "Bottom left corner":
_toolbarPositionIndex = 7;
break;
case "Center":
_toolbarPositionIndex = 8;
break;
}
_selectedLangIndex = Array.IndexOf(_languageOptions, _powerAccentSettings.Properties.SelectedLang.Value);
switch (_powerAccentSettings.Properties.SelectedLang.Value)
{
case "ALL":
_selectedLangIndex = 0;
break;
case "CUR":
_selectedLangIndex = 1;
break;
case "CZ":
_selectedLangIndex = 2;
break;
case "FR":
_selectedLangIndex = 3;
break;
case "DE":
_selectedLangIndex = 4;
break;
case "HU":
_selectedLangIndex = 5;
break;
case "IS":
_selectedLangIndex = 6;
break;
case "IT":
_selectedLangIndex = 7;
break;
case "MI":
_selectedLangIndex = 8;
break;
case "PI":
_selectedLangIndex = 9;
break;
case "PL":
_selectedLangIndex = 10;
break;
case "RO":
_selectedLangIndex = 11;
break;
case "SK":
_selectedLangIndex = 12;
break;
case "SP":
_selectedLangIndex = 13;
break;
case "TK":
_selectedLangIndex = 14;
break;
}
_toolbarPositionIndex = Array.IndexOf(_toolbarOptions, _powerAccentSettings.Properties.ToolbarPosition.Value);
// set the callback functions value to hangle outgoing IPC message.
SendConfigMSG = ipcMSGCallBackFunc;
@@ -197,45 +155,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
if (_toolbarPositionIndex != value)
{
_toolbarPositionIndex = value;
switch (_toolbarPositionIndex)
{
case 0:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Top center";
break;
case 1:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Bottom center";
break;
case 2:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Left";
break;
case 3:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Right";
break;
case 4:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Top right corner";
break;
case 5:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Top left corner";
break;
case 6:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Bottom right corner";
break;
case 7:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Bottom left corner";
break;
case 8:
_powerAccentSettings.Properties.ToolbarPosition.Value = "Center";
break;
}
_powerAccentSettings.Properties.ToolbarPosition.Value = _toolbarOptions[value];
RaisePropertyChanged(nameof(ToolbarPositionIndex));
}
}
@@ -255,55 +175,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
if (_selectedLangIndex != value)
{
_selectedLangIndex = value;
switch (_selectedLangIndex)
{
case 0:
_powerAccentSettings.Properties.SelectedLang.Value = "ALL";
break;
case 1:
_powerAccentSettings.Properties.SelectedLang.Value = "CUR";
break;
case 2:
_powerAccentSettings.Properties.SelectedLang.Value = "CZ";
break;
case 3:
_powerAccentSettings.Properties.SelectedLang.Value = "FR";
break;
case 4:
_powerAccentSettings.Properties.SelectedLang.Value = "DE";
break;
case 5:
_powerAccentSettings.Properties.SelectedLang.Value = "HU";
break;
case 6:
_powerAccentSettings.Properties.SelectedLang.Value = "IS";
break;
case 7:
_powerAccentSettings.Properties.SelectedLang.Value = "IT";
break;
case 8:
_powerAccentSettings.Properties.SelectedLang.Value = "MI";
break;
case 9:
_powerAccentSettings.Properties.SelectedLang.Value = "PI";
break;
case 10:
_powerAccentSettings.Properties.SelectedLang.Value = "PL";
break;
case 11:
_powerAccentSettings.Properties.SelectedLang.Value = "RO";
break;
case 12:
_powerAccentSettings.Properties.SelectedLang.Value = "SK";
break;
case 13:
_powerAccentSettings.Properties.SelectedLang.Value = "SP";
break;
case 14:
_powerAccentSettings.Properties.SelectedLang.Value = "TK";
break;
}
_powerAccentSettings.Properties.SelectedLang.Value = _languageOptions[value];
RaisePropertyChanged(nameof(SelectedLangIndex));
}
}

View File

@@ -2539,6 +2539,9 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="QuickAccent_SelectedLanguage_Polish.Content" xml:space="preserve">
<value>Polish</value>
</data>
<data name="QuickAccent_SelectedLanguage_Portuguese.Content" xml:space="preserve">
<value>Portuguese</value>
</data>
<data name="QuickAccent_SelectedLanguage_Slovakian.Content" xml:space="preserve">
<value>Slovakian</value>
</data>

View File

@@ -41,6 +41,7 @@
<controls:Setting.ActionContent>
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}"
SelectedIndex="{x:Bind Path=ViewModel.SelectedLangIndex, Mode=TwoWay}" >
<!-- These should be in the same order as the array items in PowerAccentViewModel.cs -->
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_All"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Currency"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Czech"/>
@@ -52,6 +53,7 @@
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Maori"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Pinyin"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Polish"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Portuguese"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Romanian"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Slovakian"/>
<ComboBoxItem x:Uid="QuickAccent_SelectedLanguage_Spanish"/>