From cd4acb5eec48ca4adacc1039d558b9127ffc7836 Mon Sep 17 00:00:00 2001 From: mbattista Date: Sat, 22 Apr 2023 01:24:23 +0200 Subject: [PATCH] lang url parameter (#296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lang url parameter * add ?lang to readme. --------- Co-authored-by: Miroslav Šedivý --- client/src/components/menu.vue | 7 +++++++ client/src/plugins/i18n.ts | 1 + docs/changelog.md | 1 + docs/getting-started/README.md | 1 + 4 files changed, 10 insertions(+) diff --git a/client/src/components/menu.vue b/client/src/components/menu.vue index 351a99ae..bbe4ff43 100644 --- a/client/src/components/menu.vue +++ b/client/src/components/menu.vue @@ -76,5 +76,12 @@ about() { this.$accessor.client.toggleAbout() } + + mounted() { + const default_lang = new URL(location.href).searchParams.get('lang') + if (default_lang && this.langs.includes(default_lang)) { + this.$i18n.locale = default_lang + } + } } diff --git a/client/src/plugins/i18n.ts b/client/src/plugins/i18n.ts index e5d5b409..6b199e86 100644 --- a/client/src/plugins/i18n.ts +++ b/client/src/plugins/i18n.ts @@ -6,5 +6,6 @@ Vue.use(VueI18n) export const i18n = new VueI18n({ locale: 'en', + fallbackLocale: 'en', messages, }) diff --git a/docs/changelog.md b/docs/changelog.md index 26715e1c..82e7bae3 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,7 @@ ### New Features - Added nvidia support for firefox. +- Added `?lang=` parameter to the URL, which will set the language of the interface (by @mbattista). ## [n.eko v2.8.0](https://github.com/m1k1o/neko/releases/tag/v2.8.0) diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md index 5b0b3610..7b9a3a8a 100644 --- a/docs/getting-started/README.md +++ b/docs/getting-started/README.md @@ -255,6 +255,7 @@ NEKO_BROADCAST_PIPELINE: "flvmux name=mux ! rtmpsink location={url} pulsesrc dev - Adding `?cast=1` will hide all control and show only video. - Adding `?embed=1` will hide most additional components and show only video. - Adding `?volume=<0-1>` will set volume to given value. + - Adding `?lang=` will set language to given value. - e.g. `http(s):///?pwd=neko&usr=guest&cast=1` ### Screen size