diff --git a/plugins/globals.js b/plugins/globals.js index b5c10a73e..c02492b46 100644 --- a/plugins/globals.js +++ b/plugins/globals.js @@ -1,6 +1,5 @@ import Vue from 'vue'; import { Translator } from '../src/translator.js'; -import config from '../data/config.suml'; import { buildDict } from '../src/helpers.js'; import { DateTime, Settings } from 'luxon'; import { decodeTime } from 'ulid'; @@ -13,7 +12,7 @@ export default ({ app, store }) => { Vue.prototype.$base = process.env.BASE_URL; - const translator = new Translator(translations, baseTranslations, config); + const translator = new Translator(translations, baseTranslations, app.$config); Vue.prototype.$translator = translator; Vue.prototype.$t = (key, params = {}, warn = false) => translator.translate(key, params, warn); Vue.prototype.$te = (key, fallback = false) => { @@ -34,12 +33,12 @@ export default ({ app, store }) => { }; Vue.prototype.$locales = buildDict(function* () { - if (config.locale !== '_') { - yield [config.locale, process.env.LOCALES[config.locale]]; + if (app.$config.locale !== '_') { + yield [app.$config.locale, process.env.LOCALES[app.$config.locale]]; } - for (const l in process.env.LOCALES) { - if (process.env.LOCALES.hasOwnProperty(l) && l !== config.locale) { - yield [l, process.env.LOCALES[l]]; + for (const [locale, localeDescription] in Object.entries(process.env.LOCALES)) { + if (locale !== app.$config.locale) { + yield [locale, localeDescription]; } } }); @@ -74,7 +73,7 @@ export default ({ app, store }) => { }; try { - Settings.defaultLocale = config.intlLocale || config.locale; + Settings.defaultLocale = app.$config.intlLocale || app.$config.locale; DateTime.now().toFormat('y-MM-dd HH:mm'); // test if locale is supported by luxon } catch { Settings.defaultLocale = 'en';