martinlindhe/laravel-vue-i18n-generator

vue-i18n-locales.generated.js empty

eduardor2k opened this issue · 4 comments

Hi, when i run the command:
php artisan vue-i18n:generate
The file vue-i18n-locales.generated.js only contains
export default

That's strange.
It should process your laravel translations, perhaps you haven't created any yet?

Hi, I've found the cause of error. Some malformed language files, instead of being encoded in utf-8 it was encoded in ISO-8859-1

See #43

Now i get:

root@1f38f50e1ebf:/var/www# php artisan vue-i18n:generate
In Generator.php line 73:                                           
  Could not generate JSON file, error code 5

You should try to analyse what is wrong with the json file using a json validator and fix the issues with it.

laravel-vue-i18n-validator expects well-formed input json to work.
There are some online tools and some offline ones.

Like https://jsonlint.com/

I made one in go: https://github.com/martinlindhe/validjson

I'm using PhpStorm, just browsing each file, PhpStorm told me that i was reading a file with the wrong encoding, thank god i had only 20 language files.

Thanks for the tip!