martinlindhe / laravel-vue-i18n-generator

Generates a vue-i18n compatible include file from your Laravel translations
MIT License
306 stars 207 forks source link

Fix locale association #121

Closed jimping closed 1 year ago

jimping commented 4 years ago

When using multiple locales with e.g. a_locale.json files and folders with php files a_locale/errors.php then the translations were mixed in the wrong files because of a wrong "lastLocale" variable. The locale will now be determined by the given file path. That results to the correct association.

In my example translations from de and en had been merged to fr.js. With this patch it correct.

E.g. with:

resources/lang/{de|fr|en|pl|es}.json AND resources/lang/{de|fr|en|pl|es}/errors.php resources/lang/{de|fr|en|pl|es}/fields.php etc.

and Command:

php artisan vue-i18n:generate --multi-locales