function initializeLocaleList(locales) {
  var seen = new InternalArray();
  if (!IS_UNDEFINED(locales)) {
    // We allow single string localeID.
    if (typeof locales === 'string') {
      %_Call(ArrayPush, seen, canonicalizeLanguageTag(locales));
      return freezeArray(seen);
    }

    var o = TO_OBJECT(locales);
    var len = TO_UINT32(o.length);

    for (var k = 0; k < len; k++) {
      if (k in o) {
        var value = o[k];

        var tag = canonicalizeLanguageTag(value);

        if (%_Call(ArrayIndexOf, seen, tag) === -1) {
          %_Call(ArrayPush, seen, tag);
        }
      }
    }
  }

  return freezeArray(seen);
}
function initializeLocaleList(locales) {
  var seen = new InternalArray();
  if (!IS_UNDEFINED(locales)) {
    
    if (typeof locales === 'string') {
      %_Call(ArrayPush, seen, canonicalizeLanguageTag(locales));
      return freezeArray(seen);
    }

    var o = TO_OBJECT(locales);
    var len = TO_UINT32(o.length);

    for (var k = 0; k < len; k++) {
      if (k in o) {
        var value = o[k];

        var tag = canonicalizeLanguageTag(value);

        if (%_Call(ArrayIndexOf, seen, tag) === -1) {
          %_Call(ArrayPush, seen, tag);
        }
      }
    }
  }

  return freezeArray(seen);
}
function initializeLocaleList ( locales ) { var seen = new InternalArray ( ) ; if ( ! IS_UNDEFINED ( locales ) ) { // We allow single string localeID. if ( typeof locales === 'string' ) { % _Call ( ArrayPush , seen , canonicalizeLanguageTag ( locales ) ) ; return freezeArray ( seen ) ; } var o = TO_OBJECT ( locales ) ; var len = TO_UINT32 ( o . length ) ; for ( var k = 0 ; k < len ; k ++ ) { if ( k in o ) { var value = o [ k ] ; var tag = canonicalizeLanguageTag ( value ) ; if ( % _Call ( ArrayIndexOf , seen , tag ) === - 1 ) { % _Call ( ArrayPush , seen , tag ) ; } } } } return freezeArray ( seen ) ; }
Returns an array where all locales are canonicalized and duplicates removed.
Throws on locales that are not well formed BCP47 tags.
Returns an array where all locales are canonicalized and duplicates removed . Throws on locales that are not well formed BCP47 tags .