i18n-command
i18n-command copied to clipboard
Consider making `make-json` not destructive by default
I was not expecting make-json
to be destructive when first running the command and lost test data.
Should the default be changed to not purge? Or require WP_CLI::confirm
if purge/no-purge
isn't specified?
I don't see much value in changing the default (again).
This options is about removing strings from the PO file that only occur in JavaScript files. Since we have the JSON translation files for JS-only strings, they are of no use in the PO file. That's why purge
is the default.
It would help if you could explain your use case a bit more, beyond unexpectedness.
I'm not sure what the actual use case is. It is unexpected that I can't run the same command twice.
In my case, I'd just created a sample translation file, and so after deleting the corresponding .json
file, I had lost all of my "translations". In practice, you'd probably have a copy/backup of this file somewhere, but maybe not.
It's better to keep them because it's a lot easier to update translation for PO files if you have some software to it (for example Poedit) and then only run the command to generate JSON translation files.
Good point.
Would it make sense to add a dedicated purge
command or something? Because it's not ideal to then load the full PO file in memory when many of the translations are only used in JS.
Yeah, maybe it would be good, but I don't know if it's needed when we can purge them by the same command only with the added parameter --purge
instead of --no-purge
to keep files intact.