From e8e1431e154735d6f32fb3e200efbd10808b8755 Mon Sep 17 00:00:00 2001 From: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Date: Wed, 27 Aug 2025 09:55:43 +0800 Subject: [PATCH] Fix localization issue for shortcut conflict window (#41378) ## Summary of the Pull Request Added localization for conflict message shown in shortcut conflict window and shortcut dialog. ## PR Checklist - [x] Closes: #41373 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed Signed-off-by: Shawn Yuan --- .../Controls/ShortcutControl/ShortcutControl.xaml.cs | 12 ++++-------- .../ShortcutDialogContentControl.xaml | 2 +- .../Settings.UI/Strings/en-us/Resources.resw | 6 ++++++ .../ViewModels/ShortcutConflictViewModel.cs | 3 +++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs index 5b21743d5f..6b4b9b7957 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs @@ -548,18 +548,14 @@ namespace Microsoft.PowerToys.Settings.UI.Controls } } - if (conflictingModules.Count > 0) + var moduleNames = conflictingModules.ToArray(); + if (string.Equals(moduleNames[0], "System", StringComparison.OrdinalIgnoreCase)) { - var moduleNames = conflictingModules.ToArray(); - var conflictMessage = moduleNames.Length == 1 - ? $"Conflict detected with {moduleNames[0]}" - : $"Conflicts detected with: {string.Join(", ", moduleNames)}"; - - c.ConflictMessage = conflictMessage; + c.ConflictMessage = ResourceLoaderInstance.ResourceLoader.GetString("SysHotkeyConflictTooltipText"); } else { - c.ConflictMessage = "Conflict detected with unknown module"; + c.ConflictMessage = ResourceLoaderInstance.ResourceLoader.GetString("InAppHotkeyConflictTooltipText"); } c.HasConflict = true; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml index 13033344ab..b7fec717c7 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml @@ -64,7 +64,7 @@ IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsWarningAltGr, Mode=OneWay}" Severity="Warning" /> Shortcuts with **Ctrl** and **Alt** may remove functionality from some international keyboards, because **Ctrl** + **Alt** = **Alt Gr** in those keyboards. The ** sequences are used for text formatting of the key names. Don't remove them on translation. + + Shortcut conflict + + + A conflict has been detected for this shortcut. + All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors diff --git a/src/settings-ui/Settings.UI/ViewModels/ShortcutConflictViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ShortcutConflictViewModel.cs index b489d29fca..2cfcbaf42f 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ShortcutConflictViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ShortcutConflictViewModel.cs @@ -145,6 +145,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { // Get current hotkey settings (fresh from file) using the accessor's getter module.HotkeySettings = hotkeyAccessor.Value; + module.HotkeySettings.ConflictDescription = isSystemConflict + ? ResourceLoaderInstance.ResourceLoader.GetString("SysHotkeyConflictTooltipText") + : ResourceLoaderInstance.ResourceLoader.GetString("InAppHotkeyConflictTooltipText"); // Set header using localization key module.Header = GetHotkeyLocalizationHeader(module.ModuleName, module.HotkeyID, hotkeyAccessor.LocalizationHeaderKey);