From 67254e0b39a54fe19ddc6a4dd7aaa91399d61940 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 19 Oct 2024 13:09:40 +0100 Subject: [PATCH] Rename Fluent *GetString methods to GetMessage. --- OpenRA.Game/FluentBundle.cs | 6 +-- OpenRA.Game/FluentProvider.cs | 16 +++---- OpenRA.Game/Game.cs | 2 +- OpenRA.Game/GameInformation.cs | 4 +- OpenRA.Game/Input/IInputHandler.cs | 4 +- OpenRA.Game/Input/Keycode.cs | 2 +- OpenRA.Game/Manifest.cs | 4 +- OpenRA.Game/Map/MapPreview.cs | 8 ++-- OpenRA.Game/Player.cs | 4 +- OpenRA.Game/Server/Server.cs | 4 +- OpenRA.Game/TextNotificationsManager.cs | 10 ++-- OpenRA.Game/Traits/TraitsInterfaces.cs | 6 +-- OpenRA.Mods.Cnc/CncLoadScreen.cs | 2 +- .../Installer/ExtractMixSourceAction.cs | 4 +- .../Traits/World/TSVeinsRenderer.cs | 2 +- OpenRA.Mods.Common/Commands/ChatCommands.cs | 2 +- OpenRA.Mods.Common/Commands/DevCommands.cs | 4 +- OpenRA.Mods.Common/Commands/HelpCommand.cs | 6 +-- .../EditorBrushes/EditorActorBrush.cs | 2 +- .../EditorBrushes/EditorCopyPasteBrush.cs | 2 +- .../EditorBrushes/EditorDefaultBrush.cs | 14 +++--- .../EditorBrushes/EditorMarkerLayerBrush.cs | 8 ++-- .../EditorBrushes/EditorResourceBrush.cs | 2 +- .../EditorBrushes/EditorTileBrush.cs | 4 +- .../SourceActions/CopySourceAction.cs | 4 +- .../SourceActions/ExtractBlastSourceAction.cs | 4 +- .../SourceActions/ExtractIscabSourceAction.cs | 2 +- .../SourceActions/ExtractMscabSourceAction.cs | 2 +- .../SourceActions/ExtractRawSourceAction.cs | 4 +- .../SourceActions/ExtractZipSourceAction.cs | 2 +- .../LoadScreens/LogoStripeLoadScreen.cs | 2 +- .../Scripting/Global/UserInterfaceGlobal.cs | 4 +- .../Scripting/Properties/GeneralProperties.cs | 2 +- .../Traits/Player/DeveloperMode.cs | 2 +- .../SupportPowers/SupportPowerManager.cs | 4 +- OpenRA.Mods.Common/Traits/Tooltip.cs | 10 ++-- .../Traits/TooltipDescription.cs | 2 +- .../Traits/World/EditorActionManager.cs | 2 +- .../Traits/World/EditorActorPreview.cs | 2 +- OpenRA.Mods.Common/Traits/World/MapOptions.cs | 4 +- .../Traits/World/ResourceRenderer.cs | 2 +- .../Traits/World/SpawnStartingUnits.cs | 2 +- .../Traits/World/TimeLimitManager.cs | 6 +-- OpenRA.Mods.Common/Widgets/ButtonWidget.cs | 6 +-- .../Widgets/ConfirmationDialogs.cs | 18 +++---- OpenRA.Mods.Common/Widgets/ImageWidget.cs | 2 +- OpenRA.Mods.Common/Widgets/LabelWidget.cs | 2 +- .../Widgets/Logic/AssetBrowserLogic.cs | 4 +- .../Widgets/Logic/BotTooltipLogic.cs | 2 +- .../Widgets/Logic/ConnectionLogic.cs | 10 ++-- .../Widgets/Logic/Editor/ActorEditLogic.cs | 12 ++--- .../Logic/Editor/ActorSelectorLogic.cs | 4 +- .../Logic/Editor/CommonSelectorLogic.cs | 8 ++-- .../Logic/Editor/MapEditorSelectionLogic.cs | 2 +- .../Logic/Editor/MapMarkerTilesLogic.cs | 12 ++--- .../Widgets/Logic/Editor/MapToolsLogic.cs | 4 +- .../Widgets/Logic/Editor/SaveMapLogic.cs | 2 +- .../Widgets/Logic/EncyclopediaLogic.cs | 6 +-- .../Widgets/Logic/GameSaveBrowserLogic.cs | 2 +- .../Widgets/Logic/Ingame/ArmyTooltipLogic.cs | 4 +- .../Widgets/Logic/Ingame/GameInfoLogic.cs | 2 +- .../Logic/Ingame/GameInfoObjectivesLogic.cs | 6 +-- .../Logic/Ingame/GameInfoStatsLogic.cs | 28 +++++------ .../Widgets/Logic/Ingame/GameTimerLogic.cs | 8 ++-- .../Logic/Ingame/IngameCashCounterLogic.cs | 2 +- .../Widgets/Logic/Ingame/IngameChatLogic.cs | 8 ++-- .../Widgets/Logic/Ingame/IngameMenuLogic.cs | 6 +-- .../Logic/Ingame/IngamePowerBarLogic.cs | 4 +- .../Logic/Ingame/IngamePowerCounterLogic.cs | 4 +- .../Logic/Ingame/IngameSiloBarLogic.cs | 2 +- .../Ingame/ObserverShroudSelectorLogic.cs | 12 ++--- .../Logic/Ingame/ObserverStatsLogic.cs | 12 ++--- .../Logic/Ingame/ProductionTooltipLogic.cs | 8 ++-- .../Widgets/Logic/Ingame/WorldTooltipLogic.cs | 2 +- .../Installation/DownloadPackageLogic.cs | 26 +++++----- .../Installation/InstallFromSourceLogic.cs | 28 +++++------ .../Logic/Installation/ModContentLogic.cs | 4 +- .../Installation/ModContentPromptLogic.cs | 4 +- .../Widgets/Logic/IntroductionPromptLogic.cs | 4 +- .../Widgets/Logic/Lobby/KickClientLogic.cs | 2 +- .../Logic/Lobby/KickSpectatorsLogic.cs | 2 +- .../Widgets/Logic/Lobby/LobbyLogic.cs | 24 +++++----- .../Widgets/Logic/Lobby/LobbyOptionsLogic.cs | 2 +- .../Widgets/Logic/Lobby/LobbyUtils.cs | 32 ++++++------- .../Widgets/Logic/Lobby/MapPreviewLogic.cs | 12 ++--- .../Logic/Lobby/SpawnSelectorTooltipLogic.cs | 6 +-- .../Widgets/Logic/MainMenuLogic.cs | 8 ++-- .../Widgets/Logic/MapChooserLogic.cs | 30 ++++++------ .../Widgets/Logic/MissionBrowserLogic.cs | 2 +- .../Widgets/Logic/MusicPlayerLogic.cs | 4 +- .../Widgets/Logic/MuteHotkeyLogic.cs | 4 +- .../Logic/RegisteredProfileTooltipLogic.cs | 4 +- .../Widgets/Logic/ReplayBrowserLogic.cs | 38 +++++++-------- .../Widgets/Logic/ServerCreationLogic.cs | 18 +++---- .../Widgets/Logic/ServerListLogic.cs | 42 ++++++++-------- .../Logic/Settings/DisplaySettingsLogic.cs | 48 +++++++++---------- .../Logic/Settings/HotkeysSettingsLogic.cs | 18 +++---- .../Logic/Settings/InputSettingsLogic.cs | 16 +++---- .../Widgets/MapPreviewWidget.cs | 6 +-- .../Widgets/ProductionPaletteWidget.cs | 4 +- .../Widgets/SupportPowerTimerWidget.cs | 2 +- .../Widgets/SupportPowersWidget.cs | 4 +- OpenRA.Mods.Common/Widgets/WidgetUtils.cs | 6 +-- OpenRA.Test/OpenRA.Game/FluentTest.cs | 4 +- 104 files changed, 396 insertions(+), 396 deletions(-) diff --git a/OpenRA.Game/FluentBundle.cs b/OpenRA.Game/FluentBundle.cs index cf60d1276a..ab722efd2e 100644 --- a/OpenRA.Game/FluentBundle.cs +++ b/OpenRA.Game/FluentBundle.cs @@ -112,15 +112,15 @@ namespace OpenRA } } - public string GetString(string key, object[] args = null) + public string GetMessage(string key, object[] args = null) { - if (!TryGetString(key, out var message, args)) + if (!TryGetMessage(key, out var message, args)) message = key; return message; } - public bool TryGetString(string key, out string value, object[] args = null) + public bool TryGetMessage(string key, out string value, object[] args = null) { if (key == null) throw new ArgumentNullException(nameof(key)); diff --git a/OpenRA.Game/FluentProvider.cs b/OpenRA.Game/FluentProvider.cs index eee653a026..703ef61835 100644 --- a/OpenRA.Game/FluentProvider.cs +++ b/OpenRA.Game/FluentProvider.cs @@ -31,32 +31,32 @@ namespace OpenRA } } - public static string GetString(string key, params object[] args) + public static string GetMessage(string key, params object[] args) { lock (SyncObject) { // By prioritizing mod-level fluent bundles we prevent maps from overwriting string keys. We do not want to // allow maps to change the UI nor any other strings not exposed to the map. - if (modFluentBundle.TryGetString(key, out var message, args)) + if (modFluentBundle.TryGetMessage(key, out var message, args)) return message; if (mapFluentBundle != null) - return mapFluentBundle.GetString(key, args); + return mapFluentBundle.GetMessage(key, args); return key; } } - public static bool TryGetString(string key, out string message, params object[] args) + public static bool TryGetMessage(string key, out string message, params object[] args) { lock (SyncObject) { // By prioritizing mod-level bundle we prevent maps from overwriting string keys. We do not want to // allow maps to change the UI nor any other strings not exposed to the map. - if (modFluentBundle.TryGetString(key, out message, args)) + if (modFluentBundle.TryGetMessage(key, out message, args)) return true; - if (mapFluentBundle != null && mapFluentBundle.TryGetString(key, out message, args)) + if (mapFluentBundle != null && mapFluentBundle.TryGetMessage(key, out message, args)) return true; return false; @@ -64,11 +64,11 @@ namespace OpenRA } /// Should only be used by . - internal static bool TryGetModString(string key, out string message, params object[] args) + internal static bool TryGetModMessage(string key, out string message, params object[] args) { lock (SyncObject) { - return modFluentBundle.TryGetString(key, out message, args); + return modFluentBundle.TryGetMessage(key, out message, args); } } } diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index e71d7c7a63..db21002d68 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -595,7 +595,7 @@ namespace OpenRA Log.Write("debug", "Taking screenshot " + path); Renderer.SaveScreenshot(path); - TextNotificationsManager.Debug(FluentProvider.GetString(SavedScreenshot, "filename", filename)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(SavedScreenshot, "filename", filename)); } } diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index c8e9448ae0..71a9d3e9ca 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -152,8 +152,8 @@ namespace OpenRA if (player.IsBot) { var number = Players.Where(p => p.BotType == player.BotType).ToList().IndexOf(player) + 1; - return FluentProvider.GetString(EnumeratedBotName, - "name", FluentProvider.GetString(player.Name), + return FluentProvider.GetMessage(EnumeratedBotName, + "name", FluentProvider.GetMessage(player.Name), "number", number); } diff --git a/OpenRA.Game/Input/IInputHandler.cs b/OpenRA.Game/Input/IInputHandler.cs index be8347cd12..0470c5f239 100644 --- a/OpenRA.Game/Input/IInputHandler.cs +++ b/OpenRA.Game/Input/IInputHandler.cs @@ -80,12 +80,12 @@ namespace OpenRA public static string DisplayString(Modifiers m) { if (m == Modifiers.Meta && Platform.CurrentPlatform == PlatformType.OSX) - return FluentProvider.GetString(Cmd); + return FluentProvider.GetMessage(Cmd); if (!ModifierFluentKeys.TryGetValue(m, out var fluentKey)) return m.ToString(); - return FluentProvider.GetString(fluentKey); + return FluentProvider.GetMessage(fluentKey); } } diff --git a/OpenRA.Game/Input/Keycode.cs b/OpenRA.Game/Input/Keycode.cs index 7f0afb9cf6..68307efaae 100644 --- a/OpenRA.Game/Input/Keycode.cs +++ b/OpenRA.Game/Input/Keycode.cs @@ -507,7 +507,7 @@ namespace OpenRA if (!KeycodeFluentKeys.TryGetValue(k, out var fluentKey)) return k.ToString(); - return FluentProvider.GetString(fluentKey); + return FluentProvider.GetMessage(fluentKey); } } } diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index c3e4dbd8a8..ee255a92b6 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -57,8 +57,8 @@ namespace OpenRA public readonly bool Hidden; #pragma warning restore IDE1006 // Naming Styles - public string TitleTranslated => FluentProvider.GetString(Title); - public string WindowTitleTranslated => WindowTitle != null ? FluentProvider.GetString(WindowTitle) : null; + public string TitleTranslated => FluentProvider.GetMessage(Title); + public string WindowTitleTranslated => WindowTitle != null ? FluentProvider.GetMessage(WindowTitle) : null; } /// Describes what is to be loaded in order to run a mod. diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index 68bb78abbd..143656c0d7 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -224,16 +224,16 @@ namespace OpenRA public int DownloadPercentage { get; private set; } /// - /// Functionality mirrors , except instead of using + /// Functionality mirrors , except instead of using /// loaded 's fluent bundle as backup, we use this 's. /// - public string GetString(string key, object[] args = null) + public string GetMessage(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)) + if (FluentProvider.TryGetModMessage(key, out var message, args)) return message; - return innerData.FluentBundle?.GetString(key, args) ?? key; + return innerData.FluentBundle?.GetMessage(key, args) ?? key; } Sprite minimap; diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index b74a584704..62e6942866 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -238,8 +238,8 @@ namespace OpenRA { var botInfo = botInfos.First(b => b.Type == BotType); var botsOfSameType = World.Players.Where(c => c.BotType == BotType).ToArray(); - return FluentProvider.GetString(EnumeratedBotName, - "name", FluentProvider.GetString(botInfo.Name), + return FluentProvider.GetMessage(EnumeratedBotName, + "name", FluentProvider.GetMessage(botInfo.Name), "number", botsOfSameType.IndexOf(this) + 1); } diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 16e6d06fcc..c4b8e42241 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -958,7 +958,7 @@ namespace OpenRA.Server DispatchServerOrdersToClients(Order.FromTargetString("FluentMessage", text, true)); if (Type == ServerType.Dedicated) - WriteLineWithTimeStamp(FluentProvider.GetString(key, args)); + WriteLineWithTimeStamp(FluentProvider.GetMessage(key, args)); } public void SendFluentMessageTo(Connection conn, string key, object[] args = null) @@ -1302,7 +1302,7 @@ namespace OpenRA.Server { lock (LobbyInfo) { - WriteLineWithTimeStamp(FluentProvider.GetString(GameStarted)); + WriteLineWithTimeStamp(FluentProvider.GetMessage(GameStarted)); // Drop any players who are not ready foreach (var c in Conns.Where(c => !c.Validated || GetClient(c).IsInvalid).ToArray()) diff --git a/OpenRA.Game/TextNotificationsManager.cs b/OpenRA.Game/TextNotificationsManager.cs index c6422f2e7c..82f6b38e80 100644 --- a/OpenRA.Game/TextNotificationsManager.cs +++ b/OpenRA.Game/TextNotificationsManager.cs @@ -38,12 +38,12 @@ namespace OpenRA return; if (player == null || player == player.World.LocalPlayer) - AddTextNotification(TextNotificationPool.Transients, SystemClientId, SystemMessageLabel, FluentProvider.GetString(text)); + AddTextNotification(TextNotificationPool.Transients, SystemClientId, SystemMessageLabel, FluentProvider.GetMessage(text)); } public static void AddFeedbackLine(string text, params object[] args) { - AddTextNotification(TextNotificationPool.Feedback, SystemClientId, SystemMessageLabel, FluentProvider.GetString(text, args)); + AddTextNotification(TextNotificationPool.Feedback, SystemClientId, SystemMessageLabel, FluentProvider.GetMessage(text, args)); } public static void AddMissionLine(string prefix, string text, Color? prefixColor = null) @@ -53,17 +53,17 @@ namespace OpenRA public static void AddPlayerJoinedLine(string text, params object[] args) { - AddTextNotification(TextNotificationPool.Join, SystemClientId, SystemMessageLabel, FluentProvider.GetString(text, args)); + AddTextNotification(TextNotificationPool.Join, SystemClientId, SystemMessageLabel, FluentProvider.GetMessage(text, args)); } public static void AddPlayerLeftLine(string text, params object[] args) { - AddTextNotification(TextNotificationPool.Leave, SystemClientId, SystemMessageLabel, FluentProvider.GetString(text, args)); + AddTextNotification(TextNotificationPool.Leave, SystemClientId, SystemMessageLabel, FluentProvider.GetMessage(text, args)); } public static void AddSystemLine(string text, params object[] args) { - AddSystemLine(SystemMessageLabel, FluentProvider.GetString(text, args)); + AddSystemLine(SystemMessageLabel, FluentProvider.GetMessage(text, args)); } public static void AddSystemLine(string prefix, string text) diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index d486bb46f4..b4c34e70fd 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.GetString(name); - Description = description != null ? map.GetString(description).Replace(@"\n", "\n") : null; + Name = map.GetMessage(name); + Description = description != null ? map.GetMessage(description).Replace(@"\n", "\n") : null; IsVisible = visible; DisplayOrder = displayorder; - Values = values.ToDictionary(v => v.Key, v => map.GetString(v.Value)); + Values = values.ToDictionary(v => v.Key, v => map.GetMessage(v.Value)); DefaultValue = defaultValue; IsLocked = locked; } diff --git a/OpenRA.Mods.Cnc/CncLoadScreen.cs b/OpenRA.Mods.Cnc/CncLoadScreen.cs index 5b811d7d26..4fcab29d0e 100644 --- a/OpenRA.Mods.Cnc/CncLoadScreen.cs +++ b/OpenRA.Mods.Cnc/CncLoadScreen.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc versionText = modData.Manifest.Metadata.Version; - message = FluentProvider.GetString(Loading); + message = FluentProvider.GetMessage(Loading); } public override void DisplayInner(Renderer r, Sheet s, int density) diff --git a/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs b/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs index 5cbed64b77..889c6e1c11 100644 --- a/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs +++ b/OpenRA.Mods.Cnc/Installer/ExtractMixSourceAction.cs @@ -51,9 +51,9 @@ namespace OpenRA.Mods.Cnc.Installer Action onProgress = null; if (stream.Length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(FluentProvider.GetString(InstallFromSourceLogic.Extracting, "filename", displayFilename)); + updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.Extracting, "filename", displayFilename)); else - onProgress = b => updateMessage(FluentProvider.GetString(InstallFromSourceLogic.ExtractingProgress, + onProgress = b => updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.ExtractingProgress, "filename", displayFilename, "progress", 100 * b / stream.Length)); diff --git a/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs b/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs index 9928ec834a..8c1877a536 100644 --- a/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs +++ b/OpenRA.Mods.Cnc/Traits/World/TSVeinsRenderer.cs @@ -371,7 +371,7 @@ namespace OpenRA.Mods.Cnc.Traits string IResourceRenderer.GetRenderedResourceTooltip(CPos cell) { if (renderIndices[cell] != null || borders[cell] != Adjacency.None) - return FluentProvider.GetString(info.Name); + return FluentProvider.GetMessage(info.Name); return null; } diff --git a/OpenRA.Mods.Common/Commands/ChatCommands.cs b/OpenRA.Mods.Common/Commands/ChatCommands.cs index 31c6dba0e0..3a312e1282 100644 --- a/OpenRA.Mods.Common/Commands/ChatCommands.cs +++ b/OpenRA.Mods.Common/Commands/ChatCommands.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Commands if (Commands.TryGetValue(name, out var command)) command.InvokeCommand(name, message[(1 + name.Length)..].Trim()); else - TextNotificationsManager.Debug(FluentProvider.GetString(InvalidCommand, "name", name)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(InvalidCommand, "name", name)); return false; } diff --git a/OpenRA.Mods.Common/Commands/DevCommands.cs b/OpenRA.Mods.Common/Commands/DevCommands.cs index 0bf8f2228e..291a9d2ce7 100644 --- a/OpenRA.Mods.Common/Commands/DevCommands.cs +++ b/OpenRA.Mods.Common/Commands/DevCommands.cs @@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Commands if (!developerMode.Enabled) { - TextNotificationsManager.Debug(FluentProvider.GetString(CheatsDisabled)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(CheatsDisabled)); return; } @@ -149,7 +149,7 @@ namespace OpenRA.Mods.Common.Commands giveCashOrder.ExtraData = (uint)cash; else { - TextNotificationsManager.Debug(FluentProvider.GetString(InvalidCashAmount)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(InvalidCashAmount)); return; } diff --git a/OpenRA.Mods.Common/Commands/HelpCommand.cs b/OpenRA.Mods.Common/Commands/HelpCommand.cs index 1bad4164e1..8d8e814d32 100644 --- a/OpenRA.Mods.Common/Commands/HelpCommand.cs +++ b/OpenRA.Mods.Common/Commands/HelpCommand.cs @@ -52,12 +52,12 @@ namespace OpenRA.Mods.Common.Commands public void InvokeCommand(string name, string arg) { - TextNotificationsManager.Debug(FluentProvider.GetString(AvailableCommands)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(AvailableCommands)); foreach (var key in console.Commands.Keys.OrderBy(k => k)) { if (!helpDescriptions.TryGetValue(key, out var description)) - description = FluentProvider.GetString(NoDescription); + description = FluentProvider.GetMessage(NoDescription); TextNotificationsManager.Debug($"{key}: {description}"); } @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Commands public void RegisterHelp(string name, string description) { - helpDescriptions[name] = FluentProvider.GetString(description); + helpDescriptions[name] = FluentProvider.GetMessage(description); } } } diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs index 284d78229a..d578b181e9 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs @@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Widgets public void Do() { editorActorPreview = editorLayer.Add(actor); - Text = FluentProvider.GetString(AddedActor, + Text = FluentProvider.GetMessage(AddedActor, "name", editorActorPreview.Info.Name, "id", editorActorPreview.ID); } diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs index cfa0040d80..eb5ea2af38 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets undoClipboard = CopySelectionContents(); - Text = FluentProvider.GetString(CopiedTiles, "amount", clipboard.Tiles.Count); + Text = FluentProvider.GetMessage(CopiedTiles, "amount", clipboard.Tiles.Count); } /// diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs index 59b1fd166b..bd7f865235 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs @@ -308,15 +308,15 @@ namespace OpenRA.Mods.Common.Widgets }; if (selection.Area != null) - Text = FluentProvider.GetString(SelectedArea, + Text = FluentProvider.GetMessage(SelectedArea, "x", selection.Area.TopLeft.X, "y", selection.Area.TopLeft.Y, "width", selection.Area.BottomRight.X - selection.Area.TopLeft.X, "height", selection.Area.BottomRight.Y - selection.Area.TopLeft.Y); else if (selection.Actor != null) - Text = FluentProvider.GetString(SelectedActor, "id", selection.Actor.ID); + Text = FluentProvider.GetMessage(SelectedActor, "id", selection.Actor.ID); else - Text = FluentProvider.GetString(ClearedSelection); + Text = FluentProvider.GetMessage(ClearedSelection); } public void Execute() @@ -360,7 +360,7 @@ namespace OpenRA.Mods.Common.Widgets Actor = defaultBrush.Selection.Actor }; - Text = FluentProvider.GetString(RemovedActor, "name", actor.Info.Name, "id", actor.ID); + Text = FluentProvider.GetMessage(RemovedActor, "name", actor.Info.Name, "id", actor.ID); } public void Execute() @@ -396,7 +396,7 @@ namespace OpenRA.Mods.Common.Widgets this.editorActorLayer = editorActorLayer; this.actor = actor; - Text = FluentProvider.GetString(RemovedActor, "name", actor.Info.Name, "id", actor.ID); + Text = FluentProvider.GetMessage(RemovedActor, "name", actor.Info.Name, "id", actor.ID); } public void Execute() @@ -464,7 +464,7 @@ namespace OpenRA.Mods.Common.Widgets to = worldRenderer.Viewport.ViewToWorld(pixelTo + pixelOffset) + cellOffset; layer.MoveActor(actor, to); - Text = FluentProvider.GetString(MovedActor, "id", actor.ID, "x1", from.X, "y1", from.Y, "x2", to.X, "y2", to.Y); + Text = FluentProvider.GetMessage(MovedActor, "id", actor.ID, "x1", from.X, "y1", from.Y, "x2", to.X, "y2", to.Y); } } @@ -485,7 +485,7 @@ namespace OpenRA.Mods.Common.Widgets this.resourceLayer = resourceLayer; this.cell = cell; - Text = FluentProvider.GetString(RemovedResource, "type", resourceType); + Text = FluentProvider.GetMessage(RemovedResource, "type", resourceType); } public void Execute() diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorMarkerLayerBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorMarkerLayerBrush.cs index 3826b183e6..d3e9177027 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorMarkerLayerBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorMarkerLayerBrush.cs @@ -150,9 +150,9 @@ namespace OpenRA.Mods.Common.Widgets } if (type != null) - Text = FluentProvider.GetString(AddedMarkerTiles, "amount", paintTiles.Count, "type", type); + Text = FluentProvider.GetMessage(AddedMarkerTiles, "amount", paintTiles.Count, "type", type); else - Text = FluentProvider.GetString(RemovedMarkerTiles, "amount", paintTiles.Count); + Text = FluentProvider.GetMessage(RemovedMarkerTiles, "amount", paintTiles.Count); } } @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Widgets tiles = new HashSet(markerLayerOverlay.Tiles[tile]); - Text = FluentProvider.GetString(ClearedSelectedMarkerTiles, "amount", tiles.Count, "type", tile); + Text = FluentProvider.GetMessage(ClearedSelectedMarkerTiles, "amount", tiles.Count, "type", tile); } public void Execute() @@ -213,7 +213,7 @@ namespace OpenRA.Mods.Common.Widgets var allTilesCount = tiles.Values.Select(x => x.Count).Sum(); - Text = FluentProvider.GetString(ClearedAllMarkerTiles, "amount", allTilesCount); + Text = FluentProvider.GetMessage(ClearedAllMarkerTiles, "amount", allTilesCount); } public void Execute() diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs index 5e21239c18..b4480ce7ce 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs @@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Widgets resourceLayer.ClearResources(resourceCell.Cell); resourceLayer.AddResource(resourceCell.NewResourceType, resourceCell.Cell, resourceLayer.GetMaxDensity(resourceCell.NewResourceType)); cellResources.Add(resourceCell); - Text = FluentProvider.GetString(AddedResource, "amount", cellResources.Count, "type", resourceType); + Text = FluentProvider.GetMessage(AddedResource, "amount", cellResources.Count, "type", resourceType); } } } diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs index 9ac43904a2..38281515f9 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs @@ -192,7 +192,7 @@ namespace OpenRA.Mods.Common.Widgets var terrainInfo = (ITemplatedTerrainInfo)map.Rules.TerrainInfo; terrainTemplate = terrainInfo.Templates[template]; - Text = FluentProvider.GetString(AddedTile, "id", terrainTemplate.Id); + Text = FluentProvider.GetMessage(AddedTile, "id", terrainTemplate.Id); } public void Execute() @@ -264,7 +264,7 @@ namespace OpenRA.Mods.Common.Widgets var terrainInfo = (ITemplatedTerrainInfo)map.Rules.TerrainInfo; terrainTemplate = terrainInfo.Templates[template]; - Text = FluentProvider.GetString(FilledTile, "id", terrainTemplate.Id); + Text = FluentProvider.GetMessage(FilledTile, "id", terrainTemplate.Id); } public void Execute() diff --git a/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs index 98b06b6e43..5cf477c65c 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/CopySourceAction.cs @@ -44,10 +44,10 @@ namespace OpenRA.Mods.Common.Installer Action onProgress = null; if (length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(FluentProvider.GetString(InstallFromSourceLogic.CopyingFilename, + updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.CopyingFilename, "filename", displayFilename)); else - onProgress = b => updateMessage(FluentProvider.GetString(InstallFromSourceLogic.CopyingFilenameProgress, + onProgress = b => updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.CopyingFilenameProgress, "filename", displayFilename, "progress", 100 * b / length)); diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs index 252d4521d0..7d10ff6ad1 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractBlastSourceAction.cs @@ -68,10 +68,10 @@ namespace OpenRA.Mods.Common.Installer Action onProgress = null; if (length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(FluentProvider.GetString(InstallFromSourceLogic.Extracting, + updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.Extracting, "filename", displayFilename)); else - onProgress = b => updateMessage(FluentProvider.GetString(InstallFromSourceLogic.ExtractingProgress, + onProgress = b => updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.ExtractingProgress, "filename", displayFilename, "progress", 100 * b / length)); diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs index 004f98015d..c8344ecfa7 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractIscabSourceAction.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Installer { Log.Write("install", $"Extracting {sourcePath} -> {targetPath}"); var displayFilename = Path.GetFileName(Path.GetFileName(targetPath)); - void OnProgress(int percent) => updateMessage(FluentProvider.GetString( + void OnProgress(int percent) => updateMessage(FluentProvider.GetMessage( InstallFromSourceLogic.ExtractingProgress, "filename", displayFilename, "progress", percent)); reader.ExtractFile(node.Value.Value, target, OnProgress); diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs index 6bc940fe79..3f7d297e71 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractMscabSourceAction.cs @@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Installer { Log.Write("install", $"Extracting {sourcePath} -> {targetPath}"); var displayFilename = Path.GetFileName(Path.GetFileName(targetPath)); - void OnProgress(int percent) => updateMessage(FluentProvider.GetString(InstallFromSourceLogic.ExtractingProgress, + void OnProgress(int percent) => updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.ExtractingProgress, "filename", displayFilename, "progress", percent)); reader.ExtractFile(node.Value.Value, target, OnProgress); diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs index e4b14a00a5..61341ce4dd 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractRawSourceAction.cs @@ -61,10 +61,10 @@ namespace OpenRA.Mods.Common.Installer Action onProgress = null; if (length < InstallFromSourceLogic.ShowPercentageThreshold) - updateMessage(FluentProvider.GetString(InstallFromSourceLogic.Extracting, + updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.Extracting, "filename", displayFilename)); else - onProgress = b => updateMessage(FluentProvider.GetString(InstallFromSourceLogic.ExtractingProgress, + onProgress = b => updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.ExtractingProgress, "filename", displayFilename, "progress", 100 * b / length)); diff --git a/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs b/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs index 3d700185d2..0529627a5b 100644 --- a/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs +++ b/OpenRA.Mods.Common/Installer/SourceActions/ExtractZipSourceAction.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Installer using (var targetStream = File.OpenWrite(targetPath)) sourceStream.CopyTo(targetStream); - updateMessage(FluentProvider.GetString(InstallFromSourceLogic.ExtractingProgress, + updateMessage(FluentProvider.GetMessage(InstallFromSourceLogic.ExtractingProgress, "filename", displayFilename, "progress", 100)); diff --git a/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs index 9c87505f23..f768293662 100644 --- a/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.LoadScreens { base.Init(modData, info); - messages = FluentProvider.GetString(Loading).Split(',').Select(x => x.Trim()).ToArray(); + messages = FluentProvider.GetMessage(Loading).Split(',').Select(x => x.Trim()).ToArray(); } public override void DisplayInner(Renderer r, Sheet s, int density) diff --git a/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs index 8ae845e8d3..cd1e50aac9 100644 --- a/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs @@ -56,10 +56,10 @@ namespace OpenRA.Mods.Common.Scripting.Global } } - return FluentProvider.GetString(key, argumentDictionary); + return FluentProvider.GetMessage(key, argumentDictionary); } - return FluentProvider.GetString(key); + return FluentProvider.GetMessage(key); } } } diff --git a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs index c25a3a8505..a7e4b2f55c 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs @@ -188,7 +188,7 @@ namespace OpenRA.Mods.Common.Scripting if (tooltip == null) return null; - return FluentProvider.GetString(tooltip.Info.Name); + return FluentProvider.GetMessage(tooltip.Info.Name); } } diff --git a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs index 35fab62eb1..1be21db357 100644 --- a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs @@ -275,7 +275,7 @@ namespace OpenRA.Mods.Common.Traits return; } - TextNotificationsManager.Debug(FluentProvider.GetString(CheatUsed, + TextNotificationsManager.Debug(FluentProvider.GetMessage(CheatUsed, "cheat", order.OrderString, "player", self.Owner.ResolvedPlayerName, "suffix", debugSuffix)); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index c6f248e19a..e39d76a40d 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -177,8 +177,8 @@ namespace OpenRA.Mods.Common.Traits Key = key; TotalTicks = info.ChargeInterval; remainingSubTicks = info.StartFullyCharged ? 0 : TotalTicks * 100; - Name = info.Name == null ? string.Empty : FluentProvider.GetString(info.Name); - Description = info.Description == null ? string.Empty : FluentProvider.GetString(info.Description); + Name = info.Name == null ? string.Empty : FluentProvider.GetMessage(info.Name); + Description = info.Description == null ? string.Empty : FluentProvider.GetMessage(info.Description); Manager = manager; } diff --git a/OpenRA.Mods.Common/Traits/Tooltip.cs b/OpenRA.Mods.Common/Traits/Tooltip.cs index cbf8029753..d985f12312 100644 --- a/OpenRA.Mods.Common/Traits/Tooltip.cs +++ b/OpenRA.Mods.Common/Traits/Tooltip.cs @@ -60,19 +60,19 @@ namespace OpenRA.Mods.Common.Traits public string TooltipForPlayerStance(PlayerRelationship relationship) { if (relationship == PlayerRelationship.None || !GenericVisibility.HasRelationship(relationship)) - return FluentProvider.GetString(Name); + return FluentProvider.GetMessage(Name); - var genericName = string.IsNullOrEmpty(GenericName) ? "" : FluentProvider.GetString(GenericName); + var genericName = string.IsNullOrEmpty(GenericName) ? "" : FluentProvider.GetMessage(GenericName); if (GenericStancePrefix) { if (!string.IsNullOrEmpty(AllyPrefix) && relationship == PlayerRelationship.Ally) - return FluentProvider.GetString(AllyPrefix) + " " + genericName; + return FluentProvider.GetMessage(AllyPrefix) + " " + genericName; if (!string.IsNullOrEmpty(NeutralPrefix) && relationship == PlayerRelationship.Neutral) - return FluentProvider.GetString(NeutralPrefix) + " " + genericName; + return FluentProvider.GetMessage(NeutralPrefix) + " " + genericName; if (!string.IsNullOrEmpty(EnemyPrefix) && relationship == PlayerRelationship.Enemy) - return FluentProvider.GetString(EnemyPrefix) + " " + genericName; + return FluentProvider.GetMessage(EnemyPrefix) + " " + genericName; } return genericName; diff --git a/OpenRA.Mods.Common/Traits/TooltipDescription.cs b/OpenRA.Mods.Common/Traits/TooltipDescription.cs index eec7802730..bdd6be8468 100644 --- a/OpenRA.Mods.Common/Traits/TooltipDescription.cs +++ b/OpenRA.Mods.Common/Traits/TooltipDescription.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits : base(info) { this.self = self; - TooltipText = FluentProvider.GetString(info.Description); + TooltipText = FluentProvider.GetMessage(info.Description); } public bool IsTooltipVisible(Player forPlayer) diff --git a/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs b/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs index 9052b48ff3..77f551938b 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs @@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits public OpenMapAction() { - Text = FluentProvider.GetString(Opened); + Text = FluentProvider.GetMessage(Opened); } public void Execute() diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 56c565c68d..7e85d70ac9 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public readonly ActorInfo Info; public string Tooltip => - (tooltip == null ? " < " + Info.Name + " >" : FluentProvider.GetString(tooltip.Name)) + "\n" + Owner.Name + " (" + Owner.Faction + ")" + (tooltip == null ? " < " + Info.Name + " >" : FluentProvider.GetMessage(tooltip.Name)) + "\n" + Owner.Name + " (" + Owner.Faction + ")" + "\nID: " + ID + "\nType: " + Info.Name; public string Type => reference.Type; diff --git a/OpenRA.Mods.Common/Traits/World/MapOptions.cs b/OpenRA.Mods.Common/Traits/World/MapOptions.cs index b9b2d5c0d4..629ef10f35 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.GetString(t.Name)); + .ToDictionary(t => t.Id, t => map.GetMessage(t.Name)); if (techLevels.Count > 0) yield return new LobbyOption(map, "techlevel", @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits techLevels, TechLevel, TechLevelDropdownLocked); var gameSpeeds = Game.ModData.Manifest.Get(); - var speeds = gameSpeeds.Speeds.ToDictionary(s => s.Key, s => FluentProvider.GetString(s.Value.Name)); + var speeds = gameSpeeds.Speeds.ToDictionary(s => s.Key, s => FluentProvider.GetMessage(s.Value.Name)); // NOTE: This is just exposing the UI, the backend logic for this option is hardcoded in World. yield return new LobbyOption(map, "gamespeed", diff --git a/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs b/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs index a80f8d6a46..32aeea4f4d 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceRenderer.cs @@ -273,7 +273,7 @@ namespace OpenRA.Mods.Common.Traits if (info == null) return null; - return FluentProvider.GetString(info.Name); + return FluentProvider.GetMessage(info.Name); } IEnumerable IResourceRenderer.ResourceTypes => Info.ResourceTypes.Keys; diff --git a/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnStartingUnits.cs index a4ae81667f..74ee1fb031 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.GetString(t.ClassName); + startingUnits[t.Class] = map.GetMessage(t.ClassName); if (startingUnits.Count > 0) yield return new LobbyOption(map, "startingunits", DropdownLabel, DropdownDescription, DropdownVisible, DropdownDisplayOrder, diff --git a/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs b/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs index 5c000f81ab..f5716857a8 100644 --- a/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs +++ b/OpenRA.Mods.Common/Traits/World/TimeLimitManager.cs @@ -88,9 +88,9 @@ namespace OpenRA.Mods.Common.Traits var timelimits = TimeLimitOptions.ToDictionary(m => m.ToStringInvariant(), m => { if (m == 0) - return FluentProvider.GetString(NoTimeLimit); + return FluentProvider.GetMessage(NoTimeLimit); else - return FluentProvider.GetString(TimeLimitOption, "minutes", m); + return FluentProvider.GetMessage(TimeLimitOption, "minutes", m); }); yield return new LobbyOption(map, "timelimit", TimeLimitLabel, TimeLimitDescription, TimeLimitDropdownVisible, TimeLimitDisplayOrder, @@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Traits countdownLabel.GetText = () => null; if (!info.SkipTimerExpiredNotification) - TextNotificationsManager.AddSystemLine(FluentProvider.GetString(TimeLimitExpired)); + TextNotificationsManager.AddSystemLine(FluentProvider.GetMessage(TimeLimitExpired)); } } } diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index 64c7a523e1..27d54759ba 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -77,9 +77,9 @@ namespace OpenRA.Mods.Common.Widgets { ModRules = modData.DefaultRules; - var textCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : ""); - var tooltipTextCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : ""); - var tooltipDescCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : ""); + var textCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : ""); + var tooltipTextCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : ""); + var tooltipDescCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : ""); GetText = () => textCache.Update(Text); GetColor = () => TextColor; diff --git a/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs b/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs index e64748e0d2..a2abd74568 100644 --- a/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs +++ b/OpenRA.Mods.Common/Widgets/ConfirmationDialogs.cs @@ -35,11 +35,11 @@ namespace OpenRA.Mods.Common.Widgets var cancelButton = prompt.GetOrNull("CANCEL_BUTTON"); var otherButton = prompt.GetOrNull("OTHER_BUTTON"); - var titleMessage = FluentProvider.GetString(title, titleArguments); + var titleMessage = FluentProvider.GetMessage(title, titleArguments); prompt.Get("PROMPT_TITLE").GetText = () => titleMessage; var headerTemplate = prompt.Get("PROMPT_TEXT"); - var textMessage = FluentProvider.GetString(text, textArguments); + var textMessage = FluentProvider.GetMessage(text, textArguments); var headerLines = textMessage.Split('\n'); var headerHeight = 0; foreach (var l in headerLines) @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets if (!string.IsNullOrEmpty(confirmText)) { - var confirmTextMessage = FluentProvider.GetString(confirmText); + var confirmTextMessage = FluentProvider.GetMessage(confirmText); confirmButton.GetText = () => confirmTextMessage; } } @@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Widgets if (!string.IsNullOrEmpty(cancelText)) { - var cancelTextMessage = FluentProvider.GetString(cancelText); + var cancelTextMessage = FluentProvider.GetMessage(cancelText); cancelButton.GetText = () => cancelTextMessage; } } @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Widgets if (!string.IsNullOrEmpty(otherText)) { - var otherTextMessage = FluentProvider.GetString(otherText); + var otherTextMessage = FluentProvider.GetMessage(otherText); otherButton.GetText = () => otherTextMessage; } } @@ -113,10 +113,10 @@ namespace OpenRA.Mods.Common.Widgets Func doValidate = null; ButtonWidget acceptButton = null, cancelButton = null; - var titleMessage = FluentProvider.GetString(title); + var titleMessage = FluentProvider.GetMessage(title); panel.Get("PROMPT_TITLE").GetText = () => titleMessage; - var promptMessage = FluentProvider.GetString(prompt); + var promptMessage = FluentProvider.GetMessage(prompt); panel.Get("PROMPT_TEXT").GetText = () => promptMessage; var input = panel.Get("INPUT_TEXT"); @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets acceptButton = panel.Get("ACCEPT_BUTTON"); if (!string.IsNullOrEmpty(acceptText)) { - var acceptTextMessage = FluentProvider.GetString(acceptText); + var acceptTextMessage = FluentProvider.GetMessage(acceptText); acceptButton.GetText = () => acceptTextMessage; } @@ -162,7 +162,7 @@ namespace OpenRA.Mods.Common.Widgets cancelButton = panel.Get("CANCEL_BUTTON"); if (!string.IsNullOrEmpty(cancelText)) { - var cancelTextMessage = FluentProvider.GetString(cancelText); + var cancelTextMessage = FluentProvider.GetMessage(cancelText); cancelButton.GetText = () => cancelTextMessage; } diff --git a/OpenRA.Mods.Common/Widgets/ImageWidget.cs b/OpenRA.Mods.Common/Widgets/ImageWidget.cs index baefd6d08a..8a7e795366 100644 --- a/OpenRA.Mods.Common/Widgets/ImageWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ImageWidget.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets { GetImageName = () => ImageName; GetImageCollection = () => ImageCollection; - var tooltipCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : ""); + var tooltipCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : ""); GetTooltipText = () => tooltipCache.Update(TooltipText); tooltipContainer = Exts.Lazy(() => Ui.Root.Get(TooltipContainer)); diff --git a/OpenRA.Mods.Common/Widgets/LabelWidget.cs b/OpenRA.Mods.Common/Widgets/LabelWidget.cs index 49b0c2ae3f..d24a24ec98 100644 --- a/OpenRA.Mods.Common/Widgets/LabelWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LabelWidget.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets [ObjectCreator.UseCtor] public LabelWidget(ModData modData) { - var textCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : ""); + var textCache = new CachedTransform(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : ""); GetText = () => textCache.Update(Text); GetColor = () => TextColor; GetContrastColorDark = () => ContrastColorDark; diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index 0bb50f141e..f5139e71e7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.modData = modData; panel = widget; - allPackages = FluentProvider.GetString(AllPackages); + allPackages = FluentProvider.GetMessage(AllPackages); var colorPickerPalettes = world.WorldActor.TraitsImplementing() .SelectMany(p => p.ColorPickerPaletteNames) @@ -238,7 +238,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (frameText != null) { var soundLength = new CachedTransform(p => - FluentProvider.GetString(LengthInSeconds, "length", Math.Round(p, 3))); + FluentProvider.GetMessage(LengthInSeconds, "length", Math.Round(p, 3))); frameText.GetText = () => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/BotTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/BotTooltipLogic.cs index 07ecc34c9d..a892c2ed70 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/BotTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/BotTooltipLogic.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var nameFont = Game.Renderer.Fonts[nameLabel.Font]; var controller = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.Index == client.BotControllerClientIndex); if (controller != null) - nameLabel.GetText = () => FluentProvider.GetString(BotManagedBy, "name", controller.Name); + nameLabel.GetText = () => FluentProvider.GetMessage(BotManagedBy, "name", controller.Name); widget.Bounds.Width = nameFont.Measure(nameLabel.GetText()).X + 2 * nameLabel.Bounds.Left; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs index 44379a9d3e..953edd7c28 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ConnectionLogic.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var panel = widget; panel.Get("ABORT_BUTTON").OnClick = () => { CloseWindow(); onAbort(); }; - var connectingDesc = FluentProvider.GetString(ConnectingToEndpoint, "endpoint", endpoint); + var connectingDesc = FluentProvider.GetMessage(ConnectingToEndpoint, "endpoint", endpoint); widget.Get("CONNECTING_DESC").GetText = () => connectingDesc; } @@ -130,17 +130,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic onRetry(pass); }; - var connectingDescText = FluentProvider.GetString(CouldNotConnectToTarget, "target", connection.Target); + var connectingDescText = FluentProvider.GetMessage(CouldNotConnectToTarget, "target", connection.Target); widget.Get("CONNECTING_DESC").GetText = () => connectingDescText; var connectionError = widget.Get("CONNECTION_ERROR"); var connectionErrorText = orderManager.ServerError != null - ? FluentProvider.GetString(orderManager.ServerError) - : connection.ErrorMessage ?? FluentProvider.GetString(UnknownError); + ? FluentProvider.GetMessage(orderManager.ServerError) + : connection.ErrorMessage ?? FluentProvider.GetMessage(UnknownError); connectionError.GetText = () => connectionErrorText; var panelTitle = widget.Get("TITLE"); - var panelTitleText = orderManager.AuthenticationFailed ? FluentProvider.GetString(PasswordRequired) : FluentProvider.GetString(ConnectionFailed); + var panelTitleText = orderManager.AuthenticationFailed ? FluentProvider.GetMessage(PasswordRequired) : FluentProvider.GetMessage(ConnectionFailed); panelTitle.GetText = () => panelTitleText; passwordField = panel.GetOrNull("PASSWORD"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs index 832cf652ef..71b43962f4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs @@ -94,8 +94,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic actorIDErrorLabel.IsVisible = () => actorIDStatus != ActorIDStatus.Normal; actorIDErrorLabel.GetText = () => actorIDStatus == ActorIDStatus.Duplicate || nextActorIDStatus == ActorIDStatus.Duplicate - ? FluentProvider.GetString(DuplicateActorId) - : FluentProvider.GetString(EnterActorId); + ? FluentProvider.GetMessage(DuplicateActorId) + : FluentProvider.GetMessage(EnterActorId); okButton.IsDisabled = () => !IsValid() || editActorPreview == null || !editActorPreview.IsDirty; okButton.OnClick = Save; @@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic initialActorID = actorIDField.Text = SelectedActor.ID; var font = Game.Renderer.Fonts[typeLabel.Font]; - var truncatedType = WidgetUtils.TruncateText(FluentProvider.GetString(SelectedActor.DescriptiveName), typeLabel.Bounds.Width, font); + var truncatedType = WidgetUtils.TruncateText(FluentProvider.GetMessage(SelectedActor.DescriptiveName), typeLabel.Bounds.Width, font); typeLabel.GetText = () => truncatedType; actorIDField.CursorPosition = SelectedActor.ID.Length; @@ -180,7 +180,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Add owner dropdown var ownerContainer = dropdownOptionTemplate.Clone(); - var owner = FluentProvider.GetString(Owner); + var owner = FluentProvider.GetMessage(Owner); ownerContainer.Get("LABEL").GetText = () => owner; var ownerDropdown = ownerContainer.Get("OPTION"); var selectedOwner = SelectedActor.Owner; @@ -454,7 +454,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { Actor = actor; this.handles = handles; - Text = FluentProvider.GetString(EditedActor, "name", actor.Info.Name, "id", actor.ID); + Text = FluentProvider.GetMessage(EditedActor, "name", actor.Info.Name, "id", actor.ID); } public void Execute() @@ -466,7 +466,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var after = Actor; if (before != after) - Text = FluentProvider.GetString(EditedActorId, "name", after.Info.Name, "old-id", before.ID, "new-id", after.ID); + Text = FluentProvider.GetMessage(EditedActorId, "name", after.Info.Name, "old-id", before.ID, "new-id", after.ID); } public void Do() diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs index a4d784c89f..6ee42c3531 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs @@ -112,12 +112,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic var tooltip = a.TraitInfos().FirstOrDefault(ti => ti.EnabledByDefault) as TooltipInfoBase ?? a.TraitInfos().FirstOrDefault(ti => ti.EnabledByDefault); - var actorType = FluentProvider.GetString(ActorTypeTooltip, "actorType", a.Name); + var actorType = FluentProvider.GetMessage(ActorTypeTooltip, "actorType", a.Name); var searchTerms = new List() { a.Name }; if (tooltip != null) { - var actorName = FluentProvider.GetString(tooltip.Name); + var actorName = FluentProvider.GetMessage(tooltip.Name); searchTerms.Add(actorName); allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), actorName + $"\n{actorType}")); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs index c4b67ad151..8e0838e380 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/CommonSelectorLogic.cs @@ -73,10 +73,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic Editor.DefaultBrush.SelectionChanged += HandleSelectionChanged; - var none = FluentProvider.GetString(None); - var searchResults = FluentProvider.GetString(SearchResults); - var all = FluentProvider.GetString(All); - var multiple = FluentProvider.GetString(Multiple); + var none = FluentProvider.GetMessage(None); + var searchResults = FluentProvider.GetMessage(SearchResults); + var all = FluentProvider.GetMessage(All); + var multiple = FluentProvider.GetMessage(Multiple); var categorySelector = widget.Get("CATEGORIES_DROPDOWN"); categorySelector.GetText = () => diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs index 28fb93e153..fb0ecf6253 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorSelectionLogic.cs @@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var resourceValueInRegion = editorResourceLayer.CalculateRegionValue(selectedRegion); var areaSelectionLabel = - $"{FluentProvider.GetString(AreaSelection)} ({DimensionsAsString(selectionSize)}) " + + $"{FluentProvider.GetMessage(AreaSelection)} ({DimensionsAsString(selectionSize)}) " + $"{PositionAsString(selectedRegion.TopLeft)} : {PositionAsString(selectedRegion.BottomRight)}"; AreaEditTitle.GetText = () => areaSelectionLabel; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapMarkerTilesLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapMarkerTilesLogic.cs index afc5fc54c6..9fffe410dd 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapMarkerTilesLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapMarkerTilesLogic.cs @@ -130,11 +130,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic switch (markerLayerTrait.MirrorMode) { case MarkerTileMirrorMode.None: - return FluentProvider.GetString(MarkerMirrorModeNone); + return FluentProvider.GetMessage(MarkerMirrorModeNone); case MarkerTileMirrorMode.Flip: - return FluentProvider.GetString(MarkerMirrorModeFlip); + return FluentProvider.GetMessage(MarkerMirrorModeFlip); case MarkerTileMirrorMode.Rotate: - return FluentProvider.GetString(MarkerMirrorModeRotate); + return FluentProvider.GetMessage(MarkerMirrorModeRotate); default: throw new ArgumentException($"Couldn't find fluent string for marker tile mirror mode '{markerLayerTrait.MirrorMode}'"); } @@ -221,11 +221,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic switch (mode) { case MarkerTileMirrorMode.None: - return FluentProvider.GetString(MarkerMirrorModeNone); + return FluentProvider.GetMessage(MarkerMirrorModeNone); case MarkerTileMirrorMode.Flip: - return FluentProvider.GetString(MarkerMirrorModeFlip); + return FluentProvider.GetMessage(MarkerMirrorModeFlip); case MarkerTileMirrorMode.Rotate: - return FluentProvider.GetString(MarkerMirrorModeRotate); + return FluentProvider.GetMessage(MarkerMirrorModeRotate); default: throw new ArgumentException($"Couldn't find fluent string for marker tile mirror mode '{mode}'"); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapToolsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapToolsLogic.cs index 262d122569..cd00937afb 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapToolsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapToolsLogic.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic toolPanels.Add(MapTool.MarkerTiles, markerToolPanel); toolsDropdown.OnMouseDown = _ => ShowToolsDropDown(toolsDropdown); - toolsDropdown.GetText = () => FluentProvider.GetString(toolNames[selectedTool]); + toolsDropdown.GetText = () => FluentProvider.GetMessage(toolNames[selectedTool]); toolsDropdown.Disabled = true; // TODO: Enable if new tools are added } @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic () => selectedTool == tool, () => SelectTool(tool)); - item.Get("LABEL").GetText = () => FluentProvider.GetString(toolNames[tool]); + item.Get("LABEL").GetText = () => FluentProvider.GetMessage(toolNames[tool]); return item; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs index ec8c2e4470..434f73429f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs @@ -171,7 +171,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var fileTypes = new Dictionary() { { MapFileType.OraMap, new MapFileTypeInfo { Extension = ".oramap", UiLabel = ".oramap" } }, - { MapFileType.Unpacked, new MapFileTypeInfo { Extension = "", UiLabel = $"({FluentProvider.GetString(Unpacked)})" } } + { MapFileType.Unpacked, new MapFileTypeInfo { Extension = "", UiLabel = $"({FluentProvider.GetMessage(Unpacked)})" } } }; var typeDropdown = widget.Get("TYPE_DROPDOWN"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/EncyclopediaLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/EncyclopediaLogic.cs index 3783e0a564..9c8c565be4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/EncyclopediaLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/EncyclopediaLogic.cs @@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var label = item.Get("TITLE"); var name = actor.TraitInfos().FirstOrDefault(info => info.EnabledByDefault)?.Name; if (!string.IsNullOrEmpty(name)) - WidgetUtils.TruncateLabelToTooltip(label, FluentProvider.GetString(name)); + WidgetUtils.TruncateLabelToTooltip(label, FluentProvider.GetMessage(name)); if (firstItem == null) { @@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var info = actor.TraitInfoOrDefault(); if (info != null && !string.IsNullOrEmpty(info.Description)) - text += WidgetUtils.WrapText(FluentProvider.GetString(info.Description) + "\n\n", descriptionLabel.Bounds.Width, descriptionFont); + text += WidgetUtils.WrapText(FluentProvider.GetMessage(info.Description) + "\n\n", descriptionLabel.Bounds.Width, descriptionFont); var height = descriptionFont.Measure(text).Y; descriptionLabel.GetText = () => text; @@ -175,7 +175,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var actorTooltip = actor.TraitInfos().FirstOrDefault(info => info.EnabledByDefault); if (actorTooltip != null) - return FluentProvider.GetString(actorTooltip.Name); + return FluentProvider.GetMessage(actorTooltip.Name); } return name; diff --git a/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs index f95c6dfe07..25183116b8 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/GameSaveBrowserLogic.cs @@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } catch (Exception ex) { - TextNotificationsManager.Debug(FluentProvider.GetString(SaveDeletionFailed, "savePath", savePath)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(SaveDeletionFailed, "savePath", savePath)); Log.Write("debug", ex.ToString()); return; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ArmyTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ArmyTooltipLogic.cs index aa57b5bfd2..c163f16796 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ArmyTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ArmyTooltipLogic.cs @@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic return; var tooltip = armyUnit.TooltipInfo; - var name = tooltip != null ? FluentProvider.GetString(tooltip.Name) : armyUnit.ActorInfo.Name; + var name = tooltip != null ? FluentProvider.GetMessage(tooltip.Name) : armyUnit.ActorInfo.Name; var buildable = armyUnit.BuildableInfo; nameLabel.GetText = () => name; var nameSize = font.Measure(name); - var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetString(buildable.Description); + var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetMessage(buildable.Description); descLabel.GetText = () => desc; var descSize = descFont.Measure(desc); descLabel.Bounds.Width = descSize.X; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs index 60838552bf..89cf47b115 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs @@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (tabButton != null) { - var tabButtonText = FluentProvider.GetString(label); + var tabButtonText = FluentProvider.GetMessage(label); tabButton.GetText = () => tabButtonText; tabButton.OnClick = () => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs index 7f41dc1d8d..e84d0415e1 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoObjectivesLogic.cs @@ -51,9 +51,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic } var missionStatus = widget.Get("MISSION_STATUS"); - var inProgress = FluentProvider.GetString(InProgress); - var accomplished = FluentProvider.GetString(Accomplished); - var failed = FluentProvider.GetString(Failed); + var inProgress = FluentProvider.GetMessage(InProgress); + var accomplished = FluentProvider.GetMessage(Accomplished); + var failed = FluentProvider.GetMessage(Failed); missionStatus.GetText = () => player.WinState == WinState.Undefined ? inProgress : player.WinState == WinState.Won ? accomplished : failed; missionStatus.GetColor = () => player.WinState == WinState.Undefined ? Color.White : diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 89892583fc..7a6abb3830 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -108,9 +108,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic checkbox.GetText = () => mo.Objectives[0].Description; } - var failed = FluentProvider.GetString(Failed); - var inProgress = FluentProvider.GetString(InProgress); - var accomplished = FluentProvider.GetString(Accomplished); + var failed = FluentProvider.GetMessage(Failed); + var inProgress = FluentProvider.GetMessage(InProgress); + var accomplished = FluentProvider.GetMessage(Accomplished); statusLabel.GetText = () => player.WinState == WinState.Won ? accomplished : player.WinState == WinState.Lost ? failed : inProgress; statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen : @@ -133,10 +133,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var teamTemplate = playerPanel.Get("TEAM_TEMPLATE"); var playerTemplate = playerPanel.Get("PLAYER_TEMPLATE"); var spectatorTemplate = playerPanel.Get("SPECTATOR_TEMPLATE"); - var unmuteTooltip = FluentProvider.GetString(Unmute); - var muteTooltip = FluentProvider.GetString(Mute); - var kickTooltip = FluentProvider.GetString(KickTooltip); - var voteKickTooltip = FluentProvider.GetString(KickVoteTooltip); + var unmuteTooltip = FluentProvider.GetMessage(Unmute); + var muteTooltip = FluentProvider.GetMessage(Mute); + var kickTooltip = FluentProvider.GetMessage(KickTooltip); + var voteKickTooltip = FluentProvider.GetMessage(KickVoteTooltip); playerPanel.RemoveChildren(); var teams = world.Players.Where(p => !p.NonCombatant && p.Playable) @@ -227,8 +227,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => false, () => { }); var team = t.Key > 0 - ? FluentProvider.GetString(TeamNumber, "team", t.Key) - : FluentProvider.GetString(NoTeam); + ? FluentProvider.GetMessage(TeamNumber, "team", t.Key) + : FluentProvider.GetMessage(NoTeam); teamHeader.Get("TEAM").GetText = () => team; var teamRating = teamHeader.Get("TEAM_SCORE"); var scoreCache = new CachedTransform(s => s.ToString(NumberFormatInfo.CurrentInfo)); @@ -257,13 +257,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic { flag.GetImageName = () => pp.Faction.InternalName; factionName = pp.Faction.Name != factionName - ? $"{FluentProvider.GetString(factionName)} ({FluentProvider.GetString(pp.Faction.Name)})" - : FluentProvider.GetString(pp.Faction.Name); + ? $"{FluentProvider.GetMessage(factionName)} ({FluentProvider.GetMessage(pp.Faction.Name)})" + : FluentProvider.GetMessage(pp.Faction.Name); } else { flag.GetImageName = () => pp.DisplayFaction.InternalName; - factionName = FluentProvider.GetString(factionName); + factionName = FluentProvider.GetMessage(factionName); } WidgetUtils.TruncateLabelToTooltip(item.Get("FACTION"), factionName); @@ -291,7 +291,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (spectators.Count > 0) { var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => false, () => { }); - var spectatorTeam = FluentProvider.GetString(Spectators); + var spectatorTeam = FluentProvider.GetMessage(Spectators); spectatorHeader.Get("TEAM").GetText = () => spectatorTeam; playerPanel.AddChild(spectatorHeader); @@ -310,7 +310,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic nameLabel.GetText = () => { - var suffix = client.State == Session.ClientState.Disconnected ? $" ({FluentProvider.GetString(Gone)})" : ""; + var suffix = client.State == Session.ClientState.Disconnected ? $" ({FluentProvider.GetMessage(Gone)})" : ""; return name.Update((client.Name, suffix)); }; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs index de3952b5a6..6506957a33 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs @@ -44,10 +44,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic bool Paused() => world.Paused || world.ReplayTimestep == 0; - var pausedText = FluentProvider.GetString(GameTimerLogic.Paused); - var maxSpeedText = FluentProvider.GetString(MaxSpeed); + var pausedText = FluentProvider.GetMessage(GameTimerLogic.Paused); + var maxSpeedText = FluentProvider.GetMessage(MaxSpeed); var speedText = new CachedTransform(p => - FluentProvider.GetString(Speed, "percentage", p)); + FluentProvider.GetMessage(Speed, "percentage", p)); if (timer != null) { @@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } var timerText = new CachedTransform(p => - FluentProvider.GetString(Complete, "percentage", p)); + FluentProvider.GetMessage(Complete, "percentage", p)); if (timer is LabelWithTooltipWidget timerTooltip) { var connection = orderManager.Connection as ReplayConnection; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs index a6b803bedb..241b6598c9 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic displayResources = playerResources.GetCashAndResources(); siloUsageTooltipCache = new CachedTransform<(int Resources, int Capacity), string>(x => - FluentProvider.GetString(SiloUsage, "usage", x.Resources, "capacity", x.Capacity)); + FluentProvider.GetMessage(SiloUsage, "usage", x.Resources, "capacity", x.Capacity)); cashLabel = widget.Get("CASH"); cashLabel.GetTooltipText = () => siloUsageTooltip; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs index 26a060b5d7..64a8192b03 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs @@ -70,10 +70,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var disableTeamChat = alwaysDisabled || (world.LocalPlayer != null && !players.Any(p => p.IsAlliedWith(world.LocalPlayer))); var teamChat = !disableTeamChat; - var teamMessage = FluentProvider.GetString(TeamChat); - var allMessage = FluentProvider.GetString(GeneralChat); + var teamMessage = FluentProvider.GetMessage(TeamChat); + var allMessage = FluentProvider.GetMessage(GeneralChat); - chatDisabled = FluentProvider.GetString(ChatDisabled); + chatDisabled = FluentProvider.GetMessage(ChatDisabled); // Only execute this once, the first time this widget is loaded if (TextNotificationsManager.MutedPlayers.Count == 0) @@ -194,7 +194,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return true; }; - chatAvailableIn = new CachedTransform(x => FluentProvider.GetString(ChatAvailability, "seconds", x)); + chatAvailableIn = new CachedTransform(x => FluentProvider.GetMessage(ChatAvailability, "seconds", x)); if (!isMenuChat) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs index d27c541404..1be0185cf0 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameMenuLogic.cs @@ -305,7 +305,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic button.Id = id; button.IsDisabled = () => leaving; - var text = FluentProvider.GetString(label); + var text = FluentProvider.GetMessage(label); button.GetText = () => text; buttonContainer.AddChild(button); buttons.Add(button); @@ -319,8 +319,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic return; var button = AddButton("ABORT_MISSION", world.IsGameOver - ? FluentProvider.GetString(Leave) - : FluentProvider.GetString(AbortMission)); + ? FluentProvider.GetMessage(Leave) + : FluentProvider.GetMessage(AbortMission)); button.OnClick = () => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerBarLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerBarLogic.cs index c6c9474a09..15bea18d3d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerBarLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerBarLogic.cs @@ -36,10 +36,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic powerBar.TooltipTextCached = new CachedTransform<(float Current, float Capacity), string>(usage => { var capacity = developerMode.UnlimitedPower ? - FluentProvider.GetString(Infinite) : + FluentProvider.GetMessage(Infinite) : powerManager.PowerProvided.ToString(NumberFormatInfo.CurrentInfo); - return FluentProvider.GetString(PowerUsage, "usage", usage.Current, "capacity", capacity); + return FluentProvider.GetMessage(PowerUsage, "usage", usage.Current, "capacity", capacity); }); powerBar.GetBarColor = () => diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs index 3537217066..aa5c975f43 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngamePowerCounterLogic.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var powerManager = world.LocalPlayer.PlayerActor.Trait(); var power = widget.Get("POWER"); var powerIcon = widget.Get("POWER_ICON"); - var unlimitedCapacity = FluentProvider.GetString(Infinite); + var unlimitedCapacity = FluentProvider.GetMessage(Infinite); powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal"; power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White; @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var tooltipTextCached = new CachedTransform<(int, int?), string>(((int Usage, int? Capacity) args) => { var capacity = args.Capacity == null ? unlimitedCapacity : args.Capacity.Value.ToString(NumberFormatInfo.CurrentInfo); - return FluentProvider.GetString(PowerUsage, + return FluentProvider.GetMessage(PowerUsage, "usage", args.Usage.ToString(NumberFormatInfo.CurrentInfo), "capacity", capacity); }); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameSiloBarLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameSiloBarLogic.cs index 1d10177124..8f63249d97 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameSiloBarLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameSiloBarLogic.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic siloBar.GetProvided = () => playerResources.ResourceCapacity; siloBar.GetUsed = () => playerResources.Resources; siloBar.TooltipTextCached = new CachedTransform<(float Current, float Capacity), string>( - usage => FluentProvider.GetString(SiloUsage, "usage", usage.Current, "capacity", usage.Capacity)); + usage => FluentProvider.GetMessage(SiloUsage, "usage", usage.Current, "capacity", usage.Capacity)); siloBar.GetBarColor = () => { if (playerResources.Resources == playerResources.ResourceCapacity) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs index a6c393b7f1..5acd8e931d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverShroudSelectorLogic.cs @@ -104,10 +104,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var groups = new Dictionary>(); - combined = new CameraOption(this, world, FluentProvider.GetString(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone")); - disableShroud = new CameraOption(this, world, FluentProvider.GetString(CameraOptionDisableShroud), null); + combined = new CameraOption(this, world, FluentProvider.GetMessage(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone")); + disableShroud = new CameraOption(this, world, FluentProvider.GetMessage(CameraOptionDisableShroud), null); if (!limitViews) - groups.Add(FluentProvider.GetString(CameraOptionOther), new List() { combined, disableShroud }); + groups.Add(FluentProvider.GetMessage(CameraOptionOther), new List() { combined, disableShroud }); teams = world.Players.Where(p => !p.NonCombatant && p.Playable) .Select(p => new CameraOption(this, p)) @@ -120,9 +120,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic foreach (var t in teams) { totalPlayers += t.Count(); - var label = noTeams ? FluentProvider.GetString(Players) : t.Key > 0 - ? FluentProvider.GetString(TeamNumber, "team", t.Key) - : FluentProvider.GetString(NoTeam); + var label = noTeams ? FluentProvider.GetMessage(Players) : t.Key > 0 + ? FluentProvider.GetMessage(TeamNumber, "team", t.Key) + : FluentProvider.GetMessage(NoTeam); groups.Add(label, t); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index 16cdce6a53..0a28dae96b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -155,10 +155,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var statsDropDown = widget.Get("STATS_DROPDOWN"); StatsDropDownOption CreateStatsOption(string title, ObserverStatsPanel panel, ScrollItemWidget template, Action a) { - title = FluentProvider.GetString(title); + title = FluentProvider.GetMessage(title); return new StatsDropDownOption { - Title = FluentProvider.GetString(title), + Title = FluentProvider.GetMessage(title), IsSelected = () => activePanel == panel, OnClick = () => { @@ -179,11 +179,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic { new() { - Title = FluentProvider.GetString(InformationNone), + Title = FluentProvider.GetMessage(InformationNone), IsSelected = () => activePanel == ObserverStatsPanel.None, OnClick = () => { - var informationNone = FluentProvider.GetString(InformationNone); + var informationNone = FluentProvider.GetMessage(InformationNone); statsDropDown.GetText = () => informationNone; playerStatsPanel.Visible = false; ClearStats(); @@ -286,8 +286,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic tt.IgnoreMouseOver = true; var teamLabel = tt.Get("TEAM"); - var teamText = team.Key > 0 ? FluentProvider.GetString(TeamNumber, "team", team.Key) - : FluentProvider.GetString(NoTeam); + var teamText = team.Key > 0 ? FluentProvider.GetMessage(TeamNumber, "team", team.Key) + : FluentProvider.GetMessage(NoTeam); teamLabel.GetText = () => teamText; tt.Bounds.Width = teamLabel.Bounds.Width = Game.Renderer.Fonts[tt.Font].Measure(teamText).X; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs index 70573fc0f7..c34f7a8102 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return; var tooltip = actor.TraitInfos().FirstOrDefault(info => info.EnabledByDefault); - var name = tooltip != null ? FluentProvider.GetString(tooltip.Name) : actor.Name; + var name = tooltip != null ? FluentProvider.GetMessage(tooltip.Name) : actor.Name; var buildable = actor.TraitInfo(); var cost = 0; @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var requiresSize = int2.Zero; if (prereqs.Count > 0) { - var requiresText = FluentProvider.GetString(Requires, "prerequisites", prereqs.JoinWith(", ")); + var requiresText = FluentProvider.GetMessage(Requires, "prerequisites", prereqs.JoinWith(", ")); requiresLabel.GetText = () => requiresText; requiresSize = requiresFont.Measure(requiresText); requiresLabel.Visible = true; @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic costLabel.GetColor = () => pr.GetCashAndResources() >= cost ? Color.White : Color.Red; var costSize = font.Measure(costText); - var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetString(buildable.Description); + var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetMessage(buildable.Description); descLabel.GetText = () => desc; var descSize = descFont.Measure(desc); descLabel.Bounds.Width = descSize.X; @@ -180,7 +180,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var actorTooltip = ai.TraitInfos().FirstOrDefault(info => info.EnabledByDefault); if (actorTooltip != null) - return FluentProvider.GetString(actorTooltip.Name); + return FluentProvider.GetMessage(actorTooltip.Name); } return a; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs index 397a83dff7..d0387aae4e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var extraHeightOnDouble = extras.Bounds.Y; var extraHeightOnSingle = extraHeightOnDouble - (doubleHeight - singleHeight); - var unrevealedTerrain = FluentProvider.GetString(UnrevealedTerrain); + var unrevealedTerrain = FluentProvider.GetMessage(UnrevealedTerrain); tooltipContainer.BeforeRender = () => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs index 06d2a70d4f..7f5166e791 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs @@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var status = new CachedTransform(s => WidgetUtils.TruncateText(s, statusLabel.Bounds.Width, statusFont)); statusLabel.GetText = () => status.Update(getStatusText()); - var text = FluentProvider.GetString(Downloading, "title", download.Title); + var text = FluentProvider.GetMessage(Downloading, "title", download.Title); panel.Get("TITLE").GetText = () => text; ShowDownloadDialog(); @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic void ShowDownloadDialog() { - getStatusText = () => FluentProvider.GetString(FetchingMirrorList); + getStatusText = () => FluentProvider.GetMessage(FetchingMirrorList); progressBar.Indeterminate = true; var retryButton = panel.Get("RETRY_BUTTON"); @@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var dataTotal = 0.0f; var mag = 0; var dataSuffix = ""; - var host = downloadHost ?? FluentProvider.GetString(UnknownHost); + var host = downloadHost ?? FluentProvider.GetMessage(UnknownHost); if (total < 0) { @@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic dataReceived = read / (float)(1L << (mag * 10)); dataSuffix = SizeSuffixes[mag]; - getStatusText = () => FluentProvider.GetString(DownloadingFrom, + getStatusText = () => FluentProvider.GetMessage(DownloadingFrom, "host", host, "received", $"{dataReceived:0.00}", "suffix", dataSuffix); @@ -133,7 +133,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic dataReceived = read / (float)(1L << (mag * 10)); dataSuffix = SizeSuffixes[mag]; - getStatusText = () => FluentProvider.GetString(DownloadingFromProgress, + getStatusText = () => FluentProvider.GetMessage(DownloadingFromProgress, "host", host, "received", $"{dataReceived:0.00}", "total", $"{dataTotal:0.00}", @@ -149,7 +149,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic void OnError(string s) => Game.RunAfterTick(() => { - var host = downloadHost ?? FluentProvider.GetString(UnknownHost); + var host = downloadHost ?? FluentProvider.GetMessage(UnknownHost); Log.Write("install", $"Download from {host} failed: " + s); progressBar.Indeterminate = false; @@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (response.StatusCode != HttpStatusCode.OK) { - OnError(FluentProvider.GetString(DownloadFailed)); + OnError(FluentProvider.GetMessage(DownloadFailed)); return; } @@ -199,7 +199,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Validate integrity if (!string.IsNullOrEmpty(download.SHA1)) { - getStatusText = () => FluentProvider.GetString(VerifyingArchive); + getStatusText = () => FluentProvider.GetMessage(VerifyingArchive); progressBar.Indeterminate = true; var archiveValid = false; @@ -221,13 +221,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (!archiveValid) { - OnError(FluentProvider.GetString(ArchiveValidationFailed)); + OnError(FluentProvider.GetMessage(ArchiveValidationFailed)); return; } } // Automatically extract - getStatusText = () => FluentProvider.GetString(Extracting); + getStatusText = () => FluentProvider.GetMessage(Extracting); progressBar.Indeterminate = true; var extracted = new List(); @@ -247,7 +247,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic continue; } - OnExtractProgress(FluentProvider.GetString(ExtractingEntry, "entry", kv.Value)); + OnExtractProgress(FluentProvider.GetMessage(ExtractingEntry, "entry", kv.Value)); Log.Write("install", "Extracting " + kv.Value); var targetPath = Platform.ResolvePath(kv.Key); Directory.CreateDirectory(Path.GetDirectoryName(targetPath)); @@ -278,7 +278,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic File.Delete(f); } - OnError(FluentProvider.GetString(ArchiveExtractionFailed)); + OnError(FluentProvider.GetMessage(ArchiveExtractionFailed)); } } catch (Exception e) @@ -311,7 +311,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { Log.Write("install", "Mirror selection failed with error:"); Log.Write("install", e.ToString()); - OnError(FluentProvider.GetString(MirrorSelectionFailed)); + OnError(FluentProvider.GetMessage(MirrorSelectionFailed)); } }); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs index 6b00a9eba3..8b230245f7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs @@ -161,15 +161,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic void DetectContentSources() { - var message = FluentProvider.GetString(DetectingSources); - ShowProgressbar(FluentProvider.GetString(CheckingSources), () => message); + var message = FluentProvider.GetMessage(DetectingSources); + ShowProgressbar(FluentProvider.GetMessage(CheckingSources), () => message); ShowBackRetry(DetectContentSources); new Task(() => { foreach (var kv in sources) { - message = FluentProvider.GetString(SearchingSourceFor, "title", kv.Value.Title); + message = FluentProvider.GetMessage(SearchingSourceFor, "title", kv.Value.Title); var sourceResolver = modData.ObjectCreator.CreateObject($"{kv.Value.Type.Value}SourceResolver"); @@ -189,7 +189,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { Game.RunAfterTick(() => { - ShowList(kv.Value, FluentProvider.GetString(ContentPackageInstallation)); + ShowList(kv.Value, FluentProvider.GetMessage(ContentPackageInstallation)); ShowContinueCancel(() => InstallFromSource(path, kv.Value)); }); @@ -221,14 +221,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic var options = new Dictionary>(); if (gameSources.Count != 0) - options.Add(FluentProvider.GetString(GameSources), gameSources); + options.Add(FluentProvider.GetMessage(GameSources), gameSources); if (digitalInstalls.Count != 0) - options.Add(FluentProvider.GetString(DigitalInstalls), digitalInstalls); + options.Add(FluentProvider.GetMessage(DigitalInstalls), digitalInstalls); Game.RunAfterTick(() => { - ShowList(FluentProvider.GetString(GameContentNotFound), FluentProvider.GetString(AlternativeContentSources), options); + ShowList(FluentProvider.GetMessage(GameContentNotFound), FluentProvider.GetMessage(AlternativeContentSources), options); ShowBackRetry(DetectContentSources); }); }).Start(); @@ -237,7 +237,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic void InstallFromSource(string path, ModContent.ModSource modSource) { var message = ""; - ShowProgressbar(FluentProvider.GetString(InstallingContent), () => message); + ShowProgressbar(FluentProvider.GetMessage(InstallingContent), () => message); ShowDisabledCancel(); new Task(() => @@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic Game.RunAfterTick(() => { - ShowMessage(FluentProvider.GetString(InstallationFailed), FluentProvider.GetString(CheckInstallLog)); + ShowMessage(FluentProvider.GetMessage(InstallationFailed), FluentProvider.GetMessage(CheckInstallLog)); ShowBackRetry(() => InstallFromSource(path, modSource)); }); } @@ -340,7 +340,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var containerWidget = (ContainerWidget)checkboxListTemplate.Clone(); var checkboxWidget = containerWidget.Get("PACKAGE_CHECKBOX"); - var title = FluentProvider.GetString(package.Title); + var title = FluentProvider.GetMessage(package.Title); checkboxWidget.GetText = () => title; checkboxWidget.IsDisabled = () => package.Required; checkboxWidget.IsChecked = () => selectedPackages[package.Identifier]; @@ -400,12 +400,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic void ShowContinueCancel(Action continueAction) { primaryButton.OnClick = continueAction; - var primaryButtonText = FluentProvider.GetString(Continue); + var primaryButtonText = FluentProvider.GetMessage(Continue); primaryButton.GetText = () => primaryButtonText; primaryButton.Visible = true; secondaryButton.OnClick = Ui.CloseWindow; - var secondaryButtonText = FluentProvider.GetString(Cancel); + var secondaryButtonText = FluentProvider.GetMessage(Cancel); secondaryButton.GetText = () => secondaryButtonText; secondaryButton.Visible = true; secondaryButton.Disabled = false; @@ -415,12 +415,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic void ShowBackRetry(Action retryAction) { primaryButton.OnClick = retryAction; - var primaryButtonText = FluentProvider.GetString(Retry); + var primaryButtonText = FluentProvider.GetMessage(Retry); primaryButton.GetText = () => primaryButtonText; primaryButton.Visible = true; secondaryButton.OnClick = Ui.CloseWindow; - var secondaryButtonText = FluentProvider.GetString(Back); + var secondaryButtonText = FluentProvider.GetMessage(Back); secondaryButton.GetText = () => secondaryButtonText; secondaryButton.Visible = true; secondaryButton.Disabled = false; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs index 3110011ff6..0bc6477446 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentLogic.cs @@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var container = template.Clone(); var titleWidget = container.Get("TITLE"); - var title = FluentProvider.GetString(p.Value.Title); + var title = FluentProvider.GetMessage(p.Value.Title); titleWidget.GetText = () => title; var requiredWidget = container.Get("REQUIRED"); @@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic requiresSourceWidget.IsVisible = () => !installed && !downloadEnabled; if (!isSourceAvailable) { - var manualInstall = FluentProvider.GetString(ManualInstall); + var manualInstall = FluentProvider.GetMessage(ManualInstall); requiresSourceWidget.GetText = () => manualInstall; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs index 7c28b6f34c..775625554c 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/ModContentPromptLogic.cs @@ -33,8 +33,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.content = content; CheckRequiredContentInstalled(); - var continueMessage = FluentProvider.GetString(Continue); - var quitMessage = FluentProvider.GetString(Quit); + var continueMessage = FluentProvider.GetMessage(Continue); + var quitMessage = FluentProvider.GetMessage(Quit); var panel = widget.Get("CONTENT_PROMPT_PANEL"); var headerLabel = panel.Get("HEADER_LABEL"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/IntroductionPromptLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/IntroductionPromptLogic.cs index c4ffaea3f4..a6b677d233 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/IntroductionPromptLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/IntroductionPromptLogic.cs @@ -43,8 +43,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic var ds = Game.Settings.Graphics; var gs = Game.Settings.Game; - classic = FluentProvider.GetString(Classic); - modern = FluentProvider.GetString(Modern); + classic = FluentProvider.GetMessage(Classic); + modern = FluentProvider.GetMessage(Modern); var escPressed = false; var nameTextfield = widget.Get("PLAYERNAME"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickClientLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickClientLogic.cs index 2f3fe901f4..e2fc938ecc 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickClientLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickClientLogic.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic [ObjectCreator.UseCtor] public KickClientLogic(Widget widget, string clientName, Action okPressed, Action cancelPressed) { - var kickMessage = FluentProvider.GetString(KickClient, "player", clientName); + var kickMessage = FluentProvider.GetMessage(KickClient, "player", clientName); widget.Get("TITLE").GetText = () => kickMessage; var tempBan = false; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickSpectatorsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickSpectatorsLogic.cs index f6326c83a0..db58659fff 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickSpectatorsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/KickSpectatorsLogic.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic [ObjectCreator.UseCtor] public KickSpectatorsLogic(Widget widget, int clientCount, Action okPressed, Action cancelPressed) { - var kickMessage = FluentProvider.GetString(KickSpectators, "count", clientCount); + var kickMessage = FluentProvider.GetMessage(KickSpectators, "count", clientCount); widget.Get("TEXT").GetText = () => kickMessage; widget.Get("OK_BUTTON").OnClick = () => diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 59a67f518e..9a53a0842e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -282,7 +282,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { new() { - Title = FluentProvider.GetString(Add), + Title = FluentProvider.GetMessage(Add), IsSelected = () => false, OnClick = () => { @@ -301,7 +301,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { botOptions.Add(new DropDownOption() { - Title = FluentProvider.GetString(Remove), + Title = FluentProvider.GetMessage(Remove), IsSelected = () => false, OnClick = () => { @@ -315,7 +315,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic }); } - options.Add(FluentProvider.GetString(ConfigureBots), botOptions); + options.Add(FluentProvider.GetMessage(ConfigureBots), botOptions); } var teamCount = (orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) + 1) / 2; @@ -323,7 +323,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var teamOptions = Enumerable.Range(2, teamCount - 1).Reverse().Select(d => new DropDownOption { - Title = FluentProvider.GetString(NumberTeams, "count", d), + Title = FluentProvider.GetMessage(NumberTeams, "count", d), IsSelected = () => false, OnClick = () => orderManager.IssueOrder(Order.Command($"assignteams {d}")) }).ToList(); @@ -332,7 +332,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { teamOptions.Add(new DropDownOption { - Title = FluentProvider.GetString(HumanVsBots), + Title = FluentProvider.GetMessage(HumanVsBots), IsSelected = () => false, OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 1")) }); @@ -340,12 +340,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic teamOptions.Add(new DropDownOption { - Title = FluentProvider.GetString(FreeForAll), + Title = FluentProvider.GetMessage(FreeForAll), IsSelected = () => false, OnClick = () => orderManager.IssueOrder(Order.Command("assignteams 0")) }); - options.Add(FluentProvider.GetString(ConfigureTeams), teamOptions); + options.Add(FluentProvider.GetMessage(ConfigureTeams), teamOptions); } ScrollItemWidget SetupItem(DropDownOption option, ScrollItemWidget template) @@ -483,7 +483,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (skirmishMode) { - var disconnectButtonText = FluentProvider.GetString(Back); + var disconnectButtonText = FluentProvider.GetMessage(Back); disconnectButton.GetText = () => disconnectButtonText; } @@ -497,8 +497,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic } var chatMode = lobby.Get("CHAT_MODE"); - var team = FluentProvider.GetString(TeamChat); - var all = FluentProvider.GetString(GeneralChat); + var team = FluentProvider.GetMessage(TeamChat); + var all = FluentProvider.GetMessage(GeneralChat); chatMode.GetText = () => teamChat ? team : all; chatMode.OnClick = () => teamChat ^= true; chatMode.IsDisabled = () => disableTeamChat || !chatEnabled; @@ -539,8 +539,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic chatTextField.OnEscKey = _ => chatTextField.YieldKeyboardFocus(); - chatAvailableIn = new CachedTransform(x => FluentProvider.GetString(ChatAvailability, "seconds", x)); - chatDisabled = FluentProvider.GetString(ChatDisabled); + chatAvailableIn = new CachedTransform(x => FluentProvider.GetMessage(ChatAvailability, "seconds", x)); + chatDisabled = FluentProvider.GetMessage(ChatDisabled); lobbyChatPanel = lobby.Get("CHAT_DISPLAY"); lobbyChatPanel.RemoveChildren(); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs index 611e9fd60d..ba491a453d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyOptionsLogic.cs @@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var getOptionLabel = new CachedTransform(id => { if (id == null || !option.Values.TryGetValue(id, out var value)) - return FluentProvider.GetString(NotAvailable); + return FluentProvider.GetMessage(NotAvailable); return value; }); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 1f206a9b0d..4438b16b2b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -56,12 +56,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client, OrderManager orderManager, MapPreview map, ModData modData) { - var open = FluentProvider.GetString(Open); - var closed = FluentProvider.GetString(Closed); + var open = FluentProvider.GetMessage(Open); + var closed = FluentProvider.GetMessage(Closed); var options = new Dictionary> { { - FluentProvider.GetString(Slot), new List + FluentProvider.GetMessage(Slot), new List { new(open, "slot_open " + slot.PlayerReference, () => !slot.Closed && client == null), new(closed, "slot_close " + slot.PlayerReference, () => slot.Closed) @@ -75,13 +75,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic foreach (var b in map.PlayerActorInfo.TraitInfos()) { var botController = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.IsAdmin); - bots.Add(new SlotDropDownOption(FluentProvider.GetString(b.Name), + bots.Add(new SlotDropDownOption(FluentProvider.GetMessage(b.Name), $"slot_bot {slot.PlayerReference} {botController.Index} {b.Type}", () => client != null && client.Bot == b.Type)); } } - options.Add(bots.Count > 0 ? FluentProvider.GetString(Bots) : FluentProvider.GetString(BotsDisabled), bots); + options.Add(bots.Count > 0 ? FluentProvider.GetMessage(Bots) : FluentProvider.GetMessage(BotsDisabled), bots); ScrollItemWidget SetupItem(SlotDropDownOption o, ScrollItemWidget itemTemplate) { @@ -222,14 +222,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic var faction = factions[factionId]; var label = item.Get("LABEL"); - var labelText = WidgetUtils.TruncateText(FluentProvider.GetString(faction.Name), label.Bounds.Width, Game.Renderer.Fonts[label.Font]); + var labelText = WidgetUtils.TruncateText(FluentProvider.GetMessage(faction.Name), label.Bounds.Width, Game.Renderer.Fonts[label.Font]); label.GetText = () => labelText; var flag = item.Get("FLAG"); flag.GetImageCollection = () => "flags"; flag.GetImageName = () => factionId; - var description = faction.Description != null ? FluentProvider.GetString(faction.Description) : null; + var description = faction.Description != null ? FluentProvider.GetMessage(faction.Description) : null; var (text, desc) = SplitOnFirstToken(description); item.GetTooltipText = () => text; item.GetTooltipDesc = () => desc; @@ -238,7 +238,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } var options = factions.Where(f => f.Value.Selectable).GroupBy(f => f.Value.Side) - .ToDictionary(g => g.Key != null ? FluentProvider.GetString(g.Key) : "", g => g.Select(f => FluentProvider.GetString(f.Key))); + .ToDictionary(g => g.Key != null ? FluentProvider.GetMessage(g.Key) : "", g => g.Select(f => FluentProvider.GetMessage(f.Key))); dropdown.ShowDropDown("FACTION_DROPDOWN_TEMPLATE", 154, options, SetupItem); } @@ -430,7 +430,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var label = parent.Get("NAME"); label.IsVisible = () => true; var font = Game.Renderer.Fonts[label.Font]; - var name = c.IsBot ? FluentProvider.GetString(c.Name) : c.Name; + var name = c.IsBot ? FluentProvider.GetMessage(c.Name) : c.Name; var text = WidgetUtils.TruncateText(name, label.Bounds.Width, font); label.GetText = () => text; @@ -448,10 +448,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic WidgetUtils.TruncateText(name, slot.Bounds.Width - slot.Bounds.Height - slot.LeftMargin - slot.RightMargin, Game.Renderer.Fonts[slot.Font])); - var closed = FluentProvider.GetString(Closed); - var open = FluentProvider.GetString(Open); + var closed = FluentProvider.GetMessage(Closed); + var open = FluentProvider.GetMessage(Open); slot.GetText = () => truncated.Update(c != null ? - c.IsBot ? FluentProvider.GetString(c.Name) : c.Name + c.IsBot ? FluentProvider.GetMessage(c.Name) : c.Name : s.Closed ? closed : open); slot.OnMouseDown = _ => ShowSlotDropDown(slot, s, c, orderManager, map, modData); @@ -465,8 +465,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic var name = parent.Get("NAME"); name.IsVisible = () => true; name.GetText = () => c != null ? c.Name : s.Closed - ? FluentProvider.GetString(Closed) - : FluentProvider.GetString(Open); + ? FluentProvider.GetMessage(Closed) + : FluentProvider.GetMessage(Open); // Ensure Slot selector (if present) is hidden HideChildWidget(parent, "SLOT_OPTIONS"); @@ -564,7 +564,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic dropdown.IsDisabled = () => s.LockFaction || orderManager.LocalClient.IsReady; dropdown.OnMouseDown = _ => ShowFactionDropDown(dropdown, c, orderManager, factions); - var description = factions[c.Faction].Description != null ? FluentProvider.GetString(factions[c.Faction].Description) : null; + var description = factions[c.Faction].Description != null ? FluentProvider.GetMessage(factions[c.Faction].Description) : null; var (text, desc) = SplitOnFirstToken(description); dropdown.GetTooltipText = () => text; dropdown.GetTooltipDesc = () => desc; @@ -577,7 +577,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var factionName = parent.Get("FACTIONNAME"); var font = Game.Renderer.Fonts[factionName.Font]; var truncated = new CachedTransform(clientFaction => - WidgetUtils.TruncateText(FluentProvider.GetString(factions[clientFaction].Name), factionName.Bounds.Width, font)); + WidgetUtils.TruncateText(FluentProvider.GetMessage(factions[clientFaction].Name), factionName.Bounds.Width, font)); factionName.GetText = () => truncated.Update(c.Faction); var factionFlag = parent.Get("FACTIONFLAG"); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs index d5007e470c..dfef5130e7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } var authorCache = new CachedTransform( - text => FluentProvider.GetString(CreatedBy, "author", text)); + text => FluentProvider.GetMessage(CreatedBy, "author", text)); Widget SetupAuthorAndMapType(Widget parent) { @@ -165,13 +165,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var (map, _) = getMap(); if (map.DownloadBytes == 0) - return FluentProvider.GetString(Connecting); + return FluentProvider.GetMessage(Connecting); // Server does not provide the total file length. if (map.DownloadPercentage == 0) - return FluentProvider.GetString(Downloading, "size", map.DownloadBytes / 1024); + return FluentProvider.GetMessage(Downloading, "size", map.DownloadBytes / 1024); - return FluentProvider.GetString(DownloadingPercentage, "size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage); + return FluentProvider.GetMessage(DownloadingPercentage, "size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage); }; return parent; @@ -198,8 +198,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic modData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { map.Uid }); }; - var retryInstall = FluentProvider.GetString(RetryInstall); - var retrySearch = FluentProvider.GetString(RetrySearch); + var retryInstall = FluentProvider.GetMessage(RetryInstall); + var retrySearch = FluentProvider.GetMessage(RetrySearch); retryButton.GetText = () => getMap().Map.Status == MapStatus.DownloadError ? retryInstall : retrySearch; var previewLarge = SetupMapPreview(widget.Get("MAP_LARGE")); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs index 15ee162db7..43b121aac3 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs @@ -49,9 +49,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic var labelText = ""; string playerFaction = null; var playerTeam = -1; - teamMessage = new CachedTransform(t => FluentProvider.GetString(TeamNumber, "team", t)); - var disabledSpawn = FluentProvider.GetString(DisabledSpawn); - var availableSpawn = FluentProvider.GetString(AvailableSpawn); + teamMessage = new CachedTransform(t => FluentProvider.GetMessage(TeamNumber, "team", t)); + var disabledSpawn = FluentProvider.GetMessage(DisabledSpawn); + var availableSpawn = FluentProvider.GetMessage(AvailableSpawn); tooltipContainer.BeforeRender = () => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index 60f313df9b..89a59b9715 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -232,7 +232,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic newsPanel.RemoveChild(newsTemplate); newsStatus = newsPanel.Get("NEWS_STATUS"); - SetNewsStatus(FluentProvider.GetString(LoadingNews)); + SetNewsStatus(FluentProvider.GetMessage(LoadingNews)); } Game.OnRemoteDirectConnect += OnRemoteDirectConnect; @@ -334,7 +334,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic catch (Exception e) { Game.RunAfterTick(() => // run on the main thread - SetNewsStatus(FluentProvider.GetString(NewsRetrivalFailed, "message", e.Message))); + SetNewsStatus(FluentProvider.GetMessage(NewsRetrivalFailed, "message", e.Message))); } }); } @@ -405,7 +405,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } catch (Exception ex) { - SetNewsStatus(FluentProvider.GetString(NewsParsingFailed, "message", ex.Message)); + SetNewsStatus(FluentProvider.GetMessage(NewsParsingFailed, "message", ex.Message)); } return null; @@ -426,7 +426,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic titleLabel.GetText = () => item.Title; var authorDateTimeLabel = newsItem.Get("AUTHOR_DATETIME"); - var authorDateTime = FluentProvider.GetString(AuthorDateTime, + var authorDateTime = FluentProvider.GetMessage(AuthorDateTime, "author", item.Author, "datetime", item.DateTime.ToLocalTime().ToString(CultureInfo.CurrentCulture)); diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index aecb264818..79695d51f6 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.onSelect = onSelect; this.remoteMapPool = remoteMapPool; - allMaps = FluentProvider.GetString(AllMaps); + allMaps = FluentProvider.GetMessage(AllMaps); var approving = new Action(() => { @@ -205,9 +205,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic var remoteMapText = new CachedTransform<(int Searching, int Unavailable), string>(counts => { if (counts.Searching > 0) - return FluentProvider.GetString(MapSearchingCount, "count", counts.Searching); + return FluentProvider.GetMessage(MapSearchingCount, "count", counts.Searching); - return FluentProvider.GetString(MapUnavailableCount, "count", counts.Unavailable); + return FluentProvider.GetMessage(MapUnavailableCount, "count", counts.Unavailable); }); remoteMapLabel.IsVisible = () => remoteMapPool != null && (remoteSearching > 0 || remoteUnavailable > 0); @@ -359,7 +359,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var item = categories.FirstOrDefault(m => m.Category == category); if (item == default((string, int))) - item.Category = FluentProvider.GetString(NoMatches); + item.Category = FluentProvider.GetMessage(NoMatches); return ShowItem(item); }; @@ -372,14 +372,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (orderByDropdown == null) return; - var orderByPlayer = FluentProvider.GetString(OrderMapsByPlayers); + var orderByPlayer = FluentProvider.GetMessage(OrderMapsByPlayers); var orderByDict = new Dictionary>() { { orderByPlayer, m => m.PlayerCount }, - { FluentProvider.GetString(OrderMapsByTitle), null }, - { FluentProvider.GetString(OrderMapsByDate), m => -m.ModifiedDate.Ticks }, - { FluentProvider.GetString(OrderMapsBySize), m => m.Bounds.Width * m.Bounds.Height }, + { FluentProvider.GetMessage(OrderMapsByTitle), null }, + { FluentProvider.GetMessage(OrderMapsByDate), m => -m.ModifiedDate.Ticks }, + { FluentProvider.GetMessage(OrderMapsBySize), m => m.Bounds.Width * m.Bounds.Height }, }; orderByFunc = orderByDict[orderByPlayer]; @@ -458,23 +458,23 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (type != null) details = type + " "; - details += FluentProvider.GetString(Players, "players", preview.PlayerCount); + details += FluentProvider.GetMessage(Players, "players", preview.PlayerCount); detailsWidget.GetText = () => details; } var authorWidget = item.GetOrNull("AUTHOR"); if (authorWidget != null && !string.IsNullOrEmpty(preview.Author)) - WidgetUtils.TruncateLabelToTooltip(authorWidget, FluentProvider.GetString(CreatedBy, "author", preview.Author)); + WidgetUtils.TruncateLabelToTooltip(authorWidget, FluentProvider.GetMessage(CreatedBy, "author", preview.Author)); var sizeWidget = item.GetOrNull("SIZE"); if (sizeWidget != null) { var size = preview.Bounds.Width + "x" + preview.Bounds.Height; var numberPlayableCells = preview.Bounds.Width * preview.Bounds.Height; - if (numberPlayableCells >= 120 * 120) size += " " + FluentProvider.GetString(MapSizeHuge); - else if (numberPlayableCells >= 90 * 90) size += " " + FluentProvider.GetString(MapSizeLarge); - else if (numberPlayableCells >= 60 * 60) size += " " + FluentProvider.GetString(MapSizeMedium); - else size += " " + FluentProvider.GetString(MapSizeSmall); + if (numberPlayableCells >= 120 * 120) size += " " + FluentProvider.GetMessage(MapSizeHuge); + else if (numberPlayableCells >= 90 * 90) size += " " + FluentProvider.GetMessage(MapSizeLarge); + else if (numberPlayableCells >= 60 * 60) size += " " + FluentProvider.GetMessage(MapSizeMedium); + else size += " " + FluentProvider.GetMessage(MapSizeSmall); sizeWidget.GetText = () => size; } @@ -502,7 +502,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } catch (Exception ex) { - TextNotificationsManager.Debug(FluentProvider.GetString(MapDeletionFailed, "map", map)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(MapDeletionFailed, "map", map)); Log.Write("debug", ex.ToString()); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs index d4c017e0db..49cdd27161 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs @@ -385,7 +385,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (option.Values.TryGetValue(missionOptions[option.Id], out var value)) return value; - return FluentProvider.GetString(NotAvailable); + return FluentProvider.GetMessage(NotAvailable); }; if (option.Description != null) diff --git a/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs index 18393a655b..99b1134908 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic panel.Get("MUTE_LABEL").GetText = () => { if (Game.Settings.Sound.Mute) - return FluentProvider.GetString(SoundMuted); + return FluentProvider.GetMessage(SoundMuted); return ""; }; @@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic return $"{minutes:D2}:{seconds:D2} / {totalMinutes:D2}:{totalSeconds:D2}"; }; - var noSongPlaying = FluentProvider.GetString(NoSongPlaying); + var noSongPlaying = FluentProvider.GetMessage(NoSongPlaying); var musicTitle = panel.GetOrNull("TITLE_LABEL"); if (musicTitle != null) musicTitle.GetText = () => currentSong != null ? currentSong.Title : noSongPlaying; diff --git a/OpenRA.Mods.Common/Widgets/Logic/MuteHotkeyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MuteHotkeyLogic.cs index dfaddd1b16..033c7ba379 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MuteHotkeyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MuteHotkeyLogic.cs @@ -35,12 +35,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (Game.Settings.Sound.Mute) { Game.Sound.MuteAudio(); - TextNotificationsManager.AddFeedbackLine(FluentProvider.GetString(AudioMuted)); + TextNotificationsManager.AddFeedbackLine(FluentProvider.GetMessage(AudioMuted)); } else { Game.Sound.UnmuteAudio(); - TextNotificationsManager.AddFeedbackLine(FluentProvider.GetString(AudioUnmuted)); + TextNotificationsManager.AddFeedbackLine(FluentProvider.GetMessage(AudioUnmuted)); } return true; diff --git a/OpenRA.Mods.Common/Widgets/Logic/RegisteredProfileTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/RegisteredProfileTooltipLogic.cs index af8e7cc5cc..40bf5bf669 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/RegisteredProfileTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/RegisteredProfileTooltipLogic.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var profileWidth = 0; var maxProfileWidth = widget.Bounds.Width; - var messageText = FluentProvider.GetString(LoadingPlayerProfile); + var messageText = FluentProvider.GetMessage(LoadingPlayerProfile); var messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left; Task.Run(async () => @@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { if (profile == null) { - messageText = FluentProvider.GetString(LoadingPlayerProfileFailed); + messageText = FluentProvider.GetMessage(LoadingPlayerProfileFailed); messageWidth = messageFont.Measure(messageText).X + 2 * message.Bounds.Left; header.Bounds.Width = widget.Bounds.Width = messageWidth; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index 383eb7323e..01b09bbeb7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic }); var replayDuration = new CachedTransform(r => - FluentProvider.GetString(Duration, "time", WidgetUtils.FormatTimeSeconds((int)selectedReplay.GameInfo.Duration.TotalSeconds))); + FluentProvider.GetMessage(Duration, "time", WidgetUtils.FormatTimeSeconds((int)selectedReplay.GameInfo.Duration.TotalSeconds))); panel.Get("DURATION").GetText = () => replayDuration.Update(selectedReplay); SetupFilters(); @@ -234,8 +234,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic var options = new List<(GameType GameType, string Text)> { (GameType.Any, ddb.GetText()), - (GameType.Singleplayer, FluentProvider.GetString(Singleplayer)), - (GameType.Multiplayer, FluentProvider.GetString(Multiplayer)) + (GameType.Singleplayer, FluentProvider.GetMessage(Singleplayer)), + (GameType.Multiplayer, FluentProvider.GetMessage(Multiplayer)) }; var lookup = options.ToDictionary(kvp => kvp.GameType, kvp => kvp.Text); @@ -267,10 +267,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var options = new List<(DateType DateType, string Text)> { (DateType.Any, ddb.GetText()), - (DateType.Today, FluentProvider.GetString(Today)), - (DateType.LastWeek, FluentProvider.GetString(LastWeek)), - (DateType.LastFortnight, FluentProvider.GetString(LastFortnight)), - (DateType.LastMonth, FluentProvider.GetString(LastMonth)) + (DateType.Today, FluentProvider.GetMessage(Today)), + (DateType.LastWeek, FluentProvider.GetMessage(LastWeek)), + (DateType.LastFortnight, FluentProvider.GetMessage(LastFortnight)), + (DateType.LastMonth, FluentProvider.GetMessage(LastMonth)) }; var lookup = options.ToDictionary(kvp => kvp.DateType, kvp => kvp.Text); @@ -303,10 +303,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var options = new List<(DurationType DurationType, string Text)> { (DurationType.Any, ddb.GetText()), - (DurationType.VeryShort, FluentProvider.GetString(ReplayDurationVeryShort)), - (DurationType.Short, FluentProvider.GetString(ReplayDurationShort)), - (DurationType.Medium, FluentProvider.GetString(ReplayDurationMedium)), - (DurationType.Long, FluentProvider.GetString(ReplayDurationLong)) + (DurationType.VeryShort, FluentProvider.GetMessage(ReplayDurationVeryShort)), + (DurationType.Short, FluentProvider.GetMessage(ReplayDurationShort)), + (DurationType.Medium, FluentProvider.GetMessage(ReplayDurationMedium)), + (DurationType.Long, FluentProvider.GetMessage(ReplayDurationLong)) }; var lookup = options.ToDictionary(kvp => kvp.DurationType, kvp => kvp.Text); @@ -340,8 +340,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic var options = new List<(WinState WinState, string Text)> { (WinState.Undefined, ddb.GetText()), - (WinState.Lost, FluentProvider.GetString(Defeat)), - (WinState.Won, FluentProvider.GetString(Victory)) + (WinState.Lost, FluentProvider.GetMessage(Defeat)), + (WinState.Won, FluentProvider.GetMessage(Victory)) }; var lookup = options.ToDictionary(kvp => kvp.WinState, kvp => kvp.Text); @@ -446,7 +446,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic options.Insert(0, null); // no filter var anyText = ddb.GetText(); - ddb.GetText = () => string.IsNullOrEmpty(filter.Faction) ? anyText : FluentProvider.GetString(filter.Faction); + ddb.GetText = () => string.IsNullOrEmpty(filter.Faction) ? anyText : FluentProvider.GetMessage(filter.Faction); ddb.OnMouseDown = _ => { ScrollItemWidget SetupItem(string option, ScrollItemWidget tpl) @@ -455,7 +455,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic tpl, () => string.Equals(filter.Faction, option, StringComparison.CurrentCultureIgnoreCase), () => { filter.Faction = option; ApplyFilter(); }); - item.Get("LABEL").GetText = () => option != null ? FluentProvider.GetString(option) : anyText; + item.Get("LABEL").GetText = () => option != null ? FluentProvider.GetMessage(option) : anyText; return item; } @@ -584,7 +584,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } catch (Exception ex) { - TextNotificationsManager.Debug(FluentProvider.GetString(ReplayDeletionFailed, "file", replay.FilePath)); + TextNotificationsManager.Debug(FluentProvider.GetMessage(ReplayDeletionFailed, "file", replay.FilePath)); Log.Write("debug", ex.ToString()); return; } @@ -724,9 +724,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic var noTeams = players.Count == 1; foreach (var p in players) { - var label = noTeams ? FluentProvider.GetString(Players) : p.Key > 0 - ? FluentProvider.GetString(TeamNumber, "team", p.Key) - : FluentProvider.GetString(NoTeam); + var label = noTeams ? FluentProvider.GetMessage(Players) : p.Key > 0 + ? FluentProvider.GetMessage(TeamNumber, "team", p.Key) + : FluentProvider.GetMessage(NoTeam); teams.Add(label, p); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs index 5f6e75a488..85e17be189 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs @@ -170,15 +170,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (advertiseOnline) { - var noticesLabelAText = FluentProvider.GetString(InternetServerNatA) + " "; + var noticesLabelAText = FluentProvider.GetMessage(InternetServerNatA) + " "; noticesLabelA.GetText = () => noticesLabelAText; var aWidth = Game.Renderer.Fonts[noticesLabelA.Font].Measure(noticesLabelAText).X; noticesLabelA.Bounds.Width = aWidth; var noticesLabelBText = - Nat.Status == NatStatus.Enabled ? FluentProvider.GetString(InternetServerNatBenabled) : - Nat.Status == NatStatus.NotSupported ? FluentProvider.GetString(InternetServerNatBnotSupported) : - FluentProvider.GetString(InternetServerNatBdisabled); + Nat.Status == NatStatus.Enabled ? FluentProvider.GetMessage(InternetServerNatBenabled) : + Nat.Status == NatStatus.NotSupported ? FluentProvider.GetMessage(InternetServerNatBnotSupported) : + FluentProvider.GetMessage(InternetServerNatBdisabled); noticesLabelB.GetText = () => noticesLabelBText; noticesLabelB.TextColor = @@ -191,14 +191,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic noticesLabelB.Bounds.Width = bWidth; noticesLabelB.Visible = true; - var noticesLabelCText = FluentProvider.GetString(InternetServerNatC); + var noticesLabelCText = FluentProvider.GetMessage(InternetServerNatC); noticesLabelC.GetText = () => noticesLabelCText; noticesLabelC.Bounds.X = noticesLabelB.Bounds.Right; noticesLabelC.Visible = true; } else { - var noticesLabelAText = FluentProvider.GetString(LocalServer); + var noticesLabelAText = FluentProvider.GetMessage(LocalServer); noticesLabelA.GetText = () => noticesLabelAText; noticesLabelB.Visible = false; noticesLabelC.Visible = false; @@ -239,13 +239,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic } catch (System.Net.Sockets.SocketException e) { - var message = FluentProvider.GetString(ServerCreationFailedPrompt, "port", Game.Settings.Server.ListenPort); + var message = FluentProvider.GetMessage(ServerCreationFailedPrompt, "port", Game.Settings.Server.ListenPort); // AddressAlreadyInUse (WSAEADDRINUSE) if (e.ErrorCode == 10048) - message += "\n" + FluentProvider.GetString(ServerCreationFailedPortUsed); + message += "\n" + FluentProvider.GetMessage(ServerCreationFailedPortUsed); else - message += "\n" + FluentProvider.GetString(ServerCreationFailedError, "message", e.Message, "code", e.ErrorCode); + message += "\n" + FluentProvider.GetMessage(ServerCreationFailedError, "message", e.Message, "code", e.ErrorCode); ConfirmationDialogs.ButtonPrompt(modData, ServerCreationFailedTitle, message, onCancel: () => { }, cancelText: ServerCreationFailedCancel); diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs index ec1b5983dc..753e310cdf 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs @@ -145,8 +145,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { switch (searchStatus) { - case SearchStatus.Failed: return FluentProvider.GetString(SearchStatusFailed); - case SearchStatus.NoGames: return FluentProvider.GetString(SearchStatusNoGames); + case SearchStatus.Failed: return FluentProvider.GetMessage(SearchStatusFailed); + case SearchStatus.NoGames: return FluentProvider.GetMessage(SearchStatusNoGames); default: return ""; } } @@ -157,22 +157,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.modData = modData; this.onJoin = onJoin; - playing = FluentProvider.GetString(Playing); - waiting = FluentProvider.GetString(Waiting); + playing = FluentProvider.GetMessage(Playing); + waiting = FluentProvider.GetMessage(Waiting); - noServerSelected = FluentProvider.GetString(NoServerSelected); - mapStatusSearching = FluentProvider.GetString(MapStatusSearching); - mapClassificationUnknown = FluentProvider.GetString(MapClassificationUnknown); + noServerSelected = FluentProvider.GetMessage(NoServerSelected); + mapStatusSearching = FluentProvider.GetMessage(MapStatusSearching); + mapClassificationUnknown = FluentProvider.GetMessage(MapClassificationUnknown); - players = new CachedTransform(i => FluentProvider.GetString(PlayersLabel, "players", i)); - bots = new CachedTransform(i => FluentProvider.GetString(BotsLabel, "bots", i)); - spectators = new CachedTransform(i => FluentProvider.GetString(SpectatorsLabel, "spectators", i)); + players = new CachedTransform(i => FluentProvider.GetMessage(PlayersLabel, "players", i)); + bots = new CachedTransform(i => FluentProvider.GetMessage(BotsLabel, "bots", i)); + spectators = new CachedTransform(i => FluentProvider.GetMessage(SpectatorsLabel, "spectators", i)); - minutes = new CachedTransform(i => FluentProvider.GetString(InProgress, "minutes", i)); - passwordProtected = FluentProvider.GetString(PasswordProtected); - waitingForPlayers = FluentProvider.GetString(WaitingForPlayers); - serverShuttingDown = FluentProvider.GetString(ServerShuttingDown); - unknownServerState = FluentProvider.GetString(UnknownServerState); + minutes = new CachedTransform(i => FluentProvider.GetMessage(InProgress, "minutes", i)); + passwordProtected = FluentProvider.GetMessage(PasswordProtected); + waitingForPlayers = FluentProvider.GetMessage(WaitingForPlayers); + serverShuttingDown = FluentProvider.GetMessage(ServerShuttingDown); + unknownServerState = FluentProvider.GetMessage(UnknownServerState); services = modData.Manifest.Get(); @@ -318,7 +318,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var playersLabel = widget.GetOrNull("PLAYER_COUNT"); if (playersLabel != null) { - var playersText = new CachedTransform(p => FluentProvider.GetString(PlayersOnline, "players", p)); + var playersText = new CachedTransform(p => FluentProvider.GetMessage(PlayersOnline, "players", p)); playersLabel.IsVisible = () => playerCount != 0; playersLabel.GetText = () => playersText.Update(playerCount); } @@ -581,14 +581,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic var noTeams = players.Count == 1; foreach (var p in players) { - var label = noTeams ? FluentProvider.GetString(Players) : p.Key > 0 - ? FluentProvider.GetString(TeamNumber, "team", p.Key) - : FluentProvider.GetString(NoTeam); + var label = noTeams ? FluentProvider.GetMessage(Players) : p.Key > 0 + ? FluentProvider.GetMessage(TeamNumber, "team", p.Key) + : FluentProvider.GetMessage(NoTeam); teams.Add(label, p); } if (server.Clients.Any(c => c.IsSpectator)) - teams.Add(FluentProvider.GetString(Spectators), server.Clients.Where(c => c.IsSpectator)); + teams.Add(FluentProvider.GetMessage(Spectators), server.Clients.Where(c => c.IsSpectator)); var factionInfo = modData.DefaultRules.Actors[SystemActors.World].TraitInfos(); foreach (var kv in teams) @@ -765,7 +765,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (game.Clients.Length > 10) displayClients = displayClients .Take(9) - .Append(FluentProvider.GetString(OtherPlayers, "players", game.Clients.Length - 9)); + .Append(FluentProvider.GetMessage(OtherPlayers, "players", game.Clients.Length - 9)); var tooltip = displayClients.JoinWith("\n"); players.GetTooltipText = () => tooltip; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs index 0072f4b39d..c53840d660 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/DisplaySettingsLogic.cs @@ -106,17 +106,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.modData = modData; viewportSizes = modData.Manifest.Get(); - legacyFullscreen = FluentProvider.GetString(LegacyFullscreen); - fullscreen = FluentProvider.GetString(Fullscreen); + legacyFullscreen = FluentProvider.GetMessage(LegacyFullscreen); + fullscreen = FluentProvider.GetMessage(Fullscreen); registerPanel(panelID, label, InitPanel, ResetPanel); - showOnDamage = FluentProvider.GetString(ShowOnDamage); - alwaysShow = FluentProvider.GetString(AlwaysShow); + showOnDamage = FluentProvider.GetMessage(ShowOnDamage); + alwaysShow = FluentProvider.GetMessage(AlwaysShow); - automatic = FluentProvider.GetString(Automatic); - manual = FluentProvider.GetString(Manual); - disabled = FluentProvider.GetString(Disabled); + automatic = FluentProvider.GetMessage(Automatic); + manual = FluentProvider.GetMessage(Manual); + disabled = FluentProvider.GetMessage(Disabled); } public static string GetViewportSizeName(ModData modData, WorldViewport worldViewport) @@ -124,13 +124,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic switch (worldViewport) { case WorldViewport.Close: - return FluentProvider.GetString(Close); + return FluentProvider.GetMessage(Close); case WorldViewport.Medium: - return FluentProvider.GetString(Medium); + return FluentProvider.GetMessage(Medium); case WorldViewport.Far: - return FluentProvider.GetString(Far); + return FluentProvider.GetMessage(Far); case WorldViewport.Native: - return FluentProvider.GetString(Furthest); + return FluentProvider.GetMessage(Furthest); default: return ""; } @@ -166,12 +166,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic var windowModeDropdown = panel.Get("MODE_DROPDOWN"); windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds, scrollPanel); windowModeDropdown.GetText = () => ds.Mode == WindowMode.Windowed - ? FluentProvider.GetString(Windowed) + ? FluentProvider.GetMessage(Windowed) : ds.Mode == WindowMode.Fullscreen ? legacyFullscreen : fullscreen; var displaySelectionDropDown = panel.Get("DISPLAY_SELECTION_DROPDOWN"); displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds); - var displaySelectionLabel = new CachedTransform(i => FluentProvider.GetString(Display, "number", i + 1)); + var displaySelectionLabel = new CachedTransform(i => FluentProvider.GetMessage(Display, "number", i + 1)); displaySelectionDropDown.GetText = () => displaySelectionLabel.Update(ds.VideoDisplay); displaySelectionDropDown.IsDisabled = () => Game.Renderer.DisplayCount < 2; @@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var statusBarsDropDown = panel.Get("STATUS_BAR_DROPDOWN"); statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs); statusBarsDropDown.GetText = () => gs.StatusBars == StatusBarsType.Standard - ? FluentProvider.GetString(Standard) + ? FluentProvider.GetMessage(Standard) : gs.StatusBars == StatusBarsType.DamageShow ? showOnDamage : alwaysShow; @@ -242,7 +242,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var frameLimitGamespeedCheckbox = panel.Get("FRAME_LIMIT_GAMESPEED_CHECKBOX"); var frameLimitCheckbox = panel.Get("FRAME_LIMIT_CHECKBOX"); - var frameLimitLabel = new CachedTransform(fps => FluentProvider.GetString(FrameLimiter, "fps", fps)); + var frameLimitLabel = new CachedTransform(fps => FluentProvider.GetMessage(FrameLimiter, "fps", fps)); frameLimitCheckbox.GetText = () => frameLimitLabel.Update(ds.MaxFramerate); frameLimitCheckbox.IsDisabled = () => ds.CapFramerateToGameFps; @@ -350,9 +350,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = new Dictionary() { - { FluentProvider.GetString(Fullscreen), WindowMode.PseudoFullscreen }, - { FluentProvider.GetString(LegacyFullscreen), WindowMode.Fullscreen }, - { FluentProvider.GetString(Windowed), WindowMode.Windowed }, + { FluentProvider.GetMessage(Fullscreen), WindowMode.PseudoFullscreen }, + { FluentProvider.GetMessage(LegacyFullscreen), WindowMode.Fullscreen }, + { FluentProvider.GetMessage(Windowed), WindowMode.Windowed }, }; ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate) @@ -399,9 +399,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = new Dictionary() { - { FluentProvider.GetString(Standard), StatusBarsType.Standard }, - { FluentProvider.GetString(ShowOnDamage), StatusBarsType.DamageShow }, - { FluentProvider.GetString(AlwaysShow), StatusBarsType.AlwaysShow }, + { FluentProvider.GetMessage(Standard), StatusBarsType.Standard }, + { FluentProvider.GetMessage(ShowOnDamage), StatusBarsType.DamageShow }, + { FluentProvider.GetMessage(AlwaysShow), StatusBarsType.AlwaysShow }, }; ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate) @@ -454,9 +454,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = new Dictionary() { - { FluentProvider.GetString(Automatic), TargetLinesType.Automatic }, - { FluentProvider.GetString(Manual), TargetLinesType.Manual }, - { FluentProvider.GetString(Disabled), TargetLinesType.Disabled }, + { FluentProvider.GetMessage(Automatic), TargetLinesType.Automatic }, + { FluentProvider.GetMessage(Manual), TargetLinesType.Manual }, + { FluentProvider.GetMessage(Disabled), TargetLinesType.Disabled }, }; ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs index 8b766827a6..9a82b6f5b4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/HotkeysSettingsLogic.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic key.Id = hd.Name; key.IsVisible = () => true; - var desc = FluentProvider.GetString(hd.Description) + ":"; + var desc = FluentProvider.GetMessage(hd.Description) + ":"; key.Get("FUNCTION").GetText = () => desc; var remapButton = key.Get("HOTKEY"); @@ -196,7 +196,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic continue; var header = headerTemplate.Clone(); - var groupName = FluentProvider.GetString(hg.Key); + var groupName = FluentProvider.GetMessage(hg.Key); header.Get("LABEL").GetText = () => groupName; hotkeyList.AddChild(header); @@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var label = panel.Get("HOTKEY_LABEL"); var labelText = new CachedTransform( - hd => (hd != null ? FluentProvider.GetString(hd.Description) : "") + ":"); + hd => (hd != null ? FluentProvider.GetMessage(hd.Description) : "") + ":"); label.IsVisible = () => selectedHotkeyDefinition != null; label.GetText = () => labelText.Update(selectedHotkeyDefinition); @@ -235,10 +235,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic duplicateNotice.IsVisible = () => !isHotkeyValid; var duplicateNoticeText = new CachedTransform(hd => hd != null - ? FluentProvider.GetString( + ? FluentProvider.GetMessage( DuplicateNotice, - "key", FluentProvider.GetString(hd.Description), - "context", FluentProvider.GetString(hd.Contexts.First(c => selectedHotkeyDefinition.Contexts.Contains(c)))) + "key", FluentProvider.GetMessage(hd.Description), + "context", FluentProvider.GetMessage(hd.Contexts.First(c => selectedHotkeyDefinition.Contexts.Contains(c)))) : ""); duplicateNotice.GetText = () => duplicateNoticeText.Update(duplicateHotkeyDefinition); @@ -246,7 +246,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic originalNotice.TextColor = ChromeMetrics.Get("NoticeInfoColor"); originalNotice.IsVisible = () => isHotkeyValid && !isHotkeyDefault; var originalNoticeText = new CachedTransform(hd => - FluentProvider.GetString(OriginalNotice, "key", hd?.Default.DisplayString())); + FluentProvider.GetMessage(OriginalNotice, "key", hd?.Default.DisplayString())); originalNotice.GetText = () => originalNoticeText.Update(selectedHotkeyDefinition); var readonlyNotice = panel.Get("READONLY_NOTICE"); @@ -336,7 +336,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var filter = filterInput.Text; var isFilteredByName = string.IsNullOrWhiteSpace(filter) || - FluentProvider.GetString(hd.Description).Contains(filter, StringComparison.CurrentCultureIgnoreCase); + FluentProvider.GetMessage(hd.Description).Contains(filter, StringComparison.CurrentCultureIgnoreCase); var isFilteredByContext = currentContext == AnyContext || hd.Contexts.Contains(currentContext); return isFilteredByName && isFilteredByContext; @@ -367,7 +367,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (string.IsNullOrEmpty(context)) context = AnyContext; - return FluentProvider.GetString(context); + return FluentProvider.GetMessage(context); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Settings/InputSettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Settings/InputSettingsLogic.cs index 851f0a5d63..67cbad3f8b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Settings/InputSettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Settings/InputSettingsLogic.cs @@ -44,8 +44,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic [ObjectCreator.UseCtor] public InputSettingsLogic(Action>, Func> registerPanel, string panelID, string label) { - classic = FluentProvider.GetString(Classic); - modern = FluentProvider.GetString(Modern); + classic = FluentProvider.GetMessage(Classic); + modern = FluentProvider.GetMessage(Modern); registerPanel(panelID, label, InitPanel, ResetPanel); } @@ -148,8 +148,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = new Dictionary() { - { FluentProvider.GetString(Classic), true }, - { FluentProvider.GetString(Modern), false }, + { FluentProvider.GetMessage(Classic), true }, + { FluentProvider.GetMessage(Modern), false }, }; ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate) @@ -168,10 +168,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var options = new Dictionary() { - { FluentProvider.GetString(Disabled), MouseScrollType.Disabled }, - { FluentProvider.GetString(Standard), MouseScrollType.Standard }, - { FluentProvider.GetString(Inverted), MouseScrollType.Inverted }, - { FluentProvider.GetString(Joystick), MouseScrollType.Joystick }, + { FluentProvider.GetMessage(Disabled), MouseScrollType.Disabled }, + { FluentProvider.GetMessage(Standard), MouseScrollType.Standard }, + { FluentProvider.GetMessage(Inverted), MouseScrollType.Inverted }, + { FluentProvider.GetMessage(Joystick), MouseScrollType.Joystick }, }; ScrollItemWidget SetupItem(string o, ScrollItemWidget itemTemplate) diff --git a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs index 7d73dfede3..298eea063a 100644 --- a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets public SpawnOccupant(Session.Client client) { Color = client.Color; - PlayerName = client.IsBot ? FluentProvider.GetString(client.Name) : client.Name; + PlayerName = client.IsBot ? FluentProvider.GetMessage(client.Name) : client.Name; Team = client.Team; Faction = client.Faction; SpawnPoint = client.SpawnPoint; @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets public SpawnOccupant(GameInformation.Player player) { Color = player.Color; - PlayerName = player.IsBot ? FluentProvider.GetString(player.Name) : player.Name; + PlayerName = player.IsBot ? FluentProvider.GetMessage(player.Name) : player.Name; Team = player.Team; Faction = player.FactionId; SpawnPoint = player.SpawnPoint; @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets public SpawnOccupant(GameClient player, bool suppressFaction) { Color = player.Color; - PlayerName = player.IsBot ? FluentProvider.GetString(player.Name) : player.Name; + PlayerName = player.IsBot ? FluentProvider.GetMessage(player.Name) : player.Name; Team = player.Team; Faction = !suppressFaction ? player.Faction : null; SpawnPoint = player.SpawnPoint; diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index fef6d4440f..aec024f60f 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -178,9 +178,9 @@ namespace OpenRA.Mods.Common.Widgets Game.Renderer.Fonts.TryGetValue(SymbolsFont, out symbolFont); iconOffset = 0.5f * IconSize.ToFloat2() + IconSpriteOffset; - HoldText = FluentProvider.GetString(HoldText); + HoldText = FluentProvider.GetMessage(HoldText); holdOffset = iconOffset - overlayFont.Measure(HoldText) / 2; - ReadyText = FluentProvider.GetString(ReadyText); + ReadyText = FluentProvider.GetMessage(ReadyText); readyOffset = iconOffset - overlayFont.Measure(ReadyText) / 2; if (ChromeMetrics.TryGet("InfiniteOffset", out infiniteOffset)) diff --git a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs index 99c4e0ac58..73142e33d0 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Widgets { var self = p.Instances[0].Self; var time = WidgetUtils.FormatTime(p.RemainingTicks, false, self.World.Timestep); - var text = FluentProvider.GetString(Format, + var text = FluentProvider.GetMessage(Format, "player", self.Owner.ResolvedPlayerName, "support-power", p.Name, "time", time); diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index d683e64761..8337733ad1 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -112,9 +112,9 @@ namespace OpenRA.Mods.Common.Widgets iconOffset = 0.5f * IconSize.ToFloat2() + IconSpriteOffset; - HoldText = FluentProvider.GetString(HoldText); + HoldText = FluentProvider.GetMessage(HoldText); holdOffset = iconOffset - overlayFont.Measure(HoldText) / 2; - ReadyText = FluentProvider.GetString(ReadyText); + ReadyText = FluentProvider.GetMessage(ReadyText); readyOffset = iconOffset - overlayFont.Measure(ReadyText) / 2; clock = new Animation(worldRenderer.World, ClockAnimation); diff --git a/OpenRA.Mods.Common/Widgets/WidgetUtils.cs b/OpenRA.Mods.Common/Widgets/WidgetUtils.cs index 3ce05b5fbf..7fc9fde296 100644 --- a/OpenRA.Mods.Common/Widgets/WidgetUtils.cs +++ b/OpenRA.Mods.Common/Widgets/WidgetUtils.cs @@ -339,12 +339,12 @@ namespace OpenRA.Mods.Common.Widgets var suffix = ""; if (c.WinState == WinState.Won) - suffix = $" ({FluentProvider.GetString(Won)})"; + suffix = $" ({FluentProvider.GetMessage(Won)})"; else if (c.WinState == WinState.Lost) - suffix = $" ({FluentProvider.GetString(Lost)})"; + suffix = $" ({FluentProvider.GetMessage(Lost)})"; if (client.State == Session.ClientState.Disconnected) - suffix = $" ({FluentProvider.GetString(Gone)})"; + suffix = $" ({FluentProvider.GetMessage(Gone)})"; text += suffix; diff --git a/OpenRA.Test/OpenRA.Game/FluentTest.cs b/OpenRA.Test/OpenRA.Game/FluentTest.cs index 55517cfd22..de029cbdc0 100644 --- a/OpenRA.Test/OpenRA.Game/FluentTest.cs +++ b/OpenRA.Test/OpenRA.Game/FluentTest.cs @@ -28,9 +28,9 @@ label-players = {$player -> public void TestOne() { var bundle = new FluentBundle("en", pluralForms, e => Console.WriteLine(e.Message)); - var label = bundle.GetString("label-players", new object[] { "player", 1 }); + var label = bundle.GetMessage("label-players", new object[] { "player", 1 }); Assert.That("One player", Is.EqualTo(label)); - label = bundle.GetString("label-players", new object[] { "player", 2 }); + label = bundle.GetMessage("label-players", new object[] { "player", 2 }); Assert.That("2 players", Is.EqualTo(label)); } }