-
-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Hello, I tried using this library with Inertita and Vue today and I found a strange behaviour. Repo where it's possible to replicate: https://github.com/LaravelDaily/Laravel-Vue-Inertia-Translations-Demo
When you first request for the page (F5), you get an error that langs[lang] is not a function, it soon dissapers (pasted picture). The problem is that there is also a flash of translation strings on the page. Also, if you use trans in props without wTrans, they stay like that. If you use it with wTrans, you get Vue warning in the console.
This is my setup of the app
createInertiaApp({
title: (title) => (title ? `${title} - ${appName}` : appName),
resolve: (name) =>
resolvePageComponent(
`./pages/${name}.vue`,
import.meta.glob<DefineComponent>('./pages/**/*.vue'),
),
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.use(i18nVue, {
fallbackLang: 'en',
resolve: async (lang: string) => {
const langs: any = import.meta.glob('../../lang/*.json');
return await langs[`../../lang/${lang}.json`]();
},
})
.mount(el);
},
progress: {
color: '#4B5563',
},
});
I tried console.log(lang) and received php_en and en.
Once you make another request, everything is working, it's just this first request.
Metadata
Metadata
Assignees
Labels
No labels