Steps for setting up i18n-js:
1) Add i18n-js gem to your Gemfile
If you’re not using the asset pipeline, add the following lines in your application.html.erb (layout file)
3) To export all translation files, run the following commands
4) Add the following lines in your application.html.erb (layout file)
5) Finally, you can use translate your text in js file.
Note: Run the following command every time you have new translation in the .yml file