1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Merge pull request #1329 from IvanSavenko/translate_game

Translations support - base functionality for main game texts
This commit is contained in:
Ivan Savenko
2023-01-09 20:33:56 +02:00
committed by GitHub
37 changed files with 652 additions and 522 deletions

View File

@@ -1303,7 +1303,7 @@ void CGameHandler::addGenericKilledLog(BattleLogMessage & blm, const CStack * de
if(killed > 0)
{
const int32_t txtIndex = (killed > 1) ? 379 : 378;
std::string formatString = VLC->generaltexth->allTexts.at(txtIndex);
std::string formatString = VLC->generaltexth->allTexts[txtIndex];
// these default h3 texts have unnecessary new lines, so get rid of them before displaying (and trim just in case, trimming newlines does not works for some reason)
formatString.erase(std::remove(formatString.begin(), formatString.end(), '\n'), formatString.end());
@@ -2990,7 +2990,7 @@ bool CGameHandler::load(const std::string & filename)
catch(const CModHandler::Incompatibility & e)
{
logGlobal->error("Failed to load game: %s", e.what());
auto errorMsg = VLC->generaltexth->localizedTexts["server"]["errors"]["modsIncompatibility"].String() + '\n';
auto errorMsg = VLC->generaltexth->translate("vcmi.server.errors.modsIncompatibility") + '\n';
errorMsg += e.what();
lobby->announceMessage(errorMsg);
return false;
@@ -5212,7 +5212,7 @@ void CGameHandler::playerMessage(PlayerColor player, const std::string &message,
if (cheated)
{
SystemMessage temp_message(VLC->generaltexth->allTexts.at(260));
SystemMessage temp_message(VLC->generaltexth->allTexts[260]);
sendAndApply(&temp_message);
if(!player.isSpectator())