1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-31 08:57:19 +08:00

Add localisation

This commit is contained in:
Dan Balasescu 2024-11-22 21:04:57 +09:00
parent 82a63228de
commit 5ebaab7e9a
No known key found for this signature in database
2 changed files with 38 additions and 3 deletions

View File

@ -0,0 +1,34 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
namespace osu.Game.Localisation
{
public static class RoomStatusPillStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.RoomStatusPill";
/// <summary>
/// "Ended"
/// </summary>
public static LocalisableString Ended => new TranslatableString(getKey(@"ended"), @"Ended");
/// <summary>
/// "Playing"
/// </summary>
public static LocalisableString Playing => new TranslatableString(getKey(@"playing"), @"Playing");
/// <summary>
/// "Open (Private)"
/// </summary>
public static LocalisableString OpenPrivate => new TranslatableString(getKey(@"open_private"), @"Open (Private)");
/// <summary>
/// "Open"
/// </summary>
public static LocalisableString Open => new TranslatableString(getKey(@"open"), @"Open");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Online.Rooms;
using osu.Game.Localisation;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
@ -59,17 +60,17 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
Pill.Background.FadeColour(colours.ForRoomStatus(room), 100);
if (DateTimeOffset.Now >= room.EndDate)
TextFlow.Text = "Ended";
TextFlow.Text = RoomStatusPillStrings.Ended;
else
{
switch (room.Status)
{
case RoomStatus.Playing:
TextFlow.Text = "Playing";
TextFlow.Text = RoomStatusPillStrings.Playing;
break;
default:
TextFlow.Text = room.HasPassword ? "Open (Private)" : "Open";
TextFlow.Text = room.HasPassword ? RoomStatusPillStrings.OpenPrivate : RoomStatusPillStrings.Open;
break;
}
}