Translate JavaScript Content

Translate text within JavaScript templates and modules using the I18n.t() method provided by i18n-js (bundled with Workarea).

The library provides access to the translations in config/locales, the same locale files used for localization of static text in Ruby code.

workarea-store_front/app/assets/javascripts/workarea/store_front/templates/log_out_link.jst.ejs:

<span> (<a href="<%= WORKAREA.routes.storeFront.logoutPath() %>" data-analytics="{'event':'logout', 'domEvent':'click'}" ><%= I18n.t('workarea.store_front.users.logout') %></a>)</span>