1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Add localisation support to beatmap options popover

This commit is contained in:
Joseph Madamba 2023-09-05 18:43:42 -07:00
parent 69fa8747f0
commit 6d2e57b73e
No known key found for this signature in database
GPG Key ID: 8B746C7BDDF0BD76
2 changed files with 53 additions and 10 deletions

View File

@ -19,6 +19,46 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString LocallyModifiedTooltip => new TranslatableString(getKey(@"locally_modified_tooltip"), @"Has been locally modified");
/// <summary>
/// "General"
/// </summary>
public static LocalisableString General => new TranslatableString(getKey(@"general"), @"General");
/// <summary>
/// "Manage collections"
/// </summary>
public static LocalisableString ManageCollections => new TranslatableString(getKey(@"manage_collections"), @"Manage collections");
/// <summary>
/// "For all difficulties"
/// </summary>
public static LocalisableString ForAllDifficulties => new TranslatableString(getKey(@"for_all_difficulties"), @"For all difficulties");
/// <summary>
/// "Delete beatmap"
/// </summary>
public static LocalisableString DeleteBeatmap => new TranslatableString(getKey(@"delete_beatmap"), @"Delete beatmap");
/// <summary>
/// "For selected difficulty"
/// </summary>
public static LocalisableString ForSelectedDifficulty => new TranslatableString(getKey(@"for_selected_difficulty"), @"For selected difficulty");
/// <summary>
/// "Mark as played"
/// </summary>
public static LocalisableString MarkAsPlayed => new TranslatableString(getKey(@"mark_as_played"), @"Mark as played");
/// <summary>
/// "Clear all local scores"
/// </summary>
public static LocalisableString ClearAllLocalScores => new TranslatableString(getKey(@"clear_all_local_scores"), @"Clear all local scores");
/// <summary>
/// "Edit beatmap"
/// </summary>
public static LocalisableString EditBeatmap => new TranslatableString(getKey(@"edit_beatmap"), @"Edit beatmap");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -5,6 +5,7 @@ using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -21,6 +22,8 @@ using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
using osu.Game.Localisation;
using CommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
namespace osu.Game.Screens.Select.FooterV2
{
@ -53,20 +56,20 @@ namespace osu.Game.Screens.Select.FooterV2
beatmapWhenOpening = beatmap.Value;
addHeader("General");
addButton(@"Manage collections", FontAwesome.Solid.Book, () => manageCollectionsDialog?.Show());
addHeader(SongSelectStrings.General);
addButton(SongSelectStrings.ManageCollections, FontAwesome.Solid.Book, () => manageCollectionsDialog?.Show());
addHeader("For all difficulties", beatmapWhenOpening.BeatmapSetInfo.ToString());
addButton(@"Delete beatmap", FontAwesome.Solid.Trash, () => songSelect?.DeleteBeatmap(beatmapWhenOpening.BeatmapSetInfo), colours.Red1);
addHeader(SongSelectStrings.ForAllDifficulties, beatmapWhenOpening.BeatmapSetInfo.ToString());
addButton(SongSelectStrings.DeleteBeatmap, FontAwesome.Solid.Trash, () => songSelect?.DeleteBeatmap(beatmapWhenOpening.BeatmapSetInfo), colours.Red1);
addHeader("For selected difficulty", beatmapWhenOpening.BeatmapInfo.DifficultyName);
addHeader(SongSelectStrings.ForSelectedDifficulty, beatmapWhenOpening.BeatmapInfo.DifficultyName);
// TODO: make work, and make show "unplayed" or "played" based on status.
addButton(@"Mark as played", FontAwesome.Regular.TimesCircle, null);
addButton(@"Hide", FontAwesome.Solid.Magic, null);
addButton(@"Clear all local scores", FontAwesome.Solid.Eraser, () => songSelect?.ClearScores(beatmapWhenOpening.BeatmapInfo), colours.Red1);
addButton(SongSelectStrings.MarkAsPlayed, FontAwesome.Regular.TimesCircle, null);
addButton(CommonStrings.ButtonsHide.ToSentence(), FontAwesome.Solid.Magic, null);
addButton(SongSelectStrings.ClearAllLocalScores, FontAwesome.Solid.Eraser, () => songSelect?.ClearScores(beatmapWhenOpening.BeatmapInfo), colours.Red1);
if (songSelect != null && songSelect.AllowEditing)
addButton(@"Edit beatmap", FontAwesome.Solid.PencilAlt, () => songSelect.Edit(beatmapWhenOpening.BeatmapInfo));
addButton(SongSelectStrings.EditBeatmap, FontAwesome.Solid.PencilAlt, () => songSelect.Edit(beatmapWhenOpening.BeatmapInfo));
}
protected override void LoadComplete()
@ -81,7 +84,7 @@ namespace osu.Game.Screens.Select.FooterV2
[Resolved]
private OverlayColourProvider overlayColourProvider { get; set; } = null!;
private void addHeader(string text, string? context = null)
private void addHeader(LocalisableString text, string? context = null)
{
var textFlow = new OsuTextFlowContainer
{