JS: Intl (class)
What is the Keyword βIntlβ
Intl object is a namespace for internationalization related functions and constants.
Intl is not specified in ECMA-262 (aka ECMAScript, JavaScript), but in ECMA-402, which is a spec for internationalization API for JavaScript.
Properties
console.log(Reflect.ownKeys(Intl)); /* [ "getCanonicalLocales", "supportedValuesOf", "DateTimeFormat", "NumberFormat", "Collator", "PluralRules", "RelativeTimeFormat", "ListFormat", "Locale", "DisplayNames", "Segmenter", "DurationFormat", Symbol(Symbol.toStringTag) ] */
const allkeys = Reflect.ownKeys(Intl); const result = allkeys.map((x) => { const xkey = x; const xval = Intl[x]; const xtype = typeof xval; const xprops = Object.getOwnPropertyNames(xval); return { xkey, xtype, xval, xprops }; }); console.log(result); /* [ { xkey: "getCanonicalLocales", xtype: "function", xval: [Function: getCanonicalLocales], xprops: [ "length", "name" ] }, { xkey: "supportedValuesOf", xtype: "function", xval: [Function: supportedValuesOf], xprops: [ "length", "name" ] }, { xkey: "DateTimeFormat", xtype: "function", xval: [Function: DateTimeFormat], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "NumberFormat", xtype: "function", xval: [Function: NumberFormat], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "Collator", xtype: "function", xval: [Function: Collator], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "PluralRules", xtype: "function", xval: [Function: PluralRules], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "RelativeTimeFormat", xtype: "function", xval: [Function: RelativeTimeFormat], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "ListFormat", xtype: "function", xval: [Function: ListFormat], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "Locale", xtype: "function", xval: [Function: Locale], xprops: [ "length", "name", "prototype" ] }, { xkey: "DisplayNames", xtype: "function", xval: [Function: DisplayNames], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "Segmenter", xtype: "function", xval: [Function: Segmenter], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: "DurationFormat", xtype: "function", xval: [Function: DurationFormat], xprops: [ "length", "name", "prototype", "supportedLocalesOf" ] }, { xkey: Symbol(Symbol.toStringTag), xtype: "string", xval: "Intl", xprops: [ "0", "1", "2", "3", "length" ] } ] */