如何为给定的URL生成所有语言版本
我在查看代码:
- [:en, :de, :fr].each do |l|
- I18n.locale = l
= link_to l, category_path
我希望
/en/categories
/de/categorien
/fr/categorieu
在我的页面上,我具有指向类别的链接。如果我在页面上更改语言,则链接将正常工作。
en > /en/categories
de > /de/categorien
fr > /fr/categorieu
但是我只有
/en/categories
/en/categories
/en/categories
如何做得好,以显示所有本地化路径?
/en/categories
/de/categorien
/fr/categorieu
scope ':locale' do
localized do
resources :c, to: 'categories#show', as: :categories, only: :show
resources :p, to: 'products#show', as: :products, only: :show do
member do
get :download
end
end
resources :t, to: 'tags#show', as: :tags, only: :show
resources :realizations, only: [:index, :show]
resources :trusts, only: :index
end
end
致谢