Rename Fluent *GetString methods to GetMessage.

This commit is contained in:
Paul Chote
2024-10-19 13:09:40 +01:00
committed by Gustas
parent 09063d23da
commit 67254e0b39
104 changed files with 396 additions and 396 deletions

View File

@@ -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));

View File

@@ -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
}
/// <summary>Should only be used by <see cref="MapPreview"/>.</summary>
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);
}
}
}

View File

@@ -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));
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -507,7 +507,7 @@ namespace OpenRA
if (!KeycodeFluentKeys.TryGetValue(k, out var fluentKey))
return k.ToString();
return FluentProvider.GetString(fluentKey);
return FluentProvider.GetMessage(fluentKey);
}
}
}

View File

@@ -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;
}
/// <summary>Describes what is to be loaded in order to run a mod.</summary>

View File

@@ -224,16 +224,16 @@ namespace OpenRA
public int DownloadPercentage { get; private set; }
/// <summary>
/// Functionality mirrors <see cref="FluentProvider.GetString"/>, except instead of using
/// Functionality mirrors <see cref="FluentProvider.GetMessage"/>, except instead of using
/// loaded <see cref="Map"/>'s fluent bundle as backup, we use this <see cref="MapPreview"/>'s.
/// </summary>
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;

View File

@@ -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);
}

View File

@@ -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())

View File

@@ -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)

View File

@@ -586,11 +586,11 @@ namespace OpenRA.Traits
IReadOnlyDictionary<string, string> 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;
}

View File

@@ -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)

View File

@@ -51,9 +51,9 @@ namespace OpenRA.Mods.Cnc.Installer
Action<long> 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));

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}
/// <summary>

View File

@@ -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()

View File

@@ -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<CPos>(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()

View File

@@ -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);
}
}
}

View File

@@ -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()

View File

@@ -44,10 +44,10 @@ namespace OpenRA.Mods.Common.Installer
Action<long> 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));

View File

@@ -68,10 +68,10 @@ namespace OpenRA.Mods.Common.Installer
Action<long> 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));

View File

@@ -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);

View File

@@ -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);

View File

@@ -61,10 +61,10 @@ namespace OpenRA.Mods.Common.Installer
Action<long> 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));

View File

@@ -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));

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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));

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
public OpenMapAction()
{
Text = FluentProvider.GetString(Opened);
Text = FluentProvider.GetMessage(Opened);
}
public void Execute()

View File

@@ -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;

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
ShortGameCheckboxVisible, ShortGameCheckboxDisplayOrder, ShortGameCheckboxEnabled, ShortGameCheckboxLocked);
var techLevels = map.PlayerActorInfo.TraitInfos<ProvidesTechPrerequisiteInfo>()
.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<GameSpeeds>();
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",

View File

@@ -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<string> IResourceRenderer.ResourceTypes => Info.ResourceTypes.Keys;

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
// Duplicate classes are defined for different race variants
foreach (var t in map.WorldActorInfo.TraitInfos<StartingUnitsInfo>())
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,

View File

@@ -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));
}
}
}

View File

@@ -77,9 +77,9 @@ namespace OpenRA.Mods.Common.Widgets
{
ModRules = modData.DefaultRules;
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var tooltipTextCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var tooltipDescCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : "");
var tooltipTextCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : "");
var tooltipDescCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : "");
GetText = () => textCache.Update(Text);
GetColor = () => TextColor;

View File

