diff options
author | Oliver Günther <mail@oliverguenther.de> | 2018-10-25 07:46:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 07:46:58 +0200 |
commit | 4692ed7e12b72f2bd3adee9a243bd270f0de402e (patch) | |
tree | 1f4552e4ffcad2317aa279010aec8c68daa88686 /actionview/lib/action_view.rb | |
parent | 3c000873946e5f2eb405fc9ba264acbfd431047e (diff) | |
download | rails-4692ed7e12b72f2bd3adee9a243bd270f0de402e.tar.gz rails-4692ed7e12b72f2bd3adee9a243bd270f0de402e.tar.bz2 rails-4692ed7e12b72f2bd3adee9a243bd270f0de402e.zip |
Document `deep_interpolation` parameter for bulk lookups
Bulk lookups are sort of an edge case, I have not heard of them until a colleague of mine decided to dynamically iterate over a growing set of translations and receiving them in bulk as a hash with `I18n.t 'welcome'` as in the example above.
When passing an interpolation to these bulk lookups, they will only be performed when also passing `deep_interpolation: true`.
**Without passing `deep_interpolation` flag:**
```ruby
I18n.t 'welcome', app_name: 'book store'
# => {:title=>"Welcome!", :content=>"Welcome to the %{app_name}"}
**With passing `deep_interpolation`:**
I18n.t 'welcome', deep_interpolation: true, app_name: 'book store'
# => {:title=>"Welcome!", :content=>"Welcome to the book store"}
```
I found this digging in the I18n lookup backend, the flag is listed on [I18n's Rubydoc](https://www.rubydoc.info/github/svenfuchs/i18n/master/I18n) but not otherwise listed. Since bulk lookups are mentioned here, I suggest to add a note with this flag along with it.
Diffstat (limited to 'actionview/lib/action_view.rb')
0 files changed, 0 insertions, 0 deletions