Skip to content

Commit

Permalink
Load Vue translations before mounting comopnents
Browse files Browse the repository at this point in the history
  • Loading branch information
eronisko committed Apr 26, 2024
1 parent fd43ba6 commit 4aa293e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,21 @@ import BottomModal from './components/BottomModal.vue'
import NewsletterSignupFormController from './components/newsletter-signup/FormController.vue'
import NewsletterSignupBottomModalController from './components/newsletter-signup/BottomModalController.vue'

createApp({
const app = createApp({
compilerOptions: {
whitespace: 'preserve',
},
})
.use(VueMasonryPlugin)

app.use(VueMasonryPlugin)
.use(i18nVue, {
resolve: async (lang) => {
const langs = import.meta.glob('../../lang/*.json')
return await langs[`../../lang/${lang}.json`]()
},
onLoad: () => {
app.mount('#app') // App is mounted here so translations are loaded before vue.
},
})
.use(ZiggyVue)

Expand Down Expand Up @@ -127,5 +131,3 @@ createApp({
.component('bottom-modal', BottomModal)
.component('newsletter-signup.form-controller', NewsletterSignupFormController)
.component('newsletter-signup.bottom-modal-controller', NewsletterSignupBottomModalController)

.mount('#app')

0 comments on commit 4aa293e

Please sign in to comment.