title: Enum [Display(Name) localisation MVC 4
body: <p>I have a enum that holds countries:</p>
  
  <pre><code>public enum CountryEnum
  {
      [Display(Name = "AF", ResourceType = typeof(Global))]
      AF,
  
      [Display(Name = "AL", ResourceType = typeof(Global))]
      AL,
  
      [Display(Name = "DZ", ResourceType = typeof(Global))]
      DZ,
  };
  </code></pre>
  
  <p>As you can see I make use of the DataAnnotations to localise the values.</p>
  
  <p>Now I want to display a dropdownlist with all of the localised country names. I come up with this code:</p>
  
  <pre><code>public static string GetDisplayName&lt;TEnum&gt;(TEnum value)
  {        
      FieldInfo fi = value.GetType().GetField(value.ToString());
  
      DisplayAttribute[] attributes = 
          (DisplayAttribute[])fi.GetCustomAttributes(
              typeof(DisplayAttribute), false);
  
          if ((attributes != null) &amp;&amp; (attributes.Length &gt; 0))
              return attributes[0].Name;
          else
              return value.ToString();
  }
  </code></pre>
  
  <p>I have a Html helper that makes use of the above method:</p>
  
  <pre><code>public static MvcHtmlString EnumDropDownListFor&lt;TModel, TEnum&gt;(this HtmlHelper&lt;TModel&gt; htmlHelper, Expression&lt;Func&lt;TModel, TEnum&gt;&gt; expression, object htmlAttributes)
  {
      ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
      Type enumType = GetNonNullableModelType(metadata);
      IEnumerable&lt;TEnum&gt; values = Enum.GetValues(enumType).Cast&lt;TEnum&gt;();
  
      IEnumerable&lt;SelectListItem&gt; items = from value in values
                                          select new SelectListItem
                                          {
                                              Text = GetDisplayName(value),
                                              Value = value.ToString(),
                                              Selected = value.Equals(metadata.Model)
                                          };
  
      // If the enum is nullable, add an 'empty' item to the collection
      if (metadata.IsNullableValueType)
          items = SingleEmptyItem.Concat(items);
  
      return htmlHelper.DropDownListFor(expression, items, htmlAttributes);
  }
  </code></pre>
  
  <p>The DropDown renders correctly, however, <code>GetDisplayName</code> doesn't return the localised value, it just display the name attribute (e.g. AF for the first entry).</p>
  
  <p>How can I modify <code>GetDisplayName</code> method to return the localised value?</p>