mirror of
https://github.com/greenshot/greenshot.git
synced 2025-01-09 15:23:03 -08:00
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System;
|
|
using System.Windows.Data;
|
|
using System.Windows.Markup;
|
|
|
|
namespace GreenshotConfluencePlugin.Support
|
|
{
|
|
/// <summary>
|
|
/// The Translate Markup extension returns a binding to a TranslationData
|
|
/// that provides a translated resource of the specified key
|
|
/// </summary>
|
|
public class TranslateExtension : MarkupExtension
|
|
{
|
|
private string _key;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="TranslateExtension"/> class.
|
|
/// </summary>
|
|
/// <param name="key">The key.</param>
|
|
public TranslateExtension(string key)
|
|
{
|
|
_key = key;
|
|
}
|
|
|
|
[ConstructorArgument("key")]
|
|
public string Key
|
|
{
|
|
get { return _key; }
|
|
set { _key = value;}
|
|
}
|
|
|
|
/// <summary>
|
|
/// See <see cref="MarkupExtension.ProvideValue" />
|
|
/// </summary>
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
var binding = new Binding("Value")
|
|
{
|
|
Source = new TranslationData(_key)
|
|
};
|
|
return binding.ProvideValue(serviceProvider);
|
|
}
|
|
}
|
|
}
|