1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 07:43:01 +08:00

Merge branch 'master' into fix-song-select-leaderboard-events

This commit is contained in:
Dan Balasescu 2021-06-14 20:03:36 +09:00 committed by GitHub
commit 980afd6a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 45 additions and 23 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2021.614.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,17 +7,17 @@ namespace osu.Game.Localisation
{ {
public static class ChatStrings public static class ChatStrings
{ {
private const string prefix = "osu.Game.Localisation.Chat"; private const string prefix = @"osu.Game.Localisation.Chat";
/// <summary> /// <summary>
/// "chat" /// "chat"
/// </summary> /// </summary>
public static LocalisableString HeaderTitle => new TranslatableString(getKey("header_title"), "chat"); public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"chat");
/// <summary> /// <summary>
/// "join the real-time discussion" /// "join the real-time discussion"
/// </summary> /// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey("header_description"), "join the real-time discussion"); public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"join the real-time discussion");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }

View File

@ -7,12 +7,12 @@ namespace osu.Game.Localisation
{ {
public static class CommonStrings public static class CommonStrings
{ {
private const string prefix = "osu.Game.Localisation.Common"; private const string prefix = @"osu.Game.Localisation.Common";
/// <summary> /// <summary>
/// "Cancel" /// "Cancel"
/// </summary> /// </summary>
public static LocalisableString Cancel => new TranslatableString(getKey("cancel"), "Cancel"); public static LocalisableString Cancel => new TranslatableString(getKey(@"cancel"), @"Cancel");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }

View File

@ -7,10 +7,10 @@ namespace osu.Game.Localisation
{ {
public enum Language public enum Language
{ {
[Description("English")] [Description(@"English")]
en, en,
[Description("日本語")] [Description(@"日本語")]
ja ja
} }
} }

View File

@ -7,17 +7,17 @@ namespace osu.Game.Localisation
{ {
public static class NotificationsStrings public static class NotificationsStrings
{ {
private const string prefix = "osu.Game.Localisation.Notifications"; private const string prefix = @"osu.Game.Localisation.Notifications";
/// <summary> /// <summary>
/// "notifications" /// "notifications"
/// </summary> /// </summary>
public static LocalisableString HeaderTitle => new TranslatableString(getKey("header_title"), "notifications"); public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"notifications");
/// <summary> /// <summary>
/// "waiting for 'ya" /// "waiting for 'ya"
/// </summary> /// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey("header_description"), "waiting for 'ya"); public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"waiting for 'ya");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }

View File

@ -7,17 +7,17 @@ namespace osu.Game.Localisation
{ {
public static class NowPlayingStrings public static class NowPlayingStrings
{ {
private const string prefix = "osu.Game.Localisation.NowPlaying"; private const string prefix = @"osu.Game.Localisation.NowPlaying";
/// <summary> /// <summary>
/// "now playing" /// "now playing"
/// </summary> /// </summary>
public static LocalisableString HeaderTitle => new TranslatableString(getKey("header_title"), "now playing"); public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"now playing");
/// <summary> /// <summary>
/// "manage the currently playing track" /// "manage the currently playing track"
/// </summary> /// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey("header_description"), "manage the currently playing track"); public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"manage the currently playing track");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using System.Resources; using System.Resources;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -34,7 +35,29 @@ namespace osu.Game.Localisation
lock (resourceManagers) lock (resourceManagers)
{ {
if (!resourceManagers.TryGetValue(ns, out var manager)) if (!resourceManagers.TryGetValue(ns, out var manager))
resourceManagers[ns] = manager = new ResourceManager(ns, GetType().Assembly); {
var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
// Traverse backwards through periods in the namespace to find a matching assembly.
string assemblyName = ns;
while (!string.IsNullOrEmpty(assemblyName))
{
var matchingAssembly = loadedAssemblies.FirstOrDefault(asm => asm.GetName().Name == assemblyName);
if (matchingAssembly != null)
{
resourceManagers[ns] = manager = new ResourceManager(ns, matchingAssembly);
break;
}
int lastIndex = Math.Max(0, assemblyName.LastIndexOf('.'));
assemblyName = assemblyName.Substring(0, lastIndex);
}
}
if (manager == null)
return null;
try try
{ {

View File

@ -7,17 +7,17 @@ namespace osu.Game.Localisation
{ {
public static class SettingsStrings public static class SettingsStrings
{ {
private const string prefix = "osu.Game.Localisation.Settings"; private const string prefix = @"osu.Game.Localisation.Settings";
/// <summary> /// <summary>
/// "settings" /// "settings"
/// </summary> /// </summary>
public static LocalisableString HeaderTitle => new TranslatableString(getKey("header_title"), "settings"); public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"settings");
/// <summary> /// <summary>
/// "change the way osu! behaves" /// "change the way osu! behaves"
/// </summary> /// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey("header_description"), "change the way osu! behaves"); public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"change the way osu! behaves");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }

View File

@ -4,7 +4,6 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Testing.Input; using osu.Framework.Testing.Input;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -49,7 +48,7 @@ namespace osu.Game.Tests.Visual
InputManager = new ManualInputManager InputManager = new ManualInputManager
{ {
UseParentInput = true, UseParentInput = true,
Child = new PlatformActionContainer().WithChild(mainContent) Child = mainContent
}, },
new Container new Container
{ {

View File

@ -34,7 +34,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="ppy.osu.Framework" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.614.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" />
<PackageReference Include="Sentry" Version="3.4.0" /> <PackageReference Include="Sentry" Version="3.4.0" />
<PackageReference Include="SharpCompress" Version="0.28.2" /> <PackageReference Include="SharpCompress" Version="0.28.2" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2021.614.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.611.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -93,7 +93,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2021.611.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.614.0" />
<PackageReference Include="SharpCompress" Version="0.28.2" /> <PackageReference Include="SharpCompress" Version="0.28.2" />
<PackageReference Include="NUnit" Version="3.13.2" /> <PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />