Permalink
Browse files

Added information about "lazy lookup" inside views (`t '.foo'`) in I1…

…8N guide
  • Loading branch information...
1 parent 959b827 commit a6f1e42c096a626b8a071094545d35f90d19ab55 @karmi karmi committed Mar 1, 2009
Showing with 17 additions and 0 deletions.
  1. +17 −0 railties/guides/source/i18n.textile
@@ -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.

0 comments on commit a6f1e42

Please sign in to comment.