using System; using CommunityToolkit.Mvvm.DependencyInjection; using StrixMusic.Sdk.WinUI.Services.Localization; using Windows.UI.Xaml.Data; namespace StrixMusic.Sdk.WinUI.Converters.Units { /// /// A converter that adds an "Artists" suffix to a unit. /// public sealed class CountToArtistsConverter : IValueConverter { /// /// Adds an "Artists" suffix to a unit. /// /// The to convert /// The converted value. public static string Convert(int value) { var localizationService = Ioc.Default.GetService(); return localizationService?.Music is null ? value.ToString() : string.Format(localizationService.Music.GetString("ArtistsCount"), value); } /// public object Convert(object value, Type targetType, object parameter, string language) { return Convert((int)value); } /// public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }