How to set language based on user profile?
<p>i was able to create translation for my project. I inserted code to have browser to remember users selected language, however, when i switch to another devise, or phone or when my app sends out emails, it defaults to the english language. So how can i have user select language, in profile, so it will remember selected language in outgoing emails? I am using devise</p>

<p>my application controller</p>

<pre><code>class ApplicationController &lt; ActionController::Base

before_action :set_locale

def set_locale
  if cookies[:educator_locale] &amp;&amp; I18n.available_locales.include?(cookies[:educator_locale].to_sym)
    l = cookies[:educator_locale].to_sym
  else
    l = I18n.default_locale
    cookies.permanent[:educator_locale] = l
  end
  I18n.locale = l
end
end
</code></pre>

<p>my config.ru part</p>

<pre><code>get '/change_locale/:locale', to: 'settings#change_locale', as: :change_locale
</code></pre>