Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions osu.Game.Tournament/osu.Game.Tournament.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="ppy.LocalisationAnalyser" Version="2025.1208.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
25 changes: 0 additions & 25 deletions osu.Game/OsuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
using osu.Game.Collections;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
Expand Down Expand Up @@ -1053,30 +1052,6 @@ protected override void LoadComplete()
{
base.LoadComplete();

var languages = Enum.GetValues<Language>();

var mappings = languages.Select(language =>
{
#if DEBUG
if (language == Language.debug)
return new LocaleMapping("debug", new DebugLocalisationStore());
#endif

string cultureCode = language.ToCultureCode();

try
{
return new LocaleMapping(new ResourceManagerLocalisationStore(cultureCode));
}
catch (Exception ex)
{
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
// in the cursor being shown for a few frames during the intro.
// This prevents the cursor from showing until we have a screen with CursorVisible = true
Expand Down
31 changes: 31 additions & 0 deletions osu.Game/OsuGameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,29 @@ public virtual string Version

private IBindable<LocalisationParameters> localisationParameters = null!;

/// <summary>
/// All available locale mappings for l10n initialisation.
/// </summary>
private static IEnumerable<LocaleMapping> localisationMappings => Enum.GetValues<Language>().Select(language =>
{
#if DEBUG
if (language == Language.debug)
return new LocaleMapping("debug", new DebugLocalisationStore());
#endif

string cultureCode = language.ToCultureCode();

try
{
return new LocaleMapping(new ResourceManagerLocalisationStore(cultureCode));
}
catch (Exception ex)
{
Logger.Error(ex, $"Could not load localisations for language \"{cultureCode}\"");
return null;
}
}).Where(m => m != null);

/// <summary>
/// Number of unhandled exceptions to allow before aborting execution.
/// </summary>
Expand Down Expand Up @@ -306,6 +329,7 @@ private void load(ReadableKeyCombinationProvider keyCombinationProvider, Framewo

MessageFormatter.WebsiteRootUrl = endpoints.WebsiteUrl;

// Initialise localisation
frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale);
frameworkLocale.BindValueChanged(_ => updateLanguage());

Expand Down Expand Up @@ -501,6 +525,13 @@ protected virtual void InitialiseFonts()
Fonts.AddStore(new OsuIcon.OsuIconStore(Textures));
}

protected override void LoadComplete()
{
base.LoadComplete();

Localisation.AddLocaleMappings(localisationMappings);
}

protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));

Expand Down