views:

2

answers:

1

Is there any way to localize the text displayed within the PropertyEditorPart?

[Personalizable(true),
WebBrowsable(true),
WebDisplayName("To Date: "),
WebDescription("Please enter To Date value.")]
public string ToDate
{
    get { return toDate; }
    set { toDate = value; }
}
A: 

To achieve this, these attributes (Category, WebDisplayName and WebDescription) should be extended so they take advantage of the localization features.

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
 public sealed class LocalizedWebDisplayNameAttribute
     : WebDisplayNameAttribute {

     bool m_isLocalized ;

     public LocalizedWebDisplayNameAttribute(string displayName)
         : base(displayName) {
     }

     public override string DisplayName {
         get {
             if (!m_isLocalized) {
                 this.DisplayNameValue = 
                     Resources.ResourceManager.GetString(
                         base.DisplayName, Resources.Culture);
                 m_isLocalized = true;
             }
             return base.DisplayName;
         }
     }
 }

More details, Web Part Properties - part 5 - localization

Ahmed