mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
Fixed localization bug (thanks Dustin), validated all working with Text page resource keys
This commit is contained in:
@@ -39,6 +39,7 @@ namespace KeyboardManagerEditorUI
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
global::System.Diagnostics.Debugger.Break();
|
||||
this.InitializeComponent();
|
||||
|
||||
Task.Run(() =>
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace KeyboardManagerEditorUI.Helpers
|
||||
|
||||
static ResourceLoaderInstance()
|
||||
{
|
||||
ResourceLoader = new ResourceLoader("resources.pri");
|
||||
ResourceLoader = new ResourceLoader("PowerToys.KeyboardManagerEditorUI.pri");
|
||||
}
|
||||
|
||||
internal static string GetString(string resourceId) => ResourceLoader.GetString(resourceId);
|
||||
internal static string GetString(string resourceId) => Microsoft.Windows.ApplicationModel.Resources.ResourceLoader.GetDefaultResourceFilePath(); // ResourceLoader.GetString(resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<AssemblyName>PowerToys.KeyboardManagerEditorUI</AssemblyName>
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\$(MSBuildProjectName)</OutputPath>
|
||||
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
|
||||
<ProjectPriFileName>PowerToys.KeyboardManagerEditorUI.pri</ProjectPriFileName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<Grid Padding="16">
|
||||
<StackPanel Orientation="Vertical" Spacing="12">
|
||||
<TextBlock
|
||||
x:Uid="TextPageInstructionTextBlock"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_Instruction')}"
|
||||
TextWrapping="Wrap" />
|
||||
<Button
|
||||
x:Name="NewShortcutBtn"
|
||||
@@ -27,7 +27,9 @@
|
||||
FontSize="14"
|
||||
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
|
||||
Glyph="" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_NewText')}" />
|
||||
<TextBlock
|
||||
x:Uid="TextPageNewTextBlock"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Grid
|
||||
@@ -47,34 +49,33 @@
|
||||
<ColumnDefinition Width="84" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="TextPageOriginalKeysTextBlock"
|
||||
Grid.Column="0"
|
||||
Margin="16,-2,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_OriginalKeys')}" />
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
<AppBarSeparator
|
||||
Grid.Column="1"
|
||||
Margin="-6,4,0,4"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBlock
|
||||
x:Uid="TextPageTextTextBlock"
|
||||
Grid.Column="1"
|
||||
Margin="12,-2,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_Text')}" />
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
<AppBarSeparator
|
||||
Grid.Column="2"
|
||||
Margin="-6,4,0,4"
|
||||
HorizontalAlignment="Left" />
|
||||
<TextBlock
|
||||
x:Uid="TextPageApplicableAppsTextBlock"
|
||||
Grid.Column="2"
|
||||
Margin="12,-2,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_ApplicableApps')}" />
|
||||
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
<Rectangle
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="4"
|
||||
@@ -155,6 +156,7 @@
|
||||
|
||||
<!-- Delete button -->
|
||||
<Button
|
||||
x:Uid="TextPageDeleteButton"
|
||||
Grid.Column="3"
|
||||
Margin="0,0,4,0"
|
||||
Padding="8,4"
|
||||
@@ -163,8 +165,7 @@
|
||||
AutomationProperties.Name="Delete remapping"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="DeleteButton_Click"
|
||||
ToolTipService.ToolTip="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_DeleteTip')}">
|
||||
Click="DeleteButton_Click">
|
||||
<FontIcon
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
@@ -180,15 +181,13 @@
|
||||
|
||||
<ContentDialog
|
||||
x:Name="KeyDialog"
|
||||
Title="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_KeyDialogTitle')}"
|
||||
x:Uid="TextPageKeyDialog"
|
||||
Width="480"
|
||||
Height="360"
|
||||
MinWidth="600"
|
||||
MaxWidth="600"
|
||||
PrimaryButtonClick="KeyDialog_PrimaryButtonClick"
|
||||
PrimaryButtonStyle="{StaticResource AccentButtonStyle}"
|
||||
PrimaryButtonText="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_KeyDialogPrimary')}"
|
||||
SecondaryButtonText="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_KeyDialogSecondary')}">
|
||||
PrimaryButtonStyle="{StaticResource AccentButtonStyle}">
|
||||
<Grid>
|
||||
<controls:TextPageInputControl x:Name="TextInputControl" />
|
||||
</Grid>
|
||||
@@ -196,7 +195,7 @@
|
||||
|
||||
<TeachingTip
|
||||
x:Name="ValidationTip"
|
||||
CloseButtonContent="{x:Bind helper:ResourceLoaderInstance.GetString('TextPage_ValidationTipClose')}"
|
||||
x:Uid="TextPageValidationTip"
|
||||
IsLightDismissEnabled="True"
|
||||
PreferredPlacement="Center">
|
||||
<TeachingTip.IconSource>
|
||||
|
||||
@@ -156,34 +156,31 @@
|
||||
<data name="RemappingsPage_NewKeys" xml:space="preserve">
|
||||
<value>New key(s)</value>
|
||||
</data>
|
||||
<data name="TextPage_Instruction" xml:space="preserve">
|
||||
<data name="TextPageInstructionTextBlock.Text" xml:space="preserve">
|
||||
<value>Text shortcuts allow you to insert text in any input field when you use the configured keyboard shortcut</value>
|
||||
</data>
|
||||
<data name="TextPage_NewText" xml:space="preserve">
|
||||
<data name="TextPageNewTextBlock.Text" xml:space="preserve">
|
||||
<value>New</value>
|
||||
</data>
|
||||
<data name="TextPage_OriginalKeys" xml:space="preserve">
|
||||
<data name="TextPageOriginalKeysTextBlock.Text" xml:space="preserve">
|
||||
<value>Original key(s)</value>
|
||||
</data>
|
||||
<data name="TextPage_ApplicableApps" xml:space="preserve">
|
||||
<data name="TextPageApplicableAppsTextBlock.Text" xml:space="preserve">
|
||||
<value>Applicable apps</value>
|
||||
</data>
|
||||
<data name="TextPage_Text" xml:space="preserve">
|
||||
<data name="TextPageTextTextBlock.Text" xml:space="preserve">
|
||||
<value>Text</value>
|
||||
</data>
|
||||
<data name="TextPage_DeleteTip" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="TextPage_KeyDialogTitle" xml:space="preserve">
|
||||
<data name="TextPageKeyDialog.Title" xml:space="preserve">
|
||||
<value>Text shortcut</value>
|
||||
</data>
|
||||
<data name="TextPage_KeyDialogPrimary" xml:space="preserve">
|
||||
<data name="TextPageKeyDialog.PrimaryButtonText" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name="TextPage_KeyDialogSecondary" xml:space="preserve">
|
||||
<data name="TextPageKeyDialog.SecondaryButtonText" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="TextPage_ValidationTipClose" xml:space="preserve">
|
||||
<data name="TextPageValidationTip.CloseButtonContent" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="ProgramsPage_Instruction" xml:space="preserve">
|
||||
@@ -306,4 +303,7 @@
|
||||
<data name="TextPageInputControl_TextContentBoxHeader" xml:space="preserve">
|
||||
<value>Text to insert</value>
|
||||
</data>
|
||||
<data name="TextPageDeleteButton.ToolTipSevice.ToolTip" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -292,8 +292,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
string path = Path.Combine(Environment.CurrentDirectory, editorPath);
|
||||
Logger.LogInfo($"Starting {PowerToyName} editor from {path}");
|
||||
|
||||
// InvariantCulture: type represents the KeyboardManagerEditorType enum value
|
||||
editor = Process.Start(path, $"{type.ToString(CultureInfo.InvariantCulture)} {Environment.ProcessId}");
|
||||
// InvariantCulture: type represents the KeyboardManagerEditorType enum va
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo(path);
|
||||
startInfo.UseShellExecute = true; // LOAD BEARING
|
||||
startInfo.Arguments = $"{type.ToString(CultureInfo.InvariantCulture)} {Environment.ProcessId}";
|
||||
System.Environment.SetEnvironmentVariable("MICROSOFT_WINDOWSAPPRUNTIME_BASE_DIRECTORY", null);
|
||||
editor = Process.Start(startInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user