Localize CmdPal settings page (#38026)

* Localize CmdPal settings page
* Xaml format
* Fix it

Follow up to #37908
This commit is contained in:
Stefan Markovic 2025-03-19 22:00:25 +01:00 committed by GitHub
parent 394583fca9
commit 53003b9969
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 138 additions and 64 deletions

View File

@ -73,17 +73,11 @@
<!-- Content goes here -->
<controls:SettingsExpander.Items>
<controls:SettingsCard
Description="Directly open Command Palette to this command"
Header="Global hotkey"
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
<controls:SettingsCard x:Uid="Settings_ExtensionPage_GlobalHotkey_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
<cpcontrols:ShortcutControl HotkeySettings="{x:Bind Hotkey, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard
Description="Typing this alias will navigate to this command. Direct aliases navigate as soon as you type the alias. Indirect aliases navigate after typing a trailing space"
Header="Alias"
HeaderIcon="{ui:FontIcon Glyph=&#xE8AC;}">
<controls:SettingsCard x:Uid="Settings_ExtensionPage_Alias_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xE8AC;}">
<StackPanel Orientation="Vertical">
<TextBox Text="{x:Bind AliasText, Mode=TwoWay}" />
<ToggleSwitch
@ -121,10 +115,7 @@
Text="{x:Bind ViewModel.ExtensionVersion}" />
</controls:SettingsCard>
<controls:SettingsCard
Description="These commands are built-in to the Windows Command Palette"
Header="Built-in"
Visibility="{x:Bind ViewModel.IsFromExtension, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}" />
<controls:SettingsCard x:Uid="Settings_ExtensionPage_Builtin_SettingsCard" Visibility="{x:Bind ViewModel.IsFromExtension, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}" />
</StackPanel>
</Grid>

View File

@ -34,20 +34,16 @@
<RepositionThemeTransition IsStaggeringEnabled="False" />
</StackPanel.ChildrenTransitions>-->
<controls:SettingsExpander
Description="This key will open the Command Palette"
Header="Activation key"
x:Uid="Settings_GeneralPage_ActivationKey_SettingsExpander"
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}"
IsExpanded="True">
<ptControls:ShortcutControl HotkeySettings="{x:Bind viewModel.Hotkey, Mode=TwoWay}" />
<controls:SettingsExpander.Items>
<controls:SettingsCard
Description="If enabled, the Command Palette will return to the home page when activated"
Header="Go home when activated"
HeaderIcon="{ui:FontIcon Glyph=&#xE80F;}">
<controls:SettingsCard x:Uid="Settings_GeneralPage_GoHome_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xE80F;}">
<ToggleSwitch IsOn="{x:Bind viewModel.HotkeyGoesHome, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard Description="When enabled, the previous search text will be selected when the app is opened" Header="Highlight search on activate">
<controls:SettingsCard x:Uid="Settings_GeneralPage_HighlightSearch_SettingsCard">
<ToggleSwitch IsOn="{x:Bind viewModel.HighlightSearchOnActivate, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard x:Uid="Run_PositionHeader" HeaderIcon="{ui:FontIcon Glyph=&#xe78b;}">
@ -62,34 +58,22 @@
</controls:SettingsExpander.Items>
</controls:SettingsExpander>
<controls:SettingsCard
Description="Controls if app details are automatically expanded or not"
Header="Show app details"
HeaderIcon="{ui:FontIcon Glyph=&#xE8A0;}">
<controls:SettingsCard x:Uid="Settings_GeneralPage_ShowAppDetails_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xE8A0;}">
<ToggleSwitch IsOn="{x:Bind viewModel.ShowAppDetails, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard
Description="When enabled, pressing backspace when the search text is empty will take you back"
Header="Backspace goes back"
HeaderIcon="{ui:FontIcon Glyph=&#xE750;}">
<controls:SettingsCard x:Uid="Settings_GeneralPage_BackspaceGoesBack_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xE750;}">
<ToggleSwitch IsOn="{x:Bind viewModel.BackspaceGoesBack, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard
Description="When enabled, single click activates list items. When disabled, single click selects and double click activates."
Header="Single-click activates"
HeaderIcon="{ui:FontIcon Glyph=&#xE962;}">
<controls:SettingsCard x:Uid="Settings_GeneralPage_SingleClickActivation_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xE962;}">
<ToggleSwitch IsOn="{x:Bind viewModel.SingleClickActivates, Mode=TwoWay}" />
</controls:SettingsCard>
<!-- Example 'About' section -->
<TextBlock x:Uid="AboutSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
<controls:SettingsExpander
Description="© 2025. All rights reserved."
Header="Windows Command Palette"
HeaderIcon="{ui:BitmapIcon Source=ms-appx:///Assets/StoreLogo.png}">
<controls:SettingsExpander x:Uid="Settings_GeneralPage_About_SettingsExpander" HeaderIcon="{ui:BitmapIcon Source=ms-appx:///Assets/StoreLogo.png}">
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
@ -97,15 +81,15 @@
<controls:SettingsExpander.Items>
<controls:SettingsCard HorizontalContentAlignment="Left" ContentAlignment="Left">
<StackPanel Margin="-12,0,0,0" Orientation="Vertical">
<HyperlinkButton Content="View GitHub Repo" NavigateUri="https://github.com/zadjii-msft/PowerToys" />
<HyperlinkButton Content="Extension SDK docs" NavigateUri="https://github.com/zadjii-msft/PowerToys/blob/main/src/modules/cmdpal/doc/initial-sdk-spec/initial-sdk-spec.md" />
<HyperlinkButton x:Uid="Settings_GeneralPage_About_GithubLink_Hyperlink" NavigateUri="https://github.com/zadjii-msft/PowerToys" />
<HyperlinkButton x:Uid="Settings_GeneralPage_About_SDKDocs_Hyperlink" NavigateUri="https://github.com/zadjii-msft/PowerToys/blob/main/src/modules/cmdpal/doc/initial-sdk-spec/initial-sdk-spec.md" />
</StackPanel>
</controls:SettingsCard>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>
<HyperlinkButton
x:Uid="Settings_GeneralPage_SendFeedback_Hyperlink"
Margin="0,8,0,0"
Content="Send feedback"
NavigateUri="https://github.com/zadjii-msft/PowerToys/issues/new" />
</StackPanel>
</Grid>

View File

@ -45,11 +45,11 @@
</NavigationView.Resources>
<NavigationView.MenuItems>
<NavigationViewItem
Content="General"
x:Uid="Settings_GeneralPage_NavigationViewItem_General"
Icon="{ui:FontIcon Glyph=&#xE80F;}"
Tag="General" />
<NavigationViewItem
Content="Extensions"
x:Uid="Settings_GeneralPage_NavigationViewItem_Extensions"
Icon="{ui:FontIcon Glyph=&#xEA86;}"
Tag="Extensions" />
</NavigationView.MenuItems>

View File

@ -278,4 +278,79 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="ConfirmationDialog_CancelButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Settings_ExtensionPage_GlobalHotkey_SettingsCard.Header" xml:space="preserve">
<value>Global hotkey</value>
</data>
<data name="Settings_ExtensionPage_GlobalHotkey_SettingsCard.Description" xml:space="preserve">
<value>Directly open Command Palette to this command.</value>
</data>
<data name="Settings_ExtensionPage_Alias_SettingsCard.Header" xml:space="preserve">
<value>Alias</value>
</data>
<data name="Settings_ExtensionPage_Alias_SettingsCard.Description" xml:space="preserve">
<value>Typing this alias will navigate to this command. Direct aliases navigate as soon as you type the alias. Indirect aliases navigate after typing a trailing space.</value>
</data>
<data name="Settings_ExtensionPage_Builtin_SettingsCard.Header" xml:space="preserve">
<value>Built-in</value>
</data>
<data name="Settings_ExtensionPage_Builtin_SettingsCard.Description" xml:space="preserve">
<value>These commands are built-in to the Windows Command Palette.</value>
</data>
<data name="Settings_GeneralPage_ActivationKey_SettingsExpander.Header" xml:space="preserve">
<value>Activation key</value>
</data>
<data name="Settings_GeneralPage_ActivationKey_SettingsExpander.Description" xml:space="preserve">
<value>This key will open the Command Palette.</value>
</data>
<data name="Settings_GeneralPage_GoHome_SettingsCard.Header" xml:space="preserve">
<value>Go home when activated</value>
</data>
<data name="Settings_GeneralPage_GoHome_SettingsCard.Description" xml:space="preserve">
<value>If enabled, the Command Palette will return to the home page when activated.</value>
</data>
<data name="Settings_GeneralPage_HighlightSearch_SettingsCard.Header" xml:space="preserve">
<value>Highlight search on activate</value>
</data>
<data name="Settings_GeneralPage_HighlightSearch_SettingsCard.Description" xml:space="preserve">
<value>When enabled, the previous search text will be selected when the app is opened.</value>
</data>
<data name="Settings_GeneralPage_ShowAppDetails_SettingsCard.Header" xml:space="preserve">
<value>Show app details</value>
</data>
<data name="Settings_GeneralPage_ShowAppDetails_SettingsCard.Description" xml:space="preserve">
<value>Controls if app details are automatically expanded or not.</value>
</data>
<data name="Settings_GeneralPage_BackspaceGoesBack_SettingsCard.Header" xml:space="preserve">
<value>Backspace goes back</value>
</data>
<data name="Settings_GeneralPage_BackspaceGoesBack_SettingsCard.Description" xml:space="preserve">
<value>When enabled, pressing backspace when the search text is empty will take you back.</value>
</data>
<data name="Settings_GeneralPage_SingleClickActivation_SettingsCard.Header" xml:space="preserve">
<value>Single-click activates</value>
</data>
<data name="Settings_GeneralPage_SingleClickActivation_SettingsCard.Description" xml:space="preserve">
<value>When enabled, single click activates list items. When disabled, single click selects and double click activates.</value>
</data>
<data name="Settings_GeneralPage_About_SettingsExpander.Header" xml:space="preserve">
<value>Windows Command Palette</value>
</data>
<data name="Settings_GeneralPage_About_SettingsExpander.Description" xml:space="preserve">
<value>© 2025. All rights reserved.</value>
</data>
<data name="Settings_GeneralPage_About_GithubLink_Hyperlink.Content" xml:space="preserve">
<value>View GitHub Repo</value>
</data>
<data name="Settings_GeneralPage_About_SDKDocs_Hyperlink.Content" xml:space="preserve">
<value>Extension SDK docs</value>
</data>
<data name="Settings_GeneralPage_SendFeedback_Hyperlink.Content" xml:space="preserve">
<value>Send feedback</value>
</data>
<data name="Settings_GeneralPage_NavigationViewItem_General.Content" xml:space="preserve">
<value>General</value>
</data>
<data name="Settings_GeneralPage_NavigationViewItem_Extensions.Content" xml:space="preserve">
<value>Extensions</value>
</data>
</root>

View File

@ -1,9 +1,8 @@
<Application x:Class="FancyZone_HitTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FancyZone_HitTest"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
<Application
x:Class="FancyZone_HitTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FancyZone_HitTest"
StartupUri="MainWindow.xaml">
<Application.Resources />
</Application>

View File

@ -1,17 +1,20 @@
<Window x:Class="FancyZone_HitTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FancyZone_HitTest"
mc:Ignorable="d"
Title="MainWindow" Width="1024" Height="768">
<Window
x:Class="FancyZone_HitTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FancyZone_HitTest"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="1024"
Height="768"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Grid MouseMove="Grid_MouseMove" Name="hitTestGrid">
<Grid Name="hitTestGrid" MouseMove="Grid_MouseMove">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
@ -19,13 +22,35 @@
</Grid.ColumnDefinitions>
<Rectangle Fill="#ff0000" Grid.Column="0" Name="a" />
<Rectangle Fill="#00ff00" Grid.Column="1" Name="b" />
<Rectangle Fill="#0000ff" Grid.Column="2" Name="c" />
<Rectangle Fill="#aabbff" Grid.ColumnSpan="3" Name="d" Width="550" Height="500" />
<!--Height="600"-->
<Rectangle Fill="#aabbff" Grid.ColumnSpan="3" Name="f" Height="400" Width="400" />
<Rectangle Fill="Orange" Grid.ColumnSpan="3" Name="e"/>
<Rectangle
Name="a"
Grid.Column="0"
Fill="#ff0000" />
<Rectangle
Name="b"
Grid.Column="1"
Fill="#00ff00" />
<Rectangle
Name="c"
Grid.Column="2"
Fill="#0000ff" />
<Rectangle
Name="d"
Grid.ColumnSpan="3"
Width="550"
Height="500"
Fill="#aabbff" />
<!-- Height="600" -->
<Rectangle
Name="f"
Grid.ColumnSpan="3"
Width="400"
Height="400"
Fill="#aabbff" />
<Rectangle
Name="e"
Grid.ColumnSpan="3"
Fill="Orange" />
</Grid>
<StackPanel Grid.Column="1">