When including data: { confirm: "Are you sure?" }
to a link_to
helper, how do we translate the two buttons "Cancel" and "OK" in the popup?
Is the Rail's I18n applicable in some way?
By default (relying on the data-confirm
attribute and calling window.confirm()
), rails-ujs uses the browser's native confirmation dialogs, so you can't really translate them, they will use the browser's translation.
If you use some alternative solution (which actually replaces the data-confirm
attribute with something else) the views depend on the specific solution you choose (for example http://lesseverything.com/blog/archives/2012/07/18/customizing-confirmation-dialog-in-rails/)
TL;DR: You can't.