Sending an Email Confirmation Link with the Right Locale (with Devise)
(This post will be short.) I have followed Railscast to configure I18n for my app, but I soon realized the link included inside the confirmation emails (sent through Devise) would direct the use to the default locale/language (i.e. English) instead of the locale that the user is using. This is my fix: In the mailer template (in devise, it would be devise/mailer/confirmation_instructions.html.erb), just pass in the user locale in the rails url helper: 1 2 3 4 5 <% user_name = ( @user . full_name . empty?) ? @user . email : @user . full_name %> <p> <%= t( '.greeting' , recipient : user_name) %> </p> <p> <%= t( '.instruction' ) %> </p> <p> <%= link_to t( '.action' ), confirmation_url( @resource , confirmation_token: @token , locale : I18n . locale) %> </p> Done.