Load new localization before firing change event

This commit is contained in:
Haselnussbomber 2025-09-05 02:15:48 +02:00
parent 29c4d4939f
commit f3e462eb6b
No known key found for this signature in database
GPG key ID: BB905BB49E7295D1

View file

@ -112,10 +112,12 @@ public class Localization : IServiceType
}
/// <summary>
/// Set up the UI language with "fallbacks"(original English text).
/// Set up the UI language with "fallbacks" (original English text).
/// </summary>
public void SetupWithFallbacks()
{
Loc.SetupWithFallbacks(this.assembly);
this.DalamudLanguageCultureInfo = CultureInfo.InvariantCulture;
foreach (var d in Delegate.EnumerateInvocationList(this.LocalizationChanged))
{
@ -128,8 +130,6 @@ public class Localization : IServiceType
Log.Error(ex, "Exception during raise of {handler}", d.Method);
}
}
Loc.SetupWithFallbacks(this.assembly);
}
/// <summary>
@ -144,6 +144,16 @@ public class Localization : IServiceType
return;
}
try
{
Loc.Setup(this.ReadLocData(langCode), this.assembly);
}
catch (Exception ex)
{
Log.Error(ex, "Could not load loc {0}. Setting up fallbacks.", langCode);
this.SetupWithFallbacks();
}
this.DalamudLanguageCultureInfo = GetCultureInfoFromLangCode(langCode);
foreach (var d in Delegate.EnumerateInvocationList(this.LocalizationChanged))
{
@ -156,16 +166,6 @@ public class Localization : IServiceType
Log.Error(ex, "Exception during raise of {handler}", d.Method);
}
}
try
{
Loc.Setup(this.ReadLocData(langCode), this.assembly);
}
catch (Exception ex)
{
Log.Error(ex, "Could not load loc {0}. Setting up fallbacks.", langCode);
this.SetupWithFallbacks();
}
}
/// <summary>