Ruby on Rails Routing Scope available locales

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

If your application is available in different languages, you usually show the current locale in the URL.

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

Your root will be accessible via the locales defined in I18n.available_locales.



Got any Ruby on Rails Question?