# Right way to do

**URL:** <https://www.ruby-forum.com/t/right-way-to-do/158760>\
**Category:** Rails\
**Created:** [January 27, 2009, 7:46pm UTC](https://www.ruby-forum.com/t/right-way-to-do/158760 "2009-01-27T19:46:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [January 27, 2009, 7:46pm UTC](https://www.ruby-forum.com/t/right-way-to-do/158760/1 "2009-01-27T19:46:24Z")

</div>

What is the right way to print localizations?

\<%=t :User %\> OR \<%=t “User” %\> OR \<%=t (“User”) %\>

\<%=t :User %\> works fine, but \<%=t :User.Username %\> doesn’t, but this  
works:  
\<%=t (“User.Username”) %\>

---

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [January 28, 2009, 2:02am UTC](https://www.ruby-forum.com/t/right-way-to-do/158760/2 "2009-01-28T02:02:42Z")

</div>

> What is the right way to print localizations?
> 
> \<%=t :User %\> OR \<%=t “User” %\> OR \<%=t (“User”) %\>
> 
> \<%=t :User %\> works fine, but \<%=t :User.Username %\> doesn’t, but this  
> works:  
> \<%=t (“User.Username”) %\>

I’d go with \<%=t “User” %\>.

:User works in this case because t() is converting the argument to a  
string and :User.to\_s =\> “User”. :User.Username won’t work because  
there is no “Username” method on the _symbol_ “User”.

-philip
