UNPKG

583 BJavaScriptView Raw
1import {
2 CanonicalizeLocaleList,
3} from "./9.negotiation.js";
4
5// 8 The Intl Object
6export const Intl = {};
7
8// 8.2 Function Properties of the Intl Object
9
10// 8.2.1
11// @spec[tc39/ecma402/master/spec/intl.html]
12// @clause[sec-intl.getcanonicallocales]
13Intl.getCanonicalLocales = function (locales) {
14 // 1. Let ll be ? CanonicalizeLocaleList(locales).
15 let ll = CanonicalizeLocaleList(locales);
16 // 2. Return CreateArrayFromList(ll).
17 {
18 let result = [];
19 for (let code in ll) {
20 result.push(ll[code]);
21 }
22 return result;
23 }
24};