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.Markup.Xaml;
using Avalonia.Markup.Xaml.MarkupExtensions;
using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings;
using Projektanker.Icons.Avalonia;
using Ryujinx.Ava.Common.Locale;
using System;
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(
"Item",
_ => LocaleManager.Instance[key],
null,
typeof(string)
);
public override object ProvideValue(IServiceProvider serviceProvider) =>
new CompiledBindingExtension(
new CompiledBindingPathBuilder()
.Property(PropertyInfo, PropertyInfoAccessorFactory.CreateInpcPropertyAccessor)
.Build()
) { Source = LocaleManager.Instance }
.ProvideValue(serviceProvider);
}
}