To start with: I am using Ruby On Rails 3.2.x
I have an observer running which triggers emails upon saving orders, two emails to be precise, one email to the seller and one email to the buyer.
All works perfectly fine, the ActionMailer sends out the emails. I have now added multi language support, i.e. the user can set his preferred language in his user settings.
Unfortunately the ActionMailer now sends out the two emails in the language set by the user who triggers the order processing, hence the other party of the order gets the wrong language should it differ from the initiator.
How can I make the ActionMailer use a specific locale/language when sending out an email?
I did come across
<%= I18n.t('daily_mail.hello', :locale => @user.locale) + @user.name %>
but that doesn’t work because I have different views for different languages.
Some progress, the solution seems to work and I havent noticed any side effects.
I store the current locale
Is this the right way to do it? Are there any possible side effects that I should be aware of?