From 76895be3957fd86e2531b14fc1a5ca37e365fddb Mon Sep 17 00:00:00 2001 From: axolotle Date: Mon, 10 Oct 2022 17:27:36 +0200 Subject: [PATCH] locales: wait locales loading before mounting the vue app --- app/src/i18n/helpers.js | 2 +- app/src/main.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/i18n/helpers.js b/app/src/i18n/helpers.js index 773a10e9..a509abde 100644 --- a/app/src/i18n/helpers.js +++ b/app/src/i18n/helpers.js @@ -80,7 +80,7 @@ function initDefaultLocales () { store.dispatch('UPDATE_LOCALE', locale) store.dispatch('UPDATE_FALLBACKLOCALE', fallbackLocale || 'en') - loadLocaleMessages('en') + return loadLocaleMessages('en') } export { diff --git a/app/src/main.js b/app/src/main.js index 149c37c3..2073316c 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -55,13 +55,13 @@ requireComponent.keys().forEach((fileName) => { registerGlobalErrorHandlers() // Load default locales translations files and setup store data -initDefaultLocales() +initDefaultLocales().then(() => { + const app = new Vue({ + store, + router, + i18n, + render: h => h(App) + }) -const app = new Vue({ - store, - router, - i18n, - render: h => h(App) + app.$mount('#app') }) - -app.$mount('#app')