Kir
Kir

Reputation: 8111

using Rails I18n in class

I have a class that generates PDF with Prawn:

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 translation() function, it prints undefined methodtranslation' for CustomersReport:Class`

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

Upvotes: 3

Views: 1784

Answers (1)

Marcel Jackwerth
Marcel Jackwerth

Reputation: 54742

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

Upvotes: 10

Related Questions