mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Merge pull request #3736 from IvanSavenko/fix_server_translations
Do not translate strings on server side
This commit is contained in:
@@ -101,28 +101,21 @@ void CArmedInstance::updateMoraleBonusFromArmy()
|
||||
factionsInArmy -= mixableFactions - 1;
|
||||
}
|
||||
|
||||
std::string description;
|
||||
MetaString bonusDescription;
|
||||
|
||||
if(factionsInArmy == 1)
|
||||
{
|
||||
b->val = +1;
|
||||
description = VLC->generaltexth->arraytxt[115]; //All troops of one alignment +1
|
||||
description = description.substr(0, description.size()-3);//trim "+1"
|
||||
bonusDescription.appendTextID("core.arraytxt.115"); //All troops of one alignment +1
|
||||
}
|
||||
else if (!factions.empty()) // no bonus from empty garrison
|
||||
{
|
||||
b->val = 2 - static_cast<si32>(factionsInArmy);
|
||||
MetaString formatter;
|
||||
formatter.appendTextID("core.arraytxt.114"); //Troops of %d alignments %d
|
||||
formatter.replaceNumber(factionsInArmy);
|
||||
formatter.replaceNumber(b->val);
|
||||
|
||||
description = formatter.toString();
|
||||
description = description.substr(0, description.size()-3);//trim value
|
||||
bonusDescription.appendTextID("core.arraytxt.114"); //Troops of %d alignments %d
|
||||
bonusDescription.replaceNumber(factionsInArmy);
|
||||
}
|
||||
|
||||
boost::algorithm::trim(description);
|
||||
b->description = description;
|
||||
b->description = bonusDescription;
|
||||
|
||||
CBonusSystemNode::treeHasChanged();
|
||||
|
||||
@@ -132,8 +125,8 @@ void CArmedInstance::updateMoraleBonusFromArmy()
|
||||
{
|
||||
if(!undeadModifier)
|
||||
{
|
||||
undeadModifier = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::MORALE, BonusSource::ARMY, -1, BonusCustomSource::undeadMoraleDebuff, VLC->generaltexth->arraytxt[116]);
|
||||
undeadModifier->description = undeadModifier->description.substr(0, undeadModifier->description.size()-2);//trim value
|
||||
undeadModifier = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::MORALE, BonusSource::ARMY, -1, BonusCustomSource::undeadMoraleDebuff);
|
||||
undeadModifier->description.appendTextID("core.arraytxt.116");
|
||||
addNewBonus(undeadModifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,15 +225,15 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
||||
{
|
||||
case Obj::SHIPWRECK:
|
||||
textID = 123;
|
||||
gbonus.bdescr.appendRawString(VLC->generaltexth->arraytxt[99]);
|
||||
gbonus.bonus.description = MetaString::createFromTextID("core.arraytxt.99");
|
||||
break;
|
||||
case Obj::DERELICT_SHIP:
|
||||
textID = 42;
|
||||
gbonus.bdescr.appendRawString(VLC->generaltexth->arraytxt[101]);
|
||||
gbonus.bonus.description = MetaString::createFromTextID("core.arraytxt.101");
|
||||
break;
|
||||
case Obj::CRYPT:
|
||||
textID = 120;
|
||||
gbonus.bdescr.appendRawString(VLC->generaltexth->arraytxt[98]);
|
||||
gbonus.bonus.description = MetaString::createFromTextID("core.arraytxt.98");
|
||||
break;
|
||||
}
|
||||
cb->giveHeroBonus(&gbonus);
|
||||
@@ -244,7 +244,8 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
||||
case Obj::PYRAMID:
|
||||
{
|
||||
GiveBonus gb;
|
||||
gb.bonus = Bonus(BonusDuration::ONE_BATTLE, BonusType::LUCK, BonusSource::OBJECT_INSTANCE, -2, BonusSourceID(id), VLC->generaltexth->arraytxt[70]);
|
||||
gb.bonus = Bonus(BonusDuration::ONE_BATTLE, BonusType::LUCK, BonusSource::OBJECT_INSTANCE, -2, BonusSourceID(id));
|
||||
gb.bonus.description = MetaString::createFromTextID("core.arraytxt.70");
|
||||
gb.id = hero->id;
|
||||
cb->giveHeroBonus(&gb);
|
||||
textID = 107;
|
||||
|
||||
@@ -144,6 +144,9 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string getBiographyTranslated() const;
|
||||
std::string getBiographyTextID() const;
|
||||
|
||||
std::string getNameTextID() const;
|
||||
std::string getNameTranslated() const;
|
||||
|
||||
HeroTypeID getPortraitSource() const;
|
||||
@@ -152,11 +155,6 @@ public:
|
||||
std::string getClassNameTranslated() const;
|
||||
std::string getClassNameTextID() const;
|
||||
|
||||
private:
|
||||
std::string getNameTextID() const;
|
||||
std::string getBiographyTextID() const;
|
||||
public:
|
||||
|
||||
bool hasSpellbook() const;
|
||||
int maxSpellLevel() const;
|
||||
void addSpellToSpellbook(const SpellID & spell);
|
||||
|
||||
@@ -98,27 +98,33 @@ std::string CGTownBuilding::getCustomBonusGreeting(const Bonus & bonus) const
|
||||
{
|
||||
if(bonus.type == BonusType::TOWN_MAGIC_WELL)
|
||||
{
|
||||
auto bonusGreeting = std::string(VLC->generaltexth->translate("vcmi.townHall.greetingInTownMagicWell"));
|
||||
auto buildingName = town->getTown()->getSpecialBuilding(bType)->getNameTranslated();
|
||||
boost::algorithm::replace_first(bonusGreeting, "%s", buildingName);
|
||||
return bonusGreeting;
|
||||
MetaString wellGreeting = MetaString::createFromTextID("vcmi.townHall.greetingInTownMagicWell");
|
||||
|
||||
wellGreeting.replaceTextID(town->getTown()->getSpecialBuilding(bType)->getNameTextID());
|
||||
return wellGreeting.toString();
|
||||
}
|
||||
auto bonusGreeting = std::string(VLC->generaltexth->translate("vcmi.townHall.greetingCustomBonus")); //"%s gives you +%d %s%s"
|
||||
std::string param;
|
||||
|
||||
MetaString greeting = MetaString::createFromTextID("vcmi.townHall.greetingCustomBonus");
|
||||
|
||||
std::string paramTextID;
|
||||
std::string until;
|
||||
|
||||
if(bonus.type == BonusType::MORALE)
|
||||
param = VLC->generaltexth->allTexts[384];
|
||||
else if(bonus.type == BonusType::LUCK)
|
||||
param = VLC->generaltexth->allTexts[385];
|
||||
paramTextID = "core.genrltxt.384"; // Morale
|
||||
|
||||
until = bonus.duration == BonusDuration::ONE_BATTLE
|
||||
? VLC->generaltexth->translate("vcmi.townHall.greetingCustomUntil")
|
||||
: ".";
|
||||
if(bonus.type == BonusType::LUCK)
|
||||
paramTextID = "core.genrltxt.385"; // Luck
|
||||
|
||||
boost::format fmt = boost::format(bonusGreeting) % bonus.description % bonus.val % param % until;
|
||||
std::string greeting = fmt.str();
|
||||
return greeting;
|
||||
greeting.replaceTextID(town->getTown()->getSpecialBuilding(bType)->getNameTextID());
|
||||
greeting.replaceNumber(bonus.val);
|
||||
greeting.replaceTextID(paramTextID);
|
||||
|
||||
if (bonus.duration == BonusDuration::ONE_BATTLE)
|
||||
greeting.replaceTextID("vcmi.townHall.greetingCustomUntil");
|
||||
else
|
||||
greeting.replaceRawString(".");
|
||||
|
||||
return greeting.toString();
|
||||
}
|
||||
|
||||
COPWBonus::COPWBonus(IGameCallback *cb)
|
||||
@@ -160,7 +166,7 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const
|
||||
if(!h->hasBonusFrom(BonusSource::OBJECT_TYPE, BonusSourceID(Obj(Obj::STABLES)))) //does not stack with advMap Stables
|
||||
{
|
||||
GiveBonus gb;
|
||||
gb.bonus = Bonus(BonusDuration::ONE_WEEK, BonusType::MOVEMENT, BonusSource::OBJECT_TYPE, 600, BonusSourceID(Obj(Obj::STABLES)), BonusCustomSubtype::heroMovementLand, VLC->generaltexth->arraytxt[100]);
|
||||
gb.bonus = Bonus(BonusDuration::ONE_WEEK, BonusType::MOVEMENT, BonusSource::OBJECT_TYPE, 600, BonusSourceID(Obj(Obj::STABLES)), BonusCustomSubtype::heroMovementLand);
|
||||
gb.id = heroID;
|
||||
cb->giveHeroBonus(&gb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user