debian-mirror-gitlab/app/controllers/concerns/preferred_language_switcher.rb
2023-01-12 18:35:48 +00:00

18 lines
437 B
Ruby

# frozen_string_literal: true
module PreferredLanguageSwitcher
extend ActiveSupport::Concern
private
def init_preferred_language
return unless Feature.enabled?(:preferred_language_switcher)
cookies[:preferred_language] = preferred_language
end
def preferred_language
cookies[:preferred_language].presence_in(Gitlab::I18n.available_locales) ||
Gitlab::CurrentSettings.default_preferred_language
end
end