1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 20:33:35 +08:00

Localise some more PopupDialogs (#36890)

changes can be reviewed commit by commit

---------

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Denis Titovets
2026-03-10 10:28:27 +03:00
committed by GitHub
Unverified
parent 054ae2983d
commit 1b488949e1
20 changed files with 191 additions and 45 deletions
@@ -93,6 +93,11 @@ Your experience will not be perfect, and may even feel subpar compared to games
Please bear with us as we continue to improve the game for you!");
/// <summary>
/// "Understood"
/// </summary>
public static LocalisableString MobileDisclaimerOkButton => new TranslatableString(getKey(@"mobile_disclaimer_ok_button"), @"Understood");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
+96
View File
@@ -49,6 +49,102 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString StableDirectoryLocationCancelButton => new TranslatableString(getKey(@"stable_directory_location_cancel_button"), @"Actually I don't have osu!stable installed.");
/// <summary>
/// "All local scores on {0}"
/// </summary>
public static LocalisableString BeatmapClearScoresBodyText(string difficulty) => new TranslatableString(getKey(@"beatmap_clear_scores_body_text"), @"All local scores on {0}", difficulty);
/// <summary>
/// "Are you sure you want to close the following playlist:"
/// </summary>
public static LocalisableString ClosePlaylistHeaderText => new TranslatableString(getKey(@"close_playlist_header_text"), @"Are you sure you want to close the following playlist:");
/// <summary>
/// "Are you sure you want to abort the match?"
/// </summary>
public static LocalisableString ConfirmAbortMatchHeaderText => new TranslatableString(getKey(@"confirm_abort_match_header_text"), @"Are you sure you want to abort the match?");
/// <summary>
/// "Are you sure you want to exit osu!?"
/// </summary>
public static LocalisableString ConfirmExitHeaderText => new TranslatableString(getKey(@"confirm_exit_header_text"), @"Are you sure you want to exit osu!?");
/// <summary>
/// "Last chance to turn back"
/// </summary>
public static LocalisableString ConfirmDialogBodyText => new TranslatableString(getKey(@"confirm_exit_body_text"), @"Last chance to turn back");
/// <summary>
/// "There are currently some background operations which will be aborted if you continue:
///
/// {0}"
/// </summary>
public static LocalisableString ConfirmExitBodyTextOngoingOperations(string ongoingOperationsText) => new TranslatableString(getKey(@"confirm_exit_body_text_ongoing_operations"), @"There are currently some background operations which will be aborted if you continue:
{0}", ongoingOperationsText);
/// <summary>
/// "There are currently some background operations which will be aborted if you continue:
///
/// {0}
///
/// and {1} other operation(s)."
/// </summary>
public static LocalisableString ConfirmExitBodyTextOtherOngoingOperations(string ongoingOperationsText, int count) => new TranslatableString(getKey(@"confirm_exit_body_text_other_ongoing_operations"), @"There are currently some background operations which will be aborted if you continue:
{0}
and {1} other operation(s).", ongoingOperationsText, count);
/// <summary>
/// "Let me out!"
/// </summary>
public static LocalisableString ConfirmExitOkButton => new TranslatableString(getKey(@"confirm_exit_ok_button"), @"Let me out!");
/// <summary>
/// "Just a little more..."
/// </summary>
public static LocalisableString ConfirmExitCancelButton => new TranslatableString(getKey(@"confirm_exit_cancel_button"), @"Just a little more...");
/// <summary>
/// "Are you sure you want to go back?"
/// </summary>
public static LocalisableString ConfirmDiscardChangesHeaderText => new TranslatableString(getKey(@"confirm_discard_changes_header_text"), @"Are you sure you want to go back?");
/// <summary>
/// "This will discard any unsaved changes"
/// </summary>
public static LocalisableString ConfirmDiscardChangesBodyText => new TranslatableString(getKey(@"confirm_discard_changes_body_text"), @"This will discard any unsaved changes");
/// <summary>
/// "No I didn't mean to"
/// </summary>
public static LocalisableString ConfirmDiscardChangesCancelButton => new TranslatableString(getKey(@"confirm_discard_changes_cancel_button"), @"No I didn't mean to");
/// <summary>
/// "Are you sure you want to open the following link in a web browser?
///
/// {0}"
/// </summary>
public static LocalisableString ExternalLinkBodyText(string url) => new TranslatableString(getKey(@"external_link_body_text"), @"Are you sure you want to open the following link in a web browser?
{0}", url);
/// <summary>
/// "Open in browser"
/// </summary>
public static LocalisableString ExternalLinkOkButton => new TranslatableString(getKey(@"external_link_ok_button"), @"Open in browser");
/// <summary>
/// "Do you really want to delete your comment?"
/// </summary>
public static LocalisableString DeleteCommentBodyText => new TranslatableString(getKey(@"delete_comment_body_text"), @"Do you really want to delete your comment?");
/// <summary>
/// "Are you sure you want to leave this multiplayer match?"
/// </summary>
public static LocalisableString ConfirmExitMultiplayerMatchBodyText => new TranslatableString(getKey(@"confirm_exit_multiplayer_match_body_text"), @"Are you sure you want to leave this multiplayer match?");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
@@ -59,6 +59,26 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString DiscardUnsavedChangesDialogHeader => new TranslatableString(getKey(@"discard_unsaved_changes_dialog_header"), @"Discard all unsaved changes? This cannot be undone.");
/// <summary>
/// "The beatmap will be saved to continue with this operation."
/// </summary>
public static LocalisableString SaveRequiredDialogHeader => new TranslatableString(getKey(@"save_required_dialog_header"), @"The beatmap will be saved to continue with this operation.");
/// <summary>
/// "Sounds good, let&#39;s go!"
/// </summary>
public static LocalisableString SoundsGood => new TranslatableString(getKey(@"sounds_good"), @"Sounds good, let's go!");
/// <summary>
/// "Difficulty &quot;{0}&quot; with {1} objects"
/// </summary>
public static LocalisableString DeleteDifficultyDetails(string difficultyName, int objectCount) => new TranslatableString(getKey(@"delete_difficulty_details"), @"Difficulty ""{0}"" with {1} objects", difficultyName, objectCount);
/// <summary>
/// "All Bookmarks"
/// </summary>
public static LocalisableString AllBookmarks => new TranslatableString(getKey(@"all_bookmarks"), @"All Bookmarks");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
+2 -2
View File
@@ -98,7 +98,7 @@ namespace osu.Game.Online.Chat
public ExternalLinkDialog(string url, Action openExternalLinkAction, Action copyExternalLinkAction)
{
HeaderText = DialogStrings.CautionHeaderText;
BodyText = $"Are you sure you want to open the following link in a web browser?\n\n{url}";
BodyText = DialogStrings.ExternalLinkBodyText(url);
Icon = FontAwesome.Solid.ExclamationTriangle;
@@ -106,7 +106,7 @@ namespace osu.Game.Online.Chat
{
new PopupDialogOkButton
{
Text = @"Open in browser",
Text = DialogStrings.ExternalLinkOkButton,
Action = openExternalLinkAction
},
new PopupDialogCancelButton
@@ -21,11 +21,12 @@ using System.Diagnostics;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Logging;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Comments.Buttons;
using osu.Game.Overlays.Dialog;
using osu.Game.Resources.Localisation.Web;
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
namespace osu.Game.Overlays.Comments
{
@@ -324,13 +325,13 @@ namespace osu.Game.Overlays.Comments
if (WasDeleted)
makeDeleted();
actionsContainer.AddLink(CommonStrings.ButtonsPermalink, () => game?.CopyToClipboard($@"{api.Endpoints.APIUrl}/comments/{Comment.Id}"));
actionsContainer.AddLink(WebCommonStrings.ButtonsPermalink, () => game?.CopyToClipboard($@"{api.Endpoints.APIUrl}/comments/{Comment.Id}"));
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
actionsContainer.AddLink(CommonStrings.ButtonsReply.ToLower(), toggleReply);
actionsContainer.AddLink(WebCommonStrings.ButtonsReply.ToLower(), toggleReply);
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
if (Comment.UserId.HasValue && Comment.UserId.Value == api.LocalUser.Value.Id)
actionsContainer.AddLink(CommonStrings.ButtonsDelete.ToLower(), deleteComment);
actionsContainer.AddLink(WebCommonStrings.ButtonsDelete.ToLower(), deleteComment);
else
actionsContainer.AddArbitraryDrawable(new CommentReportButton(Comment));
@@ -384,7 +385,7 @@ namespace osu.Game.Overlays.Comments
if (dialogOverlay == null)
deleteCommentRequest();
else
dialogOverlay.Push(new ConfirmDialog("Do you really want to delete your comment?", deleteCommentRequest));
dialogOverlay.Push(new ConfirmDialog(DialogStrings.DeleteCommentBodyText, deleteCommentRequest));
}
/// <summary>
+5 -4
View File
@@ -6,7 +6,8 @@
using System;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Localisation;
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
namespace osu.Game.Overlays.Dialog
{
@@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Dialog
public ConfirmDialog(LocalisableString message, Action onConfirm, Action onCancel = null)
{
HeaderText = message;
BodyText = "Last chance to turn back";
BodyText = DialogStrings.ConfirmDialogBodyText;
Icon = FontAwesome.Solid.ExclamationTriangle;
@@ -32,12 +33,12 @@ namespace osu.Game.Overlays.Dialog
{
new PopupDialogOkButton
{
Text = @"Yes",
Text = DialogStrings.Confirm,
Action = onConfirm
},
new PopupDialogCancelButton
{
Text = CommonStrings.ButtonsCancel,
Text = WebCommonStrings.ButtonsCancel,
Action = onCancel
},
};
+2 -2
View File
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Edit
@@ -13,7 +14,7 @@ namespace osu.Game.Screens.Edit
public BookmarkResetDialog(EditorBeatmap editorBeatmap)
{
editor = editorBeatmap;
BodyText = "All Bookmarks";
BodyText = EditorDialogsStrings.AllBookmarks;
}
[BackgroundDependencyLoader]
@@ -23,4 +24,3 @@ namespace osu.Game.Screens.Edit
}
}
}
@@ -2,16 +2,16 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Beatmaps;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Edit
{
public partial class DeleteDifficultyConfirmationDialog : DeletionDialog
{
public DeleteDifficultyConfirmationDialog(BeatmapInfo beatmapInfo, Action deleteAction)
public DeleteDifficultyConfirmationDialog(string difficultyName, int objectCount, Action deleteAction)
{
BodyText = $"\"{beatmapInfo.DifficultyName}\" difficulty";
BodyText = EditorDialogsStrings.DeleteDifficultyDetails(difficultyName, objectCount);
DangerousAction = deleteAction;
}
}
+1 -1
View File
@@ -1425,7 +1425,7 @@ namespace osu.Game.Screens.Edit
if (dialogOverlay == null)
delete();
else
dialogOverlay.Push(new DeleteDifficultyConfirmationDialog(Beatmap.Value.BeatmapInfo, delete));
dialogOverlay.Push(new DeleteDifficultyConfirmationDialog(playableBeatmap.BeatmapInfo.DifficultyName, editorBeatmap.HitObjects.Count, delete));
void delete()
{
@@ -3,6 +3,7 @@
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Edit
@@ -11,7 +12,7 @@ namespace osu.Game.Screens.Edit
{
public SaveRequiredPopupDialog(Action saveAndAction)
{
HeaderText = "The beatmap will be saved to continue with this operation.";
HeaderText = EditorDialogsStrings.SaveRequiredDialogHeader;
Icon = FontAwesome.Regular.Save;
@@ -19,12 +20,12 @@ namespace osu.Game.Screens.Edit
{
new PopupDialogOkButton
{
Text = "Sounds good, let's go!",
Text = EditorDialogsStrings.SoundsGood,
Action = saveAndAction
},
new PopupDialogCancelButton
{
Text = "Oops, continue editing",
Text = EditorDialogsStrings.ContinueEditing,
},
};
}
@@ -3,6 +3,7 @@
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Menu
@@ -16,8 +17,8 @@ namespace osu.Game.Screens.Menu
/// <param name="onCancel">An optional action to perform on cancel.</param>
public ConfirmDiscardChangesDialog(Action onConfirm, Action? onCancel = null)
{
HeaderText = "Are you sure you want to go back?";
BodyText = "This will discard any unsaved changes";
HeaderText = DialogStrings.ConfirmDiscardChangesHeaderText;
BodyText = DialogStrings.ConfirmDiscardChangesBodyText;
Icon = FontAwesome.Solid.ExclamationTriangle;
@@ -25,12 +26,12 @@ namespace osu.Game.Screens.Menu
{
new PopupDialogDangerousButton
{
Text = @"Yes",
Text = DialogStrings.Confirm,
Action = onConfirm
},
new PopupDialogCancelButton
{
Text = @"No I didn't mean to",
Text = DialogStrings.ConfirmDiscardChangesCancelButton,
Action = onCancel
},
};
+12 -13
View File
@@ -5,6 +5,7 @@ using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
@@ -30,31 +31,29 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader]
private void load(INotificationOverlay notifications)
{
HeaderText = "Are you sure you want to exit osu!?";
HeaderText = DialogStrings.ConfirmExitHeaderText;
Icon = FontAwesome.Solid.ExclamationTriangle;
if (notifications.HasOngoingOperations)
{
string text = "There are currently some background operations which will be aborted if you continue:\n\n";
var ongoingOperations = notifications.OngoingOperations.ToArray();
string ongoingOperationsText = ongoingOperations.Take(10).Aggregate(string.Empty, (current, n) => current + $"{n.Text} ({n.Progress:0%})\n");
foreach (var n in ongoingOperations.Take(10))
text += $"{n.Text} ({n.Progress:0%})\n";
LocalisableString ongoingOperationsLocalisableString;
if (ongoingOperations.Length > 10)
text += $"\nand {ongoingOperations.Length - 10} other operation(s).\n";
ongoingOperationsLocalisableString = DialogStrings.ConfirmExitBodyTextOtherOngoingOperations(ongoingOperationsText, ongoingOperations.Length - 10);
else
ongoingOperationsLocalisableString = DialogStrings.ConfirmExitBodyTextOngoingOperations(ongoingOperationsText);
text += "\nLast chance to turn back";
BodyText = text;
BodyText = LocalisableString.Interpolate($"{ongoingOperationsLocalisableString}\n\n{DialogStrings.ConfirmDialogBodyText}");
Buttons = new PopupDialogButton[]
{
new PopupDialogDangerousButton
{
Text = @"Let me out!",
Text = DialogStrings.ConfirmExitOkButton,
Action = onConfirm
},
new PopupDialogCancelButton
@@ -66,18 +65,18 @@ namespace osu.Game.Screens.Menu
}
else
{
BodyText = "Last chance to turn back";
BodyText = DialogStrings.ConfirmDialogBodyText;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Let me out!",
Text = DialogStrings.ConfirmExitOkButton,
Action = onConfirm
},
new PopupDialogCancelButton
{
Text = @"Just a little more...",
Text = DialogStrings.ConfirmExitCancelButton,
Action = onCancel
},
};
+1 -1
View File
@@ -501,7 +501,7 @@ namespace osu.Game.Screens.Menu
{
new PopupDialogOkButton
{
Text = "Understood",
Text = ButtonSystemStrings.MobileDisclaimerOkButton,
Action = confirmed,
},
};
@@ -0,0 +1,17 @@
// 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 System;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.OnlinePlay.Components
{
public partial class ConfirmExitMultiplayerMatchDialog : ConfirmDialog
{
public ConfirmExitMultiplayerMatchDialog(Action onConfirm)
: base(DialogStrings.ConfirmExitMultiplayerMatchBodyText, onConfirm)
{
}
}
}
@@ -30,6 +30,7 @@ using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
using osu.Game.Rulesets;
using osu.Game.Screens.Footer;
using osu.Game.Screens.OnlinePlay.Components;
using osu.Game.Screens.OnlinePlay.Matchmaking.Match.Gameplay;
using osu.Game.Screens.OnlinePlay.Multiplayer;
using osu.Game.Users;
@@ -378,7 +379,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match
confirmDialog.PerformOkAction();
else
{
dialogOverlay.Push(new ConfirmDialog("Are you sure you want to leave this multiplayer match?", () =>
dialogOverlay.Push(new ConfirmExitMultiplayerMatchDialog(() =>
{
exitConfirmed = true;
if (this.IsCurrentScreen())
@@ -29,6 +29,7 @@ using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
using osu.Game.Overlays.Volume;
using osu.Game.Rulesets;
using osu.Game.Screens.OnlinePlay.Components;
using osu.Game.Screens.OnlinePlay.Matchmaking.Match;
using osu.Game.Screens.OnlinePlay.Matchmaking.Match.Gameplay;
using osu.Game.Screens.OnlinePlay.Matchmaking.Queue;
@@ -455,7 +456,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay
confirmDialog.PerformOkAction();
else
{
dialogOverlay.Push(new ConfirmDialog("Are you sure you want to leave this multiplayer match?", () =>
dialogOverlay.Push(new ConfirmExitMultiplayerMatchDialog(() =>
{
exitConfirmed = true;
if (this.IsCurrentScreen())
@@ -12,6 +12,7 @@ using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Threading;
using osu.Game.Localisation;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.Countdown;
using osu.Game.Overlays;
@@ -259,7 +260,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
{
public ConfirmAbortDialog(Action abortMatch, Action cancel)
{
HeaderText = "Are you sure you want to abort the match?";
HeaderText = DialogStrings.ConfirmAbortMatchHeaderText;
DangerousAction = abortMatch;
CancelAction = cancel;
@@ -878,7 +878,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
confirmDialog.PerformOkAction();
else
{
dialogOverlay.Push(new ConfirmDialog("Are you sure you want to leave this multiplayer match?", () =>
dialogOverlay.Push(new ConfirmExitMultiplayerMatchDialog(() =>
{
ExitConfirmed = true;
this.Exit();
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Localisation;
using osu.Game.Online.Rooms;
using osu.Game.Overlays.Dialog;
@@ -11,7 +12,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
{
public ClosePlaylistDialog(Room room, Action closeAction)
{
HeaderText = "Are you sure you want to close the following playlist:";
HeaderText = DialogStrings.ClosePlaylistHeaderText;
BodyText = room.Name;
DangerousAction = closeAction;
}
@@ -5,19 +5,20 @@ using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
namespace osu.Game.Screens.Select
{
public partial class BeatmapClearScoresDialog : DangerousActionDialog
public partial class BeatmapClearScoresDialog : DeletionDialog
{
[Resolved]
private ScoreManager scoreManager { get; set; } = null!;
public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action? onCompletion = null)
{
BodyText = $"All local scores on {beatmapInfo.GetDisplayTitle()}";
BodyText = DialogStrings.BeatmapClearScoresBodyText(beatmapInfo.GetDisplayTitle());
DangerousAction = () =>
{
Task.Run(() => scoreManager.Delete(beatmapInfo))