From 87c1a73eccce1f4bd12bb035f69c49b5c6c236fb Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Mon, 24 Nov 2025 06:24:52 -0600 Subject: [PATCH] bunch of loc todos --- .../Helpers/WrappedDockItem.cs | 4 +- .../Microsoft.CmdPal.Core.Common.csproj | 15 +++ .../Properties/Resources.Designer.cs | 72 ++++++++++ .../Properties/Resources.resx | 124 ++++++++++++++++++ .../Properties/Resources.resx | 4 + .../Commands/BuiltInsCommandProvider.cs | 2 +- .../Dock/DockBandSettingsViewModel.cs | 9 +- .../Properties/Resources.Designer.cs | 71 ++++++++-- .../Properties/Resources.resx | 24 ++++ .../TopLevelViewModel.cs | 4 +- .../Properties/Resources.Designer.cs | 11 +- .../Properties/Resources.resx | 4 + .../TimeDateCommandsProvider.cs | 2 +- 13 files changed, 323 insertions(+), 23 deletions(-) create mode 100644 src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.Designer.cs create mode 100644 src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.resx diff --git a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Helpers/WrappedDockItem.cs b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Helpers/WrappedDockItem.cs index 59f6d86c96..6ad2291f6a 100644 --- a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Helpers/WrappedDockItem.cs +++ b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Helpers/WrappedDockItem.cs @@ -40,7 +40,7 @@ public partial class WrappedDockItem : CommandItem public partial class PinnedDockItem : WrappedDockItem { - public override string Title => $"{base.Title} (Pinned)"; // TODO! localization + public override string Title => $"{base.Title} ({Properties.Resources.PinnedItemSuffix})"; public PinnedDockItem(ICommand command) : base(command, command.Name) @@ -69,7 +69,7 @@ public partial class WrappedDockList : ListPage _command = command; _items = new IListItem[] { new ListItem(command) }; Name = _command.Name; - _id = _command.Id; // + "__DockBand"; + _id = _command.Id; } public WrappedDockList(ICommandItem item, string id) diff --git a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Microsoft.CmdPal.Core.Common.csproj b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Microsoft.CmdPal.Core.Common.csproj index a6b270799c..f0be58b675 100644 --- a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Microsoft.CmdPal.Core.Common.csproj +++ b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Microsoft.CmdPal.Core.Common.csproj @@ -9,4 +9,19 @@ + + + + Resources.resx + True + True + + + + + Resources.Designer.cs + PublicResXFileCodeGenerator + + + diff --git a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.Designer.cs b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..7472c2c6c2 --- /dev/null +++ b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.CmdPal.Core.Common.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CmdPal.Core.Common.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Pinned. + /// + public static string PinnedItemSuffix { + get { + return ResourceManager.GetString("PinnedItemSuffix", resourceCulture); + } + } + } +} diff --git a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.resx b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.resx new file mode 100644 index 0000000000..a23d74df3a --- /dev/null +++ b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.Common/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Pinned + Suffix shown for pinned items in the dock + + diff --git a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.ViewModels/Properties/Resources.resx b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.ViewModels/Properties/Resources.resx index 560907942b..c014e4d203 100644 --- a/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.ViewModels/Properties/Resources.resx +++ b/src/modules/cmdpal/Core/Microsoft.CmdPal.Core.ViewModels/Properties/Resources.resx @@ -121,4 +121,8 @@ Show details Name for the command that shows details of an item + + Pinned + Suffix shown for pinned items in the dock + \ No newline at end of file diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs index 52b85239e8..54b124ded7 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs @@ -49,7 +49,7 @@ public sealed partial class BuiltInsCommandProvider : CommandProvider, IExtended { var rootPage = _rootPageService.GetRootPage(); List bandItems = new(); - bandItems.Add(new WrappedDockItem(rootPage, "Open Command Palette")); // TODO!loc + bandItems.Add(new WrappedDockItem(rootPage, Properties.Resources.builtin_command_palette_title)); return new PropertySet() { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Dock/DockBandSettingsViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Dock/DockBandSettingsViewModel.cs index 7de2f5f77d..b2dc5d8f04 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Dock/DockBandSettingsViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Dock/DockBandSettingsViewModel.cs @@ -2,6 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Globalization; +using System.Text; using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.CmdPal.Core.ViewModels; using Microsoft.CmdPal.UI.ViewModels.Settings; @@ -11,6 +13,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.Dock; public partial class DockBandSettingsViewModel : ObservableObject { + private static readonly CompositeFormat PluralItemsFormatString = CompositeFormat.Parse(Properties.Resources.dock_item_count_plural); private readonly SettingsModel _settingsModel; private readonly DockBandSettings _dockSettingsModel; private readonly TopLevelViewModel _adapter; @@ -22,15 +25,15 @@ public partial class DockBandSettingsViewModel : ObservableObject { get { - // TODO! we should have a way of saying "pinned from {extension}" vs - // just a band that's from an extension List parts = [_adapter.ExtensionName]; // Add the number of items in the band var itemCount = NumItemsInBand(); if (itemCount > 0) { - var itemsString = itemCount == 1 ? "1 item" : $"{itemCount} items"; // TODO!Loc + var itemsString = itemCount == 1 ? + Properties.Resources.dock_item_count_singular : + string.Format(CultureInfo.CurrentCulture, PluralItemsFormatString, itemCount); parts.Add(itemsString); } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.Designer.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.Designer.cs index be9d103b2d..91c569dcf6 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.Designer.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -60,6 +60,15 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { } } + /// + /// Looks up a localized string similar to Open Command Palette. + /// + public static string builtin_command_palette_title { + get { + return ResourceManager.GetString("builtin_command_palette_title", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create another. /// @@ -205,7 +214,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { } /// - /// Looks up a localized string similar to Create a new extension. + /// Looks up a localized string similar to Create extension. /// public static string builtin_create_extension_title { get { @@ -285,6 +294,15 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { } } + /// + /// Looks up a localized string similar to Built-in. + /// + public static string builtin_extension_name_fallback { + get { + return ResourceManager.GetString("builtin_extension_name_fallback", resourceCulture); + } + } + /// /// Looks up a localized string similar to Home. /// @@ -349,7 +367,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { } /// - /// Looks up a localized string similar to Creates a project for a new Command Palette extension. + /// Looks up a localized string similar to Generate a new Command Palette extension project. /// public static string builtin_new_extension_subtitle { get { @@ -358,7 +376,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { } /// - /// Looks up a localized string similar to Open Settings. + /// Looks up a localized string similar to Open Command Palette settings. /// public static string builtin_open_settings_name { get { @@ -366,15 +384,6 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { } } - /// - /// Looks up a localized string similar to Open Command Palette settings. - /// - public static string builtin_open_settings_subtitle { - get { - return ResourceManager.GetString("builtin_open_settings_subtitle", resourceCulture); - } - } - /// /// Looks up a localized string similar to Exit Command Palette. /// @@ -428,5 +437,41 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { return ResourceManager.GetString("builtin_settings_extension_n_extensions_installed", resourceCulture); } } + + /// + /// Looks up a localized string similar to {0} items. + /// + public static string dock_item_count_plural { + get { + return ResourceManager.GetString("dock_item_count_plural", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1 item. + /// + public static string dock_item_count_singular { + get { + return ResourceManager.GetString("dock_item_count_singular", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Pin to dock. + /// + public static string dock_pin_command_name { + get { + return ResourceManager.GetString("dock_pin_command_name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unpin from dock. + /// + public static string dock_unpin_command_name { + get { + return ResourceManager.GetString("dock_unpin_command_name", resourceCulture); + } + } } } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.resx b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.resx index 9a658e38f1..c52e7a61be 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.resx +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.resx @@ -239,4 +239,28 @@ {0} extensions installed + + Built-in + Fallback name for built-in extensions + + + Pin to dock + Command name for pinning an item to the dock + + + Unpin from dock + Command name for unpinning an item from the dock + + + 1 item + Singular form for item count in dock band + + + {0} items + Plural form for item count in dock band + + + Open Command Palette + Title for the command to open the command palette + \ No newline at end of file diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelViewModel.cs index cbf6f36f7d..8d29939f64 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelViewModel.cs @@ -48,7 +48,7 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem public CommandPaletteHost ExtensionHost { get; private set; } - public string ExtensionName => ExtensionHost.Extension?.ExtensionDisplayName ?? "Built-in"; // TODO! loc + public string ExtensionName => ExtensionHost.Extension?.ExtensionDisplayName ?? Properties.Resources.builtin_extension_name_fallback; public CommandViewModel CommandViewModel => _commandItemViewModel.Command; @@ -486,7 +486,7 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem public override IconInfo Icon => _pin ? Icons.PinIcon : Icons.UnpinIcon; - public override string Name => _pin ? "Pin to dock" : "Unpin from dock"; // TODO! loc + public override string Name => _pin ? Properties.Resources.dock_pin_command_name : Properties.Resources.dock_unpin_command_name; public PinToDockCommand( TopLevelViewModel topLevelViewModel, diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.Designer.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.Designer.cs index e3443c3ee6..994f0f805a 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.Designer.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.CmdPal.Ext.TimeDate { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -159,6 +159,15 @@ namespace Microsoft.CmdPal.Ext.TimeDate { } } + /// + /// Looks up a localized string similar to Clock. + /// + public static string Microsoft_plugin_timedate_dock_band_title { + get { + return ResourceManager.GetString("Microsoft_plugin_timedate_dock_band_title", resourceCulture); + } + } + /// /// Looks up a localized string similar to Era. /// diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.resx b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.resx index eb248e3b1a..0235f68ee7 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.resx +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Properties/Resources.resx @@ -432,4 +432,8 @@ Show time and date results when typing keywords like "week", "year", "now", "time", or "date" + + Clock + Title for the time and date dock band + \ No newline at end of file diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs index 274c7584a5..febaa3c6d0 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs @@ -61,7 +61,7 @@ public sealed partial class TimeDateCommandsProvider : CommandProvider, IExtende var wrappedBand = new WrappedDockItem( _bandItem, "com.microsoft.cmdpal.timedate.dockband", - "Clock"); // TODO! loc + Resources.Microsoft_plugin_timedate_dock_band_title); return new PropertySet() {