intl-base-debug.js revision 712a3f959e9bc19931627c7566f5ce35dbc7319d
/**
* The Intl utility provides a central location for managing sets of localized resources (strings and formatting patterns).
*
* @class Intl
* @uses EventTarget
* @static
*/
var SPLIT_REGEX = /[, ]/;
/**
* Returns the language among those available that
* best matches the preferred language list, using the Lookup
* algorithm of BCP 47.
* If none of the available languages meets the user's preferences,
* then "" is returned.
* Extended language ranges are not supported.
*
* @method lookupBestLang
* @param {String[] | String} preferredLanguages The list of preferred languages
* in descending preference order, represented as BCP 47 language
* tags. A string array or a comma-separated list.
* @param {String[]} availableLanguages The list of languages
* that the application supports, represented as BCP 47 language
* tags.
*
* @return {String} The available language that best matches the
* preferred language list, or "".
* @since 3.1.0
*/
// check whether the list of available languages contains language; if so return it
var i;
return availableLanguages[i];
}
}
}
}
language = preferredLanguages[i];
continue;
}
// check the fallback sequence for one language
if (result) {
return result;
} else {
if (index >= 0) {
// one-character subtags get cut along with the following subtag
}
} else {
// nothing available for this language
break;
}
}
}
}
return "";
}
});