mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Update language initialisation in line with framework LocalisationManager
changes
This commit is contained in:
@ -24,6 +24,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
@ -686,27 +687,29 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
foreach (var language in Enum.GetValues(typeof(Language)).OfType<Language>())
|
var languages = Enum.GetValues(typeof(Language)).OfType<Language>();
|
||||||
|
|
||||||
|
var mappings = languages.Select(language =>
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (language == Language.debug)
|
if (language == Language.debug)
|
||||||
{
|
return new LocaleMapping("debug", new DebugLocalisationStore());
|
||||||
Localisation.AddLanguage(Language.debug.ToString(), new DebugLocalisationStore());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
string cultureCode = language.ToCultureCode();
|
string cultureCode = language.ToCultureCode();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Localisation.AddLanguage(cultureCode, new ResourceManagerLocalisationStore(cultureCode));
|
return new LocaleMapping(new ResourceManagerLocalisationStore(cultureCode));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Error(ex, $"Could not load localisations for language \"{cultureCode}\"");
|
Logger.Error(ex, $"Could not load localisations for language \"{cultureCode}\"");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}).Where(m => m != null);
|
||||||
|
|
||||||
|
Localisation.AddLocaleMappings(mappings);
|
||||||
|
|
||||||
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
||||||
// in the cursor being shown for a few frames during the intro.
|
// in the cursor being shown for a few frames during the intro.
|
||||||
|
Reference in New Issue
Block a user