【发布时间】:2011-08-24 04:38:24
【问题描述】:
我想翻译财产。我有两个资源文件:DataResource.resx 和 DataResource.en.resx。有NameString 字符串(两者)。
我的财产:
[DisplayName("NameString")]
public virtual string Name { get; set; }
我已经使用this 解决方案来本地化DataDisplay 属性。
public class LocalizedDisplayNameAttribute: DisplayNameAttribute
{
public LocalizedDisplayNameAttribute(string resourceId)
: base(GetMessageFromResource(resourceId))
{ }
private static string GetMessageFromResource(string resourceId)
{
// TODO: Return the string from the resource file
}
}
但我不明白我必须在GetMessageFromResource 方法中写什么。
谢谢。
【问题讨论】:
标签: c# winforms attributes