rails 4 locale switcher not working on heroku -
i have bilingual rails 4 application deployed in heroku - russian & english. worked until 1 day locale switcher broke no reason. it's working fine on development , production version - when point language link shows normal link 'localhost:3000/en' or 'localhost:3000/ru' param. in heroku shows 'abarskaya.com/%7b:locale=>' instead of 'abarskaya.com/ru' or 'abarskaya.com/en'. strange didn't change anything. here's application controller
class applicationcontroller < actioncontroller::base protect_from_forgery before_filter :set_locale protected def set_locale i18n.locale = params[:locale] || session[:locale] || i18n.default_locale end # ensure locale persists def default_url_options(options={}) logger.debug "default_url_options passed options: #{options.inspect}\n" { locale: i18n.locale } end end
and route.rb file is:
scope "(:locale)", locale: /ru|en/ 'about' => 'home#about', :as => 'about' 'services' => 'home#services', :as => 'services' 'contacts' => 'home#contacts', :as => 'contacts' end root :to => 'home#index' '/:locale' => 'home#index'
here's switcher in shared/_header.html.erb partial (i'm using rails_bootstrap_navbar gem)
<li class="dropdown visible-desktop"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= image_tag(:en == locale ? 'us-flag.png' : 'ru-flag.png') %> <b class="caret"></b></a> <ul class="dropdown-menu"> <li class="nav-header"><%= t(:language) %></li> <li class="divider"></li> <%= menu_item 'english', locale: 'en' %> <%= menu_item 'Русский', locale: 'ru' %> </ul> </li>
any appreciated. anyway i'm pretty sure have dumb mistake somewhere. ;)
Comments
Post a Comment