Closed macmotp closed 2 years ago
Hey @macmotp you can take a look on this demo app I created, it has Jetstream with inertia.
Hope it helps, let me know if there is any question: https://github.com/xiCO2k/laravel-vue-i18n-vite-app
Thanks @xiCO2k for the reply. I checked my code and I dont see any difference (Im not using Jetstream, that's the only one but I dont think is relevant cmiiaw).
So let me show you my console log, maybe it's more clear for you:
This is where I am logging in app.js
.use(i18nVue, {
lang: 'en',
fallbackLang: 'en',
resolve: async (lang) => {
const langs = import.meta.glob('../../lang/*.json');
console.log(langs);
return await langs[`../../lang/${lang}.json`]();
},
})
And see the image for the result:
(for reference, the file lang/php_en.json
exists)
Ok so I reinstalled node and yarn from scratch and now magically it works. Javascript magic 😄! Thank you for your support!
Hey @macmotp you can take a look on this demo app I created, it has Jetstream with inertia.
Hope it helps, let me know if there is any question: https://github.com/xiCO2k/laravel-vue-i18n-vite-app
Hey, i've tried to setup your example repo but get this error
Hello, thanks for the great package, is exactly what I need for my project.
I follow all the installation process but still I am not able to render the translations in the frontend (application using Laravel 9, Vite and InertiaJs - all latest versions). This is my setup:
app.js
vite.config.js
The build goes fine, I am also able to generate the json file from php, but if I am trying to render
{{ $t('auth.failed' )}}
in a vue component, it shows me the key. I tried to debug using your helpersisLoaded
,getActiveLanguage
and this is what I get:Any help to understand what am I doing wrong? You mentioned that you are using it with InertiaJs so I guess I am missing something here.
Thanks