diff options
author | Karel Minarik <karmi@karmi.cz> | 2009-03-01 12:51:18 +0100 |
---|---|---|
committer | Karel Minarik <karmi@karmi.cz> | 2009-03-01 12:51:18 +0100 |
commit | a6f1e42c096a626b8a071094545d35f90d19ab55 (patch) | |
tree | 4895df3e9bc8148f209dc4b3125201f36cd1fde1 | |
parent | 959b827e40248691864221d9d8561f17fb5755a6 (diff) | |
download | rails-a6f1e42c096a626b8a071094545d35f90d19ab55.tar.gz rails-a6f1e42c096a626b8a071094545d35f90d19ab55.tar.bz2 rails-a6f1e42c096a626b8a071094545d35f90d19ab55.zip |
Added information about "lazy lookup" inside views (`t '.foo'`) in I18N guide
-rw-r--r-- | railties/guides/source/i18n.textile | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/railties/guides/source/i18n.textile b/railties/guides/source/i18n.textile index d882a65d8d..bb17e1ffc4 100644 --- a/railties/guides/source/i18n.textile +++ b/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. |