Module: NicePartials::RenderingWithLocalePrefix::BaseIntegration
- Defined in:
- lib/nice_partials/monkey_patch.rb
Instance Method Summary collapse
Instance Method Details
#t(key, options = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/nice_partials/monkey_patch.rb', line 9 def t(key, = {}) if (template = @_nice_partials_translate_template) && key&.start_with?(".") key = "#{virtual_path_translate_key_prefix(template.virtual_path)}#{key}" end super(key, **) end |
#with_nice_partials_t_prefix(block) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/nice_partials/monkey_patch.rb', line 17 def with_nice_partials_t_prefix(block) old_nice_partials_translate_template = @_nice_partials_translate_template @_nice_partials_translate_template = block ? @current_template : nil yield ensure @_nice_partials_translate_template = old_nice_partials_translate_template end |