Consider the following code in a view:
<%= link_to 'Delete!', item , :confirm => t('action.item.confirm_deletion'), :method => :delete %>
It will normally come out as:
<a href="/items/123" data-confirm="Confirm deletion?" data-method="delete" rel="nofollow">Delete!</a>
But if the translation for action.item.confirm_deletion is missing for some reason (incomplete yml-file, typos, etc.) it comes out as:
<a href="/items/123" data-confirm="<span class="translation_missing" title="translation missing: sv.action.item.confirm_deletion">Confirm Deletion</span>" data-method="delete" rel="nofollow">Delete!</a>
which is invalid html, and user will see broken html tags on the homepage. It may also be a security risk in some cases.
I know that I could use apply some escaping on every call to the I18n.t function, but that feels unnecessarily repetitive for the task.
So my question is: Is there a way to make the "translation missing"-messages not contain html code.
t('action.item.confirm_deletion', :default => 'Are you sure you want to delete this thing?')
– Horseflesh