Flow.Launcher/Flow.Launcher.Core/Resource/TranslationConverter.cs

20 lines
652 B
C#
Raw Normal View History

2022-11-07 12:04:13 +00:00
using System;
using System.Globalization;
using System.Windows.Data;
2022-12-21 07:50:41 +00:00
namespace Flow.Launcher.Core.Resource
2022-11-07 12:04:13 +00:00
{
2022-12-21 07:50:41 +00:00
public class TranslationConverter : IValueConverter
2022-11-07 12:04:13 +00:00
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var key = value.ToString();
if (String.IsNullOrEmpty(key))
return key;
return InternationalizationManager.Instance.GetTranslation(key);
}
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
}
}