多语言
作者:互联网
public class CultureeeResolver : IValueResolver<ILocalizableDbEntity, ILocalizableModel, string> { public string Resolve(ILocalizableDbEntity source, ILocalizableModel destination, string destMember, ResolutionContext context) { var culture = Thread.CurrentThread.CurrentUICulture; } }
public class CultureResolver : IValueResolver<ILocalizableDbEntity, ILocalizableModel, string> { public string Resolve(ILocalizableDbEntity source, ILocalizableModel destination, string destMember, ResolutionContext context) { var culture = Thread.CurrentThread.CurrentUICulture;
SystemLang currentLang; if (!EnumsNET.Enums.TryParse<SystemLang>(culture.Name, out currentLang)) { currentLang = SystemLang.English; }
return currentLang == SystemLang.Chinese ? source.NameCN : source.NameEN; } }
标签:语言,source,currentLang,culture,SystemLang,public,string 来源: https://www.cnblogs.com/Insist-Y/p/15670526.html