mercredi 16 novembre 2016

I18n clicking navbar link defaults back to English

I'm following the railscast guide but for some reason, when I click on a link, the params locale is not being carried over.

Here's my routes.db

Rails.application.routes.draw do
scope ":locale", locale: /#{I18n.available_locales.join("|")}/ do

get 'welcome/index'

# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

# You can have the root of your site routed with "root"
root 'welcome#index'

resources :foods
resources :shops
resources :communities
resources :events
resources :pictures
resources :videos
resources :services

end
get '*path', to: redirect("/#{I18n.default_locale}/%{path}")
get '', to: redirect("/#{I18n.default_locale}/")

I think the main difference between my app and the railscasts is I am doing it on the application.html.erb template. So I wonder if that is affecting it.

Thanks for your time!

Aucun commentaire:

Enregistrer un commentaire