0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-22 23:55:47 +00:00

hotfix: Locale formatting

This commit is contained in:
Evan Husted 2024-11-01 16:17:08 -05:00
parent 4a677deb50
commit 04f014c777

View file

@ -1,6 +1,10 @@
using Avalonia.Data.Core; using Avalonia.Data.Core;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.MarkupExtensions;
using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings;
using Projektanker.Icons.Avalonia; using Projektanker.Icons.Avalonia;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using System;
namespace Ryujinx.Ava.Common.Markup namespace Ryujinx.Ava.Common.Markup
{ {
@ -26,14 +30,22 @@ namespace Ryujinx.Ava.Common.Markup
); );
} }
internal class LocaleExtension(LocaleKeys key) : BasicMarkupExtension internal class LocaleExtension(LocaleKeys key) : MarkupExtension
{ {
protected override ClrPropertyInfo PropertyInfo private ClrPropertyInfo PropertyInfo
=> new( => new(
"Item", "Item",
_ => LocaleManager.Instance[key], _ => LocaleManager.Instance[key],
null, null,
typeof(string) typeof(string)
); );
public override object ProvideValue(IServiceProvider serviceProvider) =>
new CompiledBindingExtension(
new CompiledBindingPathBuilder()
.Property(PropertyInfo, PropertyInfoAccessorFactory.CreateInpcPropertyAccessor)
.Build()
) { Source = LocaleManager.Instance }
.ProvideValue(serviceProvider);
} }
} }