def browser_locale
      accept_lang = @env["HTTP_ACCEPT_LANGUAGE"]
      return if accept_lang.nil?

      langs = accept_lang.split(",").map do |l|
        l += ";q=1.0" unless l =~ /;q=\d+\.\d+$/
        l.split(";q=")
      end

      langs.sort! { |a, b| b[1] <=> a[1] }

      if check_accepted?
        langs.each do |lang|
          l = accepted_locale(split_lang(lang.first).to_sym)
          return l unless l.nil?
        end
      end

      split_lang(langs.first.first)
    end
def browser_locale
      accept_lang = @env["HTTP_ACCEPT_LANGUAGE"]
      return if accept_lang.nil?

      langs = accept_lang.split(",").map do |l|
        l += ";q=1.0" unless l =~ /;q=\d+\.\d+$/
        l.split(";q=")
      end

      langs.sort! { |a, b| b[1] <=> a[1] }

      if check_accepted?
        langs.each do |lang|
          l = accepted_locale(split_lang(lang.first).to_sym)
          return l unless l.nil?
        end
      end

      split_lang(langs.first.first)
    end
TODO: Write notes