Rails.application.routes.draw do
  root 'home#index'

  scope '/:locale' do
    get '/', to: 'home#index'
  end

  resource :styleguide, controller: 'styleguide', only: 'show' do
    member do
      get 'css'
      get 'html'
      get 'sass'
      get 'javascript'
      get 'ruby'
    end
  end
end

Rails.application.routes.draw do
  root 'home#index'

  scope '/:locale' do
    get '/', to: 'home#index'

    resource :styleguide,
             controller:  'styleguide',
             only:        'show',
             constraints: { locale: I18n.default_locale } do
      member do
        get 'css'
        get 'html'
        get 'sass'
        get 'javascript'
        get 'ruby'
      end
    end
  end
end

Enforce localised URL convention for styleguide
Enforce localised URL convention for styleguide

Scopes the styleguide resource by locale but restricts it to the default
locale (en) only. This keeps routing consistent and ensures we have one
way to concern ourselves with how to determine the locale.