mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
29 lines
979 B
C#
29 lines
979 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using Flow.Launcher.ViewModel;
|
|
|
|
namespace Flow.Launcher.Converters;
|
|
|
|
public class TextConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var id = value?.ToString();
|
|
var translationKey = id switch
|
|
{
|
|
PluginStoreItemViewModel.NewRelease => "pluginStore_NewRelease",
|
|
PluginStoreItemViewModel.RecentlyUpdated => "pluginStore_RecentlyUpdated",
|
|
PluginStoreItemViewModel.None => "pluginStore_None",
|
|
PluginStoreItemViewModel.Installed => "pluginStore_Installed",
|
|
_ => null
|
|
};
|
|
|
|
if (translationKey is null)
|
|
return id;
|
|
|
|
return App.API.GetTranslation(translationKey);
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new InvalidOperationException();
|
|
}
|