diff --git a/front/src/Components/Menu/SettingsSubMenu.svelte b/front/src/Components/Menu/SettingsSubMenu.svelte index 53503902..776acbbe 100644 --- a/front/src/Components/Menu/SettingsSubMenu.svelte +++ b/front/src/Components/Menu/SettingsSubMenu.svelte @@ -4,7 +4,7 @@ import { HtmlUtils } from "../../WebRtc/HtmlUtils"; import { isMobile } from "../../Enum/EnvironmentVariable"; import { menuVisiblilityStore } from "../../Stores/MenuStore"; -import { translator } from "../../Translator/Translator"; + import { languages, translator } from "../../Translator/Translator"; let fullscreen: boolean = localUserStore.getFullscreen(); let notification: boolean = localUserStore.getNotification() === "granted"; @@ -12,14 +12,18 @@ import { translator } from "../../Translator/Translator"; let ignoreFollowRequests: boolean = localUserStore.getIgnoreFollowRequests(); let valueGame: number = localUserStore.getGameQualityValue(); let valueVideo: number = localUserStore.getVideoQualityValue(); + let valueLanguage: string = translator.getStringByLanguage(translator.getCurrentLanguage()) ?? "en-US"; let previewValueGame = valueGame; let previewValueVideo = valueVideo; + let previewValueLanguage = valueLanguage; function saveSetting() { - if (valueGame !== previewValueGame) { - previewValueGame = valueGame; - localUserStore.setGameQualityValue(valueGame); - window.location.reload(); + let change = false; + + if (valueLanguage !== previewValueLanguage) { + previewValueLanguage = valueLanguage; + translator.switchLanguage(previewValueLanguage); + change = true; } if (valueVideo !== previewValueVideo) { @@ -27,6 +31,16 @@ import { translator } from "../../Translator/Translator"; videoConstraintStore.setFrameRate(valueVideo); } + if (valueGame !== previewValueGame) { + previewValueGame = valueGame; + localUserStore.setGameQualityValue(valueGame); + change = true; + } + + if (change) { + window.location.reload(); + } + closeMenu(); } @@ -127,6 +141,17 @@ import { translator } from "../../Translator/Translator"; +
+

{translator._("menu.settings.language.title")}

+
+ +
+

{translator._("menu.settings.save.warning")}