2020-03-31 11:00:09 +00:00
|
|
|
|
using System.ComponentModel;
|
2020-04-21 09:12:17 +00:00
|
|
|
|
using Flow.Launcher.Core.Resource;
|
2020-03-31 11:00:09 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Core
|
2020-03-31 11:00:09 +00:00
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|