Using Rails I18n in a class

I have a class that generates PDF with shrimp:

class CustomersReport < Prawn::Document
  def to_pdf
    text "Hello, world"
    render
  end
end

How to use Rails I18n in this class? If I try to use a function translation(), it prints undefined methodtranslation 'for CustomersReport: Class`

I tried to add include ActionView::Helpers::TranslationHelperto my class, but no effect.

+3
source share
1 answer

Use I18n.t(...)or I18n.translate(...).

+9
source

All Articles