Skip to content

Evaluate modals in the context of the original file

Taico Aerts requested to merge localization-improvements-a into development

Previously, modals would evaluate translate calls in the context of application.modal, rather than the file they were requested from. By evaluating the block directly in the helper, it evaluates in the context of the requesting file instead.

The main difference is that this allows lazy lookup for translation strings to work as intended. More specifically:

File: views/companies/modals/_something.html.erb

<%= modal(...) do %>
  <%= modal_body do %>
    <%= t('.info') %>
  <% end %>
<% end %>

Previously would look for application.modal.info, and will now look for companies.modals.something.info instead.

Edited by Taico Aerts

Merge request reports