Method: I18n::Inflector::InflectionOptions#cache_aware
- Defined in:
- lib/i18n-inflector/options.rb
permalink #cache_aware ⇒ Boolean
This switch enables cache-aware mode. In that mode inflection options and flags are evaluated before calling original translate method and all options are passed to that method. Because options preparation for inflection methods is explicit (any missing switches and their default values are added to options) then original translate (or proxy caching method) will receive even those options that might have been changed globally.
Caching modules for I18n may use options passed to the translate method (if they are plugged in before inflector) for key transformation since the inflection options may influence the interpolation process and therefore the resulting string.
If however, the caching variant of the translate method is positioned before inflected variant in methods chain, then the only way of knowing all the settings by caching routine is to call options.options.prepare_options!(options)
on the used backend, for example:
I18n.backend.inflector..prepare()
That will alter the options
data so they will contain all switches and values.
81 82 83 |
# File 'lib/i18n-inflector/options.rb', line 81 def cache_aware @cache_aware end |