有没有办法本地化PropertyEditorPart
中显示的文字?
[Personalizable(true),
WebBrowsable(true),
WebDisplayName("To Date: "),
WebDescription("Please enter To Date value.")]
public string ToDate
{
get { return toDate; }
set { toDate = value; }
}
答案 0 :(得分:0)
为实现这一目标,应扩展这些属性(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;
}
}
}