[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

@@ -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));
}
}