From c49883e0dc773239f58251c19fcb08c0ff3a6b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Mon, 29 Sep 2025 19:44:02 +0200 Subject: [PATCH] Move UI strings to resources --- .../Properties/Resources.Designer.cs | 18 ++++++++++++++++++ .../Properties/Resources.resx | 6 ++++++ .../SettingsExtensionsViewModel.cs | 13 ++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) 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 e3a4e31088..be9d103b2d 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 @@ -410,5 +410,23 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties { return ResourceManager.GetString("builtin_reload_subtitle", resourceCulture); } } + + /// + /// Looks up a localized string similar to {0} extensions found. + /// + public static string builtin_settings_extension_n_extensions_found { + get { + return ResourceManager.GetString("builtin_settings_extension_n_extensions_found", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} extensions installed. + /// + public static string builtin_settings_extension_n_extensions_installed { + get { + return ResourceManager.GetString("builtin_settings_extension_n_extensions_installed", 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 6279a0bfdc..f0f68b8582 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.resx +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Properties/Resources.resx @@ -236,4 +236,10 @@ Home + + {0} extensions found + + + {0} extensions installed + \ No newline at end of file diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsExtensionsViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsExtensionsViewModel.cs index 7b326aa333..8e14a83d19 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsExtensionsViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsExtensionsViewModel.cs @@ -4,7 +4,8 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; - +using System.Globalization; +using System.Text; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; @@ -21,6 +22,12 @@ namespace Microsoft.CmdPal.UI.ViewModels; /// public partial class SettingsExtensionsViewModel : ObservableObject { + private static readonly CompositeFormat LabelNumberExtensionFound + = CompositeFormat.Parse(Properties.Resources.builtin_settings_extension_n_extensions_found!); + + private static readonly CompositeFormat LabelNumberExtensionInstalled + = CompositeFormat.Parse(Properties.Resources.builtin_settings_extension_n_extensions_installed!); + private readonly ObservableCollection _source; private readonly TaskScheduler _uiScheduler; @@ -48,8 +55,8 @@ public partial class SettingsExtensionsViewModel : ObservableObject { var hasQuery = !string.IsNullOrWhiteSpace(_searchText); var count = hasQuery ? FilteredProviders.Count : _source.Count; - var suffix = hasQuery ? "extensions found" : "extensions installed"; - return $"{count} {suffix}"; + var format = hasQuery ? LabelNumberExtensionFound : LabelNumberExtensionInstalled; + return string.Format(CultureInfo.CurrentCulture, format, count); } }