fix(i18n): load language files before doing anything else #3218
|
@ -39,6 +39,10 @@ if (window.API_URL.slice(window.API_URL.length - 1, window.API_URL.length) === '
|
|||
window.API_URL = window.API_URL.slice(0, window.API_URL.length - 1)
|
||||
}
|
||||
|
||||
// We're loading the language before creating the app so that it won't fail to load when the user's
|
||||
// language file is not yet loaded.
|
||||
await setLanguage()
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
|
||||
app.use(Notifications)
|
||||
|
@ -107,6 +111,4 @@ app.use(pinia)
|
|||
app.use(router)
|
||||
app.use(i18n)
|
||||
|
||||
setLanguage().then(() => {
|
||||
app.mount('#app')
|
||||
})
|
||||
app.mount('#app')
|
||||
|
|
Reference in New Issue
Block a user
Would it work if we save the returned promise of
setLanguage
and load it in parallel to all the stuff until mounting the app?That's how it is done right now, but that does not seem to work.
It looks like the language needs to be loaded before the Vue Lifecycle starts.
Actually tried it again but even got an error here
TypeError: route is undefined
.That's weird. I just tried this myself and couldn't trigger that error.