Skip to content

Commit

Permalink
hotfix: Locale formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Nov 1, 2024
1 parent 4a677de commit 04f014c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Ryujinx/Common/Markup/MarkupExtensions.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -26,14 +30,22 @@ protected override ClrPropertyInfo PropertyInfo
);
}

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);
}
}

0 comments on commit 04f014c

Please sign in to comment.