xiCO2k / laravel-vue-i18n

Allows to connect your `Laravel` Framework translation files with `Vue`.
MIT License
594 stars 49 forks source link

lang directory inside js folder not creating after npm run dev command. #95

Closed devbipu closed 1 year ago

devbipu commented 1 year ago

Hi, I'm using Laravel 9 & Vue3 with Vite, I've installed the plugin and also setup as per docs but after ruing the npm run dev command it's not creating the lang dir inside my js directory.

This is my configuration in the app.js file

vueApp.use(i18nVue, {
    resolve: async lang => {
        const langs = import.meta.glob('../../lang/*.json');
        return await langs[`../../lang/${lang}.json`]();
    }
})
xiCO2k commented 1 year ago

Can't find a problem with that, can you show me the error message?

devbipu commented 1 year ago

No error message is showing. The app is running well. But I can't find the lang dir inside my app. I can find it. In the tutorial lang dir is created after running the command npm run dev but in my case, it's not creating the dir into my app.

xiCO2k commented 1 year ago

so for the tutorial the lang folder should be on the root of your project. and the app.js should be on resources/js/app.js, if thats the case everything should work.

devbipu commented 1 year ago

There has a lang dir in my root directory but it's Laravel default lang dir with PHP files. For Vue, it's might my in my resources/js/app.js as per the tutorial. Should I send you a git repo of the code so you can review it?

xiCO2k commented 1 year ago

Yes can you create a public repo for me to check?

Thanks.

devbipu commented 1 year ago

This is the repo https://github.com/devbipu/Laravel-9-Vue-3-setup---vite Check it please

xiCO2k commented 1 year ago

Will check it out, and get back to you.

xiCO2k commented 1 year ago

Found it, so in order to use the .php translations you need to check this part of the documentation:

https://github.com/xiCO2k/laravel-vue-i18n#php-translations-available-on-vue

Cheers.

devbipu commented 1 year ago

Actually, I've to use JavaScript translation. But I can't get the lang dir for javascript :(