| 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 | { |
no test coverage detected