Extract strings from support power name and description.
This commit is contained in:
committed by
Gustas
parent
0c43801a2c
commit
188f0e2451
@@ -30,8 +30,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Palette used for the icon.")]
|
||||
public readonly string IconPalette = "chrome";
|
||||
|
||||
public readonly string Name = "";
|
||||
public readonly string Description = "";
|
||||
[TranslationReference(optional: true)]
|
||||
public readonly string Name = null;
|
||||
|
||||
[TranslationReference(optional: true)]
|
||||
public readonly string Description = null;
|
||||
|
||||
[Desc("Allow multiple instances of the same support power.")]
|
||||
public readonly bool AllowMultiple = false;
|
||||
@@ -46,6 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("If set to true, the support power will be fully charged when it becomes available. " +
|
||||
"Normal rules apply for subsequent charges.")]
|
||||
public readonly bool StartFullyCharged = false;
|
||||
|
||||
public readonly string[] Prerequisites = Array.Empty<string>();
|
||||
|
||||
public readonly string DetectedSound = null;
|
||||
|
||||
@@ -53,11 +53,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (sp == lastPower && hotkey == lastHotkey && lastRemainingSeconds == remainingSeconds)
|
||||
return;
|
||||
|
||||
var nameText = sp.Info.Name;
|
||||
var nameText = TranslationProvider.GetString(sp.Info.Name);
|
||||
nameLabel.GetText = () => nameText;
|
||||
var nameSize = nameFont.Measure(nameText);
|
||||
|
||||
var descText = sp.Info.Description.Replace("\\n", "\n");
|
||||
var descText = TranslationProvider.GetString(sp.Info.Description);
|
||||
descLabel.GetText = () => descText;
|
||||
var descSize = descFont.Measure(descText);
|
||||
|
||||
|
||||
@@ -21,8 +21,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
public class SupportPowerTimerWidget : Widget
|
||||
{
|
||||
[TranslationReference("player", "support-power", "time")]
|
||||
const string Format = "support-power-timer";
|
||||
|
||||
public readonly string Font = "Bold";
|
||||
public readonly string Format = "{0}'s {1}: {2}";
|
||||
public readonly TextAlign Align = TextAlign.Left;
|
||||
public readonly TimerOrder Order = TimerOrder.Descending;
|
||||
|
||||
@@ -57,7 +59,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var self = p.Instances[0].Self;
|
||||
var time = WidgetUtils.FormatTime(p.RemainingTicks, false, self.World.Timestep);
|
||||
var text = Format.FormatCurrent(self.Owner.PlayerName, p.Info.Name, time);
|
||||
var supportPowerName = TranslationProvider.GetString(p.Info.Name);
|
||||
var text = TranslationProvider.GetString(Format, Translation.Arguments("player", self.Owner.PlayerName, "support-power", supportPowerName, "time", time));
|
||||
|
||||
var playerColor = self.Owner.Color;
|
||||
|
||||
if (Game.Settings.Game.UsePlayerStanceColors)
|
||||
|
||||
Reference in New Issue
Block a user