public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is null) { return(AvaloniaProperty.UnsetValue); } PBELocalizedString localized = null; switch (value) { case PBEAbility ability: localized = PBELocalizedString.GetAbilityName(ability); break; case PBEGender gender: localized = PBELocalizedString.GetGenderName(gender); break; case PBEItem item: localized = PBELocalizedString.GetItemName(item); break; case PBELocalizedString l: localized = l; break; case PBEMove move: localized = PBELocalizedString.GetMoveName(move); break; case PBENature nature: localized = PBELocalizedString.GetNatureName(nature); break; case PBESpecies species: localized = PBELocalizedString.GetSpeciesName(species); break; case PBEStat stat: localized = PBELocalizedString.GetStatName(stat); break; case PBEType type: localized = PBELocalizedString.GetTypeName(type); break; } return(StringRenderer.Render(localized == null ? value.ToString() : localized.ToString(), parameter?.ToString()) ?? AvaloniaProperty.UnsetValue); }