localizator icon indicating copy to clipboard operation
localizator copied to clipboard

Integration in CI

Open khalyomede opened this issue 2 years ago • 1 comments

Description

First of all, thanks a lot for this package, it saved me tons of time!

I was wondering if the command could be used on a CI, and would fail (e.g. return a non 0 code) if it finds new keys to translate, without adding them.

Proposal

The command signature could be (to discuss):

php artisan localize fr --dry-run --ci

--dry-run would instruct it to return the number of untranslated terms found by comparing what is already inside json/php files, and what the command was about to add. So the command will not really add the terms, just show what it is about to add.

--ci would return a non 0 code if some translations have been added (if not using in pair with --dry-run), or if some translations would have been added (if used with --dry-run). In this case we could prevent deploying in production pages not fully translated (at least I would use it all the times).

Notes

I could give it a try if you find this feature useful to add to the package.

khalyomede avatar Jan 22 '22 11:01 khalyomede

Love the proposal. If you think you might be able to contribute feel free to PR.

Notes:

  • Separate PRs for --dry-run and --ci
  • --dry-run should maybe output all untranslated keys in console, together with the count
  • --ci is good, needs to fail with return code 1 if untranslated strings are found, together with an outputted message in console
  • Tests!

amiranagram avatar Jan 22 '22 14:01 amiranagram