Files
shadow-over-bishkek001/src/Localization.h
T

35 lines
1.2 KiB
C++

#pragma once
#include <string>
namespace FRG {
enum class Language {
Russian,
English
};
// Currently selected language for in-game text. Defaults to Russian.
extern Language g_currentLanguage;
std::string languageToCode(Language lang);
Language languageFromCode(const std::string& code);
// "resources/config/items.json" + English -> "resources/config_en/items.json".
// Returns basePath unchanged if it doesn't contain a "/config/" segment.
std::string localizedConfigPath(const std::string& basePath, Language lang);
// Reads basePath, preferring the config_<lang> variant for g_currentLanguage;
// falls back to basePath if the localized file/zip-entry is missing or empty.
// zipFile empty => loose files from disk; non-empty => entries inside that zip.
std::string readLocalizedConfigFile(const std::string& basePath, const std::string& zipFile);
// Reads the "language" field from settings.json (if present) and updates
// g_currentLanguage. Safe to call even if settings.json doesn't exist yet.
// Must run before any location/dialogue content is loaded, since some
// location scripts start dialogues eagerly as soon as they're loaded.
void loadLanguageSetting();
Language detectSystemLanguage();
} // namespace FRG