范围可用的区域设置

如果你的应用程序以不同语言提供,则通常会在 URL 中显示当前区域设置。

scope '/(:locale)', locale: /#{I18n.available_locales.join('|')}/ do
    root 'example#root'
    # other routes
end

你的 root 可以通过 I18n.available_locales 中定义的语言环境访问。