Forum: Rails I18n i18n controller-view

Posted by Kot Matroskin (furoh)
on 2010-01-26 09:45
hello, could you tell me why this doesn't work?

controller:

 flash[:success] = t('flash.added', :item => t('dictionary.challenge'))

en.yml

  dictionary:
    challenge: Challenge

  flash:
    added: {{item}} has been successfully created.
Posted by Henrik --- (malesca)
on 2010-01-26 10:20
(Received via mailing list)
On Tue, Jan 26, 2010 at 09:45, Kot Matroskin <lists@ruby-forum.com> 
wrote:
> hello, could you tell me why this doesn't work?

"Doesn't work" is too unspecific. State your Rails version, if you use
the built-in i18n or the gem (what version?) and how it doesn't work,
specifically. What do you see, what did you expect to see instead? Any
exception backtraces.

>  flash:
>    added: {{item}} has been successfully created.

One thought off the top of my head is that perhaps you need to quote
the added value when it includes curly braces, but that's a wild
guess.

So try

flash:
  added: "{{item}} has been successfully created."
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.