how can i access locale files from rake task

16 views
Skip to first unread message

tom

unread,
Jan 21, 2019, 11:36:43 AM1/21/19
to Ruby on Rails: Talk
hi,

how can i do this?

task test: :environment do
p t('pages.index.slogan11')
end

Frederick Cheung

unread,
Jan 26, 2019, 1:29:31 PM1/26/19
to Ruby on Rails: Talk
You should be able to do I18n.t(“...”)

As an aside naming the task `test` may clash with the preexisting task of the same name.

Fred
Reply all
Reply to author
Forward
0 new messages