# Gettext change language temporarily?

**URL:** <https://www.ruby-forum.com/t/gettext-change-language-temporarily/143420>\
**Category:** Rails\
**Created:** [July 18, 2008, 11:13am UTC](https://www.ruby-forum.com/t/gettext-change-language-temporarily/143420 "2008-07-18T11:13:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/90ced4/32.png) [@marlor](https://www.ruby-forum.com/u/marlor)\
**Post date:** [July 18, 2008, 11:13am UTC](https://www.ruby-forum.com/t/gettext-change-language-temporarily/143420/1 "2008-07-18T11:13:22Z")

</div>

Hello all,

Here is the scenario:

The site is multilingual as expected using gettext and that works fine.  
The problem is that when I select a language (E.g German) on the site  
and I want to send a semi static EMail (using ActionMailer and gettext)  
to another person which has another language (stored in DB).  
I am trying to find a way to temporarily set the language to the other  
persons language so that his/her email is send in that language. And  
after sending set it back to my language.

I have tried several things already like:

```auto
GetText.bindtextdomain('mysite', person.language.name)
tmp = cookies[:lang]
cookies[:lang] = person.language.name
params[:lang] = person.language.name
init_gettext
```

I have tried the above in all possible combinations before sending the  
email to the other person but nothing helped.

Any suggestions?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![marlor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/90ced4/32.png) [@marlor](https://www.ruby-forum.com/u/marlor)\
**Post date:** [July 18, 2008, 11:40am UTC](https://www.ruby-forum.com/t/gettext-change-language-temporarily/143420/2 "2008-07-18T11:40:22Z")

</div>

Found the solution:

GetText.locale = person.language.name

before sending the mail
