Question on I18n locale

Hi All,

In order to support internalization in our application, we are giving an option to the user to select the language. But the problem here is, when one user select one language for example ‘Chinese’, all other users browser’s language also changing to Chinese.

We want something like changing language at client level instead of server level. Is it possible in rails?

Below is the code I am using for setting locale.

*if params[:lang]*

I18n.default_locale = params[:lang]


I18n.locale = I18n.default_locale

Please let me know if any suggestion on this.

Don't use default_locale

In ApplcationController do something like

before_filter :set_user_locale

def set_user_locale
  I18n.locale = params[:locale] if params[:locale]

Hi Mike,

Thanks a lot. It works.