Infralution.Localization ASP.Net 2007 - Localize Enum

时间:2017-12-26 01:52:00

标签: asp.net enums localization

我读这个主题是新的,因为没有新的enum本地化解决方案。这个解决方案主题来自2007年。在这个库中,他们使用System.Resources.ResourceManager,但我想使用全局或本地源。

唯一的常数是:

 public LocalizedEnumConverter(Type type, ResourceManager resourceManager)
        : base(type, resourceManager)
    {
    }

我的枚举:

  [TypeConverter(typeof(LocalizedEnumConverter))]
public enum Role
{
    [StringValue("User")]
    User,

    [StringValue("Administrator")]
    Administrator,
}

Infralution库不是我想要的。 我希望

 [Localizable]
public enum AnaRoller
{
    [StringValue("Uye")]
    Uye,

    [StringValue("Administrator")]
    Administrator,
}
 and get the localizable enum value like this 

 AnaRoller.Uye.GetLocalizabledValue() =>> return string from globalresource 
 file if has the 
 Localizable attribute  if not have it should throw exception.

 I save in global file like this =>> name =>  Anaroller_Uye  value => User

我怎样才能实现这样的愿望?

0 个答案:

没有答案