Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/tooltips.js
Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | function getSplashDamageTooltip(template) | ||||
// If multiple attack types deal splash damage, the attack type should be shown to differentiate. | // If multiple attack types deal splash damage, the attack type should be shown to differentiate. | ||||
return tooltips.join("\n"); | return tooltips.join("\n"); | ||||
} | } | ||||
function getStatusEffectsTooltip(template) | function getStatusEffectsTooltip(template) | ||||
{ | { | ||||
let tooltipAttributes = []; | let tooltipAttributes = []; | ||||
let tooltipString = ""; | |||||
if (template.StatusTooltip) | if (template.StatusTooltip) | ||||
{ | tooltipAttributes.push(translate(template.StatusTooltip)); | ||||
tooltipAttributes.push("%(tooltip)s"); | |||||
tooltipString = translate(template.StatusTooltip); | |||||
} | |||||
let attackEffectsString = ""; | |||||
if (template.Damage || template.Capture) | if (template.Damage || template.Capture) | ||||
wraitii: From my current understanding of our translation system, this is equivalent to:
```… | |||||
{ | tooltipAttributes.push(attackEffectsDetails(template)); | ||||
tooltipAttributes.push("%(effects)s"); | |||||
attackEffectsString = attackEffectsDetails(template); | |||||
} | |||||
let intervalString = ""; | |||||
if (template.Interval) | if (template.Interval) | ||||
Done Inline Actionssame wraitii: same | |||||
{ | tooltipAttributes.push(attackRateDetails(+template.Interval)); | ||||
Done Inline Actionssame wraitii: same | |||||
tooltipAttributes.push("%(rate)s"); | |||||
intervalString = sprintf(translate("%(interval)s"), { | if (template.Duration) | ||||
"interval": attackRateDetails(+template.Interval) | tooltipAttributes.push(getStatusEffectDurationTooltip(template)); | ||||
return sprintf(translate("%(statusName)s: %(statusInfo)s %(stackability)s"), { | |||||
Done Inline ActionsThis translation is broken translate("%(statusName)s: " + foo) elexis: This translation is broken `translate("%(statusName)s: " + foo)` | |||||
"statusName": headerFont(translateWithContext("status effect", template.StatusName)), | |||||
"statusInfo": tooltipAttributes.join(commaFont(translate(", "))), | |||||
"stackability": getStatusEffectStackabilityTooltip(template) | |||||
Done Inline ActionstooltipAttributes.push("%(stackability)s") you probably mean to use translation for the string, otherwise there is probably no use case for using the sprintf format. elexis: `tooltipAttributes.push("%(stackability)s")` you probably mean to use translation for the… | |||||
}); | }); | ||||
} | } | ||||
let durationString = ""; | function getStatusEffectDurationTooltip(template) | ||||
if (template.Duration) | |||||
{ | { | ||||
tooltipAttributes.push("%(duration)s"); | if (!template.Duration) | ||||
durationString = sprintf(translate("%(durName)s: %(duration)s"), { | return ""; | ||||
return sprintf(translate("%(durName)s: %(duration)s"), { | |||||
"durName": headerFont(translate("Duration")), | "durName": headerFont(translate("Duration")), | ||||
"duration": getSecondsString((template._timeElapsed ? +template.Duration - template._timeElapsed : +template.Duration) / 1000), | "duration": getSecondsString((template._timeElapsed ? | ||||
+template.Duration - template._timeElapsed : | |||||
+template.Duration) / 1000) | |||||
}); | }); | ||||
} | } | ||||
return sprintf(translate("%(statusName)s: " + tooltipAttributes.join(translate(commaFont(", ")))), { | function getStatusEffectStackabilityTooltip(template) | ||||
"statusName": headerFont(translateWithContext("status effect", template.StatusName)), | { | ||||
"tooltip": tooltipString, | if (!template.Stackability || template.Stackability == "Ignore") | ||||
"effects": attackEffectsString, | return ""; | ||||
Not Done Inline ActionsPending question about ===. I also wonder if having enums and checking integers would have any perf impact. Probably irrelevant here. Stan: Pending question about ===.
I also wonder if having enums and checking integers would have any… | |||||
"rate": intervalString, | |||||
"duration": durationString | let stackabilityString = ""; | ||||
if (template.Stackability == "Extend") | |||||
stackabilityString = translateWithContext("status effect stackability", "(extends)"); | |||||
else if (template.Stackability == "Replace") | |||||
stackabilityString = translateWithContext("status effect stackability", "(replaces)"); | |||||
else if (template.Stackability == "Stack") | |||||
stackabilityString = translateWithContext("status effect stackability", "(stacks)"); | |||||
return sprintf(translate("%(stackability)s"), { | |||||
"stackability": stackabilityString | |||||
}); | }); | ||||
} | } | ||||
function getGarrisonTooltip(template) | function getGarrisonTooltip(template) | ||||
{ | { | ||||
if (!template.garrisonHolder) | if (!template.garrisonHolder) | ||||
return ""; | return ""; | ||||
▲ Show 20 Lines • Show All 497 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
From my current understanding of our translation system, this is equivalent to:
and requires Tooltip to be a translatable string pulled from elsewhere (which it is since rP23681)