Rename Fluent-related code to be more precise.

This commit is contained in:
Paul Chote
2024-10-01 19:34:12 +01:00
committed by Gustas
parent 771b9ddfda
commit b29b685058
176 changed files with 1349 additions and 1369 deletions

View File

@@ -47,73 +47,73 @@ namespace OpenRA.Server
public sealed class Server
{
[TranslationReference]
[FluentReference]
const string CustomRules = "notification-custom-rules";
[TranslationReference]
[FluentReference]
const string BotsDisabled = "notification-map-bots-disabled";
[TranslationReference]
[FluentReference]
const string TwoHumansRequired = "notification-two-humans-required";
[TranslationReference]
[FluentReference]
const string ErrorGameStarted = "notification-error-game-started";
[TranslationReference]
[FluentReference]
const string RequiresPassword = "notification-requires-password";
[TranslationReference]
[FluentReference]
const string IncorrectPassword = "notification-incorrect-password";
[TranslationReference]
[FluentReference]
const string IncompatibleMod = "notification-incompatible-mod";
[TranslationReference]
[FluentReference]
const string IncompatibleVersion = "notification-incompatible-version";
[TranslationReference]
[FluentReference]
const string IncompatibleProtocol = "notification-incompatible-protocol";
[TranslationReference]
[FluentReference]
const string Banned = "notification-you-were-banned";
[TranslationReference]
[FluentReference]
const string TempBanned = "notification-you-were-temp-banned";
[TranslationReference]
[FluentReference]
const string Full = "notification-game-full";
[TranslationReference("player")]
[FluentReference("player")]
const string Joined = "notification-joined";
[TranslationReference]
[FluentReference]
const string RequiresAuthentication = "notification-requires-authentication";
[TranslationReference]
[FluentReference]
const string NoPermission = "notification-no-permission-to-join";
[TranslationReference("command")]
[FluentReference("command")]
const string UnknownServerCommand = "notification-unknown-server-command";
[TranslationReference("player")]
[FluentReference("player")]
const string LobbyDisconnected = "notification-lobby-disconnected";
[TranslationReference("player")]
[FluentReference("player")]
const string PlayerDisconnected = "notification-player-disconnected";
[TranslationReference("player", "team")]
[FluentReference("player", "team")]
const string PlayerTeamDisconnected = "notification-team-player-disconnected";
[TranslationReference("player")]
[FluentReference("player")]
const string ObserverDisconnected = "notification-observer-disconnected";
[TranslationReference("player")]
[FluentReference("player")]
const string NewAdmin = "notification-new-admin";
[TranslationReference]
[FluentReference]
const string YouWereKicked = "notification-you-were-kicked";
[TranslationReference]
[FluentReference]
const string GameStarted = "notification-game-started";
public readonly MersenneTwister Random = new();
@@ -580,7 +580,7 @@ namespace OpenRA.Server
Log.Write("server", $"{client.Name} ({newConn.EndPoint}) has joined the game.");
SendLocalizedMessage(Joined, Translation.Arguments("player", client.Name));
SendLocalizedMessage(Joined, FluentBundle.Arguments("player", client.Name));
if (Type == ServerType.Dedicated)
{
@@ -954,17 +954,17 @@ namespace OpenRA.Server
public void SendLocalizedMessage(string key, Dictionary<string, object> arguments = null)
{
var text = LocalizedMessage.Serialize(key, arguments);
DispatchServerOrdersToClients(Order.FromTargetString("LocalizedMessage", text, true));
var text = FluentMessage.Serialize(key, arguments);
DispatchServerOrdersToClients(Order.FromTargetString("FluentMessage", text, true));
if (Type == ServerType.Dedicated)
WriteLineWithTimeStamp(TranslationProvider.GetString(key, arguments));
WriteLineWithTimeStamp(FluentProvider.GetString(key, arguments));
}
public void SendLocalizedMessageTo(Connection conn, string key, Dictionary<string, object> arguments = null)
{
var text = LocalizedMessage.Serialize(key, arguments);
DispatchOrdersToClient(conn, 0, 0, Order.FromTargetString("LocalizedMessage", text, true).Serialize());
var text = FluentMessage.Serialize(key, arguments);
DispatchOrdersToClient(conn, 0, 0, Order.FromTargetString("FluentMessage", text, true).Serialize());
}
void WriteLineWithTimeStamp(string line)
@@ -998,7 +998,7 @@ namespace OpenRA.Server
if (!InterpretCommand(o.TargetString, conn))
{
Log.Write("server", $"Unknown server command: {o.TargetString}");
SendLocalizedMessageTo(conn, UnknownServerCommand, Translation.Arguments("command", o.TargetString));
SendLocalizedMessageTo(conn, UnknownServerCommand, FluentBundle.Arguments("command", o.TargetString));
}
break;
@@ -1180,14 +1180,14 @@ namespace OpenRA.Server
if (State == ServerState.GameStarted)
{
if (dropClient.IsObserver)
SendLocalizedMessage(ObserverDisconnected, Translation.Arguments("player", dropClient.Name));
SendLocalizedMessage(ObserverDisconnected, FluentBundle.Arguments("player", dropClient.Name));
else if (dropClient.Team > 0)
SendLocalizedMessage(PlayerTeamDisconnected, Translation.Arguments("player", dropClient.Name, "team", dropClient.Team));
SendLocalizedMessage(PlayerTeamDisconnected, FluentBundle.Arguments("player", dropClient.Name, "team", dropClient.Team));
else
SendLocalizedMessage(PlayerDisconnected, Translation.Arguments("player", dropClient.Name));
SendLocalizedMessage(PlayerDisconnected, FluentBundle.Arguments("player", dropClient.Name));
}
else
SendLocalizedMessage(LobbyDisconnected, Translation.Arguments("player", dropClient.Name));
SendLocalizedMessage(LobbyDisconnected, FluentBundle.Arguments("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, Translation.Arguments("player", nextAdmin.Name));
SendLocalizedMessage(NewAdmin, FluentBundle.Arguments("player", nextAdmin.Name));
}
}
@@ -1302,7 +1302,7 @@ namespace OpenRA.Server
{
lock (LobbyInfo)
{
WriteLineWithTimeStamp(TranslationProvider.GetString(GameStarted));
WriteLineWithTimeStamp(FluentProvider.GetString(GameStarted));
// Drop any players who are not ready
foreach (var c in Conns.Where(c => !c.Validated || GetClient(c).IsInvalid).ToArray())