js-apis-intl.md 38.1 KB
Newer Older
S
shawn_he 已提交
1
# @ohos.intl (Internationalization)
Z
zengyawen 已提交
2

S
shawn_he 已提交
3 4
 The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402.
The [i18n](i18n-guidelines.md) module provides enhanced i18n capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the intl module to provide a complete suite of i18n capabilities.
S
shawn_he 已提交
5 6

>  **NOTE**
S
shawn_he 已提交
7 8 9
>  - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>  - This module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n interfaces defined in ECMA 402. For details about the enhanced i18n capabilities, see [i18n](js-apis-i18n.md).
S
shawn_he 已提交
10

S
shawn_he 已提交
11 12

## Modules to Import
Z
zengyawen 已提交
13

S
shawn_he 已提交
14
```js
Z
zengyawen 已提交
15 16
import Intl from '@ohos.intl';
```
S
shawn_he 已提交
17
Importing an incorrect bundle can lead to unexpected API behavior.
S
shawn_he 已提交
18 19 20 21 22 23

## Locale


### Attributes

S
shawn_he 已提交
24 25
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
26
| Name             | Type     | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
27 28 29 30 31 32
| --------------- | ------- | ---- | ---- | ---------------------------------------- |
| language        | string  | Yes   | No   | Language associated with the locale, for example, **zh**.                   |
| script          | string  | Yes   | No   | Script type of the language, for example, **Hans**.                         |
| region          | string  | Yes   | No   | Region associated with the locale, for example, **CN**.                        |
| baseName        | string  | Yes   | No   | Basic key information about the locale, which consists of the language, script, and region, for example, **zh-Hans-CN**. |
| caseFirst       | string  | Yes   | No   | Whether case is taken into account for the locale's collation rules. The value can be **upper**, **lower**, or **false**.|
S
shawn_he 已提交
33
| calendar        | string  | Yes   | No   | Calendar for the locale. The value can be any of the following: **buddhist**, **chinese**, **coptic**, **dangi**, **ethioaa**, **ethiopic**, **gregory**, **hebrew**, **indian**, **islamic**, **islamic-umalqura**, **islamic-tbla**, **islamic-civil**, **islamic-rgsa**, **iso8601**, **japanese**, **persian**, **roc**, or **islamicc**.|
S
shawn_he 已提交
34
| collation       | string  | Yes   | No   | Rule for sorting regions. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **searchjl**, **stroke**, **trad**, **unihan**, **zhuyin**.|
S
shawn_he 已提交
35
| hourCycle       | string  | Yes   | No   | Time system for the locale. The value can be any of the following: **h12**, **h23**, **h11**, or **h24**.|
S
shawn_he 已提交
36 37
| numberingSystem | string  | Yes   | No   | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.|
| numeric         | boolean | Yes   | No   | Whether to apply special collation rules for numeric characters.                     |
S
shawn_he 已提交
38 39 40 41 42 43


### constructor<sup>8+</sup>

constructor()

S
shawn_he 已提交
44
Creates a **Locale** object.
S
shawn_he 已提交
45 46 47

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
48
**Example**
S
shawn_he 已提交
49 50 51 52 53
  ```js
  // The default constructor uses the current system locale to create a Locale object.
  let locale = new Intl.Locale()
  // Return the current system locale.
  let localeID = locale.toString()
S
shawn_he 已提交
54
  ```
S
shawn_he 已提交
55 56 57 58


### constructor

S
shawn_he 已提交
59
constructor(locale: string, options?: LocaleOptions)
S
shawn_he 已提交
60

S
shawn_he 已提交
61
Creates a **Locale** object.
S
shawn_he 已提交
62 63 64

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
65
**Parameters**
S
shawn_he 已提交
66

S
shawn_he 已提交
67 68 69 70
| Name                 | Type                              | Mandatory  | Description                          |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale               | string                           | Yes   | A string containing locale information, including the language, optional script, and region. For details about the international standards and combination modes for the language, script, and country or region, see [intl Development](../../internationalization/intl-guidelines.md#setting-locale-information).|
| options<sup>9+</sup> | [LocaleOptions](#localeoptions6) | No   | Options for creating the **Locale** object.                |
S
shawn_he 已提交
71

S
shawn_he 已提交
72
**Example**
S
shawn_he 已提交
73 74 75 76
  ```js
  // Create a Locale object named zh-CN.
  let locale = new Intl.Locale("zh-CN")
  let localeID = locale.toString() // localeID = "zh-CN"
S
shawn_he 已提交
77 78 79 80 81 82
  ```


### toString

toString(): string
Z
zengyawen 已提交
83

S
shawn_he 已提交
84
Obtains the string representation of a **Locale** object.
Z
zengyawen 已提交
85

S
shawn_he 已提交
86 87
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
88
**Return value**
S
shawn_he 已提交
89

S
shawn_he 已提交
90 91
| Type    | Description         |
| ------ | ----------- |
S
shawn_he 已提交
92
| string | String representation of the **Locale** object.|
S
shawn_he 已提交
93

S
shawn_he 已提交
94
**Example**
S
shawn_he 已提交
95 96 97 98
  ```js
  // Create a Locale object named en-GB.
  let locale = new Intl.Locale("en-GB");
  let localeID = locale.toString(); // localeID = "en-GB"
S
shawn_he 已提交
99 100 101 102 103 104 105 106 107 108 109
  ```


### maximize

maximize(): Locale

Maximizes information of the **Locale** object. If the script and locale information is missing, add the information.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
110
**Return value**
S
shawn_he 已提交
111

S
shawn_he 已提交
112 113 114
| Type               | Description        |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the maximized information.|
S
shawn_he 已提交
115

S
shawn_he 已提交
116
**Example**
S
shawn_he 已提交
117 118 119 120 121 122 123 124 125 126 127 128
  ```js
  // Create a Locale object named zh.
  let locale = new Intl.Locale("zh");
  // Complete the script and region of the Locale object.
  let maximizedLocale = locale.maximize();
  let localeID = maximizedLocale.toString(); // localeID = "zh-Hans-CN"

  // Create a Locale object named en-US.
  locale = new Intl.Locale("en-US");
  // Complete the script of the Locale object.
  maximizedLocale = locale.maximize();
  localeID = maximizedLocale.toString(); // localeID = "en-Latn-US"
S
shawn_he 已提交
129 130
  ```

Z
zengyawen 已提交
131

S
shawn_he 已提交
132
### minimize
Z
zengyawen 已提交
133

S
shawn_he 已提交
134
minimize(): Locale
Z
zengyawen 已提交
135

S
shawn_he 已提交
136
Minimizes information of the **Locale** object. If the script and locale information is present, delete the information.
Z
zengyawen 已提交
137

S
shawn_he 已提交
138
**System capability**: SystemCapability.Global.I18n
Z
zengyawen 已提交
139

S
shawn_he 已提交
140
**Return value**
S
shawn_he 已提交
141

S
shawn_he 已提交
142 143 144
| Type               | Description        |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the minimized information.|
Z
zengyawen 已提交
145

S
shawn_he 已提交
146
**Example**
S
shawn_he 已提交
147 148 149 150 151 152 153 154 155 156 157 158
  ```js
  // Create a Locale object named zh-Hans-CN.
  let locale = new Intl.Locale("zh-Hans-CN");
  // Remove the script and region of the Locale object.
  let minimizedLocale = locale.minimize();
  let localeID = minimizedLocale.toString(); // localeID = "zh"

  // Create a Locale object named en-US.
  locale = new Intl.Locale("en-US");
  // Remove the region of the Locale object.
  minimizedLocale = locale.minimize();
  localeID = minimizedLocale.toString(); // localeID = "en"
S
shawn_he 已提交
159
  ```
Z
zengyawen 已提交
160 161


S
shawn_he 已提交
162
## LocaleOptions<sup>6+</sup>
S
shawn_he 已提交
163 164 165 166 167

Represents the locale options.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
168
| Name             | Type     | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
169
| --------------- | ------- | ---- | ---- | ---------------------------------------- |
S
shawn_he 已提交
170 171 172
| calendar        | string  | Yes   | Yes   | Calendar for the locale. The value can be any of the following: **buddhist**, **chinese**, **coptic**, **dangi**, **ethioaa**, **ethiopic**, **gregory**, **hebrew**, **indian**, **islamic**, **islamic-umalqura**, **islamic-tbla**, **islamic-civil**, **islamic-rgsa**, **iso8601**, **japanese**, **persian**, **roc**, or **islamicc**.|
| collation       | string  | Yes   | Yes   | Collation rule. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **emoji**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **search**, **searchjl**, **standard**, **stroke**, **trad**, **unihan**, **zhuyin**.|
| hourCycle       | string  | Yes   | Yes   | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, or **h24**.|
S
shawn_he 已提交
173 174 175
| numberingSystem | string  | Yes   | Yes   | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.|
| numeric         | boolean | Yes   | Yes   | Whether to use the 12-hour clock.                              |
| caseFirst       | string  | Yes   | Yes   | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**.|
S
shawn_he 已提交
176 177


S
shawn_he 已提交
178
## DateTimeFormat
Z
zengyawen 已提交
179

S
shawn_he 已提交
180

S
shawn_he 已提交
181
### constructor<sup>8+</sup>
S
shawn_he 已提交
182

S
shawn_he 已提交
183
constructor()
S
shawn_he 已提交
184 185 186 187 188

Creates a **DateTimeOptions** object for the specified locale.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
189
**Example**
S
shawn_he 已提交
190 191 192
  ```js
  // Use the current system locale to create a DateTimeFormat object.
  let datefmt= new Intl.DateTimeFormat();
S
shawn_he 已提交
193 194 195 196 197
  ```


### constructor

S
shawn_he 已提交
198
constructor(locale: string | Array&lt;string&gt;, options?: DateTimeOptions)
S
shawn_he 已提交
199 200 201 202 203

Creates a **DateTimeOptions** object for the specified locale.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
204
**Parameters**
S
shawn_he 已提交
205

S
shawn_he 已提交
206 207 208 209
| Name                 | Type                                  | Mandatory  | Description                          |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale               | string \| Array&lt;string&gt;        | Yes   | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [DateTimeOptions](#datetimeoptions6) | No   | Options for creating a **DateTimeFormat** object.             |
S
shawn_he 已提交
210

S
shawn_he 已提交
211
**Example**
S
shawn_he 已提交
212 213 214
  ```js
  // Use locale zh-CN to create a DateTimeFormat object. Set dateStyle to full and timeStyle to medium.
  let datefmt= new Intl.DateTimeFormat("zh-CN", { dateStyle: 'full', timeStyle: 'medium' });
S
shawn_he 已提交
215 216 217
  ```


S
shawn_he 已提交
218
**Example**
S
shawn_he 已提交
219 220 221
  ```js
  // Use the locale list ["ban", "zh"] to create a DateTimeFormat object. Because ban is an invalid locale ID, locale zh is used to create the DateTimeFormat object.
  let datefmt= new Intl.DateTimeFormat(["ban", "zh"], { dateStyle: 'full', timeStyle: 'medium' });
S
shawn_he 已提交
222 223 224 225 226 227
  ```


### format

format(date: Date): string
Z
zengyawen 已提交
228 229 230

Formats the specified date and time.

S
shawn_he 已提交
231 232
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
233
**Parameters**
S
shawn_he 已提交
234

S
shawn_he 已提交
235 236 237
| Name | Type  | Mandatory  | Description     |
| ---- | ---- | ---- | ------- |
| date | Date | Yes   | Date and time to be formatted.|
S
shawn_he 已提交
238

S
shawn_he 已提交
239
**Return value**
S
shawn_he 已提交
240

S
shawn_he 已提交
241 242 243
| Type    | Description          |
| ------ | ------------ |
| string | A string containing the formatted date and time.|
S
shawn_he 已提交
244

S
shawn_he 已提交
245
**Example**
S
shawn_he 已提交
246 247 248 249 250 251 252 253 254
  ```js
  let date = new Date(2021, 11, 17, 3, 24, 0);
  // Use locale en-GB to create a DateTimeFormat object.
  let datefmt = new Intl.DateTimeFormat("en-GB");
  let formattedDate = datefmt.format(date); // formattedDate "17/12/2021"

  // Use locale en-GB to create a DateTimeFormat object. Set dateStyle to full and timeStyle to medium.
  datefmt = new Intl.DateTimeFormat("en-GB", { dateStyle: 'full', timeStyle: 'medium' });
  formattedDate = datefmt.format(date); // formattedDate "Friday, 17 December 2021 at 03:24:00"
S
shawn_he 已提交
255 256 257 258 259
  ```


### formatRange

S
shawn_he 已提交
260
formatRange(startDate: Date, endDate: Date): string
Z
zengyawen 已提交
261 262 263

Formats the specified date range.

S
shawn_he 已提交
264 265
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
266
**Parameters**
S
shawn_he 已提交
267

S
shawn_he 已提交
268 269 270 271
| Name      | Type  | Mandatory  | Description      |
| --------- | ---- | ---- | -------- |
| startDate | Date | Yes   | Start date and time to be formatted.|
| endDate   | Date | Yes   | End date and time to be formatted.|
S
shawn_he 已提交
272

S
shawn_he 已提交
273
**Return value**
S
shawn_he 已提交
274

S
shawn_he 已提交
275 276 277
| Type    | Description            |
| ------ | -------------- |
| string | A string containing the formatted date and time range.|
S
shawn_he 已提交
278

S
shawn_he 已提交
279
**Example**
S
shawn_he 已提交
280 281 282 283 284 285
  ```js
  let startDate = new Date(2021, 11, 17, 3, 24, 0);
  let endDate = new Date(2021, 11, 18, 3, 24, 0);
  // Use locale en-GB to create a DateTimeFormat object.
  let datefmt = new Intl.DateTimeFormat("en-GB");
  let formattedDateRange = datefmt.formatRange(startDate, endDate); // formattedDateRange = "17/12/2021-18/12/2021"
S
shawn_he 已提交
286 287 288 289 290 291 292 293 294 295 296
  ```


### resolvedOptions

resolvedOptions(): DateTimeOptions

Obtains the formatting options for **DateTimeFormat** object.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
297
**Return value**
S
shawn_he 已提交
298

S
shawn_he 已提交
299 300 301
| Type                                  | Description                           |
| ------------------------------------ | ----------------------------- |
| [DateTimeOptions](#datetimeoptions6) | Formatting options for **DateTimeFormat** objects.|
S
shawn_he 已提交
302

S
shawn_he 已提交
303
**Example**
S
shawn_he 已提交
304 305 306 307 308 309
  ```js
  let datefmt = new Intl.DateTimeFormat("en-GB", { dateStyle: 'full', timeStyle: 'medium' });
  // Obtain the options of the DateTimeFormat object.
  let options = datefmt.resolvedOptions();
  let dateStyle = options.dateStyle; // dateStyle = "full"
  let timeStyle = options.timeStyle; // timeStyle = "medium"
S
shawn_he 已提交
310 311 312
  ```


S
shawn_he 已提交
313
## DateTimeOptions<sup>6+</sup>
S
shawn_he 已提交
314 315 316

Provides the options for the **DateTimeFormat** object.

S
shawn_he 已提交
317 318
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
319
| Name             | Type     | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
320 321 322 323
| --------------- | ------- | ---- | ---- | ---------------------------------------- |
| locale          | string  | Yes   | No   | Locale, for example, **zh-Hans-CN**.                |
| dateStyle       | string  | Yes   | Yes   | Date display format. The value can be **long**, **short**, **medium**, or **full**.|
| timeStyle       | string  | Yes   | Yes   | Time display format. The value can be **long**, **short**, **medium**, or **full**.|
S
shawn_he 已提交
324
| hourCycle       | string  | Yes   | Yes   | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, or **h24**.|
S
shawn_he 已提交
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
| timeZone        | string  | Yes   | Yes   | Time zone represented by a valid IANA time zone ID.                     |
| numberingSystem | string  | Yes   | Yes   | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.|
| hour12          | boolean | Yes   | Yes   | Whether to use the 12-hour clock.                              |
| weekday         | string  | Yes   | Yes   | Workday display format. The value can be **long**, **short**, or **narrow**.|
| era             | string  | Yes   | Yes   | Era display format. The value can be **long**, **short**, or **narrow**.|
| year            | string  | Yes   | Yes   | Year display format. The value can be **numeric** or **2-digit**.  |
| month           | string  | Yes   | Yes   | Month display format. The value can be any of the following: **numeric**, **2-digit**, **long**, **short**, **narrow**.|
| day             | string  | Yes   | Yes   | Day display format. The value can be **numeric** or **2-digit**. |
| hour            | string  | Yes   | Yes   | Hour display format. The value can be **numeric** or **2-digit**. |
| minute          | string  | Yes   | Yes   | Minute display format. The value can be **numeric** or **2-digit**. |
| second          | string  | Yes   | Yes   | Seconds display format. The value can be **numeric** or **2-digit**. |
| timeZoneName    | string  | Yes   | Yes   | Localized representation of a time zone name.                             |
| dayPeriod       | string  | Yes   | Yes   | Time period display format. The value can be **long**, **short**, or **narrow**.|
| localeMatcher   | string  | Yes   | Yes   | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| formatMatcher   | string  | Yes   | Yes   | Format matching algorithm. The value can be **basic** or **best fit**.|
S
shawn_he 已提交
340 341 342 343 344


## NumberFormat


S
shawn_he 已提交
345
### constructor<sup>8+</sup>
S
shawn_he 已提交
346

S
shawn_he 已提交
347
constructor()
S
shawn_he 已提交
348 349 350 351 352

Creates a **NumberFormat** object for the specified locale.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
353
**Example**
S
shawn_he 已提交
354 355 356
  ```js
  // Use the current system locale to create a NumberFormat object.
  let numfmt = new Intl.NumberFormat();
S
shawn_he 已提交
357 358 359 360 361
  ```


### constructor

S
shawn_he 已提交
362
constructor(locale: string | Array&lt;string&gt;, options?: NumberOptions)
S
shawn_he 已提交
363 364 365 366 367

Creates a **NumberFormat** object for the specified locale.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
368 369 370 371 372 373
**Parameters**

| Name                 | Type                              | Mandatory  | Description                          |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale               | string \| Array&lt;string&gt;    | Yes   | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [NumberOptions](#numberoptions6) | No   | Options for creating a **NumberFormat** object.               |
S
shawn_he 已提交
374

S
shawn_he 已提交
375
**Example**
S
shawn_he 已提交
376 377 378
  ```js
  // Use locale en-GB to create a NumberFormat object. Set style to decimal and notation to scientific.
  let numfmt = new Intl.NumberFormat("en-GB", {style:'decimal', notation:"scientific"});
S
shawn_he 已提交
379 380 381 382 383 384
  ```


### format

format(number: number): string;
Z
zengyawen 已提交
385 386 387

Formats a number.

S
shawn_he 已提交
388 389
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
390
**Parameters**
S
shawn_he 已提交
391

S
shawn_he 已提交
392 393 394
| Name   | Type    | Mandatory  | Description  |
| ------ | ------ | ---- | ---- |
| number | number | Yes   | Number to be formatted.|
S
shawn_he 已提交
395

S
shawn_he 已提交
396
**Return value**
S
shawn_he 已提交
397

S
shawn_he 已提交
398 399 400
| Type    | Description        |
| ------ | ---------- |
| string | Formatted number.|
S
shawn_he 已提交
401 402


S
shawn_he 已提交
403
**Example**
S
shawn_he 已提交
404 405 406 407
  ```js
  // Use locale list ["en-GB", "zh"] to create a NumberFormat object. Because en-GB is a valid locale ID, it is used to create the NumberFormat object.
  let numfmt = new Intl.NumberFormat(["en-GB", "zh"], {style:'decimal', notation:"scientific"});
  let formattedNumber = numfmt.format(1223); // formattedNumber = 1.223E3
S
shawn_he 已提交
408 409 410 411 412 413 414 415 416 417 418
  ```


### resolvedOptions

resolvedOptions(): NumberOptions

Obtains the options of the **NumberFormat** object.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
419
**Return value**
S
shawn_he 已提交
420

S
shawn_he 已提交
421 422 423
| Type                              | Description                         |
| -------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions6) | Formatting options for **NumberFormat** objects.|
S
shawn_he 已提交
424 425


S
shawn_he 已提交
426
**Example**
S
shawn_he 已提交
427 428 429 430 431 432
  ```js
  let numfmt = new Intl.NumberFormat(["en-GB", "zh"], {style:'decimal', notation:"scientific"});
  // Obtain the options of the NumberFormat object.
  let options = numfmt.resolvedOptions();
  let style = options.style; // style = decimal
  let notation = options.notation // notation = scientific
S
shawn_he 已提交
433 434 435
  ```


S
shawn_he 已提交
436
## NumberOptions<sup>6+</sup>
Z
zengyawen 已提交
437

S
shawn_he 已提交
438
Defines the device capability.
Z
zengyawen 已提交
439

S
shawn_he 已提交
440 441
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
442
| Name                      | Type     | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
443 444 445 446 447 448
| ------------------------ | ------- | ---- | ---- | ---------------------------------------- |
| locale                   | string  | Yes   | No   | Locale, for example, **zh-Hans-CN**.              |
| currency                 | string  | Yes   | Yes   | Currency unit, for example, **EUR**, **CNY**, or **USD**.        |
| currencySign             | string  | Yes   | Yes   | Currency unit symbol. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.|
| currencyDisplay          | string  | Yes   | Yes   | Currency display mode. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.|
| unit                     | string  | Yes   | Yes   | Unit name, for example, **meter**, **inch**, or **hectare**.       |
S
shawn_he 已提交
449
| unitDisplay              | string  | Yes   | Yes   | Unit display format. The value can be **long**, **short**, or **narrow**.|
S
shawn_he 已提交
450
| unitUsage                | string  | Yes   | Yes   | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.|
S
shawn_he 已提交
451 452 453 454 455 456 457 458 459 460 461 462
| signDisplay              | string  | Yes   | Yes   | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**.|
| compactDisplay           | string  | Yes   | Yes   | Compact display format. The value can be **long** or **short**.     |
| notation                 | string  | Yes   | Yes   | Number formatting specification. The value can be **standard**, **scientific**, **engineering**, or **compact**.|
| localeMatcher            | string  | Yes   | Yes   | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| style                    | string  | Yes   | Yes   | Number display format. The value can be **decimal**, **currency**, **percent**, or **unit**.|
| numberingSystem          | string  | Yes   | Yes   | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.|
| useGrouping              | boolean | Yes   | Yes   | Whether to use grouping for display.                                 |
| minimumIntegerDigits     | number  | Yes   | Yes   | Minimum number of digits allowed in the integer part of a number. The value ranges from **1** to **21**.                 |
| minimumFractionDigits    | number  | Yes   | Yes   | Minimum number of digits in the fraction part of a number. The value ranges from **0** to **20**.                 |
| maximumFractionDigits    | number  | Yes   | Yes   | Maximum number of digits in the fraction part of a number. The value ranges from **1** to **21**.                 |
| minimumSignificantDigits | number  | Yes   | Yes   | Minimum number of the least significant digits. The value ranges from **1** to **21**.                 |
| maximumSignificantDigits | number  | Yes   | Yes   | Maximum number of the least significant digits. The value ranges from **1** to **21**.                 |
Z
zengyawen 已提交
463 464


S
shawn_he 已提交
465 466 467 468 469 470 471
## Collator<sup>8+</sup>


### constructor<sup>8+</sup>

constructor()

S
shawn_he 已提交
472
Creates a **Collator** object.
S
shawn_he 已提交
473 474 475

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
476
**Example**
S
shawn_he 已提交
477 478 479
  ```js
  // Use the system locale to create a Collator object.
  let collator = new Intl.Collator();
S
shawn_he 已提交
480 481 482 483 484
  ```


### constructor<sup>8+</sup>

S
shawn_he 已提交
485
constructor(locale: string | Array&lt;string&gt;, options?: CollatorOptions)
S
shawn_he 已提交
486

S
shawn_he 已提交
487
Creates a **Collator** object.
S
shawn_he 已提交
488 489 490

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
491
**Parameters**
S
shawn_he 已提交
492

S
shawn_he 已提交
493 494 495 496
| Name                 | Type                                  | Mandatory  | Description                          |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale               | string \| Array&lt;string&gt;        | Yes   | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [CollatorOptions](#collatoroptions8) | No   | Options for creating a **Collator** object.                |
S
shawn_he 已提交
497

S
shawn_he 已提交
498
**Example**
S
shawn_he 已提交
499 500 501
  ```js
  // Use locale zh-CN to create a Collator object. Set localeMatcher to lookup and usage to sort.
  let collator = new Intl.Collator("zh-CN", {localeMatcher: "lookup", usage: "sort"});
S
shawn_he 已提交
502 503 504 505 506 507 508 509 510 511 512
  ```


### compare<sup>8+</sup>

compare(first: string, second: string): number

Compares two strings based on the sorting policy of the **Collator** object.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
513
**Parameters**
S
shawn_he 已提交
514

S
shawn_he 已提交
515 516 517 518
| Name   | Type    | Mandatory  | Description          |
| ------ | ------ | ---- | ------------ |
| first  | string | Yes   | First string to compare. |
| second | string | Yes   | Second string to compare.|
S
shawn_he 已提交
519

S
shawn_he 已提交
520
**Return value**
S
shawn_he 已提交
521

S
shawn_he 已提交
522 523 524
| Type    | Description                                      |
| ------ | ---------------------------------------- |
| number | Comparison result. If the value is a negative number, the first string is before the second string. If the value of number is **0**, the first string is equal to the second string. If the value of number is a positive number, the first string is after the second string.|
S
shawn_he 已提交
525

S
shawn_he 已提交
526
**Example**
S
shawn_he 已提交
527 528 529 530 531
  ```js
  // Use locale en-GB to create a Collator object.
  let collator = new Intl.Collator("en-GB");
  // Compare the sequence of the first and second strings.
  let compareResult = collator.compare("first", "second"); // compareResult = -1
S
shawn_he 已提交
532 533 534 535 536 537 538 539 540 541 542
  ```


### resolvedOptions<sup>8+</sup>

resolvedOptions(): CollatorOptions

Returns properties reflecting the locale and collation options of a **Collator** object.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
543
**Return value**
S
shawn_he 已提交
544

S
shawn_he 已提交
545 546 547
| Type                                  | Description               |
| ------------------------------------ | ----------------- |
| [CollatorOptions](#collatoroptions8) | Properties of the **Collator** object.|
S
shawn_he 已提交
548

S
shawn_he 已提交
549
**Example**
S
shawn_he 已提交
550 551 552 553 554 555
  ```js
  let collator = new Intl.Collator("zh-Hans", { usage: 'sort', ignorePunctuation: true });
  // Obtain the options of the Collator object.
  let options = collator.resolvedOptions();
  let usage = options.usage; // usage = "sort"
  let ignorePunctuation = options.ignorePunctuation // ignorePunctuation = true
S
shawn_he 已提交
556 557 558
  ```


S
shawn_he 已提交
559
## CollatorOptions<sup>8+</sup>
S
shawn_he 已提交
560 561 562

Represents the properties of a **Collator** object.

S
shawn_he 已提交
563 564
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
565
| Name               | Type     | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
566 567 568
| ----------------- | ------- | ---- | ---- | ---------------------------------------- |
| localeMatcher     | string  | Yes   | Yes   | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| usage             | string  | Yes   | Yes   | Whether the comparison is for sorting or for searching. The value can be **sort** or **search**.       |
S
shawn_he 已提交
569
| sensitivity       | string  | Yes   | Yes   | Differences in the strings that lead to non-zero return values. The value can be **base**, **accent**, **case**, or **letiant**.|
S
shawn_he 已提交
570 571 572 573
| ignorePunctuation | boolean | Yes   | Yes   | Whether punctuation is ignored. The value can be **true** or **false**.       |
| collation         | string  | Yes   | Yes   | Rule for sorting regions. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **searchjl**, **stroke**, **trad**, **unihan**, **zhuyin**.|
| numeric           | boolean | Yes   | Yes   | Whether numeric collation is used. The value can be **true** or **false**.         |
| caseFirst         | string  | Yes   | Yes   | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**.|
S
shawn_he 已提交
574 575 576 577 578 579 580 581 582


## PluralRules<sup>8+</sup>


### constructor<sup>8+</sup>

constructor()

S
shawn_he 已提交
583
Creates a **PluralRules** object to obtain the singular-plural type of numbers.
S
shawn_he 已提交
584 585 586

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
587
**Example**
S
shawn_he 已提交
588 589 590
  ```js
  // Use the system locale to create a PluralRules object.
  let pluralRules = new Intl.PluralRules();
S
shawn_he 已提交
591 592 593 594 595
  ```


### constructor<sup>8+</sup>

S
shawn_he 已提交
596
constructor(locale: string | Array&lt;string&gt;, options?: PluralRulesOptions)
S
shawn_he 已提交
597

S
shawn_he 已提交
598
Creates a **PluralRules** object to obtain the singular-plural type of numbers.
S
shawn_he 已提交
599 600

**System capability**: SystemCapability.Global.I18n
Z
zengyawen 已提交
601

S
shawn_he 已提交
602 603 604 605 606 607
**Parameters**

| Name                 | Type                                      | Mandatory  | Description                          |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale               | string \| Array&lt;string&gt;            | Yes   | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [PluralRulesOptions](#pluralrulesoptions8) | No   | Options for creating a **PluralRules** object.               |
S
shawn_he 已提交
608

S
shawn_he 已提交
609
**Example**
S
shawn_he 已提交
610 611 612
  ```js
  // Use locale zh-CN to create a PluralRules object. Set localeMatcher to lookup and type to cardinal.
  let pluralRules= new Intl.PluralRules("zh-CN", {"localeMatcher": "lookup", "type": "cardinal"});
S
shawn_he 已提交
613
  ```
Z
zengyawen 已提交
614

S
shawn_he 已提交
615 616 617 618

### select<sup>8+</sup>

select(n: number): string
Z
zengyawen 已提交
619 620 621

Obtains a string that represents the singular-plural type of the specified number.

S
shawn_he 已提交
622 623
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
624
**Parameters**
S
shawn_he 已提交
625

S
shawn_he 已提交
626 627 628
| Name | Type    | Mandatory  | Description          |
| ---- | ------ | ---- | ------------ |
| n    | number | Yes   | Number for which the singular-plural type is to be obtained.|
S
shawn_he 已提交
629

S
shawn_he 已提交
630
**Return value**
S
shawn_he 已提交
631

S
shawn_he 已提交
632 633 634
| Type    | Description                                      |
| ------ | ---------------------------------------- |
| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.|
S
shawn_he 已提交
635

S
shawn_he 已提交
636
**Example**
S
shawn_he 已提交
637 638 639 640 641 642 643 644 645 646
  ```js
  // Use locale zh-Hans to create a PluralRules object.
  let zhPluralRules = new Intl.PluralRules("zh-Hans");
  // Determine the singular-plural type corresponding to number 1 in locale zh-Hans.
  let plural = zhPluralRules.select(1); // plural = other

  // Use locale en-US to create a PluralRules object.
  let enPluralRules = new Intl.PluralRules("en-US");
  // Determine the singular-plural type corresponding to number 1 in locale en-US.
  plural = enPluralRules.select(1); // plural = one
S
shawn_he 已提交
647 648 649
  ```


S
shawn_he 已提交
650
## PluralRulesOptions<sup>8+</sup>
S
shawn_he 已提交
651 652 653

Represents the properties of a **PluralRules** object.

S
shawn_he 已提交
654 655
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
656
| Name                      | Type    | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
657 658 659 660 661 662 663 664
| ------------------------ | ------ | ---- | ---- | ---------------------------------------- |
| localeMatcher            | string | Yes   | Yes   | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| type                     | string | Yes   | Yes   | Sorting type. The value can be **cardinal** or **ordinal**.  |
| minimumIntegerDigits     | number | Yes   | Yes   | Minimum number of digits allowed in the integer part of a number. The value ranges from **1** to **21**.                 |
| minimumFractionDigits    | number | Yes   | Yes   | Minimum number of digits in the fraction part of a number. The value ranges from **0** to **20**.                 |
| maximumFractionDigits    | number | Yes   | Yes   | Maximum number of digits in the fraction part of a number. The value ranges from **1** to **21**.                 |
| minimumSignificantDigits | number | Yes   | Yes   | Minimum number of the least significant digits. The value ranges from **1** to **21**.                 |
| maximumSignificantDigits | number | Yes   | Yes   | Maximum number of the least significant digits. The value ranges from **1** to **21**.                 |
S
shawn_he 已提交
665 666 667 668 669 670 671 672 673 674 675 676 677


## RelativeTimeFormat<sup>8+</sup>


### constructor<sup>8+</sup>

constructor()

Creates a **RelativeTimeFormat** object.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
678
**Example**
S
shawn_he 已提交
679 680 681
  ```js
  // Use the system locale to create a RelativeTimeFormat object.
  let relativetimefmt = new Intl.RelativeTimeFormat();
S
shawn_he 已提交
682 683 684 685 686
  ```


### constructor<sup>8+</sup>

S
shawn_he 已提交
687
constructor(locale: string | Array&lt;string&gt;, options?: RelativeTimeFormatInputOptions)
S
shawn_he 已提交
688 689 690 691

Creates a **RelativeTimeFormat** object.

**System capability**: SystemCapability.Global.I18n
Z
zengyawen 已提交
692

S
shawn_he 已提交
693 694
**Parameters**

S
shawn_he 已提交
695 696 697 698
| Name                 | Type                                      | Mandatory  | Description                          |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale               | string \| Array&lt;string&gt;            | Yes   | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | No   | Options for creating a **RelativeTimeFormat** object.           |
S
shawn_he 已提交
699

S
shawn_he 已提交
700
**Example**
S
shawn_he 已提交
701 702 703
  ```js
  // Use locale zh-CN to create a RelativeTimeFormat object. Set localeMatcher to lookup, numeric to always, and style to long.
  let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {"localeMatcher": "lookup", "numeric": "always", "style": "long"});
S
shawn_he 已提交
704 705
  ```

Z
zengyawen 已提交
706

S
shawn_he 已提交
707 708
### format<sup>8+</sup>

S
shawn_he 已提交
709
format(value: number, unit: string): string
Z
zengyawen 已提交
710 711 712

Formats the value and unit based on the specified locale and formatting options.

S
shawn_he 已提交
713 714
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
715
**Parameters**
S
shawn_he 已提交
716

S
shawn_he 已提交
717 718 719 720
| Name  | Type    | Mandatory  | Description                                      |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes   | Value to format.                             |
| unit  | string | Yes   | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
S
shawn_he 已提交
721

S
shawn_he 已提交
722
**Return value**
S
shawn_he 已提交
723

S
shawn_he 已提交
724 725 726
| Type    | Description        |
| ------ | ---------- |
| string | Relative time after formatting.|
S
shawn_he 已提交
727

S
shawn_he 已提交
728
**Example**
S
shawn_he 已提交
729 730 731 732 733
  ```js
  // Use locale zh-CN to create a RelativeTimeFormat object.
  let relativetimefmt = new Intl.RelativeTimeFormat("zh-CN");
  // Obtain the localized representation (in unit of quarter) of number 3 in locale zh-CN.
  let formatResult = relativetimefmt.format(3, "quarter"); // formatResult = "3 quarters later"
S
shawn_he 已提交
734 735 736 737 738
  ```


### formatToParts<sup>8+</sup>

S
shawn_he 已提交
739
formatToParts(value: number, unit: string): Array&lt;object&gt;
S
shawn_he 已提交
740

S
shawn_he 已提交
741
Obtains an array of RelativeTimeFormat objects in parts for locale-aware formatting.
S
shawn_he 已提交
742 743 744

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
745
**Parameters**
S
shawn_he 已提交
746

S
shawn_he 已提交
747 748 749 750
| Name  | Type    | Mandatory  | Description                                      |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes   | Value to format.                             |
| unit  | string | Yes   | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
S
shawn_he 已提交
751

S
shawn_he 已提交
752
**Return value**
S
shawn_he 已提交
753

S
shawn_he 已提交
754 755 756
| Type                 | Description                         |
| ------------------- | --------------------------- |
| Array&lt;object&gt; | An array of **RelativeTimeFormat** objects in parts.|
S
shawn_he 已提交
757

S
shawn_he 已提交
758
**Example**
S
shawn_he 已提交
759 760 761 762
  ```js
  // Use locale en to create a RelativeTimeFormat object. Set numeric to auto.
  let relativetimefmt = new Intl.RelativeTimeFormat("en", {"numeric": "auto"});
  let parts = relativetimefmt.formatToParts(10, "seconds"); // parts = [ {type: "literal", value: "in"}, {type: "integer", value: 10, unit: "second"}, {type: "literal", value: "seconds"} ]
S
shawn_he 已提交
763 764 765 766 767 768 769 770 771 772 773
  ```


### resolvedOptions<sup>8+</sup>

resolvedOptions(): RelativeTimeFormatResolvedOptions

Obtains the formatting options for **RelativeTimeFormat** objects.

**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
774
**Return value**
S
shawn_he 已提交
775

S
shawn_he 已提交
776 777
| Type                                      | Description                               |
| ---------------------------------------- | --------------------------------- |
S
shawn_he 已提交
778
| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions8) | Formatting options for **RelativeTimeFormat** objects.|
S
shawn_he 已提交
779

S
shawn_he 已提交
780
**Example**
S
shawn_he 已提交
781 782 783 784 785 786
  ```js
  // Use locale en-GB to create a RelativeTimeFormat object.
  let relativetimefmt= new Intl.RelativeTimeFormat("en-GB", { style: "short" });
  // Obtain the options of the RelativeTimeFormat object.
  let options = relativetimefmt.resolvedOptions();
  let style = options.style; // style = "short"
S
shawn_he 已提交
787 788 789
  ```


S
shawn_he 已提交
790
## RelativeTimeFormatInputOptions<sup>8+</sup>
S
shawn_he 已提交
791 792 793

Represents the properties of a **RelativeTimeFormat** object.

S
shawn_he 已提交
794 795
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
796
| Name           | Type    | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
797 798 799 800
| ------------- | ------ | ---- | ---- | ---------------------------------------- |
| localeMatcher | string | Yes   | Yes   | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| numeric       | string | Yes   | Yes   | Format of the output message. The value can be **always** or **auto**.     |
| style         | string | Yes   | Yes   | Length of an internationalized message. The value can be **long**, **short**, or **narrow**.|
S
shawn_he 已提交
801 802


S
shawn_he 已提交
803
## RelativeTimeFormatResolvedOptions<sup>8+</sup>
S
shawn_he 已提交
804 805 806

Represents the properties of a **RelativeTimeFormat** object.

S
shawn_he 已提交
807 808
**System capability**: SystemCapability.Global.I18n

S
shawn_he 已提交
809
| Name             | Type    | Readable  | Writable  | Description                                      |
S
shawn_he 已提交
810 811 812 813 814
| --------------- | ------ | ---- | ---- | ---------------------------------------- |
| locale          | string | Yes   | Yes   | A string containing locale information, including the language, optional script, and region.            |
| numeric         | string | Yes   | Yes   | Format of the output message. The value can be **always** or **auto**.     |
| style           | string | Yes   | Yes   | Length of an internationalized message. The value can be **long**, **short**, or **narrow**.|
| numberingSystem | string | Yes   | Yes   | Numbering system.                                |