How to make JavaScript strings translatable (localizable) in Magento 2
To make JavaScript strings translatable or localizable in Magento 2, use

For instance:
Note that you should place the translation in the i18n
It is also necessary to mention that there are some Magento 2 core modules that translate JavaScript strings as follows:
define
/ require
mage/translate
and
Please note that you have to deal with the autogenerated js-translation.json
file, so it is necessary to delete it and flush cache to make the system become able to recheck your new interface strings and the dictionary. It will create a new js-translation.json
file. Also note that the js-translation.json
file is generated only if you have a language package for your current language.
More tips from Magento 2 cookbook
