[Translations] Give translators context for separator-bearing tr() strings (#6487)

Build the card menu's related card actions from complete strings with %1
placeholders instead of appending translated fragments. This also fixes
tr(cond ? "Transform into " : "Attach to "), which lupdate cannot extract:
neither string appears in cockatrice_en@source.ts, so neither was ever
translated.

Give the EDHRec tab title a %1 placeholder so French can render
"EDHRec : %1" instead of concatenating into "EDHRec :CardName".

Keep the colon in tr("Token:") and the leading space in tr(" seconds"),
since that separator is language-specific, and attach //: translator
comments so they are no longer shown out of context on Transifex.
This commit is contained in:
tooomm 2026-11-06 21:12:07 +01:00 • committed by GitHub
parent 17f583013b
commit 2d625575f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 8 deletions

View file

@ -463,16 +463,16 @@ void CardMenu::addRelatedCardActions()
relatedCardName = relatedCard.getName(); // "name"
}
QString text = tr("Token: ");
QString text;
if (cardRelation->getDoesAttach()) {
text +=
tr(cardRelation->getDoesTransform() ? "Transform into " : "Attach to ") + "\"" + relatedCardName + "\"";
text = cardRelation->getDoesTransform() ? tr("Token: Transform into \"%1\"").arg(relatedCardName)
: tr("Token: Attach to \"%1\"").arg(relatedCardName);
} else if (cardRelation->getIsVariable()) {
text += "X " + relatedCardName;
text = tr("Token: X %1").arg(relatedCardName);
} else if (cardRelation->getDefaultCount() != 1) {
text += QString::number(cardRelation->getDefaultCount()) + "x " + relatedCardName;
text = tr("Token: %1x %2").arg(cardRelation->getDefaultCount()).arg(relatedCardName);
} else {
text += relatedCardName;
text = tr("Token: %1").arg(relatedCardName);
}
if (createRelatedCards == nullptr) {
@ -587,4 +587,4 @@ void CardMenu::setShortcutsActive()
aRemoveCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aRC" + colorWords[i]));
aSetCounter[i]->setShortcuts(shortcuts.getShortcut("Player/aSC" + colorWords[i]));
}
}
}