Fix LocaleExtension SetRawSource usages + language perf improvement (#7121)

* Avoid Avalonia CompiledBindingPathBuilder.SetRawSource

* Improve UI language change performance
This commit is contained in:
Julien Lebosquain 2024-08-04 20:04:12 +02:00 committed by GitHub
parent 42f22fe5d7
commit e85ee673b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -21,7 +21,7 @@ namespace Ryujinx.Ava.Common.Locale
var builder = new CompiledBindingPathBuilder();
builder.SetRawSource(LocaleManager.Instance)
builder
.Property(new ClrPropertyInfo("Item",
obj => (LocaleManager.Instance[keyToUse]),
null,
@ -32,7 +32,10 @@ namespace Ryujinx.Ava.Common.Locale
var path = builder.Build();
var binding = new CompiledBindingExtension(path);
var binding = new CompiledBindingExtension(path)
{
Source = LocaleManager.Instance
};
return binding.ProvideValue(serviceProvider);
}

View file

@ -139,9 +139,11 @@ namespace Ryujinx.Ava.Common.Locale
foreach (var item in locale)
{
this[item.Key] = item.Value;
_localeStrings[item.Key] = item.Value;
}
OnPropertyChanged("Item");
LocaleChanged?.Invoke();
}