From c8243313b8030407037a960febf39b03e7917048 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Tue, 29 Aug 2023 14:53:15 +0400 Subject: [PATCH] Translations for turn timers --- Mods/vcmi/config/vcmi/english.json | 9 +++++++++ client/gui/InterfaceObjectConfigurable.cpp | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Mods/vcmi/config/vcmi/english.json b/Mods/vcmi/config/vcmi/english.json index 8ef48c372..cb7c2489f 100644 --- a/Mods/vcmi/config/vcmi/english.json +++ b/Mods/vcmi/config/vcmi/english.json @@ -191,6 +191,15 @@ "vcmi.randomMapTab.widgets.teamAlignmentsLabel" : "Team Alignments", "vcmi.randomMapTab.widgets.roadTypesLabel" : "Road Types", + "vcmi.optionsTab.widgets.chessFieldBase.help" : "{Base timer}\n\nCounts down when {turn timer} runs out, never resets. If timer expires, player ends turn.", + "vcmi.optionsTab.widgets.chessFieldTurn.help" : "{Turn timer}\n\nCounts down when player is making turn on adventure map, resets every turn. If {base timer} is enabled, unspent time will be added to it.", + "vcmi.optionsTab.widgets.chessFieldBattle.help" : "{Battle timer}\n\nCounts down during battles when {stack timer} runs out, resets every battle. if timer expires, currently acting stack will defend.", + "vcmi.optionsTab.widgets.chessFieldCreature.help" : "{Creature timer}\n\nCounts down when player is choosing action in battle, resets after each stack turn.", + "vcmi.optionsTab.widgets.labelTimer" : "Timer", + "vcmi.optionsTab.widgets.timerModeSwitch.classic" : "Classic timer", + "vcmi.optionsTab.widgets.timerModeSwitch.chess" : "Chess timer", + + // Custom victory conditions for H3 campaigns and HotA maps "vcmi.map.victoryCondition.daysPassed.toOthers" : "The enemy has managed to survive till this day. Victory is theirs!", "vcmi.map.victoryCondition.daysPassed.toSelf" : "Congratulations! You have managed to survive. Victory is yours!", diff --git a/client/gui/InterfaceObjectConfigurable.cpp b/client/gui/InterfaceObjectConfigurable.cpp index bab69dd1d..65da83227 100644 --- a/client/gui/InterfaceObjectConfigurable.cpp +++ b/client/gui/InterfaceObjectConfigurable.cpp @@ -157,6 +157,8 @@ std::string InterfaceObjectConfigurable::readText(const JsonNode & config) const return ""; std::string s = config.String(); + if(s.empty()) + return s; logGlobal->debug("Reading text from translations by key: %s", s); return CGI->generaltexth->translate(s); } @@ -561,8 +563,8 @@ std::shared_ptr InterfaceObjectConfigurable::buildTextInput(const Js result->font = readFont(config["font"]); if(!config["color"].isNull()) result->setColor(readColor(config["color"])); - if(!config["text"].isNull()) - result->setText(readText(config["text"])); + if(!config["text"].isNull() && config["text"].isString()) + result->setText(config["text"].String()); //for input field raw string is taken if(!config["callback"].isNull()) result->cb += callbacks_string.at(config["callback"].String()); if(!config["help"].isNull())