    # File lib/locale/driver/cgi.rb, line 28
          def locales
            req = Thread.current[:current_request]
            return nil unless req

            locales = []

            # QUERY_STRING "lang"
            if langs = req[:query_langs]
              langs.each do |lang|
                locales << Locale::Tag.parse(lang)
              end
            end

            unless locales.size > 0
              # COOKIE "lang"
              if langs = req[:cookie_langs]
                langs.each do |lang|
                  locales << Locale::Tag.parse(lang) if lang.size > 0
                end
              end
            end

            unless locales.size > 0
              # HTTP_ACCEPT_LANGUAGE
              if lang = req[:accept_language] and lang.size > 0
                locales += lang.gsub(/\s/, "").split(/,/).map{|v| v.split(";q=")}.map{|j| [j[0], j[1] ? j[1].to_f : 1.0]}.sort{|a,b| -(a[1] <=> b[1])}.map{|v| Locale::Tag.parse(v[0])}
              end
            end

            locales.size > 0 ? Locale::TagList.new(locales.uniq) : nil
          end