debian-mirror-gitlab/app/controllers/concerns/preferred_language_switcher.rb

19 lines
437 B
Ruby
Raw Normal View History

2023-01-13 00:05:48 +05:30
# 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