Added simple localizations for locations
This commit is contained in:
parent
e2d9105b02
commit
ef5b142425
@ -317,7 +317,7 @@ namespace ZL
|
||||
gameState.chatHistory[i].clear();
|
||||
}
|
||||
gameState.inventory.clear();
|
||||
gameState.questJournal.loadFromFile("resources/config/quests.json", CONST_ZIP_FILE);
|
||||
gameState.questJournal.loadFromFile(localizedConfigPath("resources/config/quests.json", g_currentLanguage), CONST_ZIP_FILE);
|
||||
createLocations();
|
||||
};
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ void GameState::save(nlohmann::json& out) const
|
||||
out["savedAt"] = ts.str();
|
||||
|
||||
// --- World ---
|
||||
out["currentLocationName"] = currentLocationName;
|
||||
out["currentLocationName"] = currentLocationName;
|
||||
out["isDarklands"] = isDarklands;
|
||||
out["isNight"] = isNight;
|
||||
out["isDawn"] = isDawn;
|
||||
|
||||
@ -101,6 +101,14 @@ namespace ZL {
|
||||
gameState_(gameState),
|
||||
audioPlayer_(audioPlayer)
|
||||
{
|
||||
localizedLocationName["uni_interior"][Language::Russian] = "Университет, 3 этаж";
|
||||
localizedLocationName["uni_interior"][Language::English] = "University, 3rd floor";
|
||||
|
||||
localizedLocationName["uni_exterior"][Language::Russian] = "Университет, двор";
|
||||
localizedLocationName["uni_exterior"][Language::English] = "University, exterior";
|
||||
|
||||
localizedLocationName["location_dorm"][Language::Russian] = "Общежитие, 1 этаж";
|
||||
localizedLocationName["location_dorm"][Language::English] = "Dormitory, 1st floor";
|
||||
}
|
||||
|
||||
void MenuManager::setup(Inventory& inv, const std::string& zipFile) {
|
||||
@ -445,7 +453,7 @@ namespace ZL {
|
||||
SaveSlotInfo info = getSlotInfoFunc(slot);
|
||||
std::string label = info.empty
|
||||
? "Empty"
|
||||
: info.locationName + "\n" + info.savedAt;
|
||||
: localizedLocationName[info.locationName][ZL::g_currentLanguage] + "\n" + info.savedAt;
|
||||
uiManager.setTextButtonText(kSlotButtons[i], label);
|
||||
}
|
||||
uiManager.setTextButtonCallback(kSlotButtons[i], [this, slot](const std::string&) {
|
||||
@ -473,7 +481,7 @@ namespace ZL {
|
||||
SaveSlotInfo info = getSlotInfoFunc(slot);
|
||||
std::string label = info.empty
|
||||
? "Empty"
|
||||
: info.locationName + "\n" + info.savedAt;
|
||||
: localizedLocationName[info.locationName][ZL::g_currentLanguage] + "\n" + info.savedAt;
|
||||
uiManager.setTextButtonText(buttonName, label);
|
||||
}
|
||||
uiManager.setTextButtonCallback(buttonName, [this, slot, buttonName](const std::string&) {
|
||||
@ -482,7 +490,7 @@ namespace ZL {
|
||||
SaveSlotInfo info = getSlotInfoFunc(slot);
|
||||
std::string label = info.empty
|
||||
? "Empty"
|
||||
: info.locationName + "\n" + info.savedAt;
|
||||
: localizedLocationName[info.locationName][ZL::g_currentLanguage] + "\n" + info.savedAt;
|
||||
uiManager.setTextButtonText(buttonName, label);
|
||||
}
|
||||
});
|
||||
|
||||
@ -34,6 +34,9 @@ namespace ZL {
|
||||
UiManager topUiManager;
|
||||
UiManager chatUiManager;
|
||||
|
||||
std::unordered_map<std::string,
|
||||
std::unordered_map<Language, std::string>> localizedLocationName;
|
||||
|
||||
MenuManager(Renderer& iRenderer, GameState& gameState, AudioPlayerAsync& audioPlayer);
|
||||
|
||||
void setup(Inventory& inv, const std::string& zipFile);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user