From 327649c0403325b6485964422a0da110034278e1 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 21 Aug 2021 20:25:36 +0200 Subject: [PATCH] Add language control parameter --- Docs/URL_Parameters.md | 4 ++++ UI/i18n/Locale.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Docs/URL_Parameters.md b/Docs/URL_Parameters.md index 589ed0cbd2..6d96e02de0 100644 --- a/Docs/URL_Parameters.md +++ b/Docs/URL_Parameters.md @@ -19,6 +19,10 @@ the URL-parameters are stated in the part between the `?` and the `#`. There are Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case. + language +---------- + +The language to display mapcomplete in. Will be ignored in case a logged-in-user did set their language before. If the specified language does not exist, it will default to the first language in the theme. download-control-toggle ------------------------- diff --git a/UI/i18n/Locale.ts b/UI/i18n/Locale.ts index 55365ce6ce..1ef9f0ae48 100644 --- a/UI/i18n/Locale.ts +++ b/UI/i18n/Locale.ts @@ -1,6 +1,7 @@ import {UIEventSource} from "../../Logic/UIEventSource"; import {LocalStorageSource} from "../../Logic/Web/LocalStorageSource"; import {Utils} from "../../Utils"; +import {QueryParameters} from "../../Logic/Web/QueryParameters"; export default class Locale { @@ -14,6 +15,10 @@ export default class Locale { window.setLanguage = function (language: string) { source.setData(language) } + source.syncWith( + QueryParameters.GetQueryParameter("language", undefined,"The language to display mapcomplete in. Will be ignored in case a logged-in-user did set their language before. If the specified language does not exist, it will default to the first language in the theme."), + true + ) } return source; }