set :locales, %w[en it]
set :default_locale, 'it'
set :locale_pattern, /^\/?(#{Regexp.union(settings.locales)})(\/.+)$/
helpers do
def locale
@locale || settings.default_locale
end
end
before('/:locale/*') { |params| @locale = params.first }
I cannot get other pages starting with / en /:
get '/attivita/:activity' do |activity|
erb "attivita/#{activity.to_sym}".to_sym
end
Should I harm routes with: locale anywhere? Thanks
source
share