Clean up the gate transformation tooltips as it caused problems for mods.

This was SVN commit r15119.
This commit is contained in:
sanderd17 2014-05-06 18:52:05 +00:00
parent 34a9b8c260
commit 9fadc2709c
7 changed files with 15 additions and 28 deletions

View File

@ -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); }
});

View File

@ -143,6 +143,7 @@
"GenericName": {},
"SpecificName": {},
"Tooltip": {},
"GateConversionTooltip": {},
"DisabledTooltip": {},
"FormationName": {},
"FromClass": {},

View File

@ -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);
}

View File

@ -29,6 +29,11 @@ Identity.prototype.Schema =
"<text/>" +
"</element>" +
"</optional>" +
"<optional>" +
"<element name='GateConversionTooltip'>" +
"<text/>" +
"</element>" +
"</optional>" +
"<optional>" +
"<element name='Rollover'>" +
"<text/>" +

View File

@ -20,6 +20,7 @@
<SelectionGroupName>other/wallset_palisade</SelectionGroupName>
<SpecificName>Palisade</SpecificName>
<GenericName>Wooden Wall</GenericName>
<GateConversionTooltip>Convert Wooden Wall into Wooden Gate</GateConversionTooltip>
<Classes datatype="tokens">-StoneWall Palisade</Classes>
<History>A cheap, quick defensive structure constructed with sharpened tree trunks</History>
<Icon>gaia/special_palisade.png</Icon>

View File

@ -36,6 +36,7 @@
</Classes>
<Icon>structures/palisade.png</Icon>
<Tooltip>A wooden and turf palisade buildable in enemy and neutral territories.</Tooltip>
<GateConversionTooltip>Convert Siege Wall into Siege Wall Gate</GateConversionTooltip>
<History>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.</History>
</Identity>
<Obstruction>

View File

@ -12,5 +12,6 @@
<Identity>
<Classes datatype="tokens">LongWall</Classes>
<Tooltip>Long wall segments can be converted to gates.</Tooltip>
<GateConversionTooltip>Convert Stone Wall into City Gate</GateConversionTooltip>
</Identity>
</Entity>