/ src / settings-ui / Settings.UI / Converters / HotkeySettingsToLocalizedStringConverter.cs
HotkeySettingsToLocalizedStringConverter.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using System;
 6  using System.Windows;
 7  using Microsoft.PowerToys.Settings.UI.Helpers;
 8  using Microsoft.PowerToys.Settings.UI.Library;
 9  using Microsoft.UI.Xaml.Data;
10  using Microsoft.Windows.ApplicationModel.Resources;
11  
12  namespace Microsoft.PowerToys.Settings.UI.Converters
13  {
14      public partial class HotkeySettingsToLocalizedStringConverter : IValueConverter
15      {
16          public object Convert(object value, Type targetType, object parameter, string language)
17          {
18              if (value is HotkeySettings keySettings && parameter is string resourceKey)
19              {
20                  return string.Format(System.Globalization.CultureInfo.CurrentCulture, ResourceLoaderInstance.ResourceLoader.GetString(resourceKey), keySettings.ToString());
21              }
22  
23              return string.Empty;
24          }
25  
26          public object ConvertBack(object value, Type targetType, object parameter, string language)
27          {
28              throw new NotImplementedException();
29          }
30      }
31  }