Extract translation strings.
This commit is contained in:
committed by
Gustas
parent
dfd5a960ed
commit
0b67b5bfae
@@ -28,6 +28,36 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
[TranslationReference]
|
||||
static readonly string Mute = "mute";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string Accomplished = "accomplished";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string Failed = "failed";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string InProgress = "in-progress";
|
||||
|
||||
[TranslationReference("team")]
|
||||
static readonly string TeamNumber = "team-number";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string NoTeam = "no-team";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string Spectators = "spectators";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string Gone = "gone";
|
||||
|
||||
[TranslationReference("player")]
|
||||
static readonly string KickTitle = "kick-title";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string KickPrompt = "kick-prompt";
|
||||
|
||||
[TranslationReference]
|
||||
static readonly string KickAccept = "kick-accept";
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public GameInfoStatsLogic(Widget widget, ModData modData, World world, OrderManager orderManager, WorldRenderer worldRenderer, Action<bool> hideMenu)
|
||||
{
|
||||
@@ -49,8 +79,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
checkbox.GetText = () => mo.Objectives.First().Description;
|
||||
}
|
||||
|
||||
statusLabel.GetText = () => player.WinState == WinState.Won ? "Accomplished" :
|
||||
player.WinState == WinState.Lost ? "Failed" : "In progress";
|
||||
statusLabel.GetText = () => player.WinState == WinState.Won ? Accomplished :
|
||||
player.WinState == WinState.Lost ? Failed : InProgress;
|
||||
statusLabel.GetColor = () => player.WinState == WinState.Won ? Color.LimeGreen :
|
||||
player.WinState == WinState.Lost ? Color.Red : Color.White;
|
||||
}
|
||||
@@ -86,7 +116,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (teams.Count() > 1)
|
||||
{
|
||||
var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
||||
teamHeader.Get<LabelWidget>("TEAM").GetText = () => t.Key == 0 ? "No Team" : $"Team {t.Key}";
|
||||
var team = t.Key > 0
|
||||
? modData.Translation.GetString(TeamNumber, Translation.Arguments("team", t.Key))
|
||||
: modData.Translation.GetString(NoTeam);
|
||||
teamHeader.Get<LabelWidget>("TEAM").GetText = () => team;
|
||||
var teamRating = teamHeader.Get<LabelWidget>("TEAM_SCORE");
|
||||
var scoreCache = new CachedTransform<int, string>(s => s.ToString());
|
||||
var teamMemberScores = t.Select(tt => tt.PlayerStatistics).Where(s => s != null).ToArray().Select(s => s.Experience);
|
||||
@@ -137,7 +170,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (spectators.Count > 0)
|
||||
{
|
||||
var spectatorHeader = ScrollItemWidget.Setup(teamTemplate, () => true, () => { });
|
||||
spectatorHeader.Get<LabelWidget>("TEAM").GetText = () => "Spectators";
|
||||
var spectatorTeam = modData.Translation.GetString(Spectators);
|
||||
spectatorHeader.Get<LabelWidget>("TEAM").GetText = () => spectatorTeam;
|
||||
|
||||
playerPanel.AddChild(spectatorHeader);
|
||||
|
||||
@@ -155,7 +189,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
nameLabel.GetText = () =>
|
||||
{
|
||||
var suffix = client.State == Session.ClientState.Disconnected ? " (Gone)" : "";
|
||||
var suffix = client.State == Session.ClientState.Disconnected ? $" ({modData.Translation.GetString(Gone)})" : "";
|
||||
return name.Update((client.Name, suffix));
|
||||
};
|
||||
|
||||
@@ -164,16 +198,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
kickButton.OnClick = () =>
|
||||
{
|
||||
hideMenu(true);
|
||||
ConfirmationDialogs.ButtonPrompt(
|
||||
title: $"Kick {client.Name}?",
|
||||
text: "They will not be able to rejoin this game.",
|
||||
ConfirmationDialogs.ButtonPrompt(modData,
|
||||
title: KickTitle,
|
||||
titleArguments: Translation.Arguments("player", client.Name),
|
||||
text: KickPrompt,
|
||||
onConfirm: () =>
|
||||
{
|
||||
orderManager.IssueOrder(Order.Command($"kick {client.Index} {false}"));
|
||||
hideMenu(false);
|
||||
},
|
||||
onCancel: () => hideMenu(false),
|
||||
confirmText: "Kick");
|
||||
confirmText: KickAccept);
|
||||
};
|
||||
|
||||
var muteCheckbox = item.Get<CheckboxWidget>("MUTE");
|
||||
|
||||
Reference in New Issue
Block a user