我在scope "(:locale)"
上遇到了麻烦,mount SimpleDiscussion::Engine => "/forum"
给了我这个错误:ActionController::UrlGenerationError in SimpleDiscussion::ForumThreads#index
此路由不匹配:No route matches {:action=>"index", :controller=>"simple_discussion/forum_threads", :locale=>:es}
这是我路线的一部分
Rails.application.routes.draw do
scope "(:locale)", locale: /en|es/ do
mount SimpleDiscussion::Engine => "/forum"
...
end
这是给我错误的视图
<% if I18n.locale == :es %>
<%= link_to t('home.navbar.english'), url_for( locale: :en ), class: "nav-link dropdown-toggle", method: :get %>
<% elsif I18n.locale == :en %>
<%= link_to t('home.navbar.spanish'), url_for( locale: :es ), class: "nav-link dropdown-toggle", method: :get %>
<% end %>
是否可以配置语言环境和安装的引擎?谢谢!