unicode-bcp47-locale-ids-language-mappings.js (1461B)
1 // |reftest| skip-if(!this.hasOwnProperty("Intl")) 2 3 // For the most part the mappings from IANA are a subset of the CLDR mappings. 4 // So there are mappings which are consistent across both databases. 5 assertEq(Intl.getCanonicalLocales("iw")[0], "he"); 6 7 // But some languages are mapped differently. 8 // 9 // From the IANA language data registry: 10 // Type: language 11 // Subtag: drh 12 // Description: Darkhat 13 // Added: 2009-07-29 14 // Deprecated: 2010-03-11 15 // Preferred-Value: khk 16 // 17 // From CLDR: 18 // <languageAlias type="drh" replacement="mn" reason="deprecated"/> 19 // 20 // because CLDR also maps macro-languages: 21 // <languageAlias type="khk" replacement="mn" reason="macrolanguage"/> 22 assertEq(Intl.getCanonicalLocales("drh")[0], "mn"); 23 24 // CLDR maps macro-languages: 25 // <languageAlias type="cmn" replacement="zh" reason="macrolanguage"/> 26 assertEq(Intl.getCanonicalLocales("cmn")[0], "zh"); 27 28 // CLDR also contains mappings from ISO-639-2 (B/T) to 639-1 codes: 29 // <languageAlias type="dut" replacement="nl" reason="bibliographic"/> 30 // <languageAlias type="nld" replacement="nl" reason="overlong"/> 31 assertEq(Intl.getCanonicalLocales("dut")[0], "nl"); 32 assertEq(Intl.getCanonicalLocales("nld")[0], "nl"); 33 34 // CLDR has additional mappings for legacy language codes. 35 // <languageAlias type="tl" replacement="fil" reason="legacy"/> 36 assertEq(Intl.getCanonicalLocales("tl")[0], "fil"); 37 38 if (typeof reportCompare === "function") 39 reportCompare(true, true);