class OdiLocale

  def self.changed_locale_path(current_path, new_locale)
    current_path.gsub(%r{\A/[a-z]{2}/(.*)}, "/#{new_locale}/\\1")
  end

end

class OdiLocale

  def self.changed_locale_path(current_path, new_locale)
    current_path.gsub(%r{\A/[a-z]{2}(_[A-Z]{2})?/(.*)}, "/#{new_locale}/\\2")
  end

end

Handle more complex locales in switching helper
Handle more complex locales in switching helper