aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Lebosquain <julien@lebosquain.net>2024-08-04 20:04:12 +0200
committerGitHub <noreply@github.com>2024-08-04 19:04:12 +0100
commite85ee673b10da5a314e68cea88caeacd2918f311 (patch)
treed7f97b7ed8fdeb7ded1315be17ffe0bae4dcb8ae
parent42f22fe5d79a2aa5866e84f4b0bcf3d2114fa62a (diff)
Fix LocaleExtension SetRawSource usages + language perf improvement (#7121)1.1.1370
* Avoid Avalonia CompiledBindingPathBuilder.SetRawSource * Improve UI language change performance
-rw-r--r--src/Ryujinx/Common/Locale/LocaleExtension.cs7
-rw-r--r--src/Ryujinx/Common/Locale/LocaleManager.cs4
2 files changed, 8 insertions, 3 deletions
diff --git a/src/Ryujinx/Common/Locale/LocaleExtension.cs b/src/Ryujinx/Common/Locale/LocaleExtension.cs
index 40661bf3..b5964aa8 100644
--- a/src/Ryujinx/Common/Locale/LocaleExtension.cs
+++ b/src/Ryujinx/Common/Locale/LocaleExtension.cs
@@ -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);
}
diff --git a/src/Ryujinx/Common/Locale/LocaleManager.cs b/src/Ryujinx/Common/Locale/LocaleManager.cs
index 257611e6..96f64876 100644
--- a/src/Ryujinx/Common/Locale/LocaleManager.cs
+++ b/src/Ryujinx/Common/Locale/LocaleManager.cs
@@ -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();
}