How to make JavaScript strings translatable (localizable) in Magento 2

Magento 2 Development
To make JavaScript strings translatable or localizable in Magento 2, use

For instance:

Note that you should place the translation in the i18n folder of the module.

It is also necessary to mention that  there are some Magento 2 core modules that translate JavaScript strings as follows:

define / require the mage/translate library

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.

Source

More tips from Magento 2 cookbook