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-storefront/app/assets/javascripts/workarea/storefront/templates/log_out_link.jst.ejs:
<span> (<a href="<%= WORKAREA.routes.storefront.logoutPath() %>" data-analytics="{'event':'logout', 'domEvent':'click'}" ><%= I18n.t('workarea.storefront.users.logout') %></a>)</span>
Help Us Improve this Doc
Was this helpful? Open a GitHub issue to report a problem with this doc, suggest an improvement, or otherwise provide feedback. Thanks!