Search code examples
ruby-on-rails-3internationalizationrefinerycms

Refinery CMS Inquiries with i18n - routing error


I am trying to add i18n to Refinery CMS with added Inquiries gem. Everything is fine until I add links for switching locales , like this :

= link_to_unless_current image_tag('flag_bulgaria.png'), locale: "bg"

Then routing error appears :

No route matches {:locale=>"bg", :controller=>"refinery/inquiries/inquiries", :action=>"new"}

I have added the refinery-I18n gem ,also have added locales in the initializer file . I have tried to add before filter for setting the locale in the application_controller , but no results . I have read all the discussions about refinery i18n and found nothing about the problem . I'm using rails 3.2.6 , refinery cms 2.0.4 , refinerycms-inquiries 2.0.3 .

Thank you for helping me .


Solution

  • Remember to use refinery.url_for in your link. Here is my language selector.

         <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">
            <% Refinery::I18n.frontend_locales.each do |frontend_locale| %>
                <li>
                  <%= link_to Refinery::I18n.locales[frontend_locale], refinery.url_for(:locale => frontend_locale) %>
                </li>
            <% end %>
          </ul>