Sha256: e61e96db878a19216dff4bf0fde669ed4fea1e7dff86be0d6f13a6942372e221
Contents?: true
Size: 880 Bytes
Versions: 9
Compression:
Stored size: 880 Bytes
Contents
require 'casino' require 'http_accept_language' class CASino::ApplicationController < ::ApplicationController include ApplicationHelper layout 'application' before_filter :set_locale def cookies super end protected def processor(processor_name, listener_name = nil) listener_name ||= processor_name listener = CASino.const_get(:"#{listener_name}Listener").new(self) @processor = CASino.const_get(:"#{processor_name}Processor").new(listener) end def set_locale I18n.locale = extract_locale_from_accept_language_header || I18n.default_locale end def extract_locale_from_accept_language_header if request.env['HTTP_ACCEPT_LANGUAGE'] http_accept_language.preferred_language_from(I18n.available_locales) end end def http_accept_language HttpAcceptLanguage::Parser.new request.env['HTTP_ACCEPT_LANGUAGE'] end end
Version data entries
9 entries across 9 versions & 1 rubygems