martinlindhe / laravel-vue-i18n-generator

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

Proposal: Support JSON as output format. #73

Closed kenfdev closed 5 years ago

kenfdev commented 5 years ago

Hi, first of all thanks for the hard work for this project. I'd really like to use this to have a single source for i18n but would like to output the results as JSON. This is because I'd like to lazy load the translation files from my SPA depending on which language has been requested.

Proposed Behavior

Add a --format option which can take es6, umd or json. (Defaults to es6)

// e.g.
php artisan vue-i18n:generate --format json

Current Behavior

Either es6 or umd is supported.

// es6
php artisan vue-i18n:generate

// umd
php artisan vue-i18n:generate --umd

Possible Solution

Since adding --json will become cumbersome, how about refactoring it to --format which takes es6, umd or json? But keep --umd for backwards compatibility.

I would like to hear your thoughts @martinlindhe and am also willing to contribute :) Thanks!

martinlindhe commented 5 years ago

Sounds like a great feature to have. Please go ahead and work on this!