@@ -35,11 +35,11 @@ namespace OpenRA.Mods.Common.Widgets
var cancelButton = prompt.GetOrNull<ButtonWidget>("CANCEL_BUTTON");
var otherButton = prompt.GetOrNull<ButtonWidget>("OTHER_BUTTON");
var titleMessage = FluentProvider.GetString(title, titleArguments);
var titleMessage = FluentProvider.GetMessage(title, titleArguments);
prompt.Get<LabelWidget>("PROMPT_TITLE").GetText = () => titleMessage;
var headerTemplate = prompt.Get<LabelWidget>("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<bool> doValidate = null;
ButtonWidget acceptButton = null, cancelButton = null;
var titleMessage = FluentProvider.GetString(title);
var titleMessage = FluentProvider.GetMessage(title);
panel.Get<LabelWidget>("PROMPT_TITLE").GetText = () => titleMessage;
var promptMessage = FluentProvider.GetString(prompt);
var promptMessage = FluentProvider.GetMessage(prompt);
panel.Get<LabelWidget>("PROMPT_TEXT").GetText = () => promptMessage;
var input = panel.Get<TextFieldWidget>("INPUT_TEXT");
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets
acceptButton = panel.Get<ButtonWidget>("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<ButtonWidget>("CANCEL_BUTTON");
if (!string.IsNullOrEmpty(cancelText))
{
var cancelTextMessage = FluentProvider.GetString(cancelText);
var cancelTextMessage = FluentProvider.GetMessage(cancelText);
cancelButton.GetText = () => cancelTextMessage;
}

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets
{
GetImageName = () => ImageName;
GetImageCollection = () => ImageCollection;
var tooltipCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var tooltipCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : "");
GetTooltipText = () => tooltipCache.Update(TooltipText);
tooltipContainer = Exts.Lazy(() =>
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets
[ObjectCreator.UseCtor]
public LabelWidget(ModData modData)
{
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetString(s) : "");
var textCache = new CachedTransform<string, string>(s => !string.IsNullOrEmpty(s) ? FluentProvider.GetMessage(s) : "");
GetText = () => textCache.Update(Text);
GetColor = () => TextColor;
GetContrastColorDark = () => ContrastColorDark;

View File

@@ -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<IProvidesAssetBrowserColorPickerPalettes>()
.SelectMany(p => p.ColorPickerPaletteNames)
@@ -238,7 +238,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (frameText != null)
{
var soundLength = new CachedTransform<double, string>(p =>
FluentProvider.GetString(LengthInSeconds, "length", Math.Round(p, 3)));
FluentProvider.GetMessage(LengthInSeconds, "length", Math.Round(p, 3)));
frameText.GetText = () =>
{

View File

@@ -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;
}

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var panel = widget;
panel.Get<ButtonWidget>("ABORT_BUTTON").OnClick = () => { CloseWindow(); onAbort(); };
var connectingDesc = FluentProvider.GetString(ConnectingToEndpoint, "endpoint", endpoint);
var connectingDesc = FluentProvider.GetMessage(ConnectingToEndpoint, "endpoint", endpoint);
widget.Get<LabelWidget>("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<LabelWidget>("CONNECTING_DESC").GetText = () => connectingDescText;
var connectionError = widget.Get<LabelWidget>("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<LabelWidget>("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<PasswordFieldWidget>("PASSWORD");

View File

@@ -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<LabelWidget>("LABEL").GetText = () => owner;
var ownerDropdown = ownerContainer.Get<DropDownButtonWidget>("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()

View File

@@ -112,12 +112,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var tooltip = a.TraitInfos<EditorOnlyTooltipInfo>().FirstOrDefault(ti => ti.EnabledByDefault) as TooltipInfoBase
?? a.TraitInfos<TooltipInfo>().FirstOrDefault(ti => ti.EnabledByDefault);
var actorType = FluentProvider.GetString(ActorTypeTooltip, "actorType", a.Name);
var actorType = FluentProvider.GetMessage(ActorTypeTooltip, "actorType", a.Name);
var searchTerms = new List<string>() { 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}"));
}

View File

@@ -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<DropDownButtonWidget>("CATEGORIES_DROPDOWN");
categorySelector.GetText = () =>

View File

@@ -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;

View File

@@ -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}'");
}

View File

@@ -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<LabelWidget>("LABEL").GetText = () => FluentProvider.GetString(toolNames[tool]);
item.Get<LabelWidget>("LABEL").GetText = () => FluentProvider.GetMessage(toolNames[tool]);
return item;
}

View File

@@ -171,7 +171,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var fileTypes = new Dictionary<MapFileType, MapFileTypeInfo>()
{
{ 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<DropDownButtonWidget>("TYPE_DROPDOWN");

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var label = item.Get<LabelWithTooltipWidget>("TITLE");
var name = actor.TraitInfos<TooltipInfo>().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<EncyclopediaInfo>();
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<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
if (actorTooltip != null)
return FluentProvider.GetString(actorTooltip.Name);
return FluentProvider.GetMessage(actorTooltip.Name);
}
return name;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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 = () =>
{

View File

@@ -51,9 +51,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var missionStatus = widget.Get<LabelWidget>("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 :

View File

@@ -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<ScrollItemWidget>("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<LabelWidget>("TEAM").GetText = () => team;
var teamRating = teamHeader.Get<LabelWidget>("TEAM_SCORE");
var scoreCache = new CachedTransform<int, string>(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<LabelWithTooltipWidget>("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<LabelWidget>("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));
};

View File

@@ -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<int, string>(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<int, string>(p =>
FluentProvider.GetString(Complete, "percentage", p));
FluentProvider.GetMessage(Complete, "percentage", p));
if (timer is LabelWithTooltipWidget timerTooltip)
{
var connection = orderManager.Connection as ReplayConnection;

View File

@@ -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<LabelWithTooltipWidget>("CASH");
cashLabel.GetTooltipText = () => siloUsageTooltip;
}

View File

@@ -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<int, string>(x => FluentProvider.GetString(ChatAvailability, "seconds", x));
chatAvailableIn = new CachedTransform<int, string>(x => FluentProvider.GetMessage(ChatAvailability, "seconds", x));
if (!isMenuChat)
{

View File

@@ -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 = () =>
{

View File

@@ -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 = () =>

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
var power = widget.Get<LabelWithTooltipWidget>("POWER");
var powerIcon = widget.Get<ImageWidget>("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);
});

View File

@@ -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)

View File

@@ -104,10 +104,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
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<CameraOption>() { combined, disableShroud });
groups.Add(FluentProvider.GetMessage(CameraOptionOther), new List<CameraOption>() { 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);
}

View File

@@ -155,10 +155,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var statsDropDown = widget.Get<DropDownButtonWidget>("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<LabelWidget>("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;

View File

@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var tooltip = actor.TraitInfos<TooltipInfo>().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<BuildableInfo>();
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<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
if (actorTooltip != null)
return FluentProvider.GetString(actorTooltip.Name);
return FluentProvider.GetMessage(actorTooltip.Name);
}
return a;

View File

@@ -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 = () =>
{

View File

@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var status = new CachedTransform<string, string>(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<LabelWidget>("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<ButtonWidget>("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<string>();
@@ -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));
}
});
}

View File

@@ -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<ISourceResolver>($"{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<string, IEnumerable<string>>();
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<CheckboxWidget>("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;

View File

@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var container = template.Clone();
var titleWidget = container.Get<LabelWidget>("TITLE");
var title = FluentProvider.GetString(p.Value.Title);
var title = FluentProvider.GetMessage(p.Value.Title);
titleWidget.GetText = () => title;
var requiredWidget = container.Get<LabelWidget>("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;
}

View File

@@ -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<LabelWidget>("HEADER_LABEL");

View File

@@ -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<TextFieldWidget>("PLAYERNAME");

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ObjectCreator.UseCtor]
public KickClientLogic(Widget widget, string clientName, Action<bool> okPressed, Action cancelPressed)
{
var kickMessage = FluentProvider.GetString(KickClient, "player", clientName);
var kickMessage = FluentProvider.GetMessage(KickClient, "player", clientName);
widget.Get<LabelWidget>("TITLE").GetText = () => kickMessage;
var tempBan = false;

View File

@@ -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<LabelWidget>("TEXT").GetText = () => kickMessage;
widget.Get<ButtonWidget>("OK_BUTTON").OnClick = () =>

View File

@@ -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<ButtonWidget>("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<int, string>(x => FluentProvider.GetString(ChatAvailability, "seconds", x));
chatDisabled = FluentProvider.GetString(ChatDisabled);
chatAvailableIn = new CachedTransform<int, string>(x => FluentProvider.GetMessage(ChatAvailability, "seconds", x));
chatDisabled = FluentProvider.GetMessage(ChatDisabled);
lobbyChatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
lobbyChatPanel.RemoveChildren();

View File

@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var getOptionLabel = new CachedTransform<string, string>(id =>
{
if (id == null || !option.Values.TryGetValue(id, out var value))
return FluentProvider.GetString(NotAvailable);
return FluentProvider.GetMessage(NotAvailable);
return value;
});

View File

@@ -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<string, IEnumerable<SlotDropDownOption>>
{
{
FluentProvider.GetString(Slot), new List<SlotDropDownOption>
FluentProvider.GetMessage(Slot), new List<SlotDropDownOption>
{
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<IBotInfo>())
{
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<LabelWidget>("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<ImageWidget>("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<LabelWidget>("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<LabelWidget>("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<LabelWidget>("FACTIONNAME");
var font = Game.Renderer.Fonts[factionName.Font];
var truncated = new CachedTransform<string, string>(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<ImageWidget>("FACTIONFLAG");

View File

@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var authorCache = new CachedTransform<string, string>(
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"));

View File

@@ -49,9 +49,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var labelText = "";
string playerFaction = null;
var playerTeam = -1;
teamMessage = new CachedTransform<int, string>(t => FluentProvider.GetString(TeamNumber, "team", t));
var disabledSpawn = FluentProvider.GetString(DisabledSpawn);
var availableSpawn = FluentProvider.GetString(AvailableSpawn);
teamMessage = new CachedTransform<int, string>(t => FluentProvider.GetMessage(TeamNumber, "team", t));
var disabledSpawn = FluentProvider.GetMessage(DisabledSpawn);
var availableSpawn = FluentProvider.GetMessage(AvailableSpawn);
tooltipContainer.BeforeRender = () =>
{

View File

@@ -232,7 +232,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
newsPanel.RemoveChild(newsTemplate);
newsStatus = newsPanel.Get<LabelWidget>("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<LabelWidget>("AUTHOR_DATETIME");
var authorDateTime = FluentProvider.GetString(AuthorDateTime,
var authorDateTime = FluentProvider.GetMessage(AuthorDateTime,
"author", item.Author,
"datetime", item.DateTime.ToLocalTime().ToString(CultureInfo.CurrentCulture));

View File

@@ -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<string, Func<MapPreview, long>>()
{
{ 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<LabelWithTooltipWidget>("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<LabelWidget>("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());
}

View File

@@ -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)

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
panel.Get<LabelWidget>("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<LabelWidget>("TITLE_LABEL");
if (musicTitle != null)
musicTitle.GetText = () => currentSong != null ? currentSong.Title : noSongPlaying;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
});
var replayDuration = new CachedTransform<ReplayMetadata, string>(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<LabelWidget>("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<LabelWidget>("LABEL").GetText = () => option != null ? FluentProvider.GetString(option) : anyText;
item.Get<LabelWidget>("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);
}

View File

@@ -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);

View File

@@ -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<int, string>(i => FluentProvider.GetString(PlayersLabel, "players", i));
bots = new CachedTransform<int, string>(i => FluentProvider.GetString(BotsLabel, "bots", i));
spectators = new CachedTransform<int, string>(i => FluentProvider.GetString(SpectatorsLabel, "spectators", i));
players = new CachedTransform<int, string>(i => FluentProvider.GetMessage(PlayersLabel, "players", i));
bots = new CachedTransform<int, string>(i => FluentProvider.GetMessage(BotsLabel, "bots", i));
spectators = new CachedTransform<int, string>(i => FluentProvider.GetMessage(SpectatorsLabel, "spectators", i));
minutes = new CachedTransform<double, string>(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<double, string>(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<WebServices>();
@@ -318,7 +318,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var playersLabel = widget.GetOrNull<LabelWidget>("PLAYER_COUNT");
if (playersLabel != null)
{
var playersText = new CachedTransform<int, string>(p => FluentProvider.GetString(PlayersOnline, "players", p));
var playersText = new CachedTransform<int, string>(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<FactionInfo>();
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;

View File

@@ -106,17 +106,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.modData = modData;
viewportSizes = modData.Manifest.Get<WorldViewportSizes>();
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<DropDownButtonWidget>("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<DropDownButtonWidget>("DISPLAY_SELECTION_DROPDOWN");
displaySelectionDropDown.OnMouseDown = _ => ShowDisplaySelectionDropdown(displaySelectionDropDown, ds);
var displaySelectionLabel = new CachedTransform<int, string>(i => FluentProvider.GetString(Display, "number", i + 1));
var displaySelectionLabel = new CachedTransform<int, string>(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<DropDownButtonWidget>("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<CheckboxWidget>("FRAME_LIMIT_GAMESPEED_CHECKBOX");
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
var frameLimitLabel = new CachedTransform<int, string>(fps => FluentProvider.GetString(FrameLimiter, "fps", fps));
var frameLimitLabel = new CachedTransform<int, string>(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<string, WindowMode>()
{
{ 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<string, StatusBarsType>()
{
{ 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<string, TargetLinesType>()
{
{ 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)

View File

@@ -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<LabelWidget>("FUNCTION").GetText = () => desc;
var remapButton = key.Get<ButtonWidget>("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<LabelWidget>("LABEL").GetText = () => groupName;
hotkeyList.AddChild(header);
@@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var label = panel.Get<LabelWidget>("HOTKEY_LABEL");
var labelText = new CachedTransform<HotkeyDefinition, string>(
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<HotkeyDefinition, string>(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<Color>("NoticeInfoColor");
originalNotice.IsVisible = () => isHotkeyValid && !isHotkeyDefault;
var originalNoticeText = new CachedTransform<HotkeyDefinition, string>(hd =>
FluentProvider.GetString(OriginalNotice, "key", hd?.Default.DisplayString()));
FluentProvider.GetMessage(OriginalNotice, "key", hd?.Default.DisplayString()));
originalNotice.GetText = () => originalNoticeText.Update(selectedHotkeyDefinition);
var readonlyNotice = panel.Get<LabelWidget>("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);
}
}
}

View File

@@ -44,8 +44,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ObjectCreator.UseCtor]
public InputSettingsLogic(Action<string, string, Func<Widget, Func<bool>>, Func<Widget, Action>> 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<string, bool>()
{
{ 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<string, MouseScrollType>()
{
{ 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)

View File

@@ -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;

View File

@@ -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))

Some files were not shown because too many files have changed in this diff Show More