Hy, i have problem with my aplication. On my Webpage i have instruction: <%= link_to "English", :locale=>'en'%> and it work good when I am on the main page, but if I have in URL many parameters, I have error, because after click this link I have only one parametr. For example: http://localhost:3000/static_pages/search?utf8=%E2%9C%93&search=asd&locale=pl&commit=Szukaj After click: http://localhost:3000/static_pages/search?locale=en Somebody know how i can solve this problem? In layout i have this line:
<% if I18n.locale == I18n.default_locale %>
<%= link_to "English", :locale=>'en'%>
<% else %>
<%= link_to "Polski", :locale=>'pl'%>
It works good when I want to go to: static_pages/home or static_pages/contact, but if I have subpage, which require parameters from form and i want to on it change language, I have error. For example i have this form:
<%= form_tag(static_pages_search_path, :method => "get" ) do %>
<%= text_field(:post, :title, size: 20, :name =>"search", :style => "color: #C0C0C0; margin-top: 10px;", :placeholder => t('widok.wyszukiwarka.tekst'),:required => true,:minlength=>"3")%>
<%= hidden_field_tag 'locale', language %>
<%= submit_tag t('widok.wyszukiwarka.przycisk'),data: { disable_with: t('widok.wyszukiwarka.przycisk_czekaj') } %>
<% end %>
where language=I18n.locale.
When I click sumbit_tag all works, but if I want to change language on this subpage i have error because URL have only one parametr: locale and hasn't parametr search and commit