Sha256: ee81c654fdc1f11f7acc4012cd7a49a5c34613154bfeec89656906f4b825580c
Contents?: true
Size: 588 Bytes
Versions: 31
Compression:
Stored size: 588 Bytes
Contents
module WorldFlags module Helper module Browser def self.browser_locale request return @browser_locale if @browser_locale if lang = request.env["HTTP_ACCEPT_LANGUAGE"] lang = lang.split(",").map { |l| l += ';q=1.0' unless l =~ /;q=\d+\.\d+$/ l.split(';q=') }.first @browser_locale = lang.first.split("-").first else @browser_locale = I18n.default_locale end end def browser_locale WorldFlags::Helper::Browser.browser_locale(request) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems