Sha256: 4404cb83df1b0996f7703f279c85a7baff7a8ba8adc73483f593d17b60caa9f0
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
class Brut::FrontEnd::Handlers::LocaleDetectionHandler < Brut::FrontEnd::Handler def handle(body:,session:) begin parsed = JSON.parse(body.read) SemanticLogger["brut:__brut/locale"].info("Got #{parsed.class}/#{parsed}") if parsed.kind_of?(Hash) locale = parsed["locale"] timezone = parsed["timeZone"] session.timezone_from_browser = timezone if !session.http_accept_language.known? session.http_accept_language = Brut::I18n::HTTPAcceptLanguage.from_browser(locale) end else SemanticLogger["brut:__brut/locale"].warn("Got a #{parsed.class} from /__brut/locale instead of a hash") end rescue => ex SemanticLogger["brut:__brut/locale"].warn("Got #{ex} from /__brut/locale instead of a parseable JSON object") end http_status(200) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brut-0.0.1 | lib/brut/front_end/handlers/locale_detection_handler.rb |