1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-05 13:04:54 +02:00

improve spell school translation

This commit is contained in:
Laserlicht 2024-12-24 14:05:21 +01:00
parent 7a4afc46a2
commit e1b0a11c54
3 changed files with 35 additions and 11 deletions

View File

@ -607,6 +607,11 @@
"mapObject.core.hillFort.object.description" : "Upgrades creatures. Levels 1 - 4 are less expensive than in associated town.",
"core.spellSchools.0": "Air",
"core.spellSchools.1": "Fire",
"core.spellSchools.2": "Water",
"core.spellSchools.3": "Earth",
"core.bonus.ADDITIONAL_ATTACK.name": "Double Strike",
"core.bonus.ADDITIONAL_ATTACK.description": "Attacks twice",
"core.bonus.ADDITIONAL_RETALIATION.name": "Additional retaliations",
@ -763,8 +768,10 @@
"core.bonus.MECHANICAL.description": "Immunity to many effects, repairable",
"core.bonus.PRISM_HEX_ATTACK_BREATH.name": "Prism Breath",
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prism Breath Attack (three directions)",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name": "${subtype.spellSchool} immunity",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description": "Immune to ${subtype.spellSchool}",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name": "Spell immunity",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description": "Immune to all spell schools",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name.specific": "${subtype.spellSchool} immunity",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description.specific": "Immune to ${subtype.spellSchool} school",
"core.bonus.OPENING_BATTLE_SPELL.name": "Starts with spell",
"core.bonus.OPENING_BATTLE_SPELL.description": "Casts ${subtype.spell} on battle start"
}

View File

@ -607,6 +607,11 @@
"mapObject.core.hillFort.object.description" : "Aufwertungen von Kreaturen. Die Stufen 1 - 4 sind billiger als in der zugehörigen Stadt.",
"core.spellSchools.0": "Luft",
"core.spellSchools.1": "Feuer",
"core.spellSchools.2": "Wasser",
"core.spellSchools.3": "Erde",
"core.bonus.ADDITIONAL_ATTACK.name": "Doppelschlag",
"core.bonus.ADDITIONAL_ATTACK.description": "Greift zweimal an",
"core.bonus.ADDITIONAL_RETALIATION.name": "Zusätzliche Vergeltungsmaßnahmen",
@ -763,8 +768,10 @@
"core.bonus.MECHANICAL.description": "Immunität gegen viele Effekte, reparierbar",
"core.bonus.PRISM_HEX_ATTACK_BREATH.name": "Prisma-Atem",
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prisma-Atem-Angriff (drei Richtungen)",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name": "${subtype.spellSchool}-Immunität",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description": "Immunität gegen ${subtype.spellSchool}",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name": "Zauber-Immunität",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description": "Immunität gegen alle Zauber-Schulen",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name.specific": "${subtype.spellSchool}-Immunität",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description.specific": "Immunität gegen Zauber der ${subtype.spellSchool}-Schule",
"core.bonus.OPENING_BATTLE_SPELL.name": "Startet mit Zauber",
"core.bonus.OPENING_BATTLE_SPELL.description": "Wirkt ${subtype.spell} beim Start des Kampfes"
}

View File

@ -75,6 +75,23 @@ std::string CBonusTypeHandler::bonusToString(const std::shared_ptr<Bonus> & bonu
std::string textID = description ? bt.getDescriptionTextID() : bt.getNameTextID();
std::string text = VLC->generaltexth->translate(textID);
if (bonus->subtype.as<SpellSchool>().hasValue())
{
auto school = bonus->subtype.as<SpellSchool>();
if(school != SpellSchool::ANY)
{
auto specificTextID = description ? bt.getDescriptionTextID() + ".specific" : bt.getNameTextID() + ".specific";
auto specificText = VLC->generaltexth->translate(specificTextID);
if(specificText.find("${subtype.spellSchool}") != std::string::npos)
{
auto schoolName = VLC->generaltexth->translate(TextIdentifier("core.spellSchools", school).get());
boost::algorithm::replace_all(specificText, "${subtype.spellSchool}", schoolName);
text = specificText;
}
}
}
if (text.find("${val}") != std::string::npos)
boost::algorithm::replace_all(text, "${val}", std::to_string(bearer->valOfBonuses(Selector::typeSubtype(bonus->type, bonus->subtype))));
@ -84,13 +101,6 @@ std::string CBonusTypeHandler::bonusToString(const std::shared_ptr<Bonus> & bonu
if (text.find("${subtype.spell}") != std::string::npos && bonus->subtype.as<SpellID>().hasValue())
boost::algorithm::replace_all(text, "${subtype.spell}", bonus->subtype.as<SpellID>().toSpell()->getNameTranslated());
if (text.find("${subtype.spellSchool}") != std::string::npos && bonus->subtype.as<SpellSchool>().hasValue())
{
auto school = bonus->subtype.as<SpellSchool>();
auto schoolName = VLC->generaltexth->zelp[school == SpellSchool::ANY ? 458 : 454 + school].first;
boost::algorithm::replace_all(text, "${subtype.spellSchool}", schoolName);
}
return text;
}