Asp.net 如何在PropertyEditorPart中本地化Web部件属性?
是否有任何方法可以本地化Asp.net 如何在PropertyEditorPart中本地化Web部件属性?,asp.net,localization,web-parts,Asp.net,Localization,Web Parts,是否有任何方法可以本地化属性编辑部分中显示的文本 [Personalizable(true), WebBrowsable(true), WebDisplayName("To Date: "), WebDescription("Please enter To Date value.")] public string ToDate { get { return toDate; } set { toDate = value; } } 为了实现这一点,应该扩展这些属性(Category
属性编辑部分中显示的文本
[Personalizable(true),
WebBrowsable(true),
WebDisplayName("To Date: "),
WebDescription("Please enter To Date value.")]
public string ToDate
{
get { return toDate; }
set { toDate = value; }
}
为了实现这一点,应该扩展这些属性(Category、WebDisplayName和WebDescription),以便它们利用本地化特性
[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;
}
}
}
更多细节