我正在处理一些 SharePoint web 部件,我正在尝试使它们尽可能独立于区域设置。我已经在资源文件中获取了大部分文本,并且正在查看我的 Web 部件上的属性:
[WebBrowsable(true),
Category("My Category"),
WebDisplayName("Display Name here"),
WebDescription("Tells you all about it"),
Personalizable(PersonalizationScope.Shared)]
public string SomeProperty { get; set; }
最好用对不使用英语的用户(在本例中为 SharePoint 管理员)更有用的内容替换这些硬编码字符串。
如果有的话,我有什么选择?
最佳答案
您正在寻找 Microsoft.SharePoint.WebPartPages.ResourcesAttribute
类。
This blog post有它的使用说明和一个简单的例子。
//RESOURCES LOCALIZATION
//Property that is localized. Use the ResourceAttibute.
//[ResourcesAttribute (PropertyNameID=1, CategoryID=2, DescriptionID=3)]
[Resources("PropNameResID", "PropCategoryResID", "PropDescriptionResID")]
关于c# - 国际化和 C# 方法属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1078586/