class ActionDispatch::Routing::Mapper

def self.normalize_path(path)

for root cases, where the latter is the correct one.
(:locale) becomes (/:locale) instead of /(:locale). Except
Invokes Journey::Router::Utils.normalize_path and ensure that
def self.normalize_path(path)
  path = Journey::Router::Utils.normalize_path(path)
  path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/(\(+[^)]+\)){1,}$}
  path
end