When I don't have a .json translation file in my ./lang folder, I get an error in the console.
Specifications:
Laravel 9
Vue 3
Inertia 1.0.0
Laravel-vue-i18n 2.3.1
Situation:
PHP Translations enabled in vite.config.js
I only have .php translation files in the ./lang folder
Console Error:
Uncaught (in promise) TypeError: langs[lang] is not a function
at resolve (app.js:24:66)
at avoidException (avoid-exceptions.js:3:16)
at I18n.resolveLangAsync (index.js:185:20)
at index.js:159:18
at new Promise (<anonymous>)
at I18n.loadLanguageAsync (index.js:155:16)
at I18n.load (index.js:129:61)
at new I18n (index.js:113:14)
at I18n.getSharedInstance (index.js:311:84)
at Object.install (index.js:83:44)
The error is caused by this line of code in the app.js:
return await langs[`../../lang/${lang}.json`]();
I added a temporary workaround:
if (typeof langs[`../../lang/${lang}.json`] == "undefined") return;
When I don't have a .json translation file in my ./lang folder, I get an error in the console.
Specifications:
Situation:
Console Error:
The error is caused by this line of code in the app.js:
return await langs[`../../lang/${lang}.json`]();
I added a temporary workaround:
if (typeof langs[`../../lang/${lang}.json`] == "undefined") return;
App.js