いくつかの深刻な問題があります。うまく機能する複数の言語選択を作成しましたが、リンクは常に変化しています。http://localhost:3000/en/products
そのようなリンクをクリックしたときから
<%= link_to image_tag('en.png',:alt => 'description', :title => (I18n.t 'english') ), params.merge(:locale => :en) %>
しばらくしてこのようなものにするには、アプリ内を移動して別のリンクをクリックしています
http://localhost:3000/manufacturer_products?locale=en&manufacturer=Christophel
問題は routes.rb ファイル内にあると思います。
これは私のルートファイルです。
root :to => 'home#index'
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
get "about_us/index"
namespace :products do
resources :categories do
resources :products
end
resources :products, only: :index
end
namespace :products do
resources :manufacturs do
resources :products
end
resources :products, only: :index
end
get "about/index"
match ":locale/products/search" => "products#search"
match "/contacts", to: "contacts#index"
match "/products", to: "products#index"
match "/home", to: "home#index"
match "/about_us", to: "about_us#index"
match "/news", to: "news#index"
match "/manufacturer_products", to: "manufacturer_products#index"
match '/:locale' => 'home#index'
scope "(:locale)", :locale => /en|lv|ru/ do
resources :products, :manufacturers, :categories, :news, :ActiveAdmin, :manufacturer_products
end
どうにかして namespace:products ルートを locale ルートとマージする必要があることは理解していますが、そもそも何をすればよいかわかりません。
ありがとう