Skip to content

Commit 2d1bf99

Browse files
committed
feat: add env variable to set the languages
1 parent 2dc006f commit 2d1bf99

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
VUE_APP_I18N_LOCALE=de
22
VUE_APP_I18N_FALLBACK_LOCALE=en
33
VUE_APP_MUSEUMSCARD=true
4+
VUE_APP_LANGUAGES=de,en,da
45
VUE_APP_NEW_API=false
56
VUE_APP_TENANT=sh
67
VUE_APP_MATOMO=true

.env.hb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
VUE_APP_I18N_LOCALE=de
2+
VUE_APP_I18N_FALLBACK_LOCALE=en
3+
VUE_APP_MUSEUMSCARD=false
4+
VUE_APP_LANGUAGES=de,en
5+
VUE_APP_NEW_API=true
6+
VUE_APP_TENANT=hb
7+
VUE_APP_MATOMO=false

src/components/dashboard/LocaleChanger.vue

+18-12
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,24 @@ export default {
4545
data() {
4646
return {
4747
locales: {
48-
de: {
49-
icon: localeIconDeutsch,
50-
name: i18n.t('locales.de.name')
51-
},
52-
en: {
53-
icon: localeIconEnglish,
54-
name: i18n.t('locales.en.name')
55-
},
56-
da: {
57-
icon: localeIconDansk,
58-
name: i18n.t('locales.da.name')
59-
}
48+
...(process.env.VUE_APP_LANGUAGES.includes('de') && {
49+
de: {
50+
icon: localeIconDeutsch,
51+
name: i18n.t('locales.de.name')
52+
}
53+
}),
54+
...(process.env.VUE_APP_LANGUAGES.includes('en') && {
55+
en: {
56+
icon: localeIconEnglish,
57+
name: i18n.t('locales.en.name')
58+
}
59+
}),
60+
...(process.env.VUE_APP_LANGUAGES.includes('da') && {
61+
da: {
62+
icon: localeIconDansk,
63+
name: i18n.t('locales.da.name')
64+
}
65+
})
6066
}
6167
}
6268
},

0 commit comments

Comments
 (0)