1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Initial support for translations

This commit is contained in:
tobspr
2020-06-10 12:13:38 +02:00
parent fad7a417f2
commit 714cd449e9
6 changed files with 860 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ import { createLogger } from "../core/logging";
import { findNiceValue, waitNextFrame } from "../core/utils";
import { cachebust } from "../core/cachebust";
import { PlatformWrapperImplBrowser } from "../platform/browser/wrapper";
import { T } from "../translations";
import { T, autoDetectLanguageId, updateApplicationLanguage } from "../translations";
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
import { CHANGELOG } from "../changelog";
import { globalConfig } from "../core/config";
@@ -143,6 +143,19 @@ export class PreloadState extends GameState {
}
})
.then(() => this.setStatus("Initializing language"))
.then(() => {
if (this.app.settings.getLanguage() === "auto-detect") {
const language = autoDetectLanguageId();
logger.log("Setting language to", language);
return this.app.settings.updateLanguage(language);
}
})
.then(() => {
const language = this.app.settings.getLanguage();
updateApplicationLanguage(language);
})
.then(() => this.setStatus("Initializing sounds"))
.then(() => {
// Notice: We don't await the sounds loading itself