t() function

10 views
Skip to first unread message

dwormuth

unread,
Feb 3, 2011, 9:12:03 AM2/3/11
to web-app-theme-generator
Can anyone provide a pointer to how the t() function works? It's a
little to short and common to find by grepping the source and I'm not
sure if it comes from web-app-theme or one of the javascript
libraries. Here's a snippet:

<li><a href="#"><%= t("web-app-theme.profile", :default =>
"Profile") %></a></li>

I want to maintain the theme, but use a link_to helper instead.

Martín Trejo

unread,
Feb 4, 2011, 9:46:57 AM2/4/11
to web-app-the...@googlegroups.com
Hi,

t is an Alias for translate, check out 


I use a 'quick_translate' method in my ApplicationHelper:

  def qt(method)
    key = "web-app-theme.#{method.underscore}"

    I18n.translate(key, :default => method)
    
  end

Then in my views do:
  %li
    = link_to qt("GoodsReceipts"), goods_receipts_path

And in my locale file have:

    goods_receipts: Entradas


Saludos,
Reply all
Reply to author
Forward
Message has been deleted
0 new messages