mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-02 23:07:25 +00:00
8474d52778
* Ava UI: Fix `string.Format` issues in Locale * LoacLanguage everytime now * Apply suggestions from code review Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * fix UpdateAndGetDynamicValue Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
30 lines
No EOL
736 B
C#
30 lines
No EOL
736 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);
|
|
}
|
|
}
|
|
} |