Rename Fluent-related code to be more precise.

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

View File

@@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var tooltip = armyUnit.TooltipInfo;
var name = tooltip != null ? TranslationProvider.GetString(tooltip.Name) : armyUnit.ActorInfo.Name;
var name = tooltip != null ? FluentProvider.GetString(tooltip.Name) : armyUnit.ActorInfo.Name;
var buildable = armyUnit.BuildableInfo;
nameLabel.GetText = () => name;
var nameSize = font.Measure(name);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : TranslationProvider.GetString(buildable.Description);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetString(buildable.Description);
descLabel.GetText = () => desc;
var descSize = descFont.Measure(desc);
descLabel.Bounds.Width = descSize.X;

View File

@@ -22,19 +22,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
sealed class GameInfoLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Objectives = "menu-game-info.objectives";
[TranslationReference]
[FluentReference]
const string Briefing = "menu-game-info.briefing";
[TranslationReference]
[FluentReference]
const string Options = "menu-game-info.options";
[TranslationReference]
[FluentReference]
const string Debug = "menu-game-info.debug";
[TranslationReference]
[FluentReference]
const string Chat = "menu-game-info.chat";
readonly World world;
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (tabButton != null)
{
var tabButtonText = TranslationProvider.GetString(label);
var tabButtonText = FluentProvider.GetString(label);
tabButton.GetText = () => tabButtonText;
tabButton.OnClick = () =>
{

View File

@@ -18,13 +18,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
sealed class GameInfoObjectivesLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string InProgress = "label-mission-in-progress";
[TranslationReference]
[FluentReference]
const string Accomplished = "label-mission-accomplished";
[TranslationReference]
[FluentReference]
const string Failed = "label-mission-failed";
readonly ContainerWidget template;
@@ -51,9 +51,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var missionStatus = widget.Get<LabelWidget>("MISSION_STATUS");
var inProgress = TranslationProvider.GetString(InProgress);
var accomplished = TranslationProvider.GetString(Accomplished);
var failed = TranslationProvider.GetString(Failed);
var inProgress = FluentProvider.GetString(InProgress);
var accomplished = FluentProvider.GetString(Accomplished);
var failed = FluentProvider.GetString(Failed);
missionStatus.GetText = () => player.WinState == WinState.Undefined ? inProgress :
player.WinState == WinState.Won ? accomplished : failed;
missionStatus.GetColor = () => player.WinState == WinState.Undefined ? Color.White :

View File

@@ -23,67 +23,67 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
sealed class GameInfoStatsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Unmute = "label-unmute-player";
[TranslationReference]
[FluentReference]
const string Mute = "label-mute-player";
[TranslationReference]
[FluentReference]
const string Accomplished = "label-mission-accomplished";
[TranslationReference]
[FluentReference]
const string Failed = "label-mission-failed";
[TranslationReference]
[FluentReference]
const string InProgress = "label-mission-in-progress";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
[TranslationReference]
[FluentReference]
const string Spectators = "label-spectators";
[TranslationReference]
[FluentReference]
const string Gone = "label-client-state-disconnected";
[TranslationReference]
[FluentReference]
const string KickTooltip = "button-kick-player";
[TranslationReference("player")]
[FluentReference("player")]
const string KickTitle = "dialog-kick.title";
[TranslationReference]
[FluentReference]
const string KickPrompt = "dialog-kick.prompt";
[TranslationReference]
[FluentReference]
const string KickAccept = "dialog-kick.confirm";
[TranslationReference]
[FluentReference]
const string KickVoteTooltip = "button-vote-kick-player";
[TranslationReference("player")]
[FluentReference("player")]
const string VoteKickTitle = "dialog-vote-kick.title";
[TranslationReference]
[FluentReference]
const string VoteKickPrompt = "dialog-vote-kick.prompt";
[TranslationReference("bots")]
[FluentReference("bots")]
const string VoteKickPromptBreakBots = "dialog-vote-kick.prompt-break-bots";
[TranslationReference]
[FluentReference]
const string VoteKickVoteStart = "dialog-vote-kick.vote-start";
[TranslationReference]
[FluentReference]
const string VoteKickVoteFor = "dialog-vote-kick.vote-for";
[TranslationReference]
[FluentReference]
const string VoteKickVoteAgainst = "dialog-vote-kick.vote-against";
[TranslationReference]
[FluentReference]
const string VoteKickVoteCancel = "dialog-vote-kick.vote-cancel";
[ObjectCreator.UseCtor]
@@ -108,9 +108,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
checkbox.GetText = () => mo.Objectives[0].Description;
}
var failed = TranslationProvider.GetString(Failed);
var inProgress = TranslationProvider.GetString(InProgress);
var accomplished = TranslationProvider.GetString(Accomplished);
var failed = FluentProvider.GetString(Failed);
var inProgress = FluentProvider.GetString(InProgress);
var accomplished = FluentProvider.GetString(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 = TranslationProvider.GetString(Unmute);
var muteTooltip = TranslationProvider.GetString(Mute);
var kickTooltip = TranslationProvider.GetString(KickTooltip);
var voteKickTooltip = TranslationProvider.GetString(KickVoteTooltip);
var unmuteTooltip = FluentProvider.GetString(Unmute);
var muteTooltip = FluentProvider.GetString(Mute);
var kickTooltip = FluentProvider.GetString(KickTooltip);
var voteKickTooltip = FluentProvider.GetString(KickVoteTooltip);
playerPanel.RemoveChildren();
var teams = world.Players.Where(p => !p.NonCombatant && p.Playable)
@@ -160,8 +160,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: VoteKickTitle,
text: botsCount > 0 ? VoteKickPromptBreakBots : VoteKickPrompt,
titleArguments: Translation.Arguments("player", client.Name),
textArguments: Translation.Arguments("bots", botsCount),
titleArguments: FluentBundle.Arguments("player", client.Name),
textArguments: FluentBundle.Arguments("bots", botsCount),
onConfirm: () =>
{
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
@@ -176,8 +176,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: VoteKickTitle,
text: botsCount > 0 ? VoteKickPromptBreakBots : VoteKickPrompt,
titleArguments: Translation.Arguments("player", client.Name),
textArguments: Translation.Arguments("bots", botsCount),
titleArguments: FluentBundle.Arguments("player", client.Name),
textArguments: FluentBundle.Arguments("bots", botsCount),
onConfirm: () =>
{
orderManager.IssueOrder(Order.Command($"vote_kick {client.Index} {true}"));
@@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: KickTitle,
text: KickPrompt,
titleArguments: Translation.Arguments("player", client.Name),
titleArguments: FluentBundle.Arguments("player", client.Name),
onConfirm: () =>
{
orderManager.IssueOrder(Order.Command($"kick {client.Index} {false}"));
@@ -227,8 +227,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => false, () => { });
var team = t.Key > 0
? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", t.Key))
: TranslationProvider.GetString(NoTeam);
? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", t.Key))
: FluentProvider.GetString(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
? $"{TranslationProvider.GetString(factionName)} ({TranslationProvider.GetString(pp.Faction.Name)})"
: TranslationProvider.GetString(pp.Faction.Name);
? $"{FluentProvider.GetString(factionName)} ({FluentProvider.GetString(pp.Faction.Name)})"
: FluentProvider.GetString(pp.Faction.Name);
}
else
{
flag.GetImageName = () => pp.DisplayFaction.InternalName;
factionName = TranslationProvider.GetString(factionName);
factionName = FluentProvider.GetString(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 = TranslationProvider.GetString(Spectators);
var spectatorTeam = FluentProvider.GetString(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 ? $" ({TranslationProvider.GetString(Gone)})" : "";
var suffix = client.State == Session.ClientState.Disconnected ? $" ({FluentProvider.GetString(Gone)})" : "";
return name.Update((client.Name, suffix));
};

View File

@@ -19,16 +19,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class GameTimerLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Paused = "label-paused";
[TranslationReference]
[FluentReference]
const string MaxSpeed = "label-max-speed";
[TranslationReference("percentage")]
[FluentReference("percentage")]
const string Speed = "label-replay-speed";
[TranslationReference("percentage")]
[FluentReference("percentage")]
const string Complete = "label-replay-complete";
[ObjectCreator.UseCtor]
@@ -44,10 +44,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
bool Paused() => world.Paused || world.ReplayTimestep == 0;
var pausedText = TranslationProvider.GetString(GameTimerLogic.Paused);
var maxSpeedText = TranslationProvider.GetString(MaxSpeed);
var pausedText = FluentProvider.GetString(GameTimerLogic.Paused);
var maxSpeedText = FluentProvider.GetString(MaxSpeed);
var speedText = new CachedTransform<int, string>(p =>
TranslationProvider.GetString(Speed, Translation.Arguments("percentage", p)));
FluentProvider.GetString(Speed, FluentBundle.Arguments("percentage", p)));
if (timer != null)
{
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var timerText = new CachedTransform<int, string>(p =>
TranslationProvider.GetString(Complete, Translation.Arguments("percentage", p)));
FluentProvider.GetString(Complete, FluentBundle.Arguments("percentage", p)));
if (timer is LabelWithTooltipWidget timerTooltip)
{
var connection = orderManager.Connection as ReplayConnection;

View File

@@ -27,10 +27,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossScreen = "selected-units-across-screen";
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossMap = "selected-units-across-map";
[ObjectCreator.UseCtor]
@@ -54,12 +54,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
// Check if selecting actors on the screen has selected new units
if (newSelection.Count > selection.Actors.Count)
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, FluentBundle.Arguments("units", newSelection.Count));
else
{
// Select actors in the world that have highest selection priority
newSelection = SelectionUtils.SelectActorsInWorld(world, null, eligiblePlayers).SubsetWithHighestSelectionPriority(e.Modifiers).ToList();
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, FluentBundle.Arguments("units", newSelection.Count));
}
selection.Combine(world, newSelection, false, false);

View File

@@ -29,13 +29,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
public readonly string ClickSound = ChromeMetrics.Get<string>("ClickSound");
public readonly string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
[TranslationReference]
[FluentReference]
const string NothingSelected = "nothing-selected";
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossScreen = "selected-units-across-screen";
[TranslationReference("units")]
[FluentReference("units")]
const string SelectedUnitsAcrossMap = "selected-units-across-map";
[ObjectCreator.UseCtor]
@@ -79,12 +79,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
// Check if selecting actors on the screen has selected new units
if (newSelection.Count > selection.Actors.Count)
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, FluentBundle.Arguments("units", newSelection.Count));
else
{
// Select actors in the world that have the same selection class as one of the already selected actors
newSelection = SelectionUtils.SelectActorsInWorld(world, selectedClasses, eligiblePlayers).ToList();
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, Translation.Arguments("units", newSelection.Count));
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossMap, FluentBundle.Arguments("units", newSelection.Count));
}
selection.Combine(world, newSelection, true, false);

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngameCashCounterLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string SiloUsage = "label-silo-usage";
const float DisplayFracPerFrame = .07f;
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
displayResources = playerResources.GetCashAndResources();
siloUsageTooltipCache = new CachedTransform<(int Resources, int Capacity), string>(x =>
TranslationProvider.GetString(SiloUsage, Translation.Arguments("usage", x.Resources, "capacity", x.Capacity)));
FluentProvider.GetString(SiloUsage, FluentBundle.Arguments("usage", x.Resources, "capacity", x.Capacity)));
cashLabel = widget.Get<LabelWithTooltipWidget>("CASH");
cashLabel.GetTooltipText = () => siloUsageTooltip;
}

View File

@@ -23,16 +23,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ChromeLogicArgsHotkeys("OpenTeamChat", "OpenGeneralChat")]
public class IngameChatLogic : ChromeLogic, INotificationHandler<TextNotification>
{
[TranslationReference]
[FluentReference]
const string TeamChat = "button-team-chat";
[TranslationReference]
[FluentReference]
const string GeneralChat = "button-general-chat";
[TranslationReference("seconds")]
[FluentReference("seconds")]
const string ChatAvailability = "label-chat-availability";
[TranslationReference]
[FluentReference]
const string ChatDisabled = "label-chat-disabled";
readonly Ruleset modRules;
@@ -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 = TranslationProvider.GetString(TeamChat);
var allMessage = TranslationProvider.GetString(GeneralChat);
var teamMessage = FluentProvider.GetString(TeamChat);
var allMessage = FluentProvider.GetString(GeneralChat);
chatDisabled = TranslationProvider.GetString(ChatDisabled);
chatDisabled = FluentProvider.GetString(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 => TranslationProvider.GetString(ChatAvailability, Translation.Arguments("seconds", x)));
chatAvailableIn = new CachedTransform<int, string>(x => FluentProvider.GetString(ChatAvailability, FluentBundle.Arguments("seconds", x)));
if (!isMenuChat)
{

View File

@@ -21,121 +21,121 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngameMenuLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string Leave = "menu-ingame.leave";
[TranslationReference]
[FluentReference]
const string AbortMission = "menu-ingame.abort";
[TranslationReference]
[FluentReference]
const string LeaveMissionTitle = "dialog-leave-mission.title";
[TranslationReference]
[FluentReference]
const string LeaveMissionPrompt = "dialog-leave-mission.prompt";
[TranslationReference]
[FluentReference]
const string LeaveMissionAccept = "dialog-leave-mission.confirm";
[TranslationReference]
[FluentReference]
const string LeaveMissionCancel = "dialog-leave-mission.cancel";
[TranslationReference]
[FluentReference]
const string RestartButton = "menu-ingame.restart";
[TranslationReference]
[FluentReference]
const string RestartMissionTitle = "dialog-restart-mission.title";
[TranslationReference]
[FluentReference]
const string RestartMissionPrompt = "dialog-restart-mission.prompt";
[TranslationReference]
[FluentReference]
const string RestartMissionAccept = "dialog-restart-mission.confirm";
[TranslationReference]
[FluentReference]
const string RestartMissionCancel = "dialog-restart-mission.cancel";
[TranslationReference]
[FluentReference]
const string SurrenderButton = "menu-ingame.surrender";
[TranslationReference]
[FluentReference]
const string SurrenderTitle = "dialog-surrender.title";
[TranslationReference]
[FluentReference]
const string SurrenderPrompt = "dialog-surrender.prompt";
[TranslationReference]
[FluentReference]
const string SurrenderAccept = "dialog-surrender.confirm";
[TranslationReference]
[FluentReference]
const string SurrenderCancel = "dialog-surrender.cancel";
[TranslationReference]
[FluentReference]
const string LoadGameButton = "menu-ingame.load-game";
[TranslationReference]
[FluentReference]
const string SaveGameButton = "menu-ingame.save-game";
[TranslationReference]
[FluentReference]
const string MusicButton = "menu-ingame.music";
[TranslationReference]
[FluentReference]
const string SettingsButton = "menu-ingame.settings";
[TranslationReference]
[FluentReference]
const string ReturnToMap = "menu-ingame.return-to-map";
[TranslationReference]
[FluentReference]
const string Resume = "menu-ingame.resume";
[TranslationReference]
[FluentReference]
const string SaveMapButton = "menu-ingame.save-map";
[TranslationReference]
[FluentReference]
const string ErrorMaxPlayerTitle = "dialog-error-max-player.title";
[TranslationReference("players", "max")]
[FluentReference("players", "max")]
const string ErrorMaxPlayerPrompt = "dialog-error-max-player.prompt";
[TranslationReference]
[FluentReference]
const string ErrorMaxPlayerAccept = "dialog-error-max-player.confirm";
[TranslationReference]
[FluentReference]
const string ExitMapButton = "menu-ingame.exit-map";
[TranslationReference]
[FluentReference]
const string ExitMapEditorTitle = "dialog-exit-map-editor.title";
[TranslationReference]
[FluentReference]
const string ExitMapEditorPromptUnsaved = "dialog-exit-map-editor.prompt-unsaved";
[TranslationReference]
[FluentReference]
const string ExitMapEditorPromptDeleted = "dialog-exit-map-editor.prompt-deleted";
[TranslationReference]
[FluentReference]
const string ExitMapEditorAnywayConfirm = "dialog-exit-map-editor.confirm-anyway";
[TranslationReference]
[FluentReference]
const string ExitMapEditorConfirm = "dialog-exit-map-editor.confirm";
[TranslationReference]
[FluentReference]
const string PlayMapWarningTitle = "dialog-play-map-warning.title";
[TranslationReference]
[FluentReference]
const string PlayMapWarningPrompt = "dialog-play-map-warning.prompt";
[TranslationReference]
[FluentReference]
const string PlayMapWarningCancel = "dialog-play-map-warning.cancel";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorTitle = "dialog-exit-to-map-editor.title";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorPrompt = "dialog-exit-to-map-editor.prompt";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorConfirm = "dialog-exit-to-map-editor.confirm";
[TranslationReference]
[FluentReference]
const string ExitToMapEditorCancel = "dialog-exit-to-map-editor.cancel";
readonly Widget menu;
@@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Ui.ResetTooltips();
}
ButtonWidget AddButton(string id, string text)
ButtonWidget AddButton(string id, string label)
{
var button = buttonTemplate.Clone() as ButtonWidget;
var lastButton = buttons.LastOrDefault();
@@ -305,8 +305,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
button.Id = id;
button.IsDisabled = () => leaving;
var translation = TranslationProvider.GetString(text);
button.GetText = () => translation;
var text = FluentProvider.GetString(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
? TranslationProvider.GetString(Leave)
: TranslationProvider.GetString(AbortMission));
? FluentProvider.GetString(Leave)
: FluentProvider.GetString(AbortMission));
button.OnClick = () =>
{
@@ -494,7 +494,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ConfirmationDialogs.ButtonPrompt(modData,
title: ErrorMaxPlayerTitle,
text: ErrorMaxPlayerPrompt,
textArguments: Translation.Arguments("players", playerCount, "max", MapPlayers.MaximumPlayerCount),
textArguments: FluentBundle.Arguments("players", playerCount, "max", MapPlayers.MaximumPlayerCount),
onConfirm: ShowMenu,
confirmText: ErrorMaxPlayerAccept);

View File

@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngamePowerBarLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string PowerUsage = "label-power-usage";
[TranslationReference]
[FluentReference]
const string Infinite = "label-infinite-power";
[ObjectCreator.UseCtor]
@@ -36,12 +36,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
powerBar.TooltipTextCached = new CachedTransform<(float Current, float Capacity), string>(usage =>
{
var capacity = developerMode.UnlimitedPower ?
TranslationProvider.GetString(Infinite) :
FluentProvider.GetString(Infinite) :
powerManager.PowerProvided.ToString(NumberFormatInfo.CurrentInfo);
return TranslationProvider.GetString(
return FluentProvider.GetString(
PowerUsage,
Translation.Arguments("usage", usage.Current, "capacity", capacity));
FluentBundle.Arguments("usage", usage.Current, "capacity", capacity));
});
powerBar.GetBarColor = () =>

View File

@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngamePowerCounterLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string PowerUsage = "label-power-usage";
[TranslationReference]
[FluentReference]
const string Infinite = "label-infinite-power";
[ObjectCreator.UseCtor]
@@ -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 = TranslationProvider.GetString(Infinite);
var unlimitedCapacity = FluentProvider.GetString(Infinite);
powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal";
power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White;
@@ -41,9 +41,9 @@ 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 TranslationProvider.GetString(
return FluentProvider.GetString(
PowerUsage,
Translation.Arguments(
FluentBundle.Arguments(
"usage", args.Usage.ToString(NumberFormatInfo.CurrentInfo),
"capacity", capacity));
});

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class IngameSiloBarLogic : ChromeLogic
{
[TranslationReference("usage", "capacity")]
[FluentReference("usage", "capacity")]
const string SiloUsage = "label-silo-usage";
[ObjectCreator.UseCtor]
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
siloBar.GetUsed = () => playerResources.Resources;
siloBar.TooltipTextCached = new CachedTransform<(float Current, float Capacity), string>(usage =>
{
return TranslationProvider.GetString(
return FluentProvider.GetString(
SiloUsage,
Translation.Arguments("usage", usage.Current, "capacity", usage.Capacity));
FluentBundle.Arguments("usage", usage.Current, "capacity", usage.Capacity));
});
siloBar.GetBarColor = () =>
{

View File

@@ -23,22 +23,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ChromeLogicArgsHotkeys("CombinedViewKey", "WorldViewKey")]
public class ObserverShroudSelectorLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string CameraOptionAllPlayers = "options-shroud-selector.all-players";
[TranslationReference]
[FluentReference]
const string CameraOptionDisableShroud = "options-shroud-selector.disable-shroud";
[TranslationReference]
[FluentReference]
const string CameraOptionOther = "options-shroud-selector.other";
[TranslationReference]
[FluentReference]
const string Players = "label-players";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
readonly CameraOption combined, disableShroud;
@@ -104,10 +104,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var groups = new Dictionary<string, IEnumerable<CameraOption>>();
combined = new CameraOption(this, world, TranslationProvider.GetString(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone"));
disableShroud = new CameraOption(this, world, TranslationProvider.GetString(CameraOptionDisableShroud), null);
combined = new CameraOption(this, world, FluentProvider.GetString(CameraOptionAllPlayers), world.Players.First(p => p.InternalName == "Everyone"));
disableShroud = new CameraOption(this, world, FluentProvider.GetString(CameraOptionDisableShroud), null);
if (!limitViews)
groups.Add(TranslationProvider.GetString(CameraOptionOther), new List<CameraOption>() { combined, disableShroud });
groups.Add(FluentProvider.GetString(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 ? TranslationProvider.GetString(Players) : t.Key > 0
? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", t.Key))
: TranslationProvider.GetString(NoTeam);
var label = noTeams ? FluentProvider.GetString(Players) : t.Key > 0
? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", t.Key))
: FluentProvider.GetString(NoTeam);
groups.Add(label, t);
}

View File

@@ -35,37 +35,37 @@ namespace OpenRA.Mods.Common.Widgets.Logic
"StatisticsArmyGraphKey")]
public class ObserverStatsLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string InformationNone = "options-observer-stats.none";
[TranslationReference]
[FluentReference]
const string Basic = "options-observer-stats.basic";
[TranslationReference]
[FluentReference]
const string Economy = "options-observer-stats.economy";
[TranslationReference]
[FluentReference]
const string Production = "options-observer-stats.production";
[TranslationReference]
[FluentReference]
const string SupportPowers = "options-observer-stats.support-powers";
[TranslationReference]
[FluentReference]
const string Combat = "options-observer-stats.combat";
[TranslationReference]
[FluentReference]
const string Army = "options-observer-stats.army";
[TranslationReference]
[FluentReference]
const string EarningsGraph = "options-observer-stats.earnings-graph";
[TranslationReference]
[FluentReference]
const string ArmyGraph = "options-observer-stats.army-graph";
[TranslationReference("team")]
[FluentReference("team")]
const string TeamNumber = "label-team-name";
[TranslationReference]
[FluentReference]
const string NoTeam = "label-no-team";
readonly ContainerWidget basicStatsHeaders;
@@ -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 = TranslationProvider.GetString(title);
title = FluentProvider.GetString(title);
return new StatsDropDownOption
{
Title = TranslationProvider.GetString(title),
Title = FluentProvider.GetString(title),
IsSelected = () => activePanel == panel,
OnClick = () =>
{
@@ -179,11 +179,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
new()
{
Title = TranslationProvider.GetString(InformationNone),
Title = FluentProvider.GetString(InformationNone),
IsSelected = () => activePanel == ObserverStatsPanel.None,
OnClick = () =>
{
var informationNone = TranslationProvider.GetString(InformationNone);
var informationNone = FluentProvider.GetString(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 ? TranslationProvider.GetString(TeamNumber, Translation.Arguments("team", team.Key))
: TranslationProvider.GetString(NoTeam);
var teamText = team.Key > 0 ? FluentProvider.GetString(TeamNumber, FluentBundle.Arguments("team", team.Key))
: FluentProvider.GetString(NoTeam);
teamLabel.GetText = () => teamText;
tt.Bounds.Width = teamLabel.Bounds.Width = Game.Renderer.Fonts[tt.Font].Measure(teamText).X;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ProductionTooltipLogic : ChromeLogic
{
[TranslationReference("prequisites")]
[FluentReference("prequisites")]
const string Requires = "label-requires";
[ObjectCreator.UseCtor]
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var tooltip = actor.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
var name = tooltip != null ? TranslationProvider.GetString(tooltip.Name) : actor.Name;
var name = tooltip != null ? FluentProvider.GetString(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 = TranslationProvider.GetString(Requires, Translation.Arguments("prequisites", prereqs.JoinWith(", ")));
var requiresText = FluentProvider.GetString(Requires, FluentBundle.Arguments("prequisites", 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) ? "" : TranslationProvider.GetString(buildable.Description);
var desc = string.IsNullOrEmpty(buildable.Description) ? "" : FluentProvider.GetString(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 TranslationProvider.GetString(actorTooltip.Name);
return FluentProvider.GetString(actorTooltip.Name);
}
return a;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class WorldTooltipLogic : ChromeLogic
{
[TranslationReference]
[FluentReference]
const string UnrevealedTerrain = "label-unrevealed-terrain";
[ObjectCreator.UseCtor]
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var extraHeightOnDouble = extras.Bounds.Y;
var extraHeightOnSingle = extraHeightOnDouble - (doubleHeight - singleHeight);
var unrevealedTerrain = TranslationProvider.GetString(UnrevealedTerrain);
var unrevealedTerrain = FluentProvider.GetString(UnrevealedTerrain);
tooltipContainer.BeforeRender = () =>
{