Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract strings from support power name and description #21385

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ public abstract class SupportPowerInfo : PausableConditionalTraitInfo
[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;
Expand All @@ -46,6 +49,7 @@ public abstract class SupportPowerInfo : PausableConditionalTraitInfo
[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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public SupportPowerTooltipLogic(Widget widget, TooltipContainerWidget tooltipCon
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);

Expand Down
8 changes: 6 additions & 2 deletions OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -57,7 +59,9 @@ public override void Tick()
{
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)
Expand Down
9 changes: 9 additions & 0 deletions mods/cnc/languages/rules/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ actor-hq =
.description = Provides radar and Air Strike support power.
Unlocks higher-tech units and buildings.
Requires power to operate.
.airstrikepower-name = Air Strike
.airstrikepower-description = Deploy an aerial napalm strike.
Burns buildings and infantry along a line.

actor-fix =
.name = Repair Facility
Expand All @@ -343,12 +346,18 @@ actor-eye =
.description = Provides radar and Orbital Ion Cannon support power.
Unlocks Mammoth Tank and Commando.
Requires power to operate.
.ioncannonpower-name = Ion Cannon
.ioncannonpower-description = Initiate an Ion Cannon strike.
Applies instant damage to a small area.

actor-tmpl =
.name = Temple of Nod
.description = Provides Nuclear Strike support power.
Unlocks Stealth Tank, Chem. Warrior and Obelisk of Light.
Requires power to operate.
.nukepower-name = Nuclear Strike
.nukepower-description = Launch a tactical nuclear warhead.
Applies heavy damage over a large area.

actor-gun =
.name = Turret
Expand Down
4 changes: 2 additions & 2 deletions mods/cnc/maps/twist-of-fate/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ Astk.proxy:
ChargeInterval: 5250
SquadSize: 3
QuantizedFacings: 8
Name: Air Strike
Description: Deploy an aerial napalm strike.\nBurns buildings and infantry along a line.
Name: actor-hq.airstrikepower-name
Description: actor-hq.airstrikepower-description
EndChargeSpeechNotification: AirstrikeReady
SelectTargetSpeechNotification: SelectTarget
InsufficientPowerSpeechNotification: InsufficientPower
Expand Down
4 changes: 2 additions & 2 deletions mods/cnc/rules/campaign-maprules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ airstrike.proxy:
ChargeInterval: 3000
SquadSize: 3
QuantizedFacings: 8
Name: Air Strike
Description: Deploy an aerial napalm strike.\nBurns buildings and infantry along a line.
Name: actor-hq.airstrikepower-name
Description: actor-hq.airstrikepower-description
EndChargeSpeechNotification: AirstrikeReady
SelectTargetSpeechNotification: SelectTarget
InsufficientPowerSpeechNotification: InsufficientPower
Expand Down
12 changes: 6 additions & 6 deletions mods/cnc/rules/structures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,8 @@ HQ:
ChargeInterval: 7500
SquadSize: 3
QuantizedFacings: 8
Name: Air Strike
Description: Deploy an aerial napalm strike.\nBurns buildings and infantry along a line.
Name: actor-hq.airstrikepower-name
Description: actor-hq.airstrikepower-description
EndChargeSpeechNotification: AirstrikeReady
SelectTargetSpeechNotification: SelectTarget
InsufficientPowerSpeechNotification: InsufficientPower
Expand Down Expand Up @@ -795,8 +795,8 @@ EYE:
Icon: ioncannon
Cursor: ioncannon
ChargeInterval: 9000
Name: Ion Cannon
Description: Initiate an Ion Cannon strike.\nApplies instant damage to a small area.
Name: actor-eye.ioncannonpower-name
Description: actor-eye.ioncannonpower-description
BeginChargeSpeechNotification: IonCannonCharging
EndChargeSpeechNotification: IonCannonReady
SelectTargetSpeechNotification: SelectTarget
Expand Down Expand Up @@ -853,8 +853,8 @@ TMPL:
Icon: abomb
Cursor: nuke
ChargeInterval: 11250
Name: Nuclear Strike
Description: Launch a tactical nuclear warhead.\nApplies heavy damage over a large area.
Name: actor-tmpl.nukepower-name
Description: actor-tmpl.nukepower-description
EndChargeSpeechNotification: NuclearWeaponAvailable
SelectTargetSpeechNotification: SelectTarget
InsufficientPowerSpeechNotification: InsufficientPower
Expand Down
1 change: 0 additions & 1 deletion mods/common/languages/chrome/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,3 @@ label-game-admin = Game Admin
## gamesave-loading.yaml
label-gamesave-loading-screen-title = Loading Saved Game
label-gamesave-loading-screen-desc = Press Escape to cancel loading and return to the main menu

3 changes: 3 additions & 0 deletions mods/common/languages/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -857,3 +857,6 @@ notification-player-is-defeated = { $player } is defeated.
## OrderManager
notification-desync-compare-logs = Out of sync in frame { $frame }.
Compare syncreport.log with other players.

## SupportPowerTimerWidget
support-power-timer = { $player }'s { $support-power }: { $time }
15 changes: 15 additions & 0 deletions mods/d2k/languages/rules/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ actor-high-tech-factory =
.encyclopedia = The High Tech Factory produces airborne units, and is required for the production of Carryalls. House Atreides can upgrade the High Tech Factory to build Ornithopters for an air strike in later missions.

The High Tech Factory is vulnerable to most types of weapons.
.airstrikepower-name = Air Strike
.airstrikepower-description = Ornithopters hit the target with bombs

actor-research-centre =
.description = Unlocks advanced tanks.
Expand All @@ -353,6 +355,19 @@ actor-palace =
.encyclopedia = The Palace serves as the command center once it is constructed. Palaces feature unique additional options, making available advanced special weapons.

Armor is heavy, but the Palace is vulnerable to most types of weapons.
.nukepower-name = Death Hand
.nukepower-description = Launches an atomic missile at a target location
.produceactorpower-fremen-name = Recruit Fremen
.produceactorpower-fremen-description = Elite infantry unit armed with assault rifles and rockets
Strong vs Infantry, Vehicles
Weak vs Artillery
Special Ability: Invisibility
.produceactorpower-saboteur-name = Recruit Saboteur
.produceactorpower-saboteur-description = Sneaky infantry, armed with explosives.
Can be deployed to become invisible for a limited time.
Strong vs Buildings
Weak vs Everything
Special Ability: destroy buildings

## vehicles.yaml
actor-mcv =
Expand Down
16 changes: 8 additions & 8 deletions mods/d2k/rules/structures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,12 @@ high_tech_factory:
ProvidesPrerequisite@buildingname:
AirstrikePower:
Icon: ornistrike
Name: Air Strike
Name: actor-high-tech-factory.airstrikepower-name
Prerequisites: ~techlevel.superweapons, upgrade.hightech
ChargeInterval: 7500
SquadSize: 3
SquadOffset: -1536, 1024, 0
Description: Ornithopters hit the target with bombs
Description: actor-high-tech-factory.airstrikepower-description
UnitType: ornithopter
DisplayBeacon: True
CameraActor: camera
Expand Down Expand Up @@ -1155,8 +1155,8 @@ palace:
RequiresCondition: harkonnen
Prerequisites: ~techlevel.superweapons, ~palace.nuke
ChargeInterval: 7500
Name: Death Hand
Description: Launches an atomic missile at a target location
Name: actor-palace.nukepower-name
Description: actor-palace.nukepower-description
BeginChargeSpeechNotification: DeathHandMissilePrepping
EndChargeSpeechNotification: DeathHandMissileReady
IncomingSpeechNotification: MissileLaunchDetected
Expand All @@ -1182,8 +1182,8 @@ palace:
TrailSequences: idle
SupportPowerPaletteOrder: 40
ProduceActorPower@fremen:
Name: Recruit Fremen
Description: Elite infantry unit armed with assault rifles and rockets\n Strong vs Infantry, Vehicles\n Weak vs Artillery\n Special Ability: Invisibility
Name: actor-palace.produceactorpower-fremen-name
Description: actor-palace.produceactorpower-fremen-description
Icon: fremen
PauseOnCondition: disabled
RequiresCondition: atreides
Expand All @@ -1199,8 +1199,8 @@ palace:
OrderName: ProduceActorPower.Fremen
SupportPowerPaletteOrder: 20
ProduceActorPower@saboteur:
Name: Recruit Saboteur
Description: Sneaky infantry, armed with explosives.\nCan be deployed to become invisible for a limited time.\n Strong vs Buildings\n Weak vs Everything\n Special Ability: destroy buildings
Name: actor-palace.produceactorpower-saboteur-name
Description: actor-palace.produceactorpower-saboteur-description
Icon: saboteur
PauseOnCondition: disabled
RequiresCondition: ordos
Expand Down
41 changes: 40 additions & 1 deletion mods/ra/languages/rules/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ actor-mslo =
Requires power to operate.
Maximum 1 can be built.
Special Ability: Atom Bomb
.nukepower-name = Atom Bomb
.nukepower-description = Launches a devastating atomic bomb
at a target location.

actor-gap =
.name = Gap Generator
Expand All @@ -443,6 +446,9 @@ actor-iron =
Maximum 1 can be built.
Special Ability: Invulnerability
.name = Iron Curtain
.grantexternalconditionpower-ironcurtain-name = Invulnerability
.grantexternalconditionpower-ironcurtain-description = Makes a group of units invulnerable
for 20 seconds.

actor-pdox =
.description = Teleports a group of units across the
Expand All @@ -451,6 +457,12 @@ actor-pdox =
Maximum 1 can be built.
Special Ability: Chronoshift
.name = Chronosphere
.chronoshiftpower-chronoshift-name = Chronoshift
.chronoshiftpower-chronoshift-description = Teleports a group of units across
the map for 20 seconds.
.chronoshiftpower-advancedchronoshift-name = Advanced Chronoshift
.chronoshiftpower-advancedchronoshift-description = Teleports a large group of units across
the map for 20 seconds.

actor-tsla =
.description = Advanced base defense.
Expand Down Expand Up @@ -514,6 +526,9 @@ actor-atek =
.description = Provides Allied advanced technologies.
Special Ability: GPS Satellite
.name = Allied Tech Center
.gpspower-name = GPS Satellite
.gpspower-description = Reveals map terrain and provides tactical
information. Requires power and active radar.

actor-weap =
.description = Produces vehicles.
Expand Down Expand Up @@ -543,6 +558,14 @@ actor-afld =
Special Ability: Spy Plane
Special Ability: Paratroopers
.name = Airfield
.airstrikepower-spyplane-name = Spy Plane
.airstrikepower-spyplane-description = Reveals an area of the map.
.paratrooperspower-paratroopers-name = Paratroopers
.paratrooperspower-paratroopers-description = A Badger drops a squad of infantry
at the selected location.
.airstrikepower-parabombs-name = Parabombs
.airstrikepower-parabombs-description = A Badger drops a load of parachuted bombs
at the selected location.

actor-afld-ukraine-description = Produces and reloads aircraft.
Special Ability: Spy Plane
Expand Down Expand Up @@ -752,7 +775,23 @@ actor-bio =
.captured-desc = Provides prerequisite for Bio-Lab units.
.capturable-desc = Capture to produce Bio-Lab units.

actor-oilb =
actor-oilb =
.name = Oil Derrick
.captured-desc = Provides additional funds.
.capturable-desc = Capture to receive additional funds.

## misc.yaml
actor-powerproxy-parabombs =
.name = Parabombs (Single Use)
.description = A Badger drops a load of parachuted bombs
at the selected location.

actor-powerproxy-sonarpulse =
.name = Sonar Pulse
.description = Reveals all submarines in the vicinity for a
short time.

actor-powerproxy-paratroopers =
.name = Paratroopers
.description = A Badger drops a squad of infantry
anywhere on the map.
9 changes: 9 additions & 0 deletions mods/ra/maps/bomber-john/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ actor-mnlyr-name = Bomber
actor-minvv =
.description = Bomb which explodes after 8 seconds
.name = Bomb
## rules.yaml
actor-player =
.chronoshiftpower-name = Chronoshift
.chronoshiftpower-description = Teleport a group of vehicles across
the map.
.grantexternalconditionpower-ironcurtain-name = Invulnerability
.grantexternalconditionpower-ironcurtain-description = Makes a unit invulnerable
for 3 seconds.
8 changes: 4 additions & 4 deletions mods/ra/maps/bomber-john/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ Player:
ChronoshiftPower:
Icon: chrono
ChargeInterval: 1500
Name: Chronoshift
Description: Teleport a group of vehicles across\nthe map.
Name: actor-player.chronoshiftpower-name
Description: actor-player.chronoshiftpower-description
SelectTargetSound: slcttgt1.aud
BeginChargeSound: chrochr1.aud
EndChargeSound: chrordy1.aud
Expand All @@ -94,8 +94,8 @@ Player:
GrantExternalConditionPower@IRONCURTAIN:
Icon: invuln
ChargeInterval: 750
Name: Invulnerability
Description: Makes a unit invulnerable\nfor 3 seconds.
Name: actor-player.grantexternalconditionpower-ironcurtain-name
Description: actor-player.grantexternalconditionpower-ironcurtain-description
Duration: 75
SelectTargetSpeechNotification: SelectTarget
InsufficientPowerSpeechNotification: InsufficientPower
Expand Down
3 changes: 3 additions & 0 deletions mods/ra/maps/fort-lonestar/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ actor-sniper =
Weak vs Vehicles, Aircraft

actor-mig-bomber-name = MiG Bomber

## rules.yaml
actor-powerproxy-parabombs-description = A MiG bomber drops a load of parachuted bombs on your target.
2 changes: 1 addition & 1 deletion mods/ra/maps/fort-lonestar/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ V2RL:

powerproxy.parabombs:
AirstrikePower:
Description: A MiG bomber drops a load of parachuted bombs on your target.
Description: actor-powerproxy-parabombs-description
CameraRemoveDelay: 50

BADR.Bomber:
Expand Down
4 changes: 4 additions & 0 deletions mods/ra/maps/top-o-the-world/en.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## rules.yaml
actor-powerproxy-spyplane =
.airstrikepower-name = Spy Plane (Single Use)
.airstrikepower-description = Reveals an area of the map and cloaked enemy units.
2 changes: 1 addition & 1 deletion mods/ra/maps/top-o-the-world/map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -897,4 +897,4 @@ Rules: ra|rules/campaign-rules.yaml, ra|rules/campaign-tooltips.yaml, ra|rules/c

Weapons: weapons.yaml

Translations: ra|languages/lua/en.ftl, ra|languages/campaign/en.ftl
Translations: ra|languages/lua/en.ftl, ra|languages/campaign/en.ftl, en.ftl
4 changes: 2 additions & 2 deletions mods/ra/maps/top-o-the-world/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ powerproxy.spyplane:
OrderName: SovietSpyPlane
Icon: spyplane
ChargeInterval: 4500
Name: Spy Plane (Single Use)
Description: Reveals an area of the map and cloaked enemy units.
Name: actor-powerproxy-spyplane.airstrikepower-name
Description: actor-powerproxy-spyplane.airstrikepower-description
OneShot: true
SelectTargetSpeechNotification: SelectTarget
EndChargeSpeechNotification: SpyPlaneReady
Expand Down