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; } }