Reading I18n file content in rails controller

Hi,

Maybe this is a beginner’s question. Can someone please tell me how can
I
reference a en.yml entry in my rails controller? I am able to
reference
it in rails view file as below.

config/locales/en.yml


read_text: “I want to display this text.”

app/views/dashboard/index.html.erb


<%=t :read_text%>

I want to access *read_text: *in
app/controllers/dashboard_controller.rb

Thanks.

Regards,
Ankur

One generally uses I18n to do that though there are other options.
I18n.t(‘read_text’). Of course it is generally recommended to do that
kind of stuff in your views and have the controllers control.

Norm

On 15 November 2014 13:51, Ankur K. [email protected] wrote:

read_text: “I want to display this text.”

app/views/dashboard/index.html.erb


<%=t :read_text%>

I want to access read_text: in app/controllers/dashboard_controller.rb

As Norm indicated, the question is why would you want to do this?
Normally that would be done in a view.

Colin