1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/guides
Oliver Günther 4692ed7e12
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.
2018-10-25 07:46:58 +02:00
..
assets Replace outdated Rails Guides logo 2018-10-19 19:27:04 -04:00
bug_report_templates use "minitest" consistently 2018-09-11 23:57:25 +02:00
rails_guides Wrap custom id of a header attribute into \" in rails guides 2018-10-05 00:57:32 +03:00
source Document deep_interpolation parameter for bulk lookups 2018-10-25 07:46:58 +02:00
.document
CHANGELOG.md reflect c03bba4 in CHANGELOGs 2018-09-08 09:50:05 +02:00
rails_guides.rb
Rakefile Enable Start/EndWith and RegexpMatch cops 2018-07-28 17:37:17 -04:00
w3c_validator.rb