src/third_party/mozjs/extract/js/src/builtin/intl/CommonFunctions.js
/**
 * Compares a BCP 47 language priority list against the set of locales in
 * availableLocales and determines the best available language to meet the
 * request. Options specified through Unicode extension subsequences are
 * ignored in the lookup, but information about such subsequences is returned
 * separately.
 *
 * This variant is based on the Lookup algorithm of RFC 4647 section 3.4.
 *
 * Spec: ECMAScript Internationalization API Specification, 9.2.3.
 * Spec: RFC 4647, section 3.4.
 */
Compares a BCP 47 language priority list against the set of locales in
availableLocales and determines the best available language to meet the
request. Options specified through Unicode extension subsequences are
ignored in the lookup, but information about such subsequences is returned
separately.

This variant is based on the Lookup algorithm of RFC 4647 section 3.4.

ECMAScript Internationalization API Specification, 9.2.3.
Compares a BCP 47 language priority list against the set of locales in availableLocales and determines the best available language to meet the request . Options specified through Unicode extension subsequences are ignored in the lookup but information about such subsequences is returned separately . This variant is based on the Lookup algorithm of RFC 4647 section 3 . 4 . ECMAScript Internationalization API Specification 9 . 2 . 3 .
function LookupMatcher(availableLocales, requestedLocales) {
    var result = new_Record();
    for (var i = 0; i < requestedLocales.length; i++) {
        var locale = requestedLocales[i];
        a.
        var noExtensionsLocale = removeUnicodeExtensions(locale);
        b.
        var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);
        c.
        if (availableLocale !== undefined) {
            c.i.
            result.locale = availableLocale;
            c.ii.
            if (locale !== noExtensionsLocale)
                result.extension = getUnicodeExtensions(locale);
            c.iii.
            return result;
        }
    }
    result.locale = DefaultLocale();
    return result;
}
function LookupMatcher ( availableLocales , requestedLocales ) { var result = new_Record ( ) ; for ( var i = 0 ; i < requestedLocales . length ; i ++ ) { var locale = requestedLocales [ i ] ; var noExtensionsLocale = removeUnicodeExtensions ( locale ) ; var availableLocale = BestAvailableLocale ( availableLocales , noExtensionsLocale ) ; if ( availableLocale !== undefined ) { result . locale = availableLocale ; if ( locale !== noExtensionsLocale ) result . extension = getUnicodeExtensions ( locale ) ; return result ; } } result . locale = DefaultLocale ( ) ; return result ; }
Compares a BCP 47 language priority list against the set of locales in
 availableLocales and determines the best available language to meet the
 request.
Compares a BCP 47 language priority list against the set of locales in availableLocales and determines the best available language to meet the request .
// Step 1. // Step 2. // Step 2.a. // Step 2.b. // Step 2.c. // Step 2.c.i. // Step 2.c.ii. // Step 2.c.iii. // Steps 3-4. // Step 5.