From 67f11dcb6a0bbb5972fff88ae722e284b2edcefa Mon Sep 17 00:00:00 2001 From: "Schiller, Tjorben" Date: Fri, 8 Dec 2023 13:00:07 +0100 Subject: [PATCH] feat: add env variable to set the languages --- .env | 1 + .env.hb | 1 + src/components/dashboard/LocaleChanger.vue | 30 +++++++++++++--------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.env b/.env index 202fc37..4c9bb3b 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ VUE_APP_I18N_LOCALE=de VUE_APP_I18N_FALLBACK_LOCALE=en VUE_APP_MUSEUMSCARD=false +VUE_APP_LANGUAGES=de,en,da VUE_APP_NEW_API=false VUE_APP_TENANT=sh VUE_APP_MATOMO=true diff --git a/.env.hb b/.env.hb index d771ebc..67e5dc1 100644 --- a/.env.hb +++ b/.env.hb @@ -1,6 +1,7 @@ VUE_APP_I18N_LOCALE=de VUE_APP_I18N_FALLBACK_LOCALE=en VUE_APP_MUSEUMSCARD=false +VUE_APP_LANGUAGES=de,en VUE_APP_NEW_API=true VUE_APP_TENANT=hb VUE_APP_MATOMO=false diff --git a/src/components/dashboard/LocaleChanger.vue b/src/components/dashboard/LocaleChanger.vue index 49d29bc..f270ac2 100644 --- a/src/components/dashboard/LocaleChanger.vue +++ b/src/components/dashboard/LocaleChanger.vue @@ -45,18 +45,24 @@ export default { data() { return { locales: { - de: { - icon: localeIconDeutsch, - name: i18n.t('locales.de.name') - }, - en: { - icon: localeIconEnglish, - name: i18n.t('locales.en.name') - }, - da: { - icon: localeIconDansk, - name: i18n.t('locales.da.name') - } + ...(process.env.VUE_APP_LANGUAGES.includes('de') && { + de: { + icon: localeIconDeutsch, + name: i18n.t('locales.de.name') + } + }), + ...(process.env.VUE_APP_LANGUAGES.includes('en') && { + en: { + icon: localeIconEnglish, + name: i18n.t('locales.en.name') + } + }), + ...(process.env.VUE_APP_LANGUAGES.includes('da') && { + da: { + icon: localeIconDansk, + name: i18n.t('locales.da.name') + } + }) } } },