Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:48:43+00:00 2026-06-04T00:48:43+00:00

To start with: I am using Ruby On Rails 3.2.x I have an observer

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:48:45+00:00Added an answer on June 4, 2026 at 12:48 am

    Some progress, the solution seems to work and I havent noticed any side effects.

    I store the current locale

    tmp = I18n.locale
    I18N.locale = User.find(uid).language
    # send the emails
    I18n.locale = tmp
    

    Is this the right way to do it? Are there any possible side effects that I should be aware of?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I start using Rspec with an existing Ruby on Rails 2.3.5 project
I have a Ruby on Rails 3.2 app using bundler and capistrano for deployment.
I have doing some POC in Ruby-on-Rails and using sqlite database, while doing this
I have made blog using ruby on rails, and it's pretty easy. What i
Have just finished my first web based application using Ruby on Rails. It was
I am using a Mac OS running Snow Leopard 10.6.8, Ruby on Rails 3.2.2
I have an app that is using devise for authentication. Rails 3 on ruby
I created a Ruby-on-Rails project using NetBean 6.8, which operates as expected on port
I have some production Rails 2 apps. I want to start using Rails 3
I have done a few projects using Ruby on Rails. I am going to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.