nl_tokens: Get the preferred languages from an Accept - Language header .
pl_tokens: function preferredLanguages ( accept , provided ) { // RFC 2616 sec 14.4: no header = * var accepts = parseAcceptLanguage ( accept === undefined ? '*' : <mask> || '' ) ; if ( ! provided ) { // sorted list of all languages return accepts . filter ( isQuality ) . sort ( compareSpecs ) . map ( getFullLanguage ) ; } var priorities = provided . map ( function getPriority ( type , index ) { return getLanguagePriority ( type , accepts , index ) ; } ) ; // sorted list of accepted languages return priorities . filter ( isQuality ) . sort ( compareSpecs ) . map ( function getLanguage ( priority ) { return provided [ priorities . indexOf ( priority ) ] ; } ) ; }