MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / loadLanguageFile

Function loadLanguageFile

src/OpenLoco/src/Localisation/LanguageFiles.cpp:285–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283 }
284
285 void loadLanguageFile()
286 {
287 // First, load en-GB for fallback strings.
288 fs::path languageDir = Environment::getPath(Environment::PathId::languageFiles);
289 fs::path languageFile = languageDir / "en-GB.yml";
290 if (!loadLanguageStringTable(languageFile))
291 {
292 throw Exception::RuntimeError("Could not load the en-GB language file!");
293 }
294
295 // Determine the language currently selected.
296 auto& config = Config::get();
297 if (config.language == "en-GB")
298 {
299 return;
300 }
301
302 // Now, load the language table for the language currently selected.
303 languageFile = languageDir / (config.language + ".yml");
304 if (!loadLanguageStringTable(languageFile))
305 {
306 throw Exception::RuntimeError("Could not load the " + config.language + " language file!");
307 }
308 }
309
310 void unloadLanguageFile()
311 {

Callers 2

initialiseFunction · 0.85
languageDropdownFunction · 0.85

Calls 3

getPathFunction · 0.85
loadLanguageStringTableFunction · 0.85
getFunction · 0.50

Tested by

no test coverage detected