### GET /available-currencies Source: https://tc39.es/ecma402 Retrieves a list of supported canonical currency codes. ```APIDOC ## GET /available-currencies ### Description Returns a sorted list of unique, well-formed, and uppercase 3-letter ISO 4217 currency codes supported by the implementation. ### Method GET ### Endpoint /available-currencies ### Response #### Success Response (200) - **currencies** (array) - A list of supported currency code strings. ``` -------------------------------- ### GET Intl.DateTimeFormat.prototype.resolvedOptions Source: https://tc39.es/ecma402 Retrieves the locale and options computed during the initialization of the Intl.DateTimeFormat object. ```APIDOC ## GET Intl.DateTimeFormat.prototype.resolvedOptions ### Description Returns an object containing the locale and formatting options that were computed during the initialization of the Intl.DateTimeFormat instance. ### Method GET ### Endpoint Intl.DateTimeFormat.prototype.resolvedOptions() ### Response #### Success Response (200) - **options** (Object) - An object containing the resolved locale and formatting properties. ``` -------------------------------- ### GET /Intl.Segmenter.prototype.resolvedOptions Source: https://tc39.es/ecma402 Returns a new object with properties reflecting the locale and segmentation options computed during initialization. ```APIDOC ## GET /Intl.Segmenter.prototype.resolvedOptions ### Description Provides access to the locale and options computed during initialization of the Intl.Segmenter object. ### Method GET ### Endpoint Intl.Segmenter.prototype.resolvedOptions() ### Response #### Success Response (200) - **locale** (string) - The BCP 47 language tag for the locale used. - **granularity** (string) - The segmentation granularity ('grapheme', 'word', or 'sentence'). ``` -------------------------------- ### GET /default-locale Source: https://tc39.es/ecma402 Retrieves the host environment's current default locale. ```APIDOC ## GET /default-locale ### Description Returns the well-formed and canonicalized language tag for the host environment's current locale. ### Method GET ### Endpoint /default-locale ### Response #### Success Response (200) - **locale** (string) - The default system locale identifier. ``` -------------------------------- ### GET Intl.Collator.prototype.resolvedOptions Source: https://tc39.es/ecma402 Retrieves the locale and collation options computed during the initialization of the Collator object. ```APIDOC ## GET Intl.Collator.prototype.resolvedOptions ### Description Provides access to the locale and options computed during initialization of the Intl.Collator object. ### Method GET ### Endpoint Intl.Collator.prototype.resolvedOptions() ### Response #### Success Response (200) - **Object** (Object) - An object with properties reflecting the locale and collation options (e.g., locale, usage, sensitivity, ignorePunctuation, collation, numeric, caseFirst). ``` -------------------------------- ### DeconstructPattern Example Source: https://tc39.es/ecma402 Illustrates how DeconstructPattern breaks down a pattern string into parts, using provided placeables for tokens. This is a core operation for list formatting. ```javascript DeconstructPattern("AA{xx}BB{yy}CC", { [[xx]]: {[[Type]]: "hour", [[Value]]: "15"}, [[yy]]: {[[Type]]: "minute", [[Value]]: "06"} }) ``` -------------------------------- ### GET Intl.DateTimeFormat.prototype.format Source: https://tc39.es/ecma402 Returns a bound function that formats a date according to the locale and formatting options of the Intl.DateTimeFormat object. ```APIDOC ## GET Intl.DateTimeFormat.prototype.format ### Description Returns a function that formats a date. The returned function is bound to the Intl.DateTimeFormat instance. ### Method GET ### Endpoint Intl.DateTimeFormat.prototype.format ### Response #### Success Response (200) - **formatFunction** (Function) - A function that accepts a date and returns a formatted string. ``` -------------------------------- ### Constructor: Intl.DisplayNames Source: https://tc39.es/ecma402 Initializes a new Intl.DisplayNames object with specified locales and configuration options. ```APIDOC ## Intl.DisplayNames(locales, options) ### Description Creates a new Intl.DisplayNames instance to retrieve localized display names for various types of codes. ### Parameters #### Request Body - **locales** (string|array) - Optional - A string with a BCP 47 language tag, or an array of such strings. - **options** (object) - Required - Configuration object containing: - **style** (string) - Optional - "narrow", "short", or "long". Defaults to "long". - **type** (string) - Required - "language", "region", "script", "currency", "calendar", or "dateTimeField". - **fallback** (string) - Optional - "code" or "none". Defaults to "code". - **languageDisplay** (string) - Optional - "dialect" or "standard". Defaults to "dialect". ``` -------------------------------- ### Intl.ListFormat Prototype Methods Source: https://tc39.es/ecma402 Documentation for the methods available on the Intl.ListFormat prototype, including format, formatToParts, and resolvedOptions. ```APIDOC ## Intl.ListFormat Prototype Methods ### Description This section details the methods available on the `Intl.ListFormat.prototype` object, which are used to format lists of strings and retrieve the resolved options of a `ListFormat` instance. ### Methods - **`constructor`**: The `Intl.ListFormat` constructor. - **`format(list)`**: Formats a list of strings into a human-readable string. - **`formatToParts(list)`**: Formats a list of strings into an array of objects representing the different parts of the formatted string. - **`resolvedOptions()`**: Returns an object with the properties of the locale and options computed during initialization of the `Intl.ListFormat` object. - **`[Symbol.toStringTag]`**: The initial value is the String value "Intl.ListFormat". ### Method: `format(list)` #### Description Formats an iterable of strings into a human-readable string according to the locale and options of the `Intl.ListFormat` instance. #### Parameters - **`list`** (Iterable): An iterable (e.g., an Array) of strings to be formatted. #### Return Value A string representing the formatted list. ### Method: `formatToParts(list)` #### Description Formats an iterable of strings into an array of objects, where each object represents a part of the formatted list (e.g., elements, separators). #### Parameters - **`list`** (Iterable): An iterable (e.g., an Array) of strings to be formatted. #### Return Value An array of objects, each with `type` and `value` properties, representing the parts of the formatted list. ### Method: `resolvedOptions()` #### Description Returns an object that contains the locale and options that were used to initialize the `Intl.ListFormat` object. #### Return Value An object with properties such as `locale` and formatting options (e.g., `type`, `style`). ### Example (Conceptual) ```javascript const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' }); const list = ['apples', 'bananas', 'oranges']; console.log(formatter.format(list)); // Output: "apples, bananas, and oranges" console.log(formatter.formatToParts(list)); // Output: [ { type: 'element', value: 'apples' }, { type: 'separator', value: ', ' }, { type: 'element', value: 'bananas' }, { type: 'separator', value: ', and ' }, { type: 'element', value: 'oranges' } ] console.log(formatter.resolvedOptions()); // Output: { locale: 'en', type: 'conjunction', style: 'long' } ``` ``` -------------------------------- ### Intl.DateTimeFormat.prototype.constructor Source: https://tc39.es/ecma402 Details the initial value of the `constructor` property on the `Intl.DateTimeFormat.prototype` object. ```APIDOC ## Intl.DateTimeFormat.prototype.constructor The initial value of `Intl.DateTimeFormat.prototype.constructor` is `%Intl.DateTimeFormat%`. ``` -------------------------------- ### PartitionNumberPattern Abstract Operation Source: https://tc39.es/ecma402 Details the steps and logic for partitioning a number according to a NumberFormat object. ```APIDOC ## PartitionNumberPattern ( numberFormat, x ) ### Description The abstract operation PartitionNumberPattern takes arguments `numberFormat` (an object initialized as a NumberFormat) and `x` (an Intl mathematical value) and returns a List of Records with fields [[Type]] (a String) and [[Value]] (a String). It creates the parts representing the mathematical value of x according to the effective locale and the formatting options of numberFormat. ### Method Abstract Operation ### Parameters - **numberFormat** (Object) - An initialized NumberFormat object. - **x** (Intl mathematical value) - The number to partition. ### Returns - **List** - A list of Records, where each Record has [[Type]] (String) and [[Value]] (String) fields representing the partitioned number. ### Steps 1. Initialize `exponent` to 0. 2. Handle special cases for `x`: not-a-number, positive-infinity, negative-infinity. 3. If `x` is not negative-zero: a. If `numberFormat.[[Style]]` is "percent", multiply `x` by 100. b. Compute `exponent` using `ComputeExponent`. c. Adjust `x` by `10**-exponent`. 4. Format the numeric string using `FormatNumericToString`. 5. Get the number format pattern using `GetNumberFormatPattern`. 6. Partition the pattern into `patternParts`. 7. Iterate through `patternParts` and construct the `result` list: a. If type is "literal", append as is. b. If type is "number", partition notation sub-pattern. c. If type is "plusSign", append the plus sign symbol. d. If type is "minusSign", append the minus sign symbol. e. If type is "percentSign" and style is "percent", append the percent sign symbol. f. If type is "unitPrefix" and style is "unit", append the unit prefix. g. If type is "unitSuffix" and style is "unit", append the unit suffix. h. If type is "currencyCode" and style is "currency", append the currency code. i. If type is "currencyPrefix" and style is "currency", append the currency prefix. j. If type is "currencySuffix" and style is "currency", append the currency suffix. k. Otherwise, append as "unknown". 8. Return the `result` list. ``` -------------------------------- ### GET /Intl/getCanonicalLocales Source: https://tc39.es/ecma402 Returns an array of canonical locale names based on the provided input list. ```APIDOC ## GET /Intl/getCanonicalLocales ### Description Returns an array of canonical locale names by processing the provided locales argument through the CanonicalizeLocaleList operation. ### Method GET ### Endpoint Intl.getCanonicalLocales(locales) ### Parameters #### Request Body - **locales** (String or Array) - Required - A string or array of strings representing the locales to be canonicalized. ### Response #### Success Response (200) - **Array** (List of Strings) - An array containing the canonicalized locale strings. #### Response Example ["en-US", "fr-FR"] ``` -------------------------------- ### Intl.DisplayNames.prototype.resolvedOptions() Source: https://tc39.es/ecma402 Returns an object with the properties of the Intl.DisplayNames instance, reflecting the locale and options computed during initialization. ```APIDOC ## Intl.DisplayNames.prototype.resolvedOptions ( ) ### Description Provides access to the locale and options computed during initialization of the object. ### Method GET ### Endpoint `Intl.DisplayNames.prototype.resolvedOptions()` ### Parameters None ### Request Body None ### Response #### Success Response (200) - **locale** (string) - The locale used for the Intl.DisplayNames object. - **style** (string) - The style option used. - **type** (string) - The type option used. - **fallback** (string) - The fallback option used. #### Response Example ```json { "locale": "en-US", "style": "long", "type": "language", "fallback": "default" } ``` ``` -------------------------------- ### Intl.DurationFormat Constructor Source: https://tc39.es/ecma402 Introduction to the Intl.DurationFormat constructor. ```APIDOC ## Intl.DurationFormat Constructor ### Description The `Intl.DurationFormat` constructor is the entry point for creating duration formatting objects. ### Properties - **%Intl.DurationFormat%**: The constructor itself. - **Initial Value**: It is the initial value of the "DurationFormat" property of the `Intl` object. ### Behavior Common behavior for service constructor properties of the `Intl` object is specified in section 9.1. ``` -------------------------------- ### Intl.Locale.prototype.minimize() Source: https://tc39.es/ecma402 The `minimize()` method contracts the locale to the smallest possible subtags. ```APIDOC ## Intl.Locale.prototype.minimize ( ) ### Description Contracts the locale to the smallest possible subtags using the Remove Likely Subtags algorithm. ### Method `minimize()` ### Endpoint N/A (Instance method) ### Parameters None ### Request Example ```javascript const locale = new Intl.Locale('en-US-u-ca-gregory'); const minimizedLocale = locale.minimize(); console.log(minimizedLocale.toString()); // Example output: 'en-US' ``` ### Response #### Success Response (Instance of Intl.Locale) - Returns a new `Intl.Locale` instance representing the minimized locale. #### Response Example ```json { "example": "en-US" } ``` ``` -------------------------------- ### Intl.NumberFormat.prototype.formatRange Source: https://tc39.es/ecma402 Formats a numeric range between a start and end value according to the locale and options of the Intl.NumberFormat object. ```APIDOC ## Intl.NumberFormat.prototype.formatRange ( start, end ) ### Description When the `formatRange` method is called with arguments `start` and `end`, it formats a numeric range according to the locale and options of the `Intl.NumberFormat` object. ### Method GET ### Endpoint `Intl.NumberFormat.prototype.formatRange(start, end)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **start** (number | undefined) - The starting value of the range. If undefined, a TypeError is thrown. - **end** (number | undefined) - The ending value of the range. If undefined, a TypeError is thrown. ### Request Example ```javascript const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }); console.log(formatter.formatRange(100, 200)); ``` ### Response #### Success Response (200) - **formattedRange** (string) - The string representation of the formatted numeric range. ### Response Example ```javascript // Example output for the request above: // "$100.00 – $200.00" ``` ``` -------------------------------- ### Intl.ListFormat Constructor Properties Source: https://tc39.es/ecma402 Details about the properties of the Intl.ListFormat constructor, including its prototype and supportedLocalesOf method. ```APIDOC ## Intl.ListFormat Constructor ### Description Provides information about the properties of the `Intl.ListFormat` constructor, including its internal slots and the `supportedLocalesOf` method. ### Properties - **`prototype`**: The prototype of the `Intl.ListFormat` constructor. - **`supportedLocalesOf(locales[, options])`**: Returns an array of supported locales from the provided list. ### Internal Slots - **`[[Prototype]]`**: Value is `%Function.prototype%`. - **`[[AvailableLocales]]`**: Implementation-defined list of available locales. - **`[[RelevantExtensionKeys]]`**: An empty array, indicating no relevant extension keys. - **`[[ResolutionOptionDescriptors]]`**: An empty array. - **`[[LocaleData]]`**: Implementation-defined locale data for formatting lists. ### Method: `supportedLocalesOf` #### Description Determines which of the provided locales are supported by `Intl.ListFormat`. #### Parameters - **`locales`** (AcceptableLocales | String | Array): A string with a BCP 47 language tag, or an array of such strings, or `undefined`. - **`options`** (Object, optional): An object with a `localeMatcher` property. #### Return Value An array of strings representing the locales from `locales` that are supported by the implementation. ### Example (Conceptual) ```javascript const locales = ['en-US', 'fr-FR', 'es-ES']; const supported = Intl.ListFormat.supportedLocalesOf(locales); console.log(supported); // e.g., ['en-US', 'fr-FR', 'es-ES'] if all are supported ``` ``` -------------------------------- ### GET Intl.Collator.prototype.compare Source: https://tc39.es/ecma402 Retrieves a bound function that compares two strings according to the sort order of the Collator object. ```APIDOC ## GET Intl.Collator.prototype.compare ### Description Returns a function that compares two strings according to the sort order of the Collator object. The returned function is bound to the collator instance. ### Method GET ### Endpoint Intl.Collator.prototype.compare ### Response #### Success Response (200) - **Function** (Function) - A function that accepts two arguments (x, y) and returns a Number representing their relative sort order. ``` -------------------------------- ### Intl.Locale Prototype Methods Source: https://tc39.es/ecma402 Methods for retrieving detailed locale-specific information such as calendars, collations, and text/week info. ```APIDOC ## GET Intl.Locale.prototype.toString ### Description Returns the string representation of the locale. ## GET Intl.Locale.prototype.getCalendars ### Description Returns the calendars associated with the locale. ## GET Intl.Locale.prototype.getCollations ### Description Returns the collations associated with the locale. ## GET Intl.Locale.prototype.getHourCycles ### Description Returns the hour cycles associated with the locale. ## GET Intl.Locale.prototype.getNumberingSystems ### Description Returns the numbering systems associated with the locale. ## GET Intl.Locale.prototype.getTimeZones ### Description Returns the time zones associated with the locale. ## GET Intl.Locale.prototype.getTextInfo ### Description Returns an object containing the text direction of the locale. ## GET Intl.Locale.prototype.getWeekInfo ### Description Returns an object containing the first day of the week and weekend days for the locale. ``` -------------------------------- ### Intl.DisplayNames.prototype.constructor Source: https://tc39.es/ecma402 The constructor property of the Intl.DisplayNames prototype object. ```APIDOC ## Intl.DisplayNames.prototype.constructor ### Description The initial value of `Intl.DisplayNames.prototype.constructor` is `%Intl.DisplayNames%`. ### Method - Accessor ### Endpoint - N/A (Prototype property) ``` -------------------------------- ### Intl.NumberFormat.prototype.formatRangeToParts Source: https://tc39.es/ecma402 Formats a numeric range between start and end values into an array of objects representing the different parts of the formatted string. ```APIDOC ## Intl.NumberFormat.prototype.formatRangeToParts ( start, end ) ### Description When the `formatRangeToParts` method is called with arguments `start` and `end`, it formats a numeric range into an array of objects representing the different parts of the formatted string, according to the locale and options of the `Intl.NumberFormat` object. ### Method GET ### Endpoint `Intl.NumberFormat.prototype.formatRangeToParts(start, end)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **start** (number | undefined) - The starting value of the range. If undefined, a TypeError is thrown. - **end** (number | undefined) - The ending value of the range. If undefined, a TypeError is thrown. ### Request Example ```javascript const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }); console.log(formatter.formatRangeToParts(100, 200)); ``` ### Response #### Success Response (200) - **parts** (Array) - An array of objects, where each object represents a part of the formatted range (e.g., literal, currency, decimal). ### Response Example ```json [ {"type": "currency", "value": "$"}, {"type": "integer", "value": "100"}, {"type": "literal", "value": "."}, {"type": "literal", "value": "00"}, {"type": "literal", "value": " – "}, {"type": "currency", "value": "$"}, {"type": "integer", "value": "200"}, {"type": "literal", "value": "."}, {"type": "literal", "value": "00"} ] ``` ``` -------------------------------- ### Intl.DateTimeFormat Constructor Source: https://tc39.es/ecma402 Initializes a new Intl.DateTimeFormat object with optional locales and options. ```APIDOC ## Intl.DateTimeFormat ( [ locales [ , options ] ] ) ### Description Creates a new Intl.DateTimeFormat object. If called as a constructor, it initializes the object; otherwise, it returns a new instance. ### Parameters #### Request Body - **locales** (String|Array) - Optional - A string with a BCP 47 language tag, or an array of such strings. - **options** (Object) - Optional - An object with properties reflecting the formatting options. ``` -------------------------------- ### GetNumberFormatPattern Source: https://tc39.es/ecma402 Abstract operation to get the appropriate pattern string for formatting a number based on its value, style, and sign display options. ```APIDOC ## GetNumberFormatPattern ( numberFormat, x ) ### Description The abstract operation GetNumberFormatPattern takes arguments numberFormat (an Intl.NumberFormat) and x (an Intl mathematical value) and returns a String. It considers the resolved unit-related options in the number format object along with the final scaled and rounded number being formatted (an Intl mathematical value) and returns a pattern, a String value as described in 16.2.3. It performs the following steps when called: 1. Let resolvedLocaleData be numberFormat.[[LocaleData]]. 2. Let patterns be resolvedLocaleData.[[patterns]]. 3. Assert: patterns is a Record (see 16.2.3). 4. Let style be numberFormat.[[Style]]. 5. If style is "percent", then a. Set patterns to patterns.[[percent]]. 6. Else if style is "unit", then a. Let unit be numberFormat.[[Unit]]. b. Let unitDisplay be numberFormat.[[UnitDisplay]]. c. Set patterns to patterns.[[unit]]. d. If patterns doesn't have a field [[]], then i. Set unit to "fallback". e. Set patterns to patterns.[[]]. f. Set patterns to patterns.[[]]. 7. Else if style is "currency", then a. Let currency be numberFormat.[[Currency]]. b. Let currencyDisplay be numberFormat.[[CurrencyDisplay]]. c. Let currencySign be numberFormat.[[CurrencySign]]. d. Set patterns to patterns.[[currency]]. e. If patterns doesn't have a field [[]], then i. Set currency to "fallback". f. Set patterns to patterns.[[]]. g. Set patterns to patterns.[[]]. h. Set patterns to patterns.[[]]. 8. Else, a. Assert: style is "decimal". b. Set patterns to patterns.[[decimal]]. 9. If x is negative-infinity, then a. Let category be negative-non-zero. 10. Else if x is negative-zero, then a. Let category be negative-zero. 11. Else if x is not-a-number, then a. Let category be positive-zero. 12. Else if x is positive-infinity, then a. Let category be positive-non-zero. 13. Else, a. Assert: x is a mathematical value. b. If x < 0, then i. Let category be negative-non-zero. c. Else if x > 0, then i. Let category be positive-non-zero. d. Else, i. Let category be positive-zero. 14. Let signDisplay be numberFormat.[[SignDisplay]]. 15. If signDisplay is "never", then a. Let pattern be patterns.[[zeroPattern]]. 16. Else if signDisplay is "auto", then a. If category is positive-non-zero or positive-zero, then i. Let pattern be patterns.[[zeroPattern]]. b. Else, i. Let pattern be patterns.[[negativePattern]]. 17. Else if signDisplay is "always", then a. If category is positive-non-zero or positive-zero, then i. Let pattern be patterns.[[positivePattern]]. b. Else, i. Let pattern be patterns.[[negativePattern]]. 18. Else if signDisplay is "exceptZero", then a. If category is positive-zero or negative-zero, then i. Let pattern be patterns.[[zeroPattern]]. b. Else if category is positive-non-zero, then i. Let pattern be patterns.[[positivePattern]]. c. Else, i. Let pattern be patterns.[[negativePattern]]. 19. Else, a. Assert: signDisplay is "negative". b. If category is negative-non-zero, then i. Let pattern be patterns.[[negativePattern]]. c. Else, i. Let pattern be patterns.[[zeroPattern]]. 20. Return pattern. ``` -------------------------------- ### GET /Intl.DateTimeFormat/supportedLocalesOf Source: https://tc39.es/ecma402 Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale. ```APIDOC ## GET /Intl.DateTimeFormat/supportedLocalesOf ### Description Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale. ### Method GET ### Endpoint Intl.DateTimeFormat.supportedLocalesOf(locales, options) ### Parameters #### Query Parameters - **locales** (string|array) - Required - A string with a BCP 47 language tag, or an array of such strings. - **options** (object) - Optional - An object that may have the property 'localeMatcher'. ``` -------------------------------- ### Intl.ListFormat Constructor Source: https://tc39.es/ecma402 Creates a new Intl.ListFormat object to format lists of items according to locale-specific rules. ```APIDOC ## Intl.ListFormat ( [ locales [ , options ] ] ) ### Description The Intl.ListFormat constructor creates an object that enables language-sensitive list formatting. ### Parameters #### Query Parameters - **locales** (string|array) - Optional - A string with a BCP 47 language tag, or an array of such strings. - **options** (object) - Optional - An object with some or all of the following properties: - **type** (string) - The type of list: "conjunction" (default), "disjunction", or "unit". - **style** (string) - The style of the list: "long" (default), "short", or "narrow". ### Response #### Success Response (200) - **listFormat** (Object) - An initialized Intl.ListFormat instance. ``` -------------------------------- ### GET Intl.Collator.supportedLocalesOf Source: https://tc39.es/ecma402 Returns an array of the provided locales that are supported by the implementation without having to fall back to the runtime's default locale. ```APIDOC ## GET Intl.Collator.supportedLocalesOf ### Description Returns the subset of the provided BCP 47 language tags that are supported in collation without having to fall back to the runtime's default locale. ### Method GET ### Endpoint Intl.Collator.supportedLocalesOf(locales, options) ### Parameters #### Path Parameters - **locales** (string|Array) - Required - A string with a BCP 47 language tag, or an array of such strings. - **options** (Object) - Optional - An object that may have the property 'localeMatcher' (e.g., 'lookup' or 'best fit'). ### Response #### Success Response (200) - **Array** (Array) - An array of supported locale strings. ``` -------------------------------- ### Intl.NumberFormat Constructor Source: https://tc39.es/ecma402 The initial value of Intl.NumberFormat.prototype.constructor is %Intl.NumberFormat%. ```APIDOC ## Intl.NumberFormat.prototype.constructor ### Description The initial value of `Intl.NumberFormat.prototype.constructor` is %Intl.NumberFormat%. ### Method Accessor Property ### Endpoint `Intl.NumberFormat.prototype.constructor` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **constructor** (Function) - The constructor function for Intl.NumberFormat objects. ### Response Example ```javascript Intl.NumberFormat.prototype.constructor ``` ``` -------------------------------- ### Intl.DisplayNames.prototype[Symbol.toStringTag] Source: https://tc39.es/ecma402 The string tag for Intl.DisplayNames objects. ```APIDOC ## Intl.DisplayNames.prototype[Symbol.toStringTag] ### Description The initial value of the `%Symbol.toStringTag%` property is the String value "Intl.DisplayNames". ### Attributes - `[[Writable]]`: false - `[[Enumerable]]`: false - `[[Configurable]]`: true ``` -------------------------------- ### Get Unicode Extension Value Source: https://tc39.es/ecma402 Retrieves the value of a specific Unicode locale extension key from a locale identifier. Returns empty if the extension is not present. ```javascript UnicodeExtensionValue ( locale, key ) ``` -------------------------------- ### Intl.Locale Constructor Source: https://tc39.es/ecma402 Details the process of creating a new Intl.Locale object. ```APIDOC ## Intl.Locale ( tag [ , options ] ) ### Description This section outlines the steps executed when the `Intl.Locale` function is called with a tag and optional options. ### Method Constructor ### Endpoint N/A (JavaScript built-in object) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript new Intl.Locale('en-US', { calendar: 'gregory', numberingSystem: 'latn' }) ``` ### Response #### Success Response (200) - **locale** (Object) - An initialized Intl.Locale object. #### Response Example ```json { "[[InitializedLocale]]": true, "[[Locale]]": "en-US", "[[Calendar]]": "gregory", "[[Collation]]": undefined, "[[FirstDayOfWeek]]": undefined, "[[HourCycle]]": undefined, "[[NumberingSystem]]": "latn" } ``` ### Internal Steps 1. If `NewTarget` is undefined, throw a `TypeError`. 2. Retrieve `[[LocaleExtensionKeys]]` from `%Intl.Locale`. 3. Initialize `internalSlotsList` with default properties. 4. Conditionally append `[[CaseFirst]]` if `localeExtensionKeys` contains "kf". 5. Conditionally append `[[Numeric]]` if `localeExtensionKeys` contains "kn". 6. Create the locale object using `OrdinaryCreateFromConstructor`. 7. Validate `tag`: must be a String or Object. 8. If `tag` is an Object with `[[InitializedLocale]]`, use its `[[Locale]]` property. 9. Otherwise, convert `tag` to a String. 10. Coerce `options` to an object. 11. Validate `tag` using `IsWellFormedLanguageTag`. 12. Canonicalize `tag` using `CanonicalizeUnicodeLocaleId`. 13. Update `tag` based on `options` using `UpdateLanguageId`. 14. Initialize an `opt` record. 15. Process `calendar` option: validate and set `opt.[[ca]]`. 16. Process `collation` option: validate and set `opt.[[co]]`. 17. Process `firstDayOfWeek` option: validate and set `opt.[[fw]]`. 18. Process `hourCycle` option: validate and set `opt.[[hc]]`. 19. Process `caseFirst` option: validate and set `opt.[[kf]]`. 20. Process `numeric` option: validate and set `opt.[[kn]]`. 21. Process `numberingSystem` option: validate and set `opt.[[nu]]`. 22. Create a `MakeLocaleRecord` using `tag` and `opt`. 23. Populate the locale object's internal slots using the `MakeLocaleRecord` results. 24. Return the initialized locale object. ``` -------------------------------- ### Intl.Locale.prototype.maximize() Source: https://tc39.es/ecma402 The `maximize()` method expands the locale to the largest possible subtags. ```APIDOC ## Intl.Locale.prototype.maximize ( ) ### Description Expands the locale to the largest possible subtags using the Add Likely Subtags algorithm. ### Method `maximize()` ### Endpoint N/A (Instance method) ### Parameters None ### Request Example ```javascript const locale = new Intl.Locale('en-US-u-ca-gregory'); const maximizedLocale = locale.maximize(); console.log(maximizedLocale.toString()); // Example output: 'en-US-u-ca-gregory' ``` ### Response #### Success Response (Instance of Intl.Locale) - Returns a new `Intl.Locale` instance representing the maximized locale. #### Response Example ```json { "example": "en-US-u-ca-gregory" } ``` ``` -------------------------------- ### DateTime Style Range Records Source: https://tc39.es/ecma402 Defines the structure and fields of DateTime Style Range Records, which are used to specify how date and time ranges should be formatted. Includes an example for English locale data. ```APIDOC ## DateTime Style Range Records Each DateTime Style Range Record has the fields defined in Table 14. ### Example Record (English Locale) * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[pattern]]`: "{hour}:{minute}" * `[[pattern12]]`: "{hour}:{minute} {ampm}" * `[[rangePatterns]]`: * `[[Hour]]`: * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[PatternParts]]`: * `{[[Source]]: "startRange", [[Pattern]]: "{hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " – "}` * `{[[Source]]: "endRange", [[Pattern]]: "{hour}:{minute}"}` * `[[Minute]]`: * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[PatternParts]]`: * `{[[Source]]: "startRange", [[Pattern]]: "{hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " – "}` * `{[[Source]]: "endRange", [[Pattern]]: "{hour}:{minute}"}` * `[[Default]]`: * `[[year]]`: "2-digit" * `[[month]]`: "numeric" * `[[day]]`: "numeric" * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[PatternParts]]`: * `{[[Source]]: "startRange", [[Pattern]]: "{day}/{month}/{year}, {hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " – "}` * `{[[Source]]: "endRange", [[Pattern]]: "{day}/{month}/{year}, {hour}:{minute}"}` * `[[rangePatterns12]]`: * `[[Hour]]`: * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[PatternParts]]`: * `{[[Source]]: "startRange", [[Pattern]]: "{hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " – "}` * `{[[Source]]: "endRange", [[Pattern]]: "{hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " {ampm}"}` * `[[Minute]]`: * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[PatternParts]]`: * `{[[Source]]: "startRange", [[Pattern]]: "{hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " – "}` * `{[[Source]]: "endRange", [[Pattern]]: "{hour}:{minute}"}` * `{[[Source]]: "shared", [[Pattern]]: " {ampm}"}` * `[[Default]]`: * `[[year]]`: "2-digit" * `[[month]]`: "numeric" * `[[day]]`: "numeric" * `[[hour]]`: "numeric" * `[[minute]]`: "numeric" * `[[PatternParts]]`: * `{[[Source]]: "startRange", [[Pattern]]: "{day}/{month}/{year}, {hour}:{minute} {ampm}"}` * `{[[Source]]: "shared", [[Pattern]]: " – "}` * `{[[Source]]: "endRange", [[Pattern]]: "{day}/{month}/{year}, {hour}:{minute} {ampm}"}` **Note**: It is recommended to use locale data from the Common Locale Data Repository (CLDR). ``` -------------------------------- ### Intl.DisplayNames Instance Properties Source: https://tc39.es/ecma402 Details the internal slots and properties of Intl.DisplayNames instances, which inherit from %Intl.DisplayNames.prototype%. ```APIDOC ## Intl.DisplayNames Instance Properties Intl.DisplayNames instances are ordinary objects that inherit properties from %Intl.DisplayNames.prototype%. ### Internal Slots - **[[InitializedDisplayNames]]**: Internal slot indicating initialization. - **[[Locale]]** (String): The language tag of the locale used for formatting. - **[[Style]]** (String): One of "narrow", "short", or "long", specifying the display name style. - **[[Type]]** (String): One of "language", "region", "script", "currency", "calendar", or "dateTimeField", specifying the type of display names requested. - **[[Fallback]]** (String): One of "code" or "none", specifying the fallback behavior. - **[[LanguageDisplay]]** (String): One of "dialect" or "standard", used when [[Type]] is "language". - **[[Fields]]** (Record): A record containing fields corresponding to style, type, and language display. ``` -------------------------------- ### Get Unsigned Rounding Mode Source: https://tc39.es/ecma402 Determines the appropriate unsigned rounding mode based on a given rounding mode and the sign of a number. This operation is used to ensure consistent rounding behavior for absolute values. ```javascript GetUnsignedRoundingMode ( roundingMode, sign ) ``` -------------------------------- ### Get Available Named Time Zone Identifier Source: https://tc39.es/ecma402 Retrieves a Time Zone Identifier Record if the provided timeZoneIdentifier matches an available named time zone. Ensures consistent results for the lifetime of the agent. ```javascript GetAvailableNamedTimeZoneIdentifier ( timeZoneIdentifier ) ``` -------------------------------- ### POST Intl.DateTimeFormat.prototype.formatToParts Source: https://tc39.es/ecma402 Formats a date and returns an array of objects representing the parts of the formatted string. ```APIDOC ## POST Intl.DateTimeFormat.prototype.formatToParts ### Description Formats a date into an array of parts. ### Method POST ### Endpoint Intl.DateTimeFormat.prototype.formatToParts(date) ### Parameters #### Path Parameters - **date** (Number) - Optional - The date to format. If undefined, defaults to current time. ### Response #### Success Response (200) - **parts** (Array) - An array of objects representing the formatted date parts. ``` -------------------------------- ### Get Calendars of Locale Source: https://tc39.es/ecma402 Retrieves an array of available calendar types for a given locale. It prioritizes the locale's explicit calendar, then uses region preference data, falling back to 'gregory' if no specific data is found. ```javascript CalendarsOfLocale ( loc ) ``` -------------------------------- ### String.prototype.localeCompare Source: https://tc39.es/ecma402 Compares two strings according to the locale and sort order of the implementation. ```APIDOC ## String.prototype.localeCompare ( that [ , locales [ , options ] ] ) ### Description Compares this string with another string (`that`), returning a number indicating whether the first string comes before, or after, the second string in sort order. Optional `locales` and `options` arguments allow customization of the comparison. ### Parameters - **that** (any) - The value to compare against the string. - **locales** (optional) - A string with a BCP 47 language tag, or an array of such strings. - **options** (optional) - An object that may contain properties to customize the comparison. ### Returns - **Number** - A negative value if the reference string precedes `that`, a positive value if the reference string follows `that`, or 0 if they are equivalent. ### Notes - This method is intentionally generic and can be used with non-string values. - The `localeCompare` function itself is not directly suitable as an argument to `Array.prototype.sort` because the latter requires a function of two arguments. ``` -------------------------------- ### Get Collations of Locale Source: https://tc39.es/ecma402 Retrieves an array of available collation types for a given locale. It prioritizes the locale's explicit collation, then looks up available locales and their sort data, falling back to 'emoji' and 'eor' for undetermined languages. ```javascript CollationsOfLocale ( loc ) ``` -------------------------------- ### TextDirectionOfLocale ( loc ) Source: https://tc39.es/ecma402 Determines the text direction (left-to-right or right-to-left) for a given locale. It first tries to get the script from the locale. If not available, it uses the 'Add Likely Subtags' algorithm to infer the script. It then returns 'rtl' or 'ltr' based on the default text ordering for that script. Returns undefined if the direction cannot be determined. ```APIDOC ## TextDirectionOfLocale ( loc ) ### Description Determines the text direction (left-to-right or right-to-left) for a given locale. It first tries to get the script from the locale. If not available, it uses the 'Add Likely Subtags' algorithm to infer the script. It then returns 'rtl' or 'ltr' based on the default text ordering for that script. Returns undefined if the direction cannot be determined. ### Parameters #### Path Parameters - **loc** (Intl.Locale) - Required - The locale object to query. ### Returns - String: 'rtl' for right-to-left, 'ltr' for left-to-right, or undefined if the direction cannot be determined. ``` -------------------------------- ### Intl.Locale.prototype Properties Source: https://tc39.es/ecma402 Overview of the properties available on the Intl.Locale.prototype object. ```APIDOC ## Intl.Locale.prototype ### Description The value of `Intl.Locale.prototype` is the prototype object for Intl.Locale instances. ### Properties - `constructor` (function) - The initial value of `Intl.Locale.prototype.constructor` is %Intl.Locale%. - `baseName` (accessor property) - Returns the base name of the locale. - `calendar` (accessor property) - Returns the calendar associated with the locale. - `caseFirst` (accessor property) - Returns the case sensitivity setting for the locale (if supported). - `collation` (accessor property) - Returns the collation (sorting) method for the locale. - `firstDayOfWeek` (accessor property) - Returns the first day of the week for the locale. - `hourCycle` (accessor property) - Returns the hour cycle used in the locale. - `language` (accessor property) - Returns the language of the locale. - `numberingSystem` (accessor property) - Returns the numbering system used in the locale. ``` -------------------------------- ### BestFitFormatMatcher Abstract Operation Source: https://tc39.es/ecma402 The BestFitFormatMatcher abstract operation provides an implementation-defined way to match formatting options, aiming for a result that a typical user would perceive as optimal. ```APIDOC ## BestFitFormatMatcher ( options, formats ) ### Description An implementation-defined abstract operation that matches formatting options, aiming for a user-perceived best fit. ### Parameters - **options** (Record) - An object containing formatting preferences. - **formats** (List of DateTime Format Records) - A list of available date time format configurations. ### Returns - (DateTime Format Record) - A DateTime Format Record that is considered a good fit for the user. ### Behavior This operation is implementation-defined and is expected to return a format that is at least as good as, if not better than, the one returned by `BasicFormatMatcher` from a typical user's perspective. ``` -------------------------------- ### Intl.RelativeTimeFormat.prototype.resolvedOptions Source: https://tc39.es/ecma402 Returns a new object with properties reflecting the locale and formatting options computed during initialization. ```APIDOC ## GET Intl.RelativeTimeFormat.prototype.resolvedOptions ### Description Provides access to the locale and options computed during initialization of the Intl.RelativeTimeFormat object. ### Method GET ### Response #### Success Response (200) - **options** (Object) - An object containing the resolved locale and formatting options. ``` -------------------------------- ### Intl.DurationFormat.prototype.resolvedOptions Source: https://tc39.es/ecma402 Returns an object containing the locale and formatting options computed during the initialization of the Intl.DurationFormat instance. ```APIDOC ## GET Intl.DurationFormat.prototype.resolvedOptions ### Description Provides access to the locale and options computed during initialization of the Intl.DurationFormat object. ### Method GET ### Response #### Success Response (200) - **options** (Object) - An object containing the resolved locale and formatting options. ``` -------------------------------- ### Intl.NumberFormat.prototype.resolvedOptions Source: https://tc39.es/ecma402 Returns an object with the properties and values of the Intl.NumberFormat object's options computed during initialization. ```APIDOC ## Intl.NumberFormat.prototype.resolvedOptions ( ) ### Description This function provides access to the locale and options computed during initialization of the object. ### Method GET ### Endpoint `Intl.NumberFormat.prototype.resolvedOptions()` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **options** (Object) - An object containing the locale and options used by the Intl.NumberFormat instance. ### Response Example ```json { "locale": "en-US", "numberingSystem": "latn", "pluralCategories": [ "zero", "one", "two", "few", "many", "other" ], "signDisplay": "auto", "useGrouping": true } ``` ```