开发者

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 ?


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'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