From 9fadc2709c53d5e4b0198fd325bb7558bbd56530 Mon Sep 17 00:00:00 2001 From: sanderd17 Date: Tue, 6 May 2014 18:52:05 +0000 Subject: [PATCH] Clean up the gate transformation tooltips as it caused problems for mods. This was SVN commit r15119. --- .../mods/public/gui/session/unit_commands.js | 33 +++---------------- binaries/data/mods/public/l10n/messages.json | 1 + .../simulation/components/GuiInterface.js | 1 + .../public/simulation/components/Identity.js | 5 +++ .../templates/other/palisades_rocks_long.xml | 1 + .../structures/rome_siege_wall_long.xml | 1 + .../template_structure_defense_wall_long.xml | 1 + 7 files changed, 15 insertions(+), 28 deletions(-) diff --git a/binaries/data/mods/public/gui/session/unit_commands.js b/binaries/data/mods/public/gui/session/unit_commands.js index 0de21de768..769b56cd60 100644 --- a/binaries/data/mods/public/gui/session/unit_commands.js +++ b/binaries/data/mods/public/gui/session/unit_commands.js @@ -1145,37 +1145,14 @@ function updateUnitCommands(entState, supplementalDetailsPanel, commandsPanel, s var gateTemplate = getWallGateTemplate(state.id); if (gateTemplate) { - var wallName = GetTemplateDataWithoutLocalization(state.template).name.generic; - var gateName = GetTemplateDataWithoutLocalization(gateTemplate).name.generic; - var tooltipString; - - // For internationalization purposes, when possible, available combinations should be provided - // as placeholder-free strings as below. - // - // The placeholder implementation is provided only so that undetected new combinations of wall - // and gate names are not simply printed in English, but as close to a perfect translation as - // possible. - - if (wallName === "Wooden Wall" && gateName === "Wooden Gate") + var tooltipString = GetTemplateDataWithoutLocalization(state.template).gateConversionTooltip; + if (!tooltipString) { - tooltipString = translate("Convert Wooden Wall into Wooden Gate"); + warn(state.template + " is supposed to be convertable to a gate, but it's missing the GateConversionTooltip in the Identity template"); + tooltipString = ""; } - else if (wallName === "Stone Wall" && gateName === "City Gate") - { - tooltipString = translate("Convert Stone Wall into City Gate"); - } - else if (wallName === "Siege Wall" && gateName === "Siege Wall Gate") - { - tooltipString = translate("Convert Siege Wall into Siege Wall Gate"); - } - else - { - warn(sprintf("Internationalization: Unexpected combination of ā€˜%(localizedWall)sā€™ (%(englishWall)s) and ā€˜%(localizedGate)sā€™ (%(englishGate)s). This combination of wall and gate types must be internationalized.", { localizedWall: translate(wallName), englishWall: wallName, localizedGate: translate(gateName), englishGate: gateName })); - tooltipString = sprintf(translate("Convert %(wall)s into %(gate)s"), { wall: translate(wallName), gate: translate(gateName) }); - } - walls.push({ - "tooltip": tooltipString, + "tooltip": translate(tooltipString), "template": gateTemplate, "callback": function (item) { transformWallToGate(item.template); } }); diff --git a/binaries/data/mods/public/l10n/messages.json b/binaries/data/mods/public/l10n/messages.json index e061f468ed..3ad736c4e6 100644 --- a/binaries/data/mods/public/l10n/messages.json +++ b/binaries/data/mods/public/l10n/messages.json @@ -143,6 +143,7 @@ "GenericName": {}, "SpecificName": {}, "Tooltip": {}, + "GateConversionTooltip": {}, "DisabledTooltip": {}, "FormationName": {}, "FromClass": {}, diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js index 7d68e4de1e..4dc3ffa7ea 100644 --- a/binaries/data/mods/public/simulation/components/GuiInterface.js +++ b/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -628,6 +628,7 @@ GuiInterface.prototype.GetTemplateData = function(player, extendedName) }; ret.icon = template.Identity.Icon; ret.tooltip = template.Identity.Tooltip; + ret.gateConversionTooltip = template.Identity.GateConversionTooltip; ret.requiredTechnology = template.Identity.RequiredTechnology; ret.identityClassesString = GetTemplateIdentityClassesString(template); } diff --git a/binaries/data/mods/public/simulation/components/Identity.js b/binaries/data/mods/public/simulation/components/Identity.js index 27f4103345..36086a9868 100644 --- a/binaries/data/mods/public/simulation/components/Identity.js +++ b/binaries/data/mods/public/simulation/components/Identity.js @@ -29,6 +29,11 @@ Identity.prototype.Schema = "" + "" + "" + + "" + + "" + + "" + + "" + + "" + "" + "" + "" + diff --git a/binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml b/binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml index 857efb8945..8ad7251ff3 100644 --- a/binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml +++ b/binaries/data/mods/public/simulation/templates/other/palisades_rocks_long.xml @@ -20,6 +20,7 @@ other/wallset_palisade Palisade Wooden Wall + Convert Wooden Wall into Wooden Gate -StoneWall Palisade A cheap, quick defensive structure constructed with sharpened tree trunks gaia/special_palisade.png diff --git a/binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_long.xml b/binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_long.xml index 63229d27b1..bde696e22f 100644 --- a/binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_long.xml +++ b/binaries/data/mods/public/simulation/templates/structures/rome_siege_wall_long.xml @@ -36,6 +36,7 @@ structures/palisade.png A wooden and turf palisade buildable in enemy and neutral territories. + Convert Siege Wall into Siege Wall Gate Quick building, but expensive wooden and earthen walls used to surround and siege an enemy town or fortified position. The most famous examples are the Roman sieges of the Iberian stronghold of Numantia and the Gallic stronghold of Alesia. diff --git a/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_long.xml b/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_long.xml index 9be2169c21..90fc5cdce1 100644 --- a/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_long.xml +++ b/binaries/data/mods/public/simulation/templates/template_structure_defense_wall_long.xml @@ -12,5 +12,6 @@ LongWall Long wall segments can be converted to gates. + Convert Stone Wall into City Gate