Browse Source

move hardcoded strings to JSON file

Andrey Filipenkov 3 years ago
parent
commit
0163190ac5

+ 3 - 3
client/windows/CAdvmapInterface.cpp

@@ -1217,7 +1217,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
 			if(itr != LOCPLINT->towns.end())
 				LOCPLINT->showThievesGuildWindow(*itr);
 			else
-				LOCPLINT->showInfoDialog("No available town with tavern!");
+				LOCPLINT->showInfoDialog(CGI->generaltexth->localizedTexts["adventureMap"]["noTownWithTavern"].String());
 		}
 		return;
 	case SDLK_i:
@@ -1249,7 +1249,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
 	case SDLK_r:
 		if(isActive() && LOCPLINT->ctrlPressed())
 		{
-			LOCPLINT->showYesNoDialog("Are you sure you want to restart game?",
+			LOCPLINT->showYesNoDialog(CGI->generaltexth->localizedTexts["adventureMap"]["confirmRestartGame"].String(),
 				[](){ LOCPLINT->sendCustomEvent(EUserEvent::RESTART_GAME); }, nullptr);
 		}
 		return;
@@ -1308,7 +1308,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
 				if(townWithMarket) //if any town has marketplace, open window
 					GH.pushIntT<CMarketplaceWindow>(townWithMarket);
 				else //if not - complain
-					LOCPLINT->showInfoDialog("No available marketplace!");
+					LOCPLINT->showInfoDialog(CGI->generaltexth->localizedTexts["adventureMap"]["noTownWithMarket"].String());
 			}
 			else if(isActive()) //no ctrl, advmapint is on the top => switch to town
 			{

+ 1 - 1
client/windows/CCastleInterface.cpp

@@ -851,7 +851,7 @@ void CCastleBuildings::enterToTheQuickRecruitmentWindow()
 	if(hasSomeoneToRecruit)
 		GH.pushIntT<QuickRecruitmentWindow>(town, pos);
 	else
-		CInfoWindow::showInfoDialog("There are no creatures to recruit", {});
+		CInfoWindow::showInfoDialog(CGI->generaltexth->localizedTexts["townHall"]["noCreaturesToRecruit"].String(), {});
 }
 
 void CCastleBuildings::enterFountain(const BuildingID & building, BuildingSubID::EBuildingSubID subID, BuildingID::EBuildingID upgrades)

+ 1 - 1
client/windows/CSpellWindow.cpp

@@ -562,7 +562,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
 				if(!texts.empty())
 					owner->myInt->showInfoDialog(texts.front());
 				else
-					owner->myInt->showInfoDialog("Unknown problem with this spell, no more information available.");
+					owner->myInt->showInfoDialog(CGI->generaltexth->localizedTexts["adventureMap"]["spellUnknownProblem"].String());
 			}
 		}
 		else //adventure spell

+ 5 - 0
config/translate.json

@@ -21,6 +21,10 @@
 				"Impossible"
 			]
 		},
+		"confirmRestartGame" : "Are you sure you want to restart game?",
+		"noTownWithMarket": "No available marketplace!",
+		"noTownWithTavern": "No available town with tavern!",
+		"spellUnknownProblem": "Unknown problem with this spell, no more information available.",
 		"playerAttacked" : "Player has been attacked: %s"
 	},
 	"systemOptions" :
@@ -44,6 +48,7 @@
 	"townHall" :
 	{
 		"missingBase" : "Base building %s must be built first",
+		"noCreaturesToRecruit" : "There are no creatures to recruit!",
 		"greetingManaVortex" : "As you near the %s your body is filled with new energy. You have doubled your normal spell points.",
 		"greetingKnowledge" : "You study the glyphs on the %s and gain insight into the workings of various magics (+1 Knowledge).",
 		"greetingSpellPower" : "The %s teaches you new ways to focus your magical powers (+1 Power).",