You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: i18nable.rb
    path of file: ./repos/mashcard/apps/server-monolith/app/controllers/concerns
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module I18nable
  extend ActiveSupport::Concern

  def switch_locale(&action)
    locale = detect_accept_language
    Mashcard::I18n.w
    
  def detect_accept_language
    return Current.user.config.locale if Current.user.present?
    return cookies[:default_locale] if cookies[:default_locale].present?

    # Mashcard::I18n.parse_accept_language request.headers.fetch('HTTP_ACCEPT_LANGUAGE', nil)
    I18n.default_locale
  end