Skip to content

Commit

Permalink
Fix LocaleExtension SetRawSource usages + language perf improvement (…
Browse files Browse the repository at this point in the history
…#7121)

* Avoid Avalonia CompiledBindingPathBuilder.SetRawSource

* Improve UI language change performance
  • Loading branch information
MrJul authored Aug 4, 2024
1 parent 42f22fe commit e85ee67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Ryujinx/Common/Locale/LocaleExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override object ProvideValue(IServiceProvider serviceProvider)

var builder = new CompiledBindingPathBuilder();

builder.SetRawSource(LocaleManager.Instance)
builder
.Property(new ClrPropertyInfo("Item",
obj => (LocaleManager.Instance[keyToUse]),
null,
Expand All @@ -32,7 +32,10 @@ public override object ProvideValue(IServiceProvider serviceProvider)

var path = builder.Build();

var binding = new CompiledBindingExtension(path);
var binding = new CompiledBindingExtension(path)
{
Source = LocaleManager.Instance
};

return binding.ProvideValue(serviceProvider);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Ryujinx/Common/Locale/LocaleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ public void LoadLanguage(string languageCode)

foreach (var item in locale)
{
this[item.Key] = item.Value;
_localeStrings[item.Key] = item.Value;
}

OnPropertyChanged("Item");

LocaleChanged?.Invoke();
}

Expand Down

0 comments on commit e85ee67

Please sign in to comment.