Flow.Launcher/Wox.Core/Resource/LocalizedDescriptionAttribute.cs
Jeremy Wu 782c73e471 Merge in branch 'master' up to commit 24cf015
commit: 24cf015b0a9b36503efbd83c9c9ed3c64da10f18- 24cf015b0a
2020-03-31 22:00:09 +11:00

27 lines
784 B
C#

using System.ComponentModel;
using Wox.Core.Resource;
namespace Wox.Core
{
public class LocalizedDescriptionAttribute : DescriptionAttribute
{
private readonly Internationalization _translator;
private readonly string _resourceKey;
public LocalizedDescriptionAttribute(string resourceKey)
{
_translator = InternationalizationManager.Instance;
_resourceKey = resourceKey;
}
public override string Description
{
get
{
string description = _translator.GetTranslation(_resourceKey);
return string.IsNullOrWhiteSpace(description) ?
string.Format("[[{0}]]", _resourceKey) : description;
}
}
}
}