# Why is this t() call failing?

**URL:** <https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537>\
**Category:** Rails I18n\
**Created:** [May 13, 2010, 4:15pm UTC](https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537 "2010-05-13T16:15:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [May 13, 2010, 4:15pm UTC](https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537/1 "2010-05-13T16:15:44Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [May 13, 2010, 4:18pm UTC](https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537/2 "2010-05-13T16:18:57Z")

</div>

On Thu, May 13, 2010 at 16:15, Max W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Can anyone see why this is failing? It’s probably something dumb on my  
> part but i’m stumped 😕
> 
> 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}}”

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [May 13, 2010, 4:19pm UTC](https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537/3 "2010-05-13T16:19:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [May 13, 2010, 4:49pm UTC](https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537/4 "2010-05-13T16:49:13Z")

</div>

Krzysztof K. wrote:

> If you use the latest version of i18n {{}} syntax is depracated, and  
> %{} introduced.
> 
> Regards,  
> KK
> 
> 2010/5/13 Max W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

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

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [May 13, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/why-is-this-t-call-failing/188537/5 "2010-05-13T16:27:44Z")

</div>

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

Regards,  
KK

2010/5/13 Max W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
