"Review & Payments","Overzicht & Betalen","module","Magento_Checkout" within app/i18n/VENDOR/language-nl_nl/nl_NL.csvphp bin/magento cache:clean and/or php bin/magento cache:flushThe only way I could force this to happen is by doing php bin/magento setup:upgrade as part of this is that it runs the following:
File system cleanup:
/pub/static/frontend
/var/view_preprocessed/frontools
/var/view_preprocessed/source
However this seems to me to be overkill to have to run a setup:upgrade to clear out translations stored for Javascript.
I understand the reasoning behind your request, since the caching in Magento caches non-js translations.
But, and this is a big but, flushing the cache should only clear Magento caches and shouldn't manipulate actual files.
This would be a disaster in a production environment, if Magento would try to remove the js translation files every time you flush the Magento cache.
On production environments, there could be a file permission policy active, where php isn't able to delete or create files in the pub/static directory for example.
So in my opinion, this is a very bad idea.
I'd suggest you simple remove the js translation files by hand every time you want it to be rebuilt on your development environment. Or even better, you can write your own custom script, maybe using grunt or gulp or something else, which does this by executing a simple command, it can probably be as simple as (not actually tested):
$ php bin/magento cache:flush translate && find pub/static/frontend -name 'js-translation.json' -delete
There are currently several issues with the js-translation.json file. The js-translation.json is part of the translation files and is preferably generated by regenerating the static content for a certain language. You do not need to rerun the setup:upgrade command.
Please take a look here: https://github.com/magento/magento2/issues/2951#issuecomment-276552659
Please note you will have to reload the page twice to have the correct js-translation.json loaded.
Thanks @hostep and @thomvanderboon for your time in replying.
@thomvanderboon I did do a static content deploy however didn't seem to work but as you say maybe I didnt do a reload twice.
It just feels a little odd that a cache:flush translate doesn't clear all translations. I would say some better documentation is needed here to confirm this.
Then as a suggestion perhaps putting into the bin/magento CLI we could add under i18n something like i18n:cache:flush. This would do both the standard magento cache:flush translate and also the removing of the js-translation.json files.
Is this a good idea that you both would support?
There are many translation related bug in Magento 2.x. Before supporting a new feature, I would much more like these bugs fixed.
I created a script to do the job. This works good enough for me.
Thom
Perhaps just go down the documentation route then on the magento 2 website then. Thanks for now.
Most helpful comment
Thanks @hostep and @thomvanderboon for your time in replying.
@thomvanderboon I did do a static content deploy however didn't seem to work but as you say maybe I didnt do a reload twice.
It just feels a little odd that a
cache:flush translatedoesn't clear all translations. I would say some better documentation is needed here to confirm this.Then as a suggestion perhaps putting into the
bin/magentoCLI we could add underi18nsomething likei18n:cache:flush. This would do both the standard magentocache:flush translateand also the removing of the js-translation.json files.Is this a good idea that you both would support?