Domanda

Using this guide I am Internationalization my app.

Everything works fine except that I can't change locale from default en to lv using link_to parameters. So my code is like this. Inside application layout

<%= link_to image_tag ('eng.png'), :locale => "en" %>
<%= link_to image_tag ('lv.png'), :locale => "lv" %>
<%= link_to image_tag ('rus.png'), :locale => "ru" %>

When I mouseover these language icons, tha generated link looks all the same, but it should be changing the locale parameter. But this moment it shows choosed locale. Only way to change locale is changing links in browsing bar. Somebody have some ideas ?

Thanks

È stato utile?

Soluzione

According to http://apidock.com/rails/v3.2.13/ActionView/Helpers/UrlHelper/link_to I recommend you to do it this way:

<%= link_to image_tag('ru.png'), params.merge(:locale => :ru)

<%= link_to image_tag('lv.png'), params.merge(:locale => :lv)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top