Skip to content

Internationalization (I18n)

Sam Stickland edited this page Mar 18, 2016 · 1 revision

To use the t('..') helper you need to include ActionView::Helpers::TranslationHelper. e.g.

class MyCell < Cell::ViewModel
  include ActionView::Helpers::TranslationHelper
end

If you want to use lazy lookup then you need to need to include the Translation module. For example:

require 'cell/translation'

class MyCell < Cell::ViewModel
  include ::Cell::Translation
  include ActionView::Helpers::TranslationHelper
end

And now in your cell template you can do:

<%= t('.my_key') %>

and it will lookup my_cell.my_key