mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
//// [tests/cases/conformance/es2016/es2016IntlAPIs.ts] ////
|
|
|
|
//// [es2016IntlAPIs.ts]
|
|
// Sample from
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales
|
|
console.log(Intl.getCanonicalLocales('EN-US'));
|
|
// Expected output: Array ["en-US"]
|
|
|
|
console.log(Intl.getCanonicalLocales(['EN-US', 'Fr']));
|
|
// Expected output: Array ["en-US", "fr"]
|
|
|
|
try {
|
|
Intl.getCanonicalLocales('EN_US');
|
|
} catch (err) {
|
|
console.log(err.toString());
|
|
// Expected output: RangeError: invalid language tag: EN_US
|
|
}
|
|
|
|
|
|
//// [es2016IntlAPIs.js]
|
|
"use strict";
|
|
// Sample from
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales
|
|
console.log(Intl.getCanonicalLocales('EN-US'));
|
|
// Expected output: Array ["en-US"]
|
|
console.log(Intl.getCanonicalLocales(['EN-US', 'Fr']));
|
|
// Expected output: Array ["en-US", "fr"]
|
|
try {
|
|
Intl.getCanonicalLocales('EN_US');
|
|
}
|
|
catch (err) {
|
|
console.log(err.toString());
|
|
// Expected output: RangeError: invalid language tag: EN_US
|
|
}
|