mirror of
https://github.com/ppy/osu
synced 2024-12-29 02:12:43 +00:00
Fix language selector in first run dialog not updating after changing language in settings
This commit is contained in:
parent
19f66c806e
commit
3ec31a5f51
@ -87,18 +87,21 @@ namespace osu.Game.Overlays.FirstRunSetup
|
|||||||
});
|
});
|
||||||
|
|
||||||
frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale);
|
frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale);
|
||||||
|
frameworkLocale.BindValueChanged(_ => onLanguageChange());
|
||||||
|
|
||||||
localisationParameters = localisation.CurrentParameters.GetBoundCopy();
|
localisationParameters = localisation.CurrentParameters.GetBoundCopy();
|
||||||
localisationParameters.BindValueChanged(p =>
|
localisationParameters.BindValueChanged(_ => onLanguageChange(), true);
|
||||||
{
|
}
|
||||||
var language = LanguageExtensions.GetLanguageFor(frameworkLocale.Value, p.NewValue);
|
|
||||||
|
|
||||||
// Changing language may cause a short period of blocking the UI thread while the new glyphs are loaded.
|
private void onLanguageChange()
|
||||||
// Scheduling ensures the button animation plays smoothly after any blocking operation completes.
|
{
|
||||||
// Note that a delay is required (the alternative would be a double-schedule; delay feels better).
|
var language = LanguageExtensions.GetLanguageFor(frameworkLocale.Value, localisationParameters.Value);
|
||||||
updateSelectedDelegate?.Cancel();
|
|
||||||
updateSelectedDelegate = Scheduler.AddDelayed(() => updateSelectedStates(language), 50);
|
// Changing language may cause a short period of blocking the UI thread while the new glyphs are loaded.
|
||||||
}, true);
|
// Scheduling ensures the button animation plays smoothly after any blocking operation completes.
|
||||||
|
// Note that a delay is required (the alternative would be a double-schedule; delay feels better).
|
||||||
|
updateSelectedDelegate?.Cancel();
|
||||||
|
updateSelectedDelegate = Scheduler.AddDelayed(() => updateSelectedStates(language), 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSelectedStates(Language language)
|
private void updateSelectedStates(Language language)
|
||||||
|
Loading…
Reference in New Issue
Block a user