views:

42

answers:

2

Hi ,

i am new to ROR.. i am having a doubt in internationalization commands.

in some case we were using <%=t :str_use%>

and in some cases we were using <%= t(:str_use) %>

what is the difference between these two

when should i have to use 1st and when to use the second one..

Pls give some ideas regarding this.

i am having a view file with in that i am having lot of strings i wanna to internationalization them.

in some cases i am having like <td>Use</td>

and in some cases

<% if use %> Use <br />
<% else %>
+3  A: 

This is ruby's syntax, not specifically ror ;)

Both are the same. Ruby can guess the parenthesis even if they're not there.
So it's completely up to you.

Damien MATHIEU
+1  A: 

There's no difference between t :str and t(:str) — they both call the method t with the symbol :str as an argument. In Ruby, parentheses around arguments are optional.

But these are both different from t: str, which is Ruby 1.9 shorthand for the hash {:t => str}.

Chuck