1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 19:54:15 +08:00

Add already existing localisation support from CommonStrings (#37401)

decided to do this mostly because of the non-localised `BackButton` that
was bothering my eyes

changes can be reviewed commit by commit
This commit is contained in:
Denis Titovets
2026-05-06 18:07:28 +03:00
committed by GitHub
Unverified
parent 27f6e94bf0
commit b8729cb7fd
7 changed files with 22 additions and 10 deletions
@@ -3,8 +3,10 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Localisation;
using osu.Game.Screens.Footer;
namespace osu.Game.Graphics.UserInterface
@@ -24,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Text = @"back",
Text = CommonStrings.Back.ToLower(),
Icon = OsuIcon.LeftCircle,
Action = () => Action?.Invoke()
};
@@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Localisation;
using osu.Game.Online;
using osuTK;
@@ -49,19 +50,19 @@ namespace osu.Game.Graphics.UserInterface
Background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
Icon.MoveToX(0, 500, Easing.InOutExpo);
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
TooltipText = "Download";
TooltipText = CommonStrings.Download;
break;
case DownloadState.Downloading:
Background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
Icon.MoveToX(0, 500, Easing.InOutExpo);
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
TooltipText = "Downloading...";
TooltipText = CommonStrings.Downloading;
break;
case DownloadState.Importing:
Background.FadeColour(colours.Yellow, 500, Easing.InOutExpo);
TooltipText = "Importing";
TooltipText = CommonStrings.Importing;
break;
case DownloadState.LocallyAvailable:
@@ -10,6 +10,7 @@ using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@@ -161,7 +162,7 @@ namespace osu.Game.Graphics.UserInterface
set => bouncingIcon.Icon = value;
}
public string Text
public LocalisableString Text
{
set => text.Text = value;
}
+5
View File
@@ -59,6 +59,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString Height => new TranslatableString(getKey(@"height"), @"Height");
/// <summary>
/// "Download"
/// </summary>
public static LocalisableString Download => new TranslatableString(getKey(@"download"), @"Download");
/// <summary>
/// "Downloading..."
/// </summary>
@@ -605,7 +605,7 @@ namespace osu.Game.Screens.OnlinePlay
List<MenuItem> items = new List<MenuItem>();
if (beatmapOverlay != null)
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID)));
items.Add(new OsuMenuItem(CommonStrings.Details, MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID)));
if (beatmap != null)
{
@@ -617,9 +617,9 @@ namespace osu.Game.Screens.OnlinePlay
.Select(c => new CollectionToggleMenuItem(c.ToLive(realm), beatmap)).Cast<OsuMenuItem>().ToList();
if (manageCollectionsDialog != null)
collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show));
collectionItems.Add(new OsuMenuItem(CommonStrings.Manage, MenuItemType.Standard, manageCollectionsDialog.Show));
items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
items.Add(new OsuMenuItem(CommonStrings.Collections) { Items = collectionItems });
}
}
@@ -13,6 +13,7 @@ using osu.Framework.Screens;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
@@ -49,7 +50,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay
Spacing = new Vector2(3),
};
addButton(rankedPlayScreen?.ActiveSubScreen is not EndedScreen ? "Give up" : "Exit", FontAwesome.Solid.SignOutAlt, () => rankedPlayScreen?.Exit());
addButton(rankedPlayScreen?.ActiveSubScreen is not EndedScreen ? "Give up" : CommonStrings.Exit, FontAwesome.Solid.SignOutAlt, () => rankedPlayScreen?.Exit());
}
protected override void LoadComplete()
+3 -1
View File
@@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
@@ -15,6 +16,7 @@ using osu.Game.Collections;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osuTK;
using Realms;
@@ -41,7 +43,7 @@ namespace osu.Game.Screens.Ranking
Size = new Vector2(75, 30);
TooltipText = "collections";
TooltipText = CommonStrings.Collections.ToLower();
}
[BackgroundDependencyLoader]