Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
1005 B

using Microsoft.Extensions.Localization;
using System;
using Volo.Abp.Localization;
namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending;
public static class EnumHelper
{
[Obsolete("Use IAbpEnumLocalizer instead.")]
public static string GetLocalizedMemberName(Type enumType, object value, IStringLocalizerFactory stringLocalizerFactory)
{
var memberName = enumType.GetEnumName(value) ?? Enum.ToObject(enumType, value).ToString();
var localizedMemberName = AbpInternalLocalizationHelper.LocalizeWithFallback(
new[]
{
stringLocalizerFactory.CreateDefaultOrNull()
},
new[]
{
$"Enum:{enumType.Name}.{value}",
$"Enum:{enumType.Name}.{memberName}",
$"{enumType.Name}.{value}",
$"{enumType.Name}.{memberName}",
memberName
}!,
memberName!
);
return localizedMemberName;
}
}