29 lines
No EOL
875 B
C#
29 lines
No EOL
875 B
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Resources;
|
|
|
|
namespace WebsitePanel.WebDav.Core.Attributes.Resources
|
|
{
|
|
public class LocalizedDescriptionAttribute : DescriptionAttribute
|
|
{
|
|
private readonly string _resourceKey;
|
|
private readonly ResourceManager _resource;
|
|
public LocalizedDescriptionAttribute(Type resourceType, string resourceKey)
|
|
{
|
|
_resource = new ResourceManager(resourceType);
|
|
_resourceKey = resourceKey;
|
|
}
|
|
|
|
public override string Description
|
|
{
|
|
get
|
|
{
|
|
string displayName = _resource.GetString(_resourceKey);
|
|
|
|
return string.IsNullOrEmpty(displayName)
|
|
? string.Format("[[{0}]]", _resourceKey)
|
|
: displayName;
|
|
}
|
|
}
|
|
}
|
|
} |