Why is this t() call failing?

Can anyone see why this is failing? It’s probably something dumb on my
part but i’m stumped :confused:

ActionView::TemplateError (interpolation argument :date_string missing
in “Created on {{:date_string}} at {{:time_string}}”) on line #51 of
app/views/quizzes/edit_step_0.html.haml:
48: %p
49: = quiz.name
50: %br/
51: = t(‘general.created_on’, :date_string =>
quiz.created_at.strftime(’%d/%m/%y’), :time_string =>
quiz.created_at.strftime(’%H:%M’))
52: = link_to “Edit”, edit_quiz_path(quiz), :title => “Edit
quiz”, :class => “Button”
53:

As far as i can see this error doesn’t make sense as i’m passing
date_string through in my t call. Here’s the t call line by itself:

          = t('general.created_on', :date_string =>

quiz.created_at.strftime(’%d/%m/%y’), :time_string =>
quiz.created_at.strftime(’%H:%M’))

here’s my en.yml file, with some lines removed for clarity:

en:
hello_world: Hello
general:
created_on: “Created on {{:date_string}} at {{:time_string}}”

It’s nothing to do with the actual values i’m passing through, ie all
the created_at.strftime stuff. If i swap those out for ‘foo’ and ‘bar’
i get the same problem. Can anyone see what i’m doing wrong?

thanks, max

On Thu, May 13, 2010 at 16:15, Max W. [email protected]
wrote:

Can anyone see why this is failing? It’s probably something dumb on my
part but i’m stumped :confused:

ActionView::TemplateError (interpolation argument :date_string missing
in “Created on {{:date_string}} at {{:time_string}}”) on line #51 of
app/views/quizzes/edit_step_0.html.haml:

created_on: “Created on {{:date_string}} at {{:time_string}}”

I think you need to lose the colons there, so:

created_on: “Created on {{date_string}} at {{time_string}}”

SOLVED: Je suis un idiot: it should be

created_on: "Created on {{date_string}} at {{time_string}}"

not

created_on: "Created on {{:date_string}} at {{:time_string}}"

Thanks for reading. max

Krzysztof K. wrote:

If you use the latest version of i18n {{}} syntax is depracated, and
%{} introduced.

Regards,
KK

2010/5/13 Max W. [email protected]:

ah, cool, thanks Krzysztof, i’ll check that out. It’s not the first
time i’ve slipped up with the {{ }} syntax.

If you use the latest version of i18n {{}} syntax is depracated, and
%{} introduced.

Regards,
KK

2010/5/13 Max W. [email protected]: