diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index 141309b174..68bb78abbd 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -227,7 +227,7 @@ namespace OpenRA /// Functionality mirrors , except instead of using /// loaded 's fluent bundle as backup, we use this 's. /// - public string GetLocalisedString(string key, object[] args = null) + public string GetString(string key, object[] args = null) { // PERF: instead of loading mod level strings per each MapPreview, reuse the already loaded one in FluentProvider. if (FluentProvider.TryGetModString(key, out var message, args)) diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 2df8b81627..419d1a3fe3 100644 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -65,13 +65,13 @@ namespace OpenRA.Network var yaml = MiniYaml.FromString(order.TargetString, order.OrderString); foreach (var node in yaml) { - var localizedMessage = new FluentMessage(node.Value); - if (localizedMessage.Key == Joined) - TextNotificationsManager.AddPlayerJoinedLine(localizedMessage.Key, localizedMessage.Arguments); - else if (localizedMessage.Key == Left) - TextNotificationsManager.AddPlayerLeftLine(localizedMessage.Key, localizedMessage.Arguments); + var message = new FluentMessage(node.Value); + if (message.Key == Joined) + TextNotificationsManager.AddPlayerJoinedLine(message.Key, message.Arguments); + else if (message.Key == Left) + TextNotificationsManager.AddPlayerLeftLine(message.Key, message.Arguments); else - TextNotificationsManager.AddSystemLine(localizedMessage.Key, localizedMessage.Arguments); + TextNotificationsManager.AddSystemLine(message.Key, message.Arguments); } break; diff --git a/OpenRA.Game/Server/PlayerMessageTracker.cs b/OpenRA.Game/Server/PlayerMessageTracker.cs index ad779bb7b1..8fe7289ce4 100644 --- a/OpenRA.Game/Server/PlayerMessageTracker.cs +++ b/OpenRA.Game/Server/PlayerMessageTracker.cs @@ -22,16 +22,16 @@ namespace OpenRA.Server readonly Dictionary> messageTracker = new(); readonly Server server; readonly Action dispatchOrdersToClient; - readonly Action sendLocalizedMessageTo; + readonly Action sendFluentMessageTo; public PlayerMessageTracker( Server server, Action dispatchOrdersToClient, - Action sendLocalizedMessageTo) + Action sendFluentMessageTo) { this.server = server; this.dispatchOrdersToClient = dispatchOrdersToClient; - this.sendLocalizedMessageTo = sendLocalizedMessageTo; + this.sendFluentMessageTo = sendFluentMessageTo; } public void DisableChatUI(Connection conn, int time) @@ -56,7 +56,7 @@ namespace OpenRA.Server if (!isAdmin && time < settings.FloodLimitJoinCooldown) { var remaining = CalculateRemaining(settings.FloodLimitJoinCooldown); - sendLocalizedMessageTo(conn, ChatTemporaryDisabled, new object[] { "remaining", remaining }); + sendFluentMessageTo(conn, ChatTemporaryDisabled, new object[] { "remaining", remaining }); return true; } @@ -64,7 +64,7 @@ namespace OpenRA.Server if (tracker.Count >= settings.FloodLimitMessageCount) { var remaining = CalculateRemaining(tracker[0] + settings.FloodLimitInterval); - sendLocalizedMessageTo(conn, ChatTemporaryDisabled, new object[] { "remaining", remaining }); + sendFluentMessageTo(conn, ChatTemporaryDisabled, new object[] { "remaining", remaining }); return true; } diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index ebe187f9f6..16e6d06fcc 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -319,7 +319,7 @@ namespace OpenRA.Server MapStatusCache = new MapStatusCache(modData, MapStatusChanged, type == ServerType.Dedicated && settings.EnableLintChecks); - playerMessageTracker = new PlayerMessageTracker(this, DispatchOrdersToClient, SendLocalizedMessageTo); + playerMessageTracker = new PlayerMessageTracker(this, DispatchOrdersToClient, SendFluentMessageTo); VoteKickTracker = new VoteKickTracker(this); LobbyInfo = new Session @@ -580,7 +580,7 @@ namespace OpenRA.Server Log.Write("server", $"{client.Name} ({newConn.EndPoint}) has joined the game."); - SendLocalizedMessage(Joined, "player", client.Name); + SendFluentMessage(Joined, "player", client.Name); if (Type == ServerType.Dedicated) { @@ -594,12 +594,12 @@ namespace OpenRA.Server } if ((LobbyInfo.GlobalSettings.MapStatus & Session.MapStatus.UnsafeCustomRules) != 0) - SendLocalizedMessageTo(newConn, CustomRules); + SendFluentMessageTo(newConn, CustomRules); if (!LobbyInfo.GlobalSettings.EnableSingleplayer) - SendLocalizedMessageTo(newConn, TwoHumansRequired); + SendFluentMessageTo(newConn, TwoHumansRequired); else if (Map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots)) - SendLocalizedMessageTo(newConn, BotsDisabled); + SendFluentMessageTo(newConn, BotsDisabled); } } @@ -952,7 +952,7 @@ namespace OpenRA.Server WriteLineWithTimeStamp(text); } - public void SendLocalizedMessage(string key, params object[] args) + public void SendFluentMessage(string key, params object[] args) { var text = FluentMessage.Serialize(key, args); DispatchServerOrdersToClients(Order.FromTargetString("FluentMessage", text, true)); @@ -961,7 +961,7 @@ namespace OpenRA.Server WriteLineWithTimeStamp(FluentProvider.GetString(key, args)); } - public void SendLocalizedMessageTo(Connection conn, string key, object[] args = null) + public void SendFluentMessageTo(Connection conn, string key, object[] args = null) { var text = FluentMessage.Serialize(key, args); DispatchOrdersToClient(conn, 0, 0, Order.FromTargetString("FluentMessage", text, true).Serialize()); @@ -998,7 +998,7 @@ namespace OpenRA.Server if (!InterpretCommand(o.TargetString, conn)) { Log.Write("server", $"Unknown server command: {o.TargetString}"); - SendLocalizedMessageTo(conn, UnknownServerCommand, new object[] { "command", o.TargetString }); + SendFluentMessageTo(conn, UnknownServerCommand, new object[] { "command", o.TargetString }); } break; @@ -1180,14 +1180,14 @@ namespace OpenRA.Server if (State == ServerState.GameStarted) { if (dropClient.IsObserver) - SendLocalizedMessage(ObserverDisconnected, "player", dropClient.Name); + SendFluentMessage(ObserverDisconnected, "player", dropClient.Name); else if (dropClient.Team > 0) - SendLocalizedMessage(PlayerTeamDisconnected, "player", dropClient.Name, "team", dropClient.Team); + SendFluentMessage(PlayerTeamDisconnected, "player", dropClient.Name, "team", dropClient.Team); else - SendLocalizedMessage(PlayerDisconnected, "player", dropClient.Name); + SendFluentMessage(PlayerDisconnected, "player", dropClient.Name); } else - SendLocalizedMessage(LobbyDisconnected, "player", dropClient.Name); + SendFluentMessage(LobbyDisconnected, "player", dropClient.Name); LobbyInfo.Clients.RemoveAll(c => c.Index == toDrop.PlayerIndex); @@ -1204,7 +1204,7 @@ namespace OpenRA.Server if (nextAdmin != null) { nextAdmin.IsAdmin = true; - SendLocalizedMessage(NewAdmin, "player", nextAdmin.Name); + SendFluentMessage(NewAdmin, "player", nextAdmin.Name); } } diff --git a/OpenRA.Game/Server/VoteKickTracker.cs b/OpenRA.Game/Server/VoteKickTracker.cs index 526d04daa6..ab3947f77f 100644 --- a/OpenRA.Game/Server/VoteKickTracker.cs +++ b/OpenRA.Game/Server/VoteKickTracker.cs @@ -76,7 +76,7 @@ namespace OpenRA.Server || (voteInProgress && this.kickee.Client != kickee) // Disallow starting new votes when one is already ongoing. || !ClientHasPower(kicker)) { - server.SendLocalizedMessageTo(conn, UnableToStartAVote); + server.SendFluentMessageTo(conn, UnableToStartAVote); return false; } @@ -107,7 +107,7 @@ namespace OpenRA.Server if (!kickee.IsObserver && !server.HasClientWonOrLost(kickee)) { // Vote kick cannot be the sole deciding factor for a game. - server.SendLocalizedMessageTo(conn, InsufficientVotes, new object[] { "kickee", kickee.Name }); + server.SendFluentMessageTo(conn, InsufficientVotes, new object[] { "kickee", kickee.Name }); EndKickVote(); return false; } @@ -126,7 +126,7 @@ namespace OpenRA.Server { if (time + server.Settings.VoteKickerCooldown > kickeeConn.ConnectionTimer.ElapsedMilliseconds) { - server.SendLocalizedMessageTo(conn, UnableToStartAVote); + server.SendFluentMessageTo(conn, UnableToStartAVote); return false; } else @@ -135,7 +135,7 @@ namespace OpenRA.Server Log.Write("server", $"Vote kick started on {kickeeID}."); voteKickTimer = Stopwatch.StartNew(); - server.SendLocalizedMessage(VoteKickStarted, "kicker", kicker.Name, "kickee", kickee.Name); + server.SendFluentMessage(VoteKickStarted, "kicker", kicker.Name, "kickee", kickee.Name); server.DispatchServerOrdersToClients(new Order("StartKickVote", null, false) { ExtraData = (uint)kickeeID }.Serialize()); this.kickee = (kickee, kickeeConn); voteKickerStarter = (kicker, conn); @@ -145,7 +145,7 @@ namespace OpenRA.Server voteTracker[conn.PlayerIndex] = vote; else { - server.SendLocalizedMessageTo(conn, AlreadyVoted); + server.SendFluentMessageTo(conn, AlreadyVoted); return false; } @@ -168,7 +168,7 @@ namespace OpenRA.Server } var votesNeeded = eligiblePlayers / 2 + 1; - server.SendLocalizedMessage(VoteKickProgress, + server.SendFluentMessage(VoteKickProgress, "kickee", kickee.Name, "percentage", votesFor * 100 / eligiblePlayers); @@ -210,7 +210,7 @@ namespace OpenRA.Server return; if (sendMessage) - server.SendLocalizedMessage(VoteKickEnded, "kickee", kickee.Client.Name); + server.SendFluentMessage(VoteKickEnded, "kickee", kickee.Client.Name); server.DispatchServerOrdersToClients(new Order("EndKickVote", null, false) { ExtraData = (uint)kickee.Client.Index }.Serialize()); diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index ffa8fe3c5c..d486bb46f4 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -586,11 +586,11 @@ namespace OpenRA.Traits IReadOnlyDictionary values, string defaultValue, bool locked) { Id = id; - Name = map.GetLocalisedString(name); - Description = description != null ? map.GetLocalisedString(description).Replace(@"\n", "\n") : null; + Name = map.GetString(name); + Description = description != null ? map.GetString(description).Replace(@"\n", "\n") : null; IsVisible = visible; DisplayOrder = displayorder; - Values = values.ToDictionary(v => v.Key, v => map.GetLocalisedString(v.Value)); + Values = values.ToDictionary(v => v.Key, v => map.GetString(v.Value)); DefaultValue = defaultValue; IsLocked = locked; } diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 41680faaed..21ee5dd1f9 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -206,7 +206,7 @@ namespace OpenRA.Mods.Common.Server if (requiresHost && !client.IsAdmin) { - server.SendLocalizedMessageTo(conn, RequiresHost); + server.SendFluentMessageTo(conn, RequiresHost); return false; } @@ -224,12 +224,12 @@ namespace OpenRA.Mods.Common.Server if (server.State == ServerState.GameStarted) { - server.SendLocalizedMessageTo(conn, StateUnchangedGameStarted, new object[] { "command", command }); + server.SendFluentMessageTo(conn, StateUnchangedGameStarted, new object[] { "command", command }); return false; } else if (client.State == Session.ClientState.Ready && !(command.StartsWith("state", StringComparison.Ordinal) || command == "startgame")) { - server.SendLocalizedMessageTo(conn, StateUnchangedReady); + server.SendFluentMessageTo(conn, StateUnchangedReady); return false; } @@ -303,7 +303,7 @@ namespace OpenRA.Mods.Common.Server { if (!Enum.TryParse(s, false, out var state)) { - server.SendLocalizedMessageTo(conn, MalformedCommand, new object[] { "command", "state" }); + server.SendFluentMessageTo(conn, MalformedCommand, new object[] { "command", "state" }); return true; } @@ -324,13 +324,13 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, OnlyHostStartGame); + server.SendFluentMessageTo(conn, OnlyHostStartGame); return true; } if (server.LobbyInfo.Slots.Any(sl => sl.Value.Required && server.LobbyInfo.ClientInSlot(sl.Key) == null)) { - server.SendLocalizedMessageTo(conn, NoStartUntilRequiredSlotsFull); + server.SendFluentMessageTo(conn, NoStartUntilRequiredSlotsFull); return true; } @@ -342,13 +342,13 @@ namespace OpenRA.Mods.Common.Server if (!server.LobbyInfo.GlobalSettings.EnableSingleplayer && server.LobbyInfo.NonBotPlayers.Count() < 2) { - server.SendLocalizedMessageTo(conn, TwoHumansRequired); + server.SendFluentMessageTo(conn, TwoHumansRequired); return true; } if (LobbyUtils.InsufficientEnabledSpawnPoints(server.Map, server.LobbyInfo)) { - server.SendLocalizedMessageTo(conn, InsufficientEnabledSpawnPoints); + server.SendFluentMessageTo(conn, InsufficientEnabledSpawnPoints); return true; } @@ -399,7 +399,7 @@ namespace OpenRA.Mods.Common.Server return true; } - server.SendLocalizedMessageTo(conn, MalformedCommand, new object[] { "command", "allow_spectate" }); + server.SendFluentMessageTo(conn, MalformedCommand, new object[] { "command", "allow_spectate" }); return true; } @@ -488,7 +488,7 @@ namespace OpenRA.Mods.Common.Server var parts = s.Split(' '); if (parts.Length < 3) { - server.SendLocalizedMessageTo(conn, MalformedCommand, new object[] { "command", "slot_bot" }); + server.SendFluentMessageTo(conn, MalformedCommand, new object[] { "command", "slot_bot" }); return true; } @@ -506,7 +506,7 @@ namespace OpenRA.Mods.Common.Server // Invalid slot if (bot != null && bot.Bot == null) { - server.SendLocalizedMessageTo(conn, InvalidBotSlot); + server.SendFluentMessageTo(conn, InvalidBotSlot); return true; } @@ -516,7 +516,7 @@ namespace OpenRA.Mods.Common.Server if (botInfo == null) { - server.SendLocalizedMessageTo(conn, InvalidBotType); + server.SendFluentMessageTo(conn, InvalidBotType); return true; } @@ -569,7 +569,7 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, HostChangeMap); + server.SendFluentMessageTo(conn, HostChangeMap); return true; } @@ -652,15 +652,15 @@ namespace OpenRA.Mods.Common.Server server.SyncLobbyInfo(); - server.SendLocalizedMessage(ChangedMap, "player", client.Name, "map", server.Map.Title); + server.SendFluentMessage(ChangedMap, "player", client.Name, "map", server.Map.Title); if ((server.LobbyInfo.GlobalSettings.MapStatus & Session.MapStatus.UnsafeCustomRules) != 0) - server.SendLocalizedMessage(CustomRules); + server.SendFluentMessage(CustomRules); if (!server.LobbyInfo.GlobalSettings.EnableSingleplayer) - server.SendLocalizedMessage(TwoHumansRequired); + server.SendFluentMessage(TwoHumansRequired); else if (server.Map.Players.Players.Where(p => p.Value.Playable).All(p => !p.Value.AllowBots)) - server.SendLocalizedMessage(MapBotsDisabled); + server.SendFluentMessage(MapBotsDisabled); var briefing = MissionBriefingOrDefault(server); if (briefing != null) @@ -673,7 +673,7 @@ namespace OpenRA.Mods.Common.Server SelectMap(m); else if (server.Settings.QueryMapRepository) { - server.SendLocalizedMessageTo(conn, SearchingMap); + server.SendFluentMessageTo(conn, SearchingMap); var mapRepository = server.ModData.Manifest.Get().MapRepository; var reported = false; server.ModData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { s }, SelectMap, _ => @@ -690,7 +690,7 @@ namespace OpenRA.Mods.Common.Server return true; } - void QueryFailed() => server.SendLocalizedMessageTo(conn, UnknownMap); + void QueryFailed() => server.SendFluentMessageTo(conn, UnknownMap); } static bool Option(S server, Connection conn, Session.Client client, string s) @@ -699,7 +699,7 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, NotAdmin); + server.SendFluentMessageTo(conn, NotAdmin); return true; } @@ -716,13 +716,13 @@ namespace OpenRA.Mods.Common.Server if (split.Length < 2 || !options.TryGetValue(split[0], out var option) || !option.Values.ContainsKey(split[1])) { - server.SendLocalizedMessageTo(conn, InvalidConfigurationCommand); + server.SendFluentMessageTo(conn, InvalidConfigurationCommand); return true; } if (option.IsLocked) { - server.SendLocalizedMessageTo(conn, OptionLocked, new object[] { "option", option.Name }); + server.SendFluentMessageTo(conn, OptionLocked, new object[] { "option", option.Name }); return true; } @@ -732,14 +732,14 @@ namespace OpenRA.Mods.Common.Server if (!option.Values.ContainsKey(split[1])) { - server.SendLocalizedMessageTo(conn, InvalidConfigurationCommand); + server.SendFluentMessageTo(conn, InvalidConfigurationCommand); return true; } oo.Value = oo.PreferredValue = split[1]; server.SyncLobbyGlobalSettings(); - server.SendLocalizedMessage(ValueChanged, "player", client.Name, "name", option.Name, "value", option.Label(split[1])); + server.SendFluentMessage(ValueChanged, "player", client.Name, "name", option.Name, "value", option.Label(split[1])); foreach (var c in server.LobbyInfo.Clients) c.State = Session.ClientState.NotReady; @@ -756,7 +756,7 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, NotAdmin); + server.SendFluentMessageTo(conn, NotAdmin); return true; } @@ -768,7 +768,7 @@ namespace OpenRA.Mods.Common.Server foreach (var o in allOptions) { if (o.DefaultValue != server.LobbyInfo.GlobalSettings.LobbyOptions[o.Id].Value) - server.SendLocalizedMessage(ValueChanged, + server.SendFluentMessage(ValueChanged, "player", client.Name, "name", o.Name, "value", o.Label(o.DefaultValue)); @@ -799,13 +799,13 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, AdminOption); + server.SendFluentMessageTo(conn, AdminOption); return true; } if (!Exts.TryParseInt32Invariant(raw, out var teamCount)) { - server.SendLocalizedMessageTo(conn, NumberTeams, new object[] { "raw", raw }); + server.SendFluentMessageTo(conn, NumberTeams, new object[] { "raw", raw }); return true; } @@ -843,14 +843,14 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, AdminKick); + server.SendFluentMessageTo(conn, AdminKick); return true; } var split = s.Split(' '); if (split.Length < 2) { - server.SendLocalizedMessageTo(conn, MalformedCommand, new object[] { "command", "kick" }); + server.SendFluentMessageTo(conn, MalformedCommand, new object[] { "command", "kick" }); return true; } @@ -859,32 +859,32 @@ namespace OpenRA.Mods.Common.Server if (kickConn == null) { - server.SendLocalizedMessageTo(conn, KickNone); + server.SendFluentMessageTo(conn, KickNone); return true; } var kickClient = server.GetClient(kickConn); if (client == kickClient) { - server.SendLocalizedMessageTo(conn, NoKickSelf); + server.SendFluentMessageTo(conn, NoKickSelf); return true; } if (server.State == ServerState.GameStarted && !kickClient.IsObserver && !server.HasClientWonOrLost(kickClient)) { - server.SendLocalizedMessageTo(conn, NoKickGameStarted); + server.SendFluentMessageTo(conn, NoKickGameStarted); return true; } Log.Write("server", $"Kicking client {kickClientID}."); - server.SendLocalizedMessage(AdminKicked, "admin", client.Name, "player", kickClient.Name); + server.SendFluentMessage(AdminKicked, "admin", client.Name, "player", kickClient.Name); server.SendOrderTo(kickConn, "ServerError", YouWereKicked); server.DropClient(kickConn); if (bool.TryParse(split[1], out var tempBan) && tempBan) { Log.Write("server", $"Temporarily banning client {kickClientID} ({kickClient.IPAddress})."); - server.SendLocalizedMessage(TempBan, "admin", client.Name, "player", kickClient.Name); + server.SendFluentMessage(TempBan, "admin", client.Name, "player", kickClient.Name); server.TempBans.Add(kickClient.IPAddress); } @@ -902,13 +902,13 @@ namespace OpenRA.Mods.Common.Server var split = s.Split(' '); if (split.Length != 2) { - server.SendLocalizedMessageTo(conn, MalformedCommand, new object[] { "command", "vote_kick" }); + server.SendFluentMessageTo(conn, MalformedCommand, new object[] { "command", "vote_kick" }); return true; } if (!server.Settings.EnableVoteKick) { - server.SendLocalizedMessageTo(conn, VoteKickDisabled); + server.SendFluentMessageTo(conn, VoteKickDisabled); return true; } @@ -917,27 +917,27 @@ namespace OpenRA.Mods.Common.Server if (kickConn == null) { - server.SendLocalizedMessageTo(conn, KickNone); + server.SendFluentMessageTo(conn, KickNone); return true; } var kickClient = server.GetClient(kickConn); if (client == kickClient) { - server.SendLocalizedMessageTo(conn, NoKickSelf); + server.SendFluentMessageTo(conn, NoKickSelf); return true; } if (!bool.TryParse(split[1], out var vote)) { - server.SendLocalizedMessageTo(conn, MalformedCommand, new object[] { "command", "vote_kick" }); + server.SendFluentMessageTo(conn, MalformedCommand, new object[] { "command", "vote_kick" }); return true; } if (server.VoteKickTracker.VoteKick(conn, client, kickConn, kickClient, kickClientID, vote)) { Log.Write("server", $"Kicking client {kickClientID}."); - server.SendLocalizedMessage(Kicked, "player", kickClient.Name); + server.SendFluentMessage(Kicked, "player", kickClient.Name); server.SendOrderTo(kickConn, "ServerError", YouWereKicked); server.DropClient(kickConn); @@ -957,7 +957,7 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, NoTransferAdmin); + server.SendFluentMessageTo(conn, NoTransferAdmin); return true; } @@ -966,7 +966,7 @@ namespace OpenRA.Mods.Common.Server if (newAdminConn == null) { - server.SendLocalizedMessageTo(conn, EmptySlot); + server.SendFluentMessageTo(conn, EmptySlot); return true; } @@ -980,7 +980,7 @@ namespace OpenRA.Mods.Common.Server foreach (var b in bots) b.BotControllerClientIndex = newAdminId; - server.SendLocalizedMessage(NewAdmin, "player", newAdminClient.Name); + server.SendFluentMessage(NewAdmin, "player", newAdminClient.Name); Log.Write("server", $"{newAdminClient.Name} is now the admin."); server.SyncLobbyClients(); @@ -994,7 +994,7 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, NoMoveSpectators); + server.SendFluentMessageTo(conn, NoMoveSpectators); return true; } @@ -1003,7 +1003,7 @@ namespace OpenRA.Mods.Common.Server if (targetConn == null) { - server.SendLocalizedMessageTo(conn, EmptySlot); + server.SendFluentMessageTo(conn, EmptySlot); return true; } @@ -1014,7 +1014,7 @@ namespace OpenRA.Mods.Common.Server targetClient.Handicap = 0; targetClient.Color = Color.White; targetClient.State = Session.ClientState.NotReady; - server.SendLocalizedMessage(MoveSpectators, "admin", client.Name, "player", targetClient.Name); + server.SendFluentMessage(MoveSpectators, "admin", client.Name, "player", targetClient.Name); Log.Write("server", $"{client.Name} moved {targetClient.Name} to spectators."); server.SyncLobbyClients(); CheckAutoStart(server); @@ -1032,7 +1032,7 @@ namespace OpenRA.Mods.Common.Server return true; Log.Write("server", $"Player@{conn.EndPoint} is now known as {sanitizedName}."); - server.SendLocalizedMessage(Nick, "player", client.Name, "name", sanitizedName); + server.SendFluentMessage(Nick, "player", client.Name, "name", sanitizedName); client.Name = sanitizedName; server.SyncLobbyClients(); @@ -1062,8 +1062,8 @@ namespace OpenRA.Mods.Common.Server var faction = parts[1]; if (!factions.Contains(faction)) { - server.SendLocalizedMessageTo(conn, InvalidFactionSelected, new object[] { "faction", faction }); - server.SendLocalizedMessageTo(conn, SupportedFactions, new object[] { "factions", factions.JoinWith(", ") }); + server.SendFluentMessageTo(conn, InvalidFactionSelected, new object[] { "faction", faction }); + server.SendFluentMessageTo(conn, SupportedFactions, new object[] { "factions", factions.JoinWith(", ") }); return true; } @@ -1147,7 +1147,7 @@ namespace OpenRA.Mods.Common.Server var existingClient = server.LobbyInfo.Clients.FirstOrDefault(cc => cc.SpawnPoint == spawnPoint); if (client != existingClient && !client.IsAdmin) { - server.SendLocalizedMessageTo(conn, AdminClearSpawn); + server.SendFluentMessageTo(conn, AdminClearSpawn); return true; } @@ -1203,7 +1203,7 @@ namespace OpenRA.Mods.Common.Server if (server.LobbyInfo.Clients.Any(cc => cc != client && (cc.SpawnPoint == spawnPoint) && (cc.SpawnPoint != 0))) { - server.SendLocalizedMessageTo(conn, SpawnOccupied); + server.SendFluentMessageTo(conn, SpawnOccupied); return true; } @@ -1218,7 +1218,7 @@ namespace OpenRA.Mods.Common.Server if (spawnLockedByAnotherSlot) { - server.SendLocalizedMessageTo(conn, SpawnLocked); + server.SendFluentMessageTo(conn, SpawnLocked); return true; } } @@ -1265,7 +1265,7 @@ namespace OpenRA.Mods.Common.Server { if (!client.IsAdmin) { - server.SendLocalizedMessageTo(conn, AdminLobbyInfo); + server.SendFluentMessageTo(conn, AdminLobbyInfo); return true; } @@ -1276,7 +1276,7 @@ namespace OpenRA.Mods.Common.Server } catch (Exception) { - server.SendLocalizedMessageTo(conn, InvalidLobbyInfo); + server.SendFluentMessageTo(conn, InvalidLobbyInfo); } return true; @@ -1427,7 +1427,7 @@ namespace OpenRA.Mods.Common.Server void OnError(string message) { if (connectionToEcho != null && message != null) - server.SendLocalizedMessageTo(connectionToEcho, message); + server.SendFluentMessageTo(connectionToEcho, message); } var terrainColors = server.ModData.DefaultTerrainInfo[server.Map.TileSet].RestrictedPlayerColors.ToList(); diff --git a/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs b/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs index 3c206db210..09a58acd5c 100644 --- a/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs +++ b/OpenRA.Mods.Common/ServerTraits/MasterServerPinger.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Server lock (masterServerMessages) while (masterServerMessages.Count > 0) - server.SendLocalizedMessage(masterServerMessages.Dequeue()); + server.SendFluentMessage(masterServerMessages.Dequeue()); } void INotifyServerStart.ServerStarted(S server) diff --git a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs index d877c60f1f..632dd88c2e 100644 --- a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs +++ b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Server if (client == null) { server.DropClient(c); - server.SendLocalizedMessage(PlayerDropped); + server.SendFluentMessage(PlayerDropped); continue; } @@ -68,13 +68,13 @@ namespace OpenRA.Mods.Common.Server { if (!c.TimeoutMessageShown && c.TimeSinceLastResponse > PingInterval * 2) { - server.SendLocalizedMessage(ConnectionProblems, "player", client.Name); + server.SendFluentMessage(ConnectionProblems, "player", client.Name); c.TimeoutMessageShown = true; } } else { - server.SendLocalizedMessage(Timeout, "player", client.Name); + server.SendFluentMessage(Timeout, "player", client.Name); server.DropClient(c); } } @@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Server if (client != null) { var timeout = (ConnTimeout - c.TimeSinceLastResponse) / 1000; - server.SendLocalizedMessage(TimeoutIn, "player", client.Name, "timeout", timeout); + server.SendFluentMessage(TimeoutIn, "player", client.Name, "timeout", timeout); } } } diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index 962c732d78..b9b2d5c0d4 100644 --- a/OpenRA.Mods.Common/Traits/World/MapOptions.cs +++ b/OpenRA.Mods.Common/Traits/World/MapOptions.cs @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits ShortGameCheckboxVisible, ShortGameCheckboxDisplayOrder, ShortGameCheckboxEnabled, ShortGameCheckboxLocked); var techLevels = map.PlayerActorInfo.TraitInfos() - .ToDictionary(t => t.Id, t => map.GetLocalisedString(t.Name)); + .ToDictionary(t => t.Id, t => map.GetString(t.Name)); if (techLevels.Count > 0) yield return new LobbyOption(map, "techlevel", diff --git a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs index 56861e3128..a4ae81667f 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits // Duplicate classes are defined for different race variants foreach (var t in map.WorldActorInfo.TraitInfos()) - startingUnits[t.Class] = map.GetLocalisedString(t.ClassName); + startingUnits[t.Class] = map.GetString(t.ClassName); if (startingUnits.Count > 0) yield return new LobbyOption(map, "startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder,