Hartator
Hartator

Reputation: 5145

Rails problem using I18n in views but not in console

I have to show a translation in a view in a locale different from the current one. I use this code to force the locale for one translation :

I18n.t :what_ever, :locale => 'es'

It works in the rails console but not in the view! I have try many things but I cannot find a solution. The view tell this error :

translation missing: es.what_ever

So, I was thinking it was a trouble from the YAML but exactly the same code works well in rails console....

Any Ideas ?

Upvotes: 3

Views: 3431

Answers (1)

dimitarvp
dimitarvp

Reputation: 2383

This seems like answered, but I will give you the solution anyway:

Instead of doing:

I18n.t :what_ever, :locale => 'es'

Do this:

I18n.t 'what_ever', :locale => 'es'

Upvotes: 3

Related Questions