[General]Support language selection (#34971)

* Language setting

* spellcheck

* Set FileLocksmithContextMenu package version in AppManifest.xml

* Fix ambigious symbol build error

* Fix ambigious symbol build error #2

* Revert unneeded changes

* Improve perf

* try fix ci build
This commit is contained in:
Stefan Markovic
2024-09-25 22:20:15 +02:00
committed by GitHub
parent 2b4b55cfeb
commit 5b616c9eed
38 changed files with 754 additions and 25 deletions

View File

@@ -78,6 +78,12 @@ namespace Microsoft.PowerToys.Settings.UI
{
Logger.InitializeLogger(@"\Settings\Logs");
string appLanguage = LanguageHelper.LoadLanguage();
if (!string.IsNullOrEmpty(appLanguage))
{
Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = appLanguage;
}
InitializeComponent();
UnhandledException += App_UnhandledException;

View File

@@ -229,6 +229,25 @@
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="Appearance_Behavior" IsEnabled="True">
<tkcontrols:SettingsCard x:Uid="LanguageHeader" HeaderIcon="{ui:FontIcon Glyph=&#xF2B7;}">
<ComboBox
x:Name="Languages_ComboBox"
MinWidth="{StaticResource SettingActionControlMinWidth}"
DisplayMemberPath="Language"
ItemsSource="{Binding Languages, Mode=TwoWay}"
SelectedIndex="{Binding LanguagesIndex, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<InfoBar
x:Uid="LanguageRestartInfo"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.LanguageChanged}"
IsTabStop="True"
Severity="Informational">
<InfoBar.ActionButton>
<Button x:Uid="LanguageRestartInfoButton" Click="Click_LanguageRestart" />
</InfoBar.ActionButton>
</InfoBar>
<tkcontrols:SettingsCard x:Uid="ColorModeHeader" HeaderIcon="{ui:FontIcon Glyph=&#xE790;}">
<tkcontrols:SettingsCard.Description>
<HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" />

View File

@@ -130,5 +130,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
string r = await Task.FromResult<string>(ShellGetFolder.GetFolderDialog(hwnd));
return r;
}
private void Click_LanguageRestart(object sender, RoutedEventArgs e)
{
ViewModel.Restart();
}
}
}