Allow localisation of the invite notification

This commit is contained in:
Dean Herbert 2023-10-12 17:59:08 +09:00
parent a1a9bb75b7
commit d2aa601912
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -93,6 +93,11 @@ public static class NotificationsStrings
/// </summary>
public static LocalisableString YourNameWasMentioned(string username) => new TranslatableString(getKey(@"your_name_was_mentioned"), @"Your name was mentioned in chat by '{0}'. Click to find out why!", username);
/// <summary>
/// "{0} invited you to the multiplayer match &quot;{1}&quot;! Click to join."
/// </summary>
public static LocalisableString InvitedYouToTheMultiplayer(string username, string roomName) => new TranslatableString(getKey(@"invited_you_to_the_multiplayer"), @"{0} invited you to the multiplayer match ""{1}""! Click to join.", username, roomName);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -23,6 +23,7 @@
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Utils;
using osu.Game.Localisation;
namespace osu.Game.Online.Multiplayer
{
@ -452,7 +453,7 @@ async Task IMultiplayerClient.Invited(int invitedBy, long roomID, string passwor
if (apiUser == null || apiRoom == null) return;
PostNotification?.Invoke(
new UserAvatarNotification(apiUser, $"{apiUser.Username} invited you to a multiplayer match:\"{apiRoom.Name}\"!")
new UserAvatarNotification(apiUser, NotificationsStrings.InvitedYouToTheMultiplayer(apiUser.Username, apiRoom.Name.Value))
{
Activated = () =>
{