Rails3: Switch between locales

Freitag, 15. April 2011, 11:47 Uhr | roberto@vasquez-angel.de |

Assume you have a i18n toolbar on your page. To switch between locales, without switching the current page, you can link to the locale without setting any path:

  <%= link_to image_tag("application/icons/german.jpg"), url_for(:locale => :de) %>
  <%= link_to image_tag("application/icons/english.jpg"), url_for(:locale => :en) %>