Skip to content

Commit

Permalink
Added information about "lazy lookup" inside views (t '.foo') in I1…
Browse files Browse the repository at this point in the history
…8N guide
  • Loading branch information
karmi committed Mar 1, 2009
1 parent 959b827 commit a6f1e42
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions railties/guides/source/i18n.textile
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,23 @@ I18n.t 'active_record.error_messages'
# => { :inclusion => "is not included in the list", :exclusion => ... }
</ruby>

h5. "Lazy" lookup

Rails 2.3 implements convenient way to lookup locale inside _views_. When you have following dictionary:

<yaml>
es:
books:
index:
title: "Título"
</yaml>

you can lookup the +books.index.title+ value *inside* +app/views/books/index.html.erb+ template like this (note the dot):

<ruby>
<%= t '.title' %>
</ruby>

h4. Interpolation

In many cases you want to abstract your translations so that *variables can be interpolated into the translation*. For this reason the I18n API provides an interpolation feature.
Expand Down

0 comments on commit a6f1e42

Please sign in to comment.