mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 01:55:27 +00:00
30 lines
720 B
C#
30 lines
720 B
C#
|
using Avalonia.Data;
|
|||
|
using Avalonia.Markup.Xaml;
|
|||
|
using Avalonia.Markup.Xaml.MarkupExtensions;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace Ryujinx.Ava.Common.Locale
|
|||
|
{
|
|||
|
public class LocaleExtension : MarkupExtension
|
|||
|
{
|
|||
|
public LocaleExtension(string key)
|
|||
|
{
|
|||
|
Key = key;
|
|||
|
}
|
|||
|
|
|||
|
public string Key { get; }
|
|||
|
|
|||
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|||
|
{
|
|||
|
string keyToUse = Key;
|
|||
|
|
|||
|
ReflectionBindingExtension binding = new($"[{keyToUse}]")
|
|||
|
{
|
|||
|
Mode = BindingMode.OneWay,
|
|||
|
Source = LocaleManager.Instance
|
|||
|
};
|
|||
|
|
|||
|
return binding.ProvideValue(serviceProvider);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|