class ActionDispatch::Routing::Mapper

def add_route(action, controller, options, _path, to, via, formatted, anchor, options_constraints) # :nodoc:

:nodoc:
rubocop:disable Lint/UnderscorePrefixedVariableName, Metrics/PerceivedComplexity
def add_route(action, controller, options, _path, to, via, formatted, anchor, options_constraints) # :nodoc:
  return super unless @localized
  path = path_for_action(action, _path)
  raise ArgumentError, 'path is required' if path.blank?
  action = action.to_s
  default_action = options.delete(:action) || @scope[:action]
  if %r{^[\w\-\/]+$}.match?(action)
    default_action ||= action.tr('-', '_') unless action.include?('/')
  else
    action = nil
  end
  as = if options.fetch(:as, true)
         name_for_action(options.delete(:as), action)
       else
         options.delete(:as)
       end
  path = Mapping.normalize_path URI::DEFAULT_PARSER.escape(path), formatted
  ast = Journey::Parser.parse path
  mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
  @set.add_localized_route(mapping, as, anchor, @scope, path, controller, default_action, to, via, formatted, options_constraints, options)
end

def add_route(action, controller, as, options_action, _path, to, via, formatted, anchor, options_constraints, internal, options_mapping) # :nodoc:

:nodoc:
rubocop:disable Lint/UnderscorePrefixedVariableName, Metrics/PerceivedComplexity
def add_route(action, controller, as, options_action, _path, to, via, formatted, anchor, options_constraints, internal, options_mapping) # :nodoc:
  return super unless @localized
  path = path_for_action(action, _path)
  raise ArgumentError, 'path is required' if path.blank?
  action = action.to_s
  default_action = options_action || @scope[:action]
  if %r{^[\w\-/]+$}.match?(action)
    default_action ||= action.tr('-', '_') unless action.include?('/')
  else
    action = nil
  end
  as   = name_for_action(as, action) if as
  path = Mapping.normalize_path URI::RFC2396_PARSER.escape(path), formatted
  ast  = Journey::Parser.parse path
  mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, internal, options_mapping)
  @set.add_localized_route(mapping, as, anchor, @scope, path, controller, default_action, to, via, formatted, options_constraints, internal, options_mapping)
end

def define_generate_prefix(app, name)

def define_generate_prefix(app, name)
  return super unless @localized
  RouteTranslator::Translator.available_locales.each do |locale|
    super(app, "#{name}_#{locale.to_s.underscore}")
  end
end

def define_generate_prefix(app, name)

def define_generate_prefix(app, name)
  return super unless @localized
  RouteTranslator::Translator.available_locales.each do |locale|
    super(app, "#{name}_#{locale.to_s.underscore}")
  end
end

def localized

def localized
  @localized = true
  yield
ensure
  @localized = false
end

def localized

def localized
  @localized = true
  yield
ensure
  @localized = false
end