cs_best_language

one of the documented procedures in this installation of the ACS
Usage:
cs_best_language   str
What it does:
Returns the best non-experimental language from an HTTP Accept-Language header string.
Defined in: /web/philip/tcl/1-cs-defs.tcl

Source code:


    set best_language ""
    set best_quality  -1
    foreach language [split $str ","] {
	set language [string trim $language]
	if { ![regexp {^([^;]+);q=([^;]+)$} $language "" language quality] } {
	    set quality 1
	}
	if { [regexp {^x-} $language] } {
	    continue
	}
	if { $quality > $best_quality } {
	    set best_language $language
	    set best_quality $quality
	}
    }
    return $best_language


philg@mit.edu