mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 10:05:25 +00:00
02714a1291
* Add source generator for locale keys * use locale keys in Ui subdir
30 lines
734 B
C#
30 lines
734 B
C#
using Avalonia.Data;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.Markup.Xaml.MarkupExtensions;
|
|
using System;
|
|
|
|
namespace Ryujinx.Ava.Common.Locale
|
|
{
|
|
internal class LocaleExtension : MarkupExtension
|
|
{
|
|
public LocaleExtension(LocaleKeys key)
|
|
{
|
|
Key = key;
|
|
}
|
|
|
|
public LocaleKeys Key { get; }
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
LocaleKeys keyToUse = Key;
|
|
|
|
ReflectionBindingExtension binding = new($"[{keyToUse}]")
|
|
{
|
|
Mode = BindingMode.OneWay,
|
|
Source = LocaleManager.Instance
|
|
};
|
|
|
|
return binding.ProvideValue(serviceProvider);
|
|
}
|
|
}
|
|
} |