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

Extract "copy link" text to common localisation

This commit is contained in:
Bartłomiej Dach 2024-11-04 13:44:25 +01:00
parent 00e795cf76
commit 51f26993fa
No known key found for this signature in database
5 changed files with 17 additions and 8 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Localisation;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -77,7 +78,7 @@ namespace osu.Game.Graphics.UserInterface
if (Link != null) if (Link != null)
{ {
items.Add(new OsuMenuItem("Open", MenuItemType.Highlighted, () => game?.OpenUrlExternally(Link))); items.Add(new OsuMenuItem("Open", MenuItemType.Highlighted, () => game?.OpenUrlExternally(Link)));
items.Add(new OsuMenuItem("Copy link", MenuItemType.Standard, copyUrl)); items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, copyUrl));
} }
return items.ToArray(); return items.ToArray();

View File

@ -174,6 +174,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString General => new TranslatableString(getKey(@"general"), @"General"); public static LocalisableString General => new TranslatableString(getKey(@"general"), @"General");
/// <summary>
/// "Copy link"
/// </summary>
public static LocalisableString CopyLink => new TranslatableString(getKey(@"copy_link"), @"Copy link");
private static string getKey(string key) => $@"{prefix}:{key}"; private static string getKey(string key) => $@"{prefix}:{key}";
} }
} }

View File

@ -11,7 +11,7 @@ using osu.Game.Configuration;
using osu.Game.Localisation; using osu.Game.Localisation;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Dialog; using osu.Game.Overlays.Dialog;
using CommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings; using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
namespace osu.Game.Online.Chat namespace osu.Game.Online.Chat
{ {
@ -60,12 +60,12 @@ namespace osu.Game.Online.Chat
}, },
new PopupDialogCancelButton new PopupDialogCancelButton
{ {
Text = @"Copy link", Text = CommonStrings.CopyLink,
Action = copyExternalLinkAction Action = copyExternalLinkAction
}, },
new PopupDialogCancelButton new PopupDialogCancelButton
{ {
Text = CommonStrings.ButtonsCancel, Text = WebCommonStrings.ButtonsCancel,
}, },
}; };
} }

View File

@ -32,6 +32,8 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using CommonStrings = osu.Game.Localisation.CommonStrings;
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
namespace osu.Game.Screens.Select.Carousel namespace osu.Game.Screens.Select.Carousel
{ {
@ -296,10 +298,10 @@ namespace osu.Game.Screens.Select.Carousel
items.Add(new OsuMenuItem("Collections") { Items = collectionItems }); items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
if (beatmapInfo.GetOnlineURL(api, ruleset.Value) is string url) if (beatmapInfo.GetOnlineURL(api, ruleset.Value) is string url)
items.Add(new OsuMenuItem("Copy link", MenuItemType.Standard, () => game?.CopyUrlToClipboard(url))); items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyUrlToClipboard(url)));
if (hideRequested != null) if (hideRequested != null)
items.Add(new OsuMenuItem(CommonStrings.ButtonsHide.ToSentence(), MenuItemType.Destructive, () => hideRequested(beatmapInfo))); items.Add(new OsuMenuItem(WebCommonStrings.ButtonsHide.ToSentence(), MenuItemType.Destructive, () => hideRequested(beatmapInfo)));
return items.ToArray(); return items.ToArray();
} }

View File

@ -20,6 +20,7 @@ using osu.Game.Beatmaps;
using osu.Game.Collections; using osu.Game.Collections;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -300,7 +301,7 @@ namespace osu.Game.Screens.Select.Carousel
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested(beatmapSet))); items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested(beatmapSet)));
if (beatmapSet.GetOnlineURL(api, ruleset.Value) is string url) if (beatmapSet.GetOnlineURL(api, ruleset.Value) is string url)
items.Add(new OsuMenuItem("Copy link", MenuItemType.Standard, () => game?.CopyUrlToClipboard(url))); items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyUrlToClipboard(url)));
if (dialogOverlay != null) if (dialogOverlay != null)
items.Add(new OsuMenuItem("Delete...", MenuItemType.Destructive, () => dialogOverlay.Push(new BeatmapDeleteDialog(beatmapSet)))); items.Add(new OsuMenuItem("Delete...", MenuItemType.Destructive, () => dialogOverlay.Push(new BeatmapDeleteDialog(beatmapSet))));