mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[ColorPicker]Fix localization of color names (#22837)
* [ColorPicker] Restructure to have color names localized * [ColorPicker] Restrucure code to have localised color names * Fix analyzer errors * [ColorPicker] add comments
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
@@ -15,7 +15,8 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
return ColorFormatHelper.GetStringRepresentation(null, (string)value);
|
||||
// get string representation in 2 steps. First replace all color specific number values then in 2nd step replace color name with localisation
|
||||
return Library.Helpers.ColorNameHelper.ReplaceName(ColorFormatHelper.GetStringRepresentation(null, (string)value), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,17 +4,13 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Labs.WinUI;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.System;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
@@ -99,7 +95,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
dialog.Content = new TextBlock() { Text = resourceLoader.GetString("Delete_Dialog_Description") };
|
||||
dialog.PrimaryButtonClick += (s, args) =>
|
||||
{
|
||||
ViewModel.DeleteModel(color);
|
||||
ViewModel.DeleteModel(color);
|
||||
};
|
||||
var result = await dialog.ShowAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user