提交 d65c1df4 编写于 作者: H HelloCrease

update docs

Signed-off-by: NHelloCrease <lian15@huawei.com>
上级 aebd7b2c
......@@ -2,7 +2,7 @@
This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402.
The [Intl](intl-guidelines.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities.
The [Intl](js-apis-intl.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities.
> **NOTE**
>
......@@ -27,15 +27,15 @@ Obtains the localized script for the specified language.
**Parameters**
| Name | Type | Mandatory | Description |
| ------------ | ------- | ---- | ---------------- |
| ------------ | ------- | --------- | ---------------------------------------- |
| language | string | Yes | Specified language. |
| locale | string | Yes | Locale ID. |
| sentenceCase | boolean | No | Whether to use sentence case for the localized script.|
| sentenceCase | boolean | No | Whether to use sentence case for the localized script. |
**Return Value**
| Type | Description |
| ------ | ------------- |
| string | Localized script for the specified language.|
| ------ | ---------------------------------------- |
| string | Localized script for the specified language. |
**Example**
```
......@@ -54,15 +54,15 @@ Obtains the localized script for the specified country.
**Parameters**
| Name | Type | Mandatory | Description |
| ------------ | ------- | ---- | ----------------------------- |
| ------------ | ------- | --------- | ---------------------------------------- |
| country | string | Yes | Specified country. |
| locale | string | Yes | Locale ID. |
| sentenceCase | boolean | No | Whether to use sentence case for the localized script.|
| sentenceCase | boolean | No | Whether to use sentence case for the localized script. |
**Return Value**
| Type | Description |
| ------ | ------------------------------------------ |
| string | Localized script for the specified country.|
| ------ | ---------------------------------------- |
| string | Localized script for the specified country. |
**Example**
```
......@@ -87,7 +87,7 @@ Checks whether the localized script for the specified language is displayed from
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the localized script is displayed from right to left; returns **false** otherwise.|
| boolean | Returns **true** if the localized script is displayed from right to left; returns **false** otherwise. |
**Example**
```
......@@ -106,8 +106,8 @@ Obtains the system language.
**Return Value**
| Type | Description |
| ------ | ------- |
| string | System language ID.|
| ------ | ------------------- |
| string | System language ID. |
**Example**
```
......@@ -131,13 +131,13 @@ Sets the system language. Currently, this API does not support real-time updatin
**Parameters**
| Name | Type | Description |
| -------- | ------ | ----- |
| language | string | Language ID.|
| -------- | ------ | ------------ |
| language | string | Language ID. |
**Return Value**
| Type | Description |
| ------- | ------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
**Example**
```
......@@ -157,8 +157,8 @@ Obtains the list of system languages.
**Return Value**
| Type | Description |
| ------------------- | ------------ |
| Array&lt;string&gt; | List of the IDs of system languages.|
| ------------------- | ------------------------------------ |
| Array&lt;string&gt; | List of the IDs of system languages. |
**Example**
```
......@@ -178,13 +178,13 @@ Obtains the list of countries and regions supported for the specified language.
**Parameters**
| Name | Type | Description |
| -------- | ------ | ----- |
| language | string | Language ID.|
| -------- | ------ | ------------ |
| language | string | Language ID. |
**Return Value**
| Type | Description |
| ------------------- | ------------ |
| Array&lt;string&gt; | List of the IDs of the countries and regions supported for the specified language.|
| ------------------- | ---------------------------------------- |
| Array&lt;string&gt; | List of the IDs of the countries and regions supported for the specified language. |
**Example**
```
......@@ -202,8 +202,8 @@ Obtains the system region.
**Return Value**
| Type | Description |
| ------ | ------- |
| string | System region ID.|
| ------ | ----------------- |
| string | System region ID. |
**Example**
```
......@@ -225,13 +225,13 @@ Sets the system region.
**Parameters**
| Name | Type | Description |
| ------ | ------ | ----- |
| region | string | Region ID.|
| ------ | ------ | ----------- |
| region | string | Region ID. |
**Return Value**
| Type | Description |
| ------- | ------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
**Example**
```
......@@ -249,8 +249,8 @@ Obtains the system locale.
**Return Value**
| Type | Description |
| ------ | ------- |
| string | System locale ID.|
| ------ | ----------------- |
| string | System locale ID. |
**Example**
```
......@@ -272,13 +272,13 @@ Sets the system locale.
**Parameters**
| Name | Type | Description |
| ------ | ------ | --------------- |
| locale | string | System locale ID, for example, **zh-CN**.|
| ------ | ------ | ---------------------------------------- |
| locale | string | System locale ID, for example, **zh-CN**. |
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
**Example**
```
......@@ -298,14 +298,14 @@ Checks whether the system language matches the specified region.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ------------- |
| language | string | Yes | Valid language ID, for example, **zh**.|
| -------- | ------ | --------- | --------------------------------------- |
| language | string | Yes | Valid language ID, for example, **zh**. |
| region | string | No | Valid region ID, for example, **CN**. |
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise.|
| boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise. |
**Example**
```
......@@ -323,14 +323,14 @@ Obtains a **Calendar** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| ------ | ------ | --------- | ---------------------------------------- |
| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. |
| type | string | No | Valid calendar type. Currently, the valid types are as follows: **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic\_civil**, **islamic\_tbla**, **islamic\_umalqura**, **japanese**, and **persian**. If this parameter is left unspecified, the default calendar type of the specified locale is used.|
| type | string | No | Valid calendar type. Currently, the valid types are as follows: **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic\_civil**, **islamic\_tbla**, **islamic\_umalqura**, **japanese**, and **persian**. If this parameter is left unspecified, the default calendar type of the specified locale is used. |
**Return Value**
| Type | Description |
| ---------------------- | ----- |
| [Calendar](#calendar8) | **Calendar** object.|
| ---------------------- | -------------------- |
| [Calendar](#calendar8) | **Calendar** object. |
**Example**
```
......@@ -351,8 +351,8 @@ Sets the date for this **Calendar** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ----------------- |
| date | Date | Yes | Date to be set for the **Calendar** object.|
| ---- | ---- | --------- | ---------------------------------------- |
| date | Date | Yes | Date to be set for the **Calendar** object. |
**Example**
```
......@@ -372,8 +372,8 @@ Sets the date and time for this **Calendar** object. The value is represented by
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ---------------------------------------- |
| time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch.|
| ---- | ------ | --------- | ---------------------------------------- |
| time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch. |
**Example**
```
......@@ -392,12 +392,12 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------ |
| ------ | ------ | --------- | -------------- |
| year | number | Yes | Year to set. |
| month | number | Yes | Month to set. |
| date | number | Yes | Day to set. |
| hour | number | No | Hour to set.|
| minute | number | No | Minute to set.|
| hour | number | No | Hour to set. |
| minute | number | No | Minute to set. |
| second | number | No | Second to set. |
**Example**
......@@ -417,8 +417,8 @@ Sets the time zone of this **Calendar** object.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ------------------------- |
| timezone | string | Yes | Time zone, for example, **Asia/Shanghai**.|
| -------- | ------ | --------- | ---------------------------------------- |
| timezone | string | Yes | Time zone, for example, **Asia/Shanghai**. |
**Example**
```
......@@ -437,8 +437,8 @@ Obtains the time zone of this **Calendar** object.
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Time zone of the **Calendar** object.|
| ------ | ------------------------------------- |
| string | Time zone of the **Calendar** object. |
**Example**
```
......@@ -458,8 +458,8 @@ Obtains the start day of a week for this **Calendar** object.
**Return Value**
| Type | Description |
| ------ | --------------------- |
| number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
| ------ | ---------------------------------------- |
| number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday. |
**Example**
```
......@@ -478,8 +478,8 @@ Sets the start day of a week for this **Calendar** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | --------------------- |
| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
| ----- | ------ | --------- | ---------------------------------------- |
| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday. |
**Example**
```
......@@ -498,8 +498,8 @@ Obtains the minimum number of days in the first week of a year.
**Return Value**
| Type | Description |
| ------ | ------------ |
| number | Minimum number of days in the first week of a year.|
| ------ | ---------------------------------------- |
| number | Minimum number of days in the first week of a year. |
**Example**
```
......@@ -518,8 +518,8 @@ Sets the minimum number of days in the first week of a year.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ------------ |
| value | number | No | Minimum number of days in the first week of a year.|
| ----- | ------ | --------- | ---------------------------------------- |
| value | number | No | Minimum number of days in the first week of a year. |
**Example**
```
......@@ -538,13 +538,13 @@ Obtains the value of the specified field in the **Calendar** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| field | string | Yes | Value of the specified field in the **Calendar** object. Currently, a valid field can be any of the following: **era**, **year**, **month**, **week\_of\_year**, **week\_of\_month**, **date**, **day\_of\_year**, **day\_of\_week**, **day\_of\_week\_in\_month**, **hour**, **hour\_of\_day**, **minute**, **second**, **millisecond**, **zone\_offset**, **dst\_offset**, **year\_woy**, **dow\_local**, **extended\_year**, **julian\_day**, **milliseconds\_in\_day**, **is\_leap\_month**.|
| ----- | ------ | --------- | ---------------------------------------- |
| field | string | Yes | Value of the specified field in the **Calendar** object. Currently, a valid field can be any of the following: **era**, **year**, **month**, **week\_of\_year**, **week\_of\_month**, **date**, **day\_of\_year**, **day\_of\_week**, **day\_of\_week\_in\_month**, **hour**, **hour\_of\_day**, **minute**, **second**, **millisecond**, **zone\_offset**, **dst\_offset**, **year\_woy**, **dow\_local**, **extended\_year**, **julian\_day**, **milliseconds\_in\_day**, **is\_leap\_month**. |
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**.|
| number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**. |
**Example**
```
......@@ -564,13 +564,13 @@ Obtains the name of the **Calendar** object displayed for the specified locale.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| locale | string | Yes | Locale for which the name of the **Calendar** object is displayed. For example, if **locale** is **en-US**, the name of the Buddhist calendar will be **Buddhist Calendar**.|
| ------ | ------ | --------- | ---------------------------------------- |
| locale | string | Yes | Locale for which the name of the **Calendar** object is displayed. For example, if **locale** is **en-US**, the name of the Buddhist calendar will be **Buddhist Calendar**. |
**Return Value**
| Type | Description |
| ------ | ------------------- |
| string | Name of the **Calendar** object displayed for the specified locale.|
| ------ | ---------------------------------------- |
| string | Name of the **Calendar** object displayed for the specified locale. |
**Example**
```
......@@ -589,13 +589,13 @@ Checks whether the specified date in this **Calendar** object is a weekend.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ---------------------------------------- |
| date | Date | No | Specified date in this **Calendar** object. If this parameter is left unspecified, the system checks whether the current date in the **Calendar** object is a weekend.|
| ---- | ---- | --------- | ---------------------------------------- |
| date | Date | No | Specified date in this **Calendar** object. If this parameter is left unspecified, the system checks whether the current date in the **Calendar** object is a weekend. |
**Return Value**
| Type | Description |
| ------- | ----------------------------------- |
| boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday. |
**Example**
```
......@@ -620,8 +620,8 @@ Creates a **PhoneNumberFormat** object.
Parameters
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------- |
| country | string | Yes | Country or region to which the phone number to be formatted belongs.|
| ------- | ---------------------------------------- | --------- | ---------------------------------------- |
| country | string | Yes | Country or region to which the phone number to be formatted belongs. |
| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. |
**Example**
......@@ -640,13 +640,13 @@ Checks whether the format of the specified phone number is valid.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------- |
| number | string | Yes | Phone number to be checked.|
| ------ | ------ | --------- | --------------------------- |
| number | string | Yes | Phone number to be checked. |
**Return Value**
| Type | Description |
| ------- | ------------------------------------- |
| boolean | Returns **true** if the phone number format is valid; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the phone number format is valid; returns **false** otherwise. |
**Example**
```
......@@ -665,13 +665,13 @@ Formats a phone number.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------- |
| number | string | Yes | Phone number to be formatted.|
| ------ | ------ | --------- | ----------------------------- |
| number | string | Yes | Phone number to be formatted. |
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Formatted phone number.|
| ------ | ----------------------- |
| string | Formatted phone number. |
**Example**
```
......@@ -689,14 +689,14 @@ Obtains the home location of a phone number.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------- |
| number | string | Yes | Phone number.|
| locale | string | Yes | Locale ID.|
| ------ | ------ | --------- | ------------- |
| number | string | Yes | Phone number. |
| locale | string | Yes | Locale ID. |
**Return value**
| Type | Description |
| ------ | ---------- |
| string | Home location of the phone number.|
| ------ | ---------------------------------- |
| string | Home location of the phone number. |
**Example**
```js
......@@ -712,8 +712,8 @@ Defines the options for this PhoneNumberFormat object.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ---------------------------------------- |
| type | string | Yes | Yes | Format type of a phone number. The value can be **E164**, **INTERNATIONAL**, **NATIONAL**, or **RFC3966**.|
| ---- | ------ | -------- | -------- | ---------------------------------------- |
| type | string | Yes | Yes | Format type of a phone number. The value can be **E164**, **INTERNATIONAL**, **NATIONAL**, or **RFC3966**. |
## UnitInfo<sup>8+</sup>
......@@ -723,9 +723,9 @@ Defines the measurement unit information.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| ------------- | ------ | ---- | ---- | ---------------------------------------- |
| unit | string | Yes | Yes | Name of the measurement unit, for example, **meter**, **inch**, or **cup**.|
| measureSystem | string | Yes | Yes | Measurement system. The value can be **SI**, **US**, or **UK**.|
| ------------- | ------ | -------- | -------- | ---------------------------------------- |
| unit | string | Yes | Yes | Name of the measurement unit, for example, **meter**, **inch**, or **cup**. |
| measureSystem | string | Yes | Yes | Measurement system. The value can be **SI**, **US**, or **UK**. |
## Util<sup>8+</sup>
......@@ -741,17 +741,17 @@ Converts one measurement unit into another and formats the unit based on the spe
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ---------------------------------------- |
| -------- | ---------------------- | --------- | ---------------------------------------- |
| fromUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted. |
| toUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted to. |
| value | number | Yes | Value of the measurement unit to be converted. |
| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. |
| style | string | No | Style used for formatting. The value can be **long**, **short**, or **medium**.|
| style | string | No | Style used for formatting. The value can be **long**, **short**, or **medium**. |
**Return Value**
| Type | Description |
| ------ | ----------------------- |
| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**.|
| ------ | ---------------------------------------- |
| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**. |
**Example**
```
......@@ -768,13 +768,13 @@ Obtains the sequence of the year, month, and day in the specified locale.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ---------------------------------------- |
| ------ | ------ | --------- | ---------------------------------------- |
| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. |
**Return value**
| Type | Description |
| ------ | ----------------------- |
| string | Sequence of the year, month, and day.|
| ------ | ------------------------------------- |
| string | Sequence of the year, month, and day. |
**Example**
```
......@@ -791,13 +791,13 @@ Creates an **IndexUtil** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------- |
| locale | string | No | A string containing locale information, including the language, optional script, and region.|
| ------ | ------ | --------- | ---------------------------------------- |
| locale | string | No | A string containing locale information, including the language, optional script, and region. |
**Return Value**
| Type | Description |
| ------------------------ | --------------------- |
| [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale.|
| ------------------------ | ---------------------------------------- |
| [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale. |
**Example**
```
......@@ -818,8 +818,8 @@ Obtains the index list for this **locale** object.
**Return Value**
| Type | Description |
| ------------------- | ------------------ |
| Array&lt;string&gt; | Index list for this **locale** object.|
| ------------------- | -------------------------------------- |
| Array&lt;string&gt; | Index list for this **locale** object. |
**Example**
```
......@@ -838,8 +838,8 @@ Adds the index of the new **locale** object to the index list.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region.|
| ------ | ------ | --------- | ---------------------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region. |
**Example**
```
......@@ -858,13 +858,13 @@ Obtains the index of a text object.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ |
| text | string | Yes | **text** object whose index is to be obtained.|
| ---- | ------ | --------- | ---------------------------------------- |
| text | string | Yes | **text** object whose index is to be obtained. |
**Return Value**
| Type | Description |
| ------ | ----------- |
| string | Index of the **text** object.|
| ------ | ----------------------------- |
| string | Index of the **text** object. |
**Example**
```
......@@ -886,13 +886,13 @@ Checks whether the input character string is composed of digits.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | ------------------------------------ |
| boolean | Returns **true** if the input character is a digit; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is a digit; returns **false** otherwise. |
**Example**
```
......@@ -910,13 +910,13 @@ Checks whether the input character is a space.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | -------------------------------------- |
| boolean | Returns **true** if the input character is a space; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is a space; returns **false** otherwise. |
**Example**
```
......@@ -934,13 +934,13 @@ Checks whether the input character is a white space.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | -------------------------------------- |
| boolean | Returns **true** if the input character is a white space; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is a white space; returns **false** otherwise. |
**Example**
```
......@@ -958,13 +958,13 @@ Checks whether the input character is of the right to left (RTL) language.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise.|
| boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise. |
**Example**
```
......@@ -982,13 +982,13 @@ Checks whether the input character is an ideographic character.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise.|
| boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise. |
**Example**
```
......@@ -1006,13 +1006,13 @@ Checks whether the input character is a letter.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | ------------------------------------ |
| boolean | Returns **true** if the input character is a letter; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is a letter; returns **false** otherwise. |
**Example**
```
......@@ -1030,13 +1030,13 @@ Checks whether the input character is a lowercase letter.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise.|
| boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise. |
**Example**
```
......@@ -1054,13 +1054,13 @@ Checks whether the input character is an uppercase letter.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise.|
| boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise. |
**Example**
```
......@@ -1078,13 +1078,13 @@ Obtains the type of the input character string.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
| ---- | ------ | --------- | ---------------- |
| char | string | Yes | Input character. |
**Return Value**
| Type | Description |
| ------ | ----------- |
| string | Type of the input character.|
| ------ | ---------------------------- |
| string | Type of the input character. |
**Example**
```
......@@ -1102,13 +1102,13 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. The [BreakIterator](#breakiterator8) object segments text according to the rules of the specified locale.|
| ------ | ------ | --------- | ---------------------------------------- |
| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. The [BreakIterator](#breakiterator8) object segments text according to the rules of the specified locale. |
**Return Value**
| Type | Description |
| -------------------------------- | ----------- |
| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.|
| -------------------------------- | ---------------------------------------- |
| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation. |
**Example**
```
......@@ -1129,8 +1129,8 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----------------------- |
| text | string | Yes | Text to be processed by the **BreakIterator** object.|
| ---- | ------ | --------- | ---------------------------------------- |
| text | string | Yes | Text to be processed by the **BreakIterator** object. |
**Example**
```
......@@ -1149,8 +1149,8 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object.
**Return Value**
| Type | Description |
| ------ | ---------------------- |
| string | Text being processed by the **BreakIterator** object.|
| ------ | ---------------------------------------- |
| string | Text being processed by the **BreakIterator** object. |
**Example**
```
......@@ -1170,8 +1170,8 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text
**Return Value**
| Type | Description |
| ------ | --------------------------- |
| number | Position of the **BreakIterator** object in the text being processed.|
| ------ | ---------------------------------------- |
| number | Position of the **BreakIterator** object in the text being processed. |
**Example**
```
......@@ -1191,8 +1191,8 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi
**Return Value**
| Type | Description |
| ------ | ----------------- |
| number | Offset to the first text boundary of the processed text.|
| ------ | ---------------------------------------- |
| number | Offset to the first text boundary of the processed text. |
**Example**
```
......@@ -1212,8 +1212,8 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic
**Return Value**
| Type | Description |
| ------ | ------------------ |
| number | Offset of the last text boundary of the processed text.|
| ------ | ---------------------------------------- |
| number | Offset of the last text boundary of the processed text. |
**Example**
```
......@@ -1233,13 +1233,13 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| index | number | No | Number of text boundaries by which the [BreakIterator](#breakiterator8) object is moved. A positive value indicates that the text boundary is moved backward, and a negative value indicates the opposite. If no index is specified, the index will be treated as **1**.|
| ----- | ------ | --------- | ---------------------------------------- |
| index | number | No | Number of text boundaries by which the [BreakIterator](#breakiterator8) object is moved. A positive value indicates that the text boundary is moved backward, and a negative value indicates the opposite. If no index is specified, the index will be treated as **1**. |
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved by the specified number of text boundaries. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.|
| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved by the specified number of text boundaries. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries. |
**Example**
```
......@@ -1262,7 +1262,7 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary.
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved to the previous text boundary. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.|
| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved to the previous text boundary. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries. |
**Example**
```
......@@ -1284,13 +1284,13 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| offset | number | Yes | Offset to the position before the text boundary to which the [BreakIterator](#breakiterator8) object is moved.|
| ------ | ------ | --------- | ---------------------------------------- |
| offset | number | Yes | Offset to the position before the text boundary to which the [BreakIterator](#breakiterator8) object is moved. |
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | The value **-1** is returned if the text boundary to which the [BreakIterator](#breakiterator8) object is moved is outside of the processed text.|
| number | The value **-1** is returned if the text boundary to which the [BreakIterator](#breakiterator8) object is moved is outside of the processed text. |
**Example**
```
......@@ -1312,13 +1312,13 @@ Checks whether the position specified by the offset is a text boundary. If **tru
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----------- |
| offset | number | Yes | Position to check.|
| ------ | ------ | --------- | ------------------ |
| offset | number | Yes | Position to check. |
**Return Value**
| Type | Description |
| ------- | ------------------------------- |
| boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise. |
**Example**
```
......@@ -1340,7 +1340,7 @@ Checks whether the 24-hour clock is used.
**Return Value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise.|
| boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise. |
**Example**
```
......@@ -1360,13 +1360,13 @@ Sets the 24-hour clock.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | ---------------------------------------- |
| option | boolean | Yes | Whether to enable the 24-hour clock. The value **true** means to enable the 24-hour clock, and the value **false** means the opposite.|
| ------ | ------- | --------- | ---------------------------------------- |
| option | boolean | Yes | Whether to enable the 24-hour clock. The value **true** means to enable the 24-hour clock, and the value **false** means the opposite. |
**Return Value**
| Type | Description |
| ------- | ----------------------------- |
| boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise. |
**Example**
```
......@@ -1387,14 +1387,14 @@ Adds a preferred language to the specified position on the preferred language li
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ---------- |
| -------- | ------ | --------- | ---------------------------------------- |
| language | string | Yes | Preferred language to add. |
| index | number | No | Position to which the preferred language is added.|
| index | number | No | Position to which the preferred language is added. |
**Return Value**
| Type | Description |
| ------- | ----------------------------- |
| boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise. |
**Example**
```
......@@ -1417,13 +1417,13 @@ Deletes a preferred language from the specified position on the preferred langua
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | --------------------- |
| index | number | Yes | Position of the preferred language to delete.|
| ----- | ------ | --------- | ---------------------------------------- |
| index | number | Yes | Position of the preferred language to delete. |
**Return Value**
| Type | Description |
| ------- | ----------------------------- |
| boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise. |
**Example**
```
......@@ -1443,8 +1443,8 @@ Obtains the list of preferred languages.
**Return Value**
| Type | Description |
| ------------------- | --------- |
| Array&lt;string&gt; | List of preferred languages.|
| ------------------- | ---------------------------- |
| Array&lt;string&gt; | List of preferred languages. |
**Example**
```
......@@ -1462,8 +1462,8 @@ Obtains the first language in the preferred language list.
**Return Value**
| Type | Description |
| ------ | -------------- |
| string | First language in the preferred language list.|
| ------ | ---------------------------------------- |
| string | First language in the preferred language list. |
**Example**
```
......@@ -1481,13 +1481,13 @@ Obtains the **TimeZone** object corresponding to the specified time zone ID.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----- |
| zondID | string | No | Time zone ID.|
| ------ | ------ | --------- | ------------- |
| zondID | string | No | Time zone ID. |
**Return Value**
| Type | Description |
| -------- | ------------ |
| TimeZone | **TimeZone** object corresponding to the time zone ID.|
| -------- | ---------------------------------------- |
| TimeZone | **TimeZone** object corresponding to the time zone ID. |
**Example**
```
......@@ -1508,8 +1508,8 @@ Obtains the ID of the specified **TimeZone** object.
**Return Value**
| Type | Description |
| ------ | ------------ |
| string | Time zone ID corresponding to the **TimeZone** object.|
| ------ | ---------------------------------------- |
| string | Time zone ID corresponding to the **TimeZone** object. |
**Example**
```
......@@ -1528,14 +1528,14 @@ Obtains the representation of a **TimeZone** object in the specified locale.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------- |
| ------ | ------- | --------- | ---------------------------------------- |
| locale | string | No | System locale ID. |
| isDST | boolean | No | Whether to consider DST when obtaining the representation of the **TimeZone** object.|
| isDST | boolean | No | Whether to consider DST when obtaining the representation of the **TimeZone** object. |
**Return Value**
| Type | Description |
| ------ | ------------- |
| string | Representation of the **TimeZone** object in the specified locale.|
| ------ | ---------------------------------------- |
| string | Representation of the **TimeZone** object in the specified locale. |
**Example**
```
......@@ -1554,8 +1554,8 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
**Return Value**
| Type | Description |
| ------ | ------------------- |
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone.|
| ------ | ---------------------------------------- |
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone. |
**Example**
```
......@@ -1574,8 +1574,8 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
**Return Value**
| Type | Description |
| ------ | ----------------------- |
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point.|
| ------ | ---------------------------------------- |
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point. |
**Example**
```
......@@ -1593,8 +1593,8 @@ Obtains the list of time zone IDs supported by the system.
**Return value**
| Type | Description |
| ------------------- | ----------- |
| Array&lt;string&gt; | List of time zone IDs supported by the system.|
| ------------------- | ---------------------------------------- |
| Array&lt;string&gt; | List of time zone IDs supported by the system. |
**Example**
```ts
......@@ -1612,8 +1612,8 @@ Obtains the list of time zone city IDs supported by the system.
**Return value**
| Type | Description |
| ------------------- | ------------- |
| Array&lt;string&gt; | List of time zone city IDs supported by the system.|
| ------------------- | ---------------------------------------- |
| Array&lt;string&gt; | List of time zone city IDs supported by the system. |
**Example**
```ts
......@@ -1631,14 +1631,14 @@ Obtains the localized display of a time zone city in the specified locale.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------ |
| cityID | string | Yes | Time zone city ID.|
| ------ | ------ | --------- | ------------------ |
| cityID | string | Yes | Time zone city ID. |
| locale | string | Yes | Locale ID. |
**Return value**
| Type | Description |
| ------ | ------------------ |
| string | Localized display of the time zone city in the specified locale.|
| ------ | ---------------------------------------- |
| string | Localized display of the time zone city in the specified locale. |
**Example**
```ts
......@@ -1656,13 +1656,13 @@ Obtains the **TimeZone** object corresponding to the specified time zone city ID
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------ |
| cityID | string | Yes | Time zone city ID.|
| ------ | ------ | --------- | ------------------ |
| cityID | string | Yes | Time zone city ID. |
**Return value**
| Type | Description |
| -------- | ----------- |
| TimeZone | **TimeZone** object corresponding to the specified time zone city ID.|
| -------- | ---------------------------------------- |
| TimeZone | **TimeZone** object corresponding to the specified time zone city ID. |
**Example**
```ts
......@@ -1684,13 +1684,13 @@ This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------- | ---- | ------------------------------- |
| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite.|
| ---- | ------- | --------- | ---------------------------------------- |
| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite. |
**Return value**
| Type | Description |
| ------- | ----------------------------------- |
| boolean | Result indicating whether the local digit switch is successfully set. The value **true** indicates that the local digit switch is successfully set, and the value **false** indicates the opposite.|
| ------- | ---------------------------------------- |
| boolean | Result indicating whether the local digit switch is successfully set. The value **true** indicates that the local digit switch is successfully set, and the value **false** indicates the opposite. |
**Example**
```ts
......@@ -1709,7 +1709,7 @@ Checks whether the local digit switch is turned on.
**Return value**
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Result indicating whether the local digit switch is turned on. The value **true** indicates that the local digit switch is turned on, and the value **false** indicates the opposite.|
| boolean | Result indicating whether the local digit switch is turned on. The value **true** indicates that the local digit switch is turned on, and the value **false** indicates the opposite. |
**Example**
```ts
......@@ -1730,8 +1730,8 @@ Obtains a list of IDs supported by the **Transliterator** object.
**Return value**
| Type | Description |
| -------- | ---------- |
| string[] | List of IDs supported by the **Transliterator** object.|
| -------- | ---------------------------------------- |
| string[] | List of IDs supported by the **Transliterator** object. |
**Example**
```ts
......@@ -1749,13 +1749,13 @@ Creates a **Transliterator** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | -------- |
| id | string | Yes | ID supported by the **Transliterator** object.|
| ---- | ------ | --------- | ---------------------------------------- |
| id | string | Yes | ID supported by the **Transliterator** object. |
**Return value**
| Type | Description |
| ---------------------------------- | ----- |
| [Transliterator](#transliterator9) | **Transliterator** object.|
| ---------------------------------- | -------------------------- |
| [Transliterator](#transliterator9) | **Transliterator** object. |
**Example**
```ts
......@@ -1773,13 +1773,13 @@ Converts the input string from the source format to the target format.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------ |
| text | string | Yes | Input string.|
| ---- | ------ | --------- | ------------- |
| text | string | Yes | Input string. |
**Return value**
| Type | Description |
| ------ | -------- |
| string | Target string.|
| ------ | -------------- |
| string | Target string. |
**Example**
```ts
......
......@@ -2,7 +2,7 @@
This 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 APIs that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities.
The [I18N](js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary APIs that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities.
> **NOTE**
>
......@@ -24,16 +24,16 @@ import Intl from '@ohos.intl';
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| --------------- | ------- | ---- | ---- | ---------------------------------------- |
| --------------- | ------- | -------- | -------- | ---------------------------------------- |
| 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**.|
| 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**, **islamicc**.|
| 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**.|
| hourCycle | string | Yes | No | Time system for the locale. The value can be any of the following: **h12**, **h23**, **h11**, **h24**.|
| 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**.|
| caseFirst | string | Yes | No | Whether case is taken into account for the locale's collation rules. The value can be **upper**, **lower**, or **false**. |
| 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**, **islamicc**. |
| 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**. |
| hourCycle | string | Yes | No | Time system for the locale. The value can be any of the following: **h12**, **h23**, **h11**, **h24**. |
| 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. |
......@@ -61,8 +61,8 @@ Creates a Locale object.
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------------- | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region.|
| ------- | ------------- | --------- | ---------------------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region. |
| options | LocaleOptions | No | Options for creating the **Locale** object. |
**Example**
......@@ -81,8 +81,8 @@ Converts locale information to a string.
**Return Value**
| Type | Description |
| ------ | ----------- |
| string | String containing locale information.|
| ------ | ------------------------------------- |
| string | String containing locale information. |
**Example**
```js
......@@ -101,8 +101,8 @@ Maximizes information of the **Locale** object. If the script and locale informa
**Return Value**
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the maximized information.|
| ----------------- | ---------------------------------------- |
| [Locale](#locale) | **Locale** object with the maximized information. |
**Example**
```js
......@@ -121,8 +121,8 @@ Minimizes information of the **Locale** object. If the script and locale informa
**Return Value**
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the minimized information.|
| ----------------- | ---------------------------------------- |
| [Locale](#locale) | **Locale** object with the minimized information. |
**Example**
```js
......@@ -138,13 +138,13 @@ Represents the locale options.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| --------------- | ------- | ---- | ---- | ---------------------------------------- |
| calendar | string | Yes | Yes | Calendar for the locale. The calue 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**, **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**, **h24**.|
| 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**.|
| --------------- | ------- | -------- | -------- | ---------------------------------------- |
| calendar | string | Yes | Yes | Calendar for the locale. The calue 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**, **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**, **h24**. |
| 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**.|
| caseFirst | string | Yes | Yes | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**. |
## DateTimeFormat
......@@ -174,8 +174,8 @@ Creates a **DateTimeOptions** object for the specified locale.
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| ------- | ----------------------------------- | --------- | ---------------------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region. |
| options | [DateTimeOptions](#datetimeoptions) | No | Options for creating a **DateTimeFormat** object. |
**Example**
......@@ -200,13 +200,13 @@ Formats the specified date and time.
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ------- |
| date | Date | Yes | Date and time to be formatted.|
| ---- | ---- | --------- | ------------------------------ |
| date | Date | Yes | Date and time to be formatted. |
**Return Value**
| Type | Description |
| ------ | ------------ |
| string | A string containing the formatted date and time.|
| ------ | ---------------------------------------- |
| string | A string containing the formatted date and time. |
**Example**
```js
......@@ -226,14 +226,14 @@ Formats the specified date range.
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ---- | ---- | -------- |
| startDate | Date | Yes | Start date and time to be formatted.|
| endDate | Date | Yes | End date and time to be formatted.|
| --------- | ---- | --------- | ------------------------------------ |
| startDate | Date | Yes | Start date and time to be formatted. |
| endDate | Date | Yes | End date and time to be formatted. |
**Return Value**
| Type | Description |
| ------ | -------------- |
| string | A string containing the formatted date and time range.|
| ------ | ---------------------------------------- |
| string | A string containing the formatted date and time range. |
**Example**
```js
......@@ -254,8 +254,8 @@ Obtains the formatting options for **DateTimeFormat** object.
**Return Value**
| Type | Description |
| ----------------------------------- | ----------------------------- |
| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects.|
| ----------------------------------- | ---------------------------------------- |
| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects. |
**Example**
```js
......@@ -271,26 +271,26 @@ Provides the options for the **DateTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| --------------- | ------- | ---- | ---- | ---------------------------------------- |
| --------------- | ------- | -------- | -------- | ---------------------------------------- |
| 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**.|
| hourCycle | string | Yes | Yes | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, **h24**.|
| 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**. |
| hourCycle | string | Yes | Yes | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, **h24**. |
| 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**.|
| 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**.|
| 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**.|
| 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**.|
| 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**. |
## NumberFormat
......@@ -320,8 +320,8 @@ Creates a **NumberFormat** object for the specified locale.
Parameters
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| ------- | ------------------------------- | --------- | ---------------------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region. |
| options | [NumberOptions](#numberoptions) | No | Options for creating a **NumberFormat** object. |
**Example**
......@@ -340,13 +340,13 @@ Formats a number.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---- |
| number | number | Yes | Number to be formatted.|
| ------ | ------ | --------- | ----------------------- |
| number | number | Yes | Number to be formatted. |
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Formatted number.|
| ------ | ----------------- |
| string | Formatted number. |
**Example**
......@@ -366,8 +366,8 @@ Obtains the options of the **NumberFormat** object.
**Return Value**
| Type | Description |
| ------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects.|
| ------------------------------- | ---------------------------------------- |
| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects. |
**Example**
......@@ -384,20 +384,20 @@ Provides the device capability.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| ------------------------ | ------- | ---- | ---- | ---------------------------------------- |
| ------------------------ | ------- | -------- | -------- | ---------------------------------------- |
| 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**.|
| 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**. |
| unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **medium**.|
| unitUsage<sup>8+</sup> | 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**.|
| signDisplay | string | Yes | Yes | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**.|
| unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **medium**. |
| unitUsage<sup>8+</sup> | 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**. |
| 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**.|
| 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**. |
......@@ -434,8 +434,8 @@ Creates a Collator object.
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| ------- | ----------------------------------- | --------- | ---------------------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region. |
| options | [CollatorOptions](#collatoroptions) | No | Options for creating a **Collator** object. |
**Example**
......@@ -454,14 +454,14 @@ Compares two strings based on the sorting policy of the **Collator** object.
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------------ |
| ------ | ------ | --------- | ------------------------- |
| first | string | Yes | First string to compare. |
| second | string | Yes | Second string to compare.|
| second | string | Yes | Second string to compare. |
**Return Value**
| 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.|
| 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. |
**Example**
```js
......@@ -480,8 +480,8 @@ Returns properties reflecting the locale and collation options of a **Collator**
**Return Value**
| Type | Description |
| ----------------------------------- | ----------------- |
| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object.|
| ----------------------------------- | -------------------------------------- |
| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object. |
**Example**
```js
......@@ -497,14 +497,14 @@ Represents the properties of a **Collator** object.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| ----------------- | ------- | ---- | ---- | ---------------------------------------- |
| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| ----------------- | ------- | -------- | -------- | ---------------------------------------- |
| 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**. |
| sensitivity | string | Yes | Yes | Differences in the strings that lead to non-zero return values. The value can be **base**, **accent**, **case**, or **variant**.|
| sensitivity | string | Yes | Yes | Differences in the strings that lead to non-zero return values. The value can be **base**, **accent**, **case**, or **variant**. |
| 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**.|
| 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**.|
| caseFirst | string | Yes | Yes | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**. |
## PluralRules<sup>8+</sup>
......@@ -534,8 +534,8 @@ Create a **PluralRules** object.
Parameters
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| ------- | ---------------------------------------- | --------- | ---------------------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region. |
| options | [PluralRulesOptions](#pluralrulesoptions) | No | Options for creating a **PluralRules** object. |
**Example**
......@@ -554,13 +554,13 @@ Obtains a string that represents the singular-plural type of the specified numbe
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ |
| n | number | Yes | Number for which the singular-plural type is to be obtained.|
| ---- | ------ | --------- | ---------------------------------------- |
| n | number | Yes | Number for which the singular-plural type is to be obtained. |
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.|
| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**. |
**Example**
```js
......@@ -576,8 +576,8 @@ Represents the properties of a **PluralRules** object.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| ------------------------ | ------ | ---- | ---- | ---------------------------------------- |
| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| ------------------------ | ------ | -------- | -------- | ---------------------------------------- |
| 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**. |
......@@ -613,8 +613,8 @@ Creates a **RelativeTimeFormat** object.
Parameters
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| ------- | ---------------------------------------- | --------- | ---------------------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region. |
| options | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions) | No | Options for creating a **RelativeTimeFormat** object. |
**Example**
......@@ -633,14 +633,14 @@ Formats the value and unit based on the specified locale and formatting options.
**Parameters**
| 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**.|
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**. |
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Relative time after formatting.|
| ------ | ------------------------------- |
| string | Relative time after formatting. |
**Example**
```js
......@@ -659,14 +659,14 @@ Returns an array of RelativeTimeFormat objects in parts for locale-aware formatt
**Parameters**
| 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**.|
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**. |
**Return Value**
| Type | Description |
| ------------------- | --------------------------- |
| Array&lt;object&gt; | An array of **RelativeTimeFormat** objects in parts.|
| ------------------- | ---------------------------------------- |
| Array&lt;object&gt; | An array of **RelativeTimeFormat** objects in parts. |
**Example**
```js
......@@ -685,8 +685,8 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
**Return Value**
| Type | Description |
| ---------------------------------------- | --------------------------------- |
| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects.|
| ---------------------------------------- | ---------------------------------------- |
| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects. |
**Example**
```js
......@@ -702,10 +702,10 @@ Represents the properties of a **RelativeTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| ------------- | ------ | ---- | ---- | ---------------------------------------- |
| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.|
| ------------- | ------ | -------- | -------- | ---------------------------------------- |
| 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**.|
| style | string | Yes | Yes | Length of an internationalized message. The value can be **long**, **short**, or **narrow**. |
## RelativeTimeFormatResolvedOptions<sup>8+</sup>
......@@ -715,8 +715,8 @@ Represents the properties of a **RelativeTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
| Name | Type | Readable | Writable | Description |
| --------------- | ------ | ---- | ---- | ---------------------------------------- |
| --------------- | ------ | -------- | -------- | ---------------------------------------- |
| 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**.|
| style | string | Yes | Yes | Length of an internationalized message. The value can be **long**, **short**, or **narrow**. |
| numberingSystem | string | Yes | Yes | Numbering system. |
......@@ -15,21 +15,21 @@ None
## Child Components
The following are supported: [\<svg>](js-components-svg.md), [\<rect>](js-components-svg-rect.md), [\<circle>](js-components-svg-circle.md), [\<ellipse>](../arkui-js/js-components-svg-ellipse.md), [\<path>](js-components-svg-path.md), [\<line](../arkui-js/js-components-svg-line.md), [\<polygon>](../arkui-js/js-components-svg-polygon.md), [\<polyline>](js-components-svg-polyline.md), [\<text>](js-components-svg-text.md), [\<animate>](js-components-svg-animate.md), and [\<animateTransform>](js-components-svg-animateTransform.md).
The following are supported: [\<svg>](js-components-svg.md), [\<rect>](js-components-svg-rect.md), [\<circle>](js-components-svg-circle.md), [\<ellipse>](../arkui-js/js-components-svg-ellipse.md), [\<path>](js-components-svg-path.md), [\<line](../arkui-js/js-components-svg-line.md), [\<polygon>](../arkui-js/js-components-svg-polygon.md), [\<polyline>](js-components-svg-polyline.md), [\<text>](js-components-svg-text.md), [\<animate>](js-components-svg-animate.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- |
| id | string | - | No| Unique ID of the component.|
| width | &lt;length&gt;\|&lt;percentage&gt; | - | No| Component width.|
| height | &lt;length&gt;\|&lt;percentage&gt; | - | No| Component height.|
| x | &lt;length&gt;\|&lt;percentage&gt; | - | No| X-coordinate of the current **\<svg>** component. The settings do not work for the root **\<svg>** node. |
| y | &lt;length&gt;\|&lt;percentage&gt; | | No| Y-coordinate of the current **\<svg>** component. The settings do not work for the root **\<svg>** node. |
| viewBox | string | - | No| View box of the current **\<svg>** component. The supported format is \<number number number number>. The four parameters indicate **min-x**, **min-y**, **width**, and **height**, respectively. The width and height of the view box are different from those of the **\<svg>** component. The view box is scaled in center-aligned mode. |
| Name | Type | Default Value | Mandatory | Description |
| ------- | ---------------------------------- | ------------- | --------- | ---------------------------------------- |
| id | string | - | No | Unique ID of the component. |
| width | &lt;length&gt;\|&lt;percentage&gt; | - | No | Component width. |
| height | &lt;length&gt;\|&lt;percentage&gt; | - | No | Component height. |
| x | &lt;length&gt;\|&lt;percentage&gt; | - | No | X-coordinate of the current **\<svg>** component. The settings do not work for the root **\<svg>** node. |
| y | &lt;length&gt;\|&lt;percentage&gt; | | No | Y-coordinate of the current **\<svg>** component. The settings do not work for the root **\<svg>** node. |
| viewBox | string | - | No | View box of the current **\<svg>** component. The supported format is \<number number number number>. The four parameters indicate **min-x**, **min-y**, **width**, and **height**, respectively. The width and height of the view box are different from those of the **\<svg>** component. The view box is scaled in center-aligned mode. |
## Example
......
# Web
> **NOTE**<br>
>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **<Web\>** component can be used to display web pages.
......@@ -19,8 +19,8 @@ Not supported
Table 1 options
| Name | Type | Mandatory | Default Value | Description |
| ---------- | ------------------------------- | ---- | ---- | ------- |
| src | string | Yes | - | Address of a web page resource.|
| ---------- | ------------------------------- | --------- | ------------- | ------------------------------- |
| src | string | Yes | - | Address of a web page resource. |
| controller | [WebController](#webcontroller) | No | - | Controller. |
......@@ -33,14 +33,14 @@ Not supported
## Attributes
| Name | Type | Default Value | Description |
| ------------------ | ---------------------------------------- | ----------------- | ---------------------------------------- |
| domStorageAccess | boolean | false | Whether to enable the DOM Storage API permission. By default, the permission is disabled.|
| fileAccess | boolean | false | Whether to enable in-application rawfile access through [$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#referencing-resources). By default, this feature is enabled.|
| fileFromUrlAccess | boolean | true | Whether to allow JavaScript scripts on web pages to access the content in [$rawfile(filepath/filename)](../../ui/ts-application-resource-access.md#referencing-resources). By default, this feature is disabled.|
| domStorageAccess | boolean | false | Whether to enable the DOM Storage API permission. By default, the permission is disabled. |
| fileAccess | boolean | false | Whether to enable in-application rawfile access through [$rawfile(filepath/filename)](../../ui/ui-ts-basic-resource-file-categories.md). By default, this feature is enabled. |
| fileFromUrlAccess | boolean | true | Whether to allow JavaScript scripts on web pages to access the content in [$rawfile(filepath/filename)](../../ui/ui-ts-basic-resource-file-categories.md). By default, this feature is disabled. |
| imageAccess | boolean | true | Whether to enable automatic image loading. By default, this feature is enabled. |
| javaScriptProxy | { <br> object: object, <br> name: string, <br> methodList: Array\<string\>, <br> controller: WebController <br>} | - | JavaScript object to be injected into the window. Methods of this object can be invoked in the window. The parameters in this attribute cannot be updated.<br> **object** indicates the object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.<br> **name** indicates the name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.<br> **methodList** indicates the methods of the JavaScript object to be registered at the application side.<br> **controller** indicates the controller.|
| javaScriptProxy | { <br> object: object, <br> name: string, <br> methodList: Array\<string\>, <br> controller: WebController <br>} | - | JavaScript object to be injected into the window. Methods of this object can be invoked in the window. The parameters in this attribute cannot be updated.<br> **object** indicates the object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.<br> **name** indicates the name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.<br> **methodList** indicates the methods of the JavaScript object to be registered at the application side.<br> **controller** indicates the controller. |
| javaScriptAccess | boolean | true | Whether JavaScript scripts can be executed. By default, JavaScript scripts can be executed. |
| mixedMode | [MixedMode](#mixedmode) | MixedMode.None | Whether to enable loading of HTTP and HTTPS hybrid content can be loaded. By default, this feature is disabled.|
| onlineImageAccess | boolean | true | Whether to enable access to online images through HTTP and HTTPS. By default, this feature is enabled.|
| mixedMode | [MixedMode](#mixedmode) | MixedMode.None | Whether to enable loading of HTTP and HTTPS hybrid content can be loaded. By default, this feature is disabled. |
| onlineImageAccess | boolean | true | Whether to enable access to online images through HTTP and HTTPS. By default, this feature is enabled. |
| zoomAccess | boolean | true | Whether to enable zoom gestures. By default, zoom gestures are enabled. |
| overviewModeAccess | boolean | true | Whether to use the overview mode to load web pages. By default, this mode is used. |
| databaseAccess | boolean | false | Whether to enable database access. By default, this feature is disabled. |
......@@ -57,7 +57,7 @@ Not supported
The universal events are not supported.
| Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| ---------------------------------------- | ---------------------------------------- |
| onAlert(callback: (event?: { url: string; message: string; result: [JsResult](#jsresult) }) => boolean) | <p>Triggered when **alert()** is invoked to display an alert dialog box on the web page.<br>If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows only the confirm operation) and invoke the **JsResult** API to notify the **\<Web>** component of the user's operation.<br>**url**: URL of the web page where the dialog box is displayed.<br>**message**: information displayed in the dialog box.<br>**JsResult**: the user's operation.</p> |
| onBeforeUnload(callback: (event?: { url: string; message: string; result: [JsResult](#jsresult) }) => boolean) | <p>Triggered when the current page is about to exit after the user refreshes or closes the page.<br>If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\<Web>** component of the user's operation.<br>**url**: URL of the web page where the dialog box is displayed.<br>**message**: information displayed in the dialog box.<br>**JsResult**: the user's operation.</p> |
| onConfirm(callback: (event?: { url: string; message: string; result: [JsResult](#jsresult) }) => boolean) | <p>Triggered when **confirm()** is invoked by the web page.<br>If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\<Web>** component of the user's operation.<br>**url**: URL of the web page where the dialog box is displayed.<br>**message**: information displayed in the dialog box.<br>**JsResult**: the user's operation.</p> |
......@@ -77,20 +77,20 @@ The universal events are not supported.
## ConsoleMessage
| Name | Description |
| ------------------------------- | ---------------------- |
| ---------------------------------------- | ---------------------------------------- |
| getLineNumber(): number | Obtains the number of rows in the **ConsoleMessage**. |
| getMessage(): string | Obtains the log information of the **ConsoleMessage**.|
| getMessageLevel(): [MessageLevel](#messagelevel-enums) | Obtains the log information level of the **ConsoleMessage**.|
| getMessage(): string | Obtains the log information of the **ConsoleMessage**. |
| getMessageLevel(): [MessageLevel](#messagelevel-enums) | Obtains the log information level of the **ConsoleMessage**. |
| getSourceId(): string | Obtains the path and name of the web page source file. |
## MessageLevel Enums
| Name | Description |
| ----- | :---- |
| Debug | Debug level.|
| Error | Error level.|
| Info | Information level.|
| Log | Log level.|
| ----- | :----------------- |
| Debug | Debug level. |
| Error | Error level. |
| Info | Information level. |
| Log | Log level. |
| Warn | Warning level. |
## JsResult
......@@ -98,56 +98,56 @@ The universal events are not supported.
Provides the result returned to the **\<Web>** component to indicate the user operation performed in the dialog box.
| Name | Description |
| --------------------- | ----------------------- |
| --------------------- | ---------------------------------------- |
| handleCancel(): void | <p>The user's cancel operation in the dialog box.</p> |
| handleConfirm(): void | <p>The user's confirm operation in the dialog box.</p> |
## WebResourceError
| Name | Description |
| ---------------------- | ------------ |
| ---------------------- | ---------------------------------------- |
| getErrorCode(): number | Obtains the error code for resource loading. |
| getErrorInfo(): string | Obtains error information about resource loading.|
| getErrorInfo(): string | Obtains error information about resource loading. |
## WebResourceRequest
| Name | Description |
| ---------------------------------------- | -------------------- |
| ---------------------------------------- | ---------------------------------------- |
| getRequestHeader(): Array\<[Header](#header)\> | Obtains the information about the resource request header. |
| getRequestUrl(): string | Obtains the URL of the resource request. |
| isMainFrame(): boolean | Checks whether the resource request is in the main frame. |
| isRedirect(): boolean | Checks whether the resource request is redirected by the server. |
| isRequestGesture(): boolean | Checks whether the resource request is associated with a gesture (for example, a tap).|
| isRequestGesture(): boolean | Checks whether the resource request is associated with a gesture (for example, a tap). |
## Header
Describes the request/response header returned by the **\<Web>** component.
| Name | Type | Description |
| ----------- | ------ | ------------- |
| ----------- | ------ | ------------------------------------- |
| headerKey | string | Key of the request/response header. |
| headerValue | string | Value of the request/response header.|
| headerValue | string | Value of the request/response header. |
## WebResourceResponse
| Name | Description |
| ---------------------------------------- | ------------------ |
| ---------------------------------------- | ---------------------------------------- |
| getReasonMessage(): string | Obtains the status code description of the resource response. |
| getResponseCode(): number | Obtains the status code of the resource response. |
| getResponseData(): string | Obtains the data in the resource response. |
| getResponseEncoding(): string | Obtains the encoding of the resource response. |
| getResponseHeader(): Array\<[Header](#header)\> | Obtains the resource response header. |
| getResponseMimeType(): string | Obtains the media (MIME) type of the resource response.|
| getResponseMimeType(): string | Obtains the media (MIME) type of the resource response. |
## RenderExitReason
Explains why the rendering process exits.
| Name | Description |
| -------------------------- | ----------------- |
| ---------------------------- | ---------------------------------------- |
| PROCESS_ABNORMAL_TERMINATION | The rendering process exits abnormally. |
| PROCESS_WAS_KILLED | The rendering process receives a SIGKILL message or is manually terminated.|
| PROCESS_WAS_KILLED | The rendering process receives a SIGKILL message or is manually terminated. |
| PROCESS_CRASHED | The rendering process crashes due to a segmentation error or other errors. |
| PROCESS_OOM | The program memory is running low. |
| PROCESS_EXIT_UNKNOWN | Other reason. |
......@@ -155,15 +155,15 @@ Explains why the rendering process exits.
## MixedMode
| Name | Description |
| ---------- | ---------------------------------- |
| All | HTTP and HTTPS hybrid content can be loaded. This means that all insecure content can be loaded.|
| ---------- | ---------------------------------------- |
| All | HTTP and HTTPS hybrid content can be loaded. This means that all insecure content can be loaded. |
| Compatible | HTTP and HTTPS hybrid content can be loaded in compatibility mode. This means that some insecure content may be loaded. |
| None | HTTP and HTTPS hybrid content cannot be loaded. |
## CacheMode
| Name | Description |
| ------- | ------------------------------------ |
| Default | The cache that has not expired is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet.|
| ------- | ---------------------------------------- |
| Default | The cache that has not expired is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet. |
| None | The cache is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet. |
| Online | The cache is not used to load the resources. All resources are obtained from the Internet. |
| Only | The cache alone is used to load the resources. |
......@@ -172,23 +172,23 @@ Explains why the rendering process exits.
Notifies the **\<Web>** component of the file selection result.
| Name | Description |
| ---------------------------------------------- | ------------------------------------------------------------ |
| ---------------------------------------- | ---------------------------------------- |
| handleFileList(fileList: Array\<string>): void | Instructs the **\<Web>** component to select a file.<br>**fileList**: list of files to operate. |
## FileSelectorParam
| Name | Description |
| -------------------------------- | ------------ |
| ----------------------------- | ---------------------------------------- |
| title(): string | Title of the file selector. |
| mode(): FileSelectorMode | Mode of the file selector. |
| acceptType(): Array\<string\> | File filtering type. |
| isCapture(): boolean | Whether multimedia capabilities are invoked.|
| isCapture(): boolean | Whether multimedia capabilities are invoked. |
## FileSelectorMode
| Name | Description |
| -------------------- | ---------- |
| ----------------------- | ------------------------------- |
| FILE_OPEN_MODE | Open and upload a file. |
| FILE_OPEN_MULTIPLE_MODE | Open and upload multiple files. |
| FILE_OPEN_FOLDER_MODE | Open and upload a folder.|
| FILE_OPEN_FOLDER_MODE | Open and upload a folder. |
| FILE_SAVE_MODE | Save a file. |
## WebController
......@@ -222,14 +222,14 @@ Indicates whether a specific number of steps forward or backward can be performe
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| ---- | ------ | ---- | ---- | --------------------- |
| step | number | Yes | - | Number of the steps to take. A positive number means to going forward, and a negative number means to going backward.|
| ---- | ------ | --------- | ------------- | ---------------------------------------- |
| step | number | Yes | - | Number of the steps to take. A positive number means to going forward, and a negative number means to going backward. |
- Return value
| Type | Description |
| ------- | --------- |
| boolean | Whether to go forward or backward from the current page.|
| ------- | ---------------------------------------- |
| boolean | Whether to go forward or backward from the current page. |
### backward
......@@ -246,8 +246,8 @@ Deletes a specific application JavaScript object that is registered with the win
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| ---- | ------ | ---- | ---- | ---------------------------------------- |
| name | string | Yes | - | Name of the registered JavaScript object, which can be used to invoke the corresponding object on the application side from the web side.|
| ---- | ------ | --------- | ------------- | ---------------------------------------- |
| name | string | Yes | - | Name of the registered JavaScript object, which can be used to invoke the corresponding object on the application side from the web side. |
### forward
......@@ -264,11 +264,11 @@ Obtains the element type of the area being clicked.
- HitTestType enums
| Name | Description |
| ------------- | ------------------------ |
| ------------- | ---------------------------------------- |
| EditText | Editable area. |
| Email | Email address. |
| HttpAnchor | Hyperlink where **src** is **http**. |
| HttpAnchorImg | Image with a hyperlink, where **src** is **http**.|
| HttpAnchorImg | Image with a hyperlink, where **src** is **http**. |
| Img | HTML::img tag. |
| Map | Geographical address. |
| Unknown | Unknown content. |
......@@ -286,12 +286,12 @@ If **baseUrl** is set to an HTTP or HTTPS URL, the encoded string will be proces
- options
| Name | Type | Mandatory | Default Value | Description |
| ---------- | ------ | ---- | ---- | ---------------------------------------- |
| ---------- | ------ | --------- | ------------- | ---------------------------------------- |
| data | string | Yes | - | Character string obtained after being Base64 or URL encoded. |
| mimeType | string | Yes | - | Media type (MIME). |
| encoding | string | Yes | - | Encoding type, which can be Base64 or URL. |
| baseUrl | string | No | - | URL (HTTP/HTTPS/data compliant), which is assigned by the **\<Web>** component to **window.origin**.|
| historyUrl | string | No | - | Historical record URL. If this parameter is not empty, it can be managed in historical records to implement page going backward and forward. This parameter is invalid when **baseUrl** is left empty.|
| baseUrl | string | No | - | URL (HTTP/HTTPS/data compliant), which is assigned by the **\<Web>** component to **window.origin**. |
| historyUrl | string | No | - | Historical record URL. If this parameter is not empty, it can be managed in historical records to implement page going backward and forward. This parameter is invalid when **baseUrl** is left empty. |
### loadUrl
......@@ -306,9 +306,9 @@ The object injected through **registerJavaScriptProxy** is still valid on a new
- options
| Name | Type | Mandatory | Default Value | Description |
| ------- | ------------------------------ | ---- | ---- | -------------- |
| ------- | -------------------------- | --------- | ------------- | ---------------------------------------- |
| url | string | Yes | - | URL to load. |
| headers | Array\<[Header](#header)\> | No | [] | Additional HTTP request header of the URL.|
| headers | Array\<[Header](#header)\> | No | [] | Additional HTTP request header of the URL. |
### onActive
......@@ -337,9 +337,9 @@ Injects a JavaScript object into the window and invokes the methods of the objec
- options
| Name | Type | Mandatory | Default Value | Description |
| ---------- | --------------- | ---- | ---- | ---------------------------------------- |
| object | object | Yes | - | Application-side JavaScript object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type.|
| name | string | Yes | - | Name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side.|
| ---------- | --------------- | --------- | ------------- | ---------------------------------------- |
| object | object | Yes | - | Application-side JavaScript object to be registered. Methods can be declared, but not attributes. The parameters and return value can only be of the string, number, or Boolean type. |
| name | string | Yes | - | Name of the object to be registered, which is the same as that invoked in the window. After registration, the window can use this name to access the JavaScript object at the application side. |
| methodList | Array\<string\> | Yes | - | Methods of the JavaScript object to be registered at the application side. |
### runJavaScript
......@@ -351,9 +351,9 @@ Asynchronously executes a JavaScript script. This API uses a callback to return
- options
| Name | Type | Mandatory | Default Value | Description |
| -------- | ------------------------ | ---- | ---- | ---------------------------------------- |
| -------- | ------------------------ | --------- | ------------- | ---------------------------------------- |
| script | string | Yes | - | JavaScript script. |
| callback | (result: string) => void | No | - | Callback used to return the result. Returns **null** if the JavaScript script fails to be executed or no value is returned.|
| callback | (result: string) => void | No | - | Callback used to return the result. Returns **null** if the JavaScript script fails to be executed or no value is returned. |
### stop
......@@ -375,7 +375,7 @@ Obtains the cookie management object of the **\<Web>** component.
- Return value
| Type | Description |
| --------- | ---------------------------------------- |
| WebCookie | Cookie management object. For details, see [WebCookie](#webcookie).|
| WebCookie | Cookie management object. For details, see [WebCookie](#webcookie). |
## WebCookie
Manages behavior of cookies in **\<Web>** components. All **\<Web>** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management.
### setCookie
......@@ -386,13 +386,13 @@ Sets the cookie. This API is synchronous.
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| ----- | ------ | ---- | ---- | ----------------- |
| url | string | Yes | - | URL of the cookie to set.|
| ----- | ------ | --------- | ------------- | --------------------------- |
| url | string | Yes | - | URL of the cookie to set. |
| value | string | Yes | - | Value of the cookie to set. |
- Return value
| Type | Description |
| ------- | ------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
### saveCookieSync
saveCookieSync(): boolean
......@@ -400,8 +400,8 @@ saveCookieSync(): boolean
Saves this cookie in the memory to the disk. This API is synchronous.
- Return value
| Type | Description |
| ------- | -------------------- |
| boolean | Returns the operation result.|
| ------- | ----------------------------- |
| boolean | Returns the operation result. |
## Example
```ts
......
......@@ -15,24 +15,24 @@ PanGesture(value?: { fingers?: number, direction?: PanDirection, distance?: numb
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1**|
| direction | PanDirection | No| Pan direction. The enumerated value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **PanDirection.All**|
| distance | number | No| Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and tab swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.|
| Name | Type | Mandatory | Description |
| --------- | ------------ | --------- | ---------------------------------------- |
| fingers | number | No | Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1** |
| direction | PanDirection | No | Pan direction. The enumerated value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **PanDirection.All** |
| distance | number | No | Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and tab swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized. |
## PanDirection enums
| Name| Description|
| -------- | -------- |
| All | All directions.|
| Horizontal | Horizontal panning.|
| Vertical | Vertical panning.|
| Left | Panning to the left.|
| Right | Panning to the right.|
| Up | Panning up.|
| Down | Panning down.|
| None | Panning disabled.|
| Name | Description |
| ---------- | --------------------- |
| All | All directions. |
| Horizontal | Horizontal panning. |
| Vertical | Vertical panning. |
| Left | Panning to the left. |
| Right | Panning to the right. |
| Up | Panning up. |
| Down | Panning down. |
| None | Panning disabled. |
## PanGestureOptions
......@@ -47,21 +47,21 @@ See the **PanGesture** parameters.
**APIs**
| Name| Description|
| -------- | -------- |
| setDirection(value: PanDirection) | Sets the direction.|
| setDistance(value: number) | Sets the distance.|
| setFingers(value: number) | Sets the number of fingers.|
| Name | Description |
| --------------------------------- | --------------------------- |
| setDirection(value: PanDirection) | Sets the direction. |
| setDistance(value: number) | Sets the distance. |
| setFingers(value: number) | Sets the number of fingers. |
## Events
| Name| Description|
| -------- | -------- |
| onActionStart(event: (event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Callback invoked when a pan gesture is recognized.|
| onActionUpdate(event: (event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Callback invoked when the pan gesture status is updated.|
| onActionEnd(event: (event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Callback invoked when the finger used for a pan gesture is lift.|
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized.|
| Name | Description |
| ---------------------------------------- | ---------------------------------------- |
| onActionStart(event: (event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Callback invoked when a pan gesture is recognized. |
| onActionUpdate(event: (event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Callback invoked when the pan gesture status is updated. |
| onActionEnd(event: (event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Callback invoked when the finger used for a pan gesture is lift. |
| onActionCancel(event: () =&gt; void) | Callback invoked when a tap cancellation event is received after a pan gesture is recognized. |
## Example
......@@ -115,13 +115,3 @@ struct PanGestureExample {
}
}
```
**Diagrams**
Pannig to the left:
![en-us_image_0000001174264374](figures/en-us_image_0000001174264374.png)
Click Set PanGesture Trigger Condition to two fingers moving toward the lower left corner.
![en-us_image1_0000001174264374](figures/en-us_image1_0000001174264374.png)
......@@ -13,20 +13,20 @@ PinchGesture(value?: { fingers?: number, distance?: number })
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| fingers | number | No| Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5.<br>Default value: **2**|
| distance | number | No| Minimum recognition distance, in vp.<br>Default value: **3**|
| Name | Type | Mandatory | Description |
| -------- | ------ | --------- | ---------------------------------------- |
| fingers | number | No | Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5.<br>Default value: **2** |
| distance | number | No | Minimum recognition distance, in vp.<br>Default value: **3** |
## Events
| Name| Description|
| -------- | -------- |
| onActionStart(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when a pinch gesture is recognized.|
| onActionUpdate(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when the user moves the finger in a pinch gesture on the screen.|
| onActionEnd(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when the finger used for a pinch gesture is lift.|
| onActionCancel(event: () =&gt; void) | Triggered when a tap cancellation event is received after a pinch gesture is recognized.|
| Name | Description |
| ---------------------------------------- | ---------------------------------------- |
| onActionStart(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when a pinch gesture is recognized. |
| onActionUpdate(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when the user moves the finger in a pinch gesture on the screen. |
| onActionEnd(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when the finger used for a pinch gesture is lift. |
| onActionCancel(event: () =&gt; void) | Triggered when a tap cancellation event is received after a pinch gesture is recognized. |
## Example
......
......@@ -13,27 +13,27 @@ SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: num
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| fingers | number | No| Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10.<br>Default value: **1**|
| direction | SwipeDirection | No| Swipe direction.<br>Default value: **SwipeDirection.All**|
| speed | number | No| Minimum speed of the swipe gesture, in vp/s.<br>Default value: **100**|
| Name | Type | Mandatory | Description |
| --------- | -------------- | --------- | ---------------------------------------- |
| fingers | number | No | Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10.<br>Default value: **1** |
| direction | SwipeDirection | No | Swipe direction.<br>Default value: **SwipeDirection.All** |
| speed | number | No | Minimum speed of the swipe gesture, in vp/s.<br>Default value: **100** |
## SwipeDirection
| Name| Description|
| -------- | -------- |
| All | All directions.|
| Name | Description |
| ---------- | --------------------- |
| All | All directions. |
| Horizontal | Horizontal direction. |
| Vertical | Vertical direction. |
| None | Swiping disabled.|
| None | Swiping disabled. |
## Events
| Name| Description|
| -------- | -------- |
| onAction(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when a swipe gesture is recognized.|
| Name | Description |
| ---------------------------------------- | ---------------------------------------- |
| onAction(event:(event?: [GestureEvent](ts-gesture-settings.md)) =&gt; void) | Triggered when a swipe gesture is recognized. |
## Example
......
......@@ -23,30 +23,30 @@ Shape(value?: PixelMap)
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| value | PixelMap | No| - | Shape to draw. You can draw a shape in the specified **PixelMap** object. If no object is specified, the shape is drawn in the current drawing target.|
| Name | Type | Mandatory | Default Value | Description |
| ----- | -------- | --------- | ------------- | ---------------------------------------- |
| value | PixelMap | No | - | Shape to draw. You can draw a shape in the specified **PixelMap** object. If no object is specified, the shape is drawn in the current drawing target. |
## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- |
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | No| View port of the shape.|
| fill | [ResourceColor](ts-types.md#resourcecolor8) | Color.Black | No| Color of the fill area.|
| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | No| Opacity of the fill area.|
| stroke | [ResourceColor](ts-types.md#resourcecolor8) | Color.Black | No| Stroke color.|
| strokeDashArray | Array&lt;Length&gt; | [] | No| Stroke dash.|
| strokeDashOffset | number \| string | 0 | No| Offset of the start point for drawing the stroke.|
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No| Cap style of the stroke.|
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No| Join style of the stroke.|
| strokeMiterLimit | number \| string | 4 | No| Limit value when the sharp angle is drawn as a miter.|
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | No| Stroke opacity.|
| strokeWidth | number \| string | 1 | No| Stroke width.|
| antiAlias | boolean | true | No| Whether anti-aliasing is enabled.|
| mesh<sup>8+</sup> | Array&lt;number&gt;,number,number | [],0,0 | No| Mesh effect. The first parameter is an array of lengths (column + 1) * (row + 1) * 2, which records the position of each vertex of the distorted bitmap. The second parameter is the number of columns in the mesh matrix. The third parameter is the number of rows in the mesh matrix.|
| Name | Type | Default Value | Mandatory | Description |
| ----------------- | ---------------------------------------- | ------------------------------- | --------- | ---------------------------------------- |
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | No | View port of the shape. |
| fill | [ResourceColor](ts-types.md#resourcecolor8) | Color.Black | No | Color of the fill area. |
| fillOpacity | number \| string \| [Resource](ts-types.md#resource) | 1 | No | Opacity of the fill area. |
| stroke | [ResourceColor](ts-types.md#resourcecolor8) | Color.Black | No | Stroke color. |
| strokeDashArray | Array&lt;Length&gt; | [] | No | Stroke dash. |
| strokeDashOffset | number \| string | 0 | No | Offset of the start point for drawing the stroke. |
| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | No | Cap style of the stroke. |
| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | No | Join style of the stroke. |
| strokeMiterLimit | number \| string | 4 | No | Limit value when the sharp angle is drawn as a miter. |
| strokeOpacity | number \| string \| [Resource](ts-types.md#resource) | 1 | No | Stroke opacity. |
| strokeWidth | number \| string | 1 | No | Stroke width. |
| antiAlias | boolean | true | No | Whether anti-aliasing is enabled. |
| mesh<sup>8+</sup> | Array&lt;number&gt;,number,number | [],0,0 | No | Mesh effect. The first parameter is an array of lengths (column + 1) * (row + 1) * 2, which records the position of each vertex of the distorted bitmap. The second parameter is the number of columns in the mesh matrix. The third parameter is the number of rows in the mesh matrix. |
## Example
......
......@@ -243,8 +243,8 @@
- [Distributed Data Object Development](database/database-distributedobject-guidelines.md)
- Task Management
- Background Task Management
- [Background Task Management Overview](background-task-management/background-task-overview.md)
- [Background Task Management Development](background-task-management/background-task-dev-guide.md)
- [Background Task Management Overview](task-management/background-task-overview.md)
- [Background Task Management Development](task-management/background-task-dev-guide.md)
- Work Scheduler
- [Work Scheduler Overview](task-management/work-scheduler-overview.md)
- [Work Scheduler Development](task-management/work-scheduler-dev-guide.md)
......
......@@ -23,7 +23,7 @@ Scroll(scroller?: Scroller)
除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
| 名称 | 参数类型 | 描述 |
| -------------- | ---------------------------------------- | --------- |
| -------------- | ---------------------------------------- | ---------------------------------------- |
| scrollable | [ScrollDirection](#scrolldirection枚举说明) | 设置滚动方向。<br/>默认值:ScrollDirection.Vertical |
| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。<br/>默认值:BarState.Auto |
| scrollBarColor | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;[Color](ts-appendix-enums.md#color) | 设置滚动条的颜色。 |
......@@ -32,16 +32,16 @@ Scroll(scroller?: Scroller)
## ScrollDirection枚举说明
| 名称 | 描述 |
| ---------- | ------------------------ |
| ---------------------------- | ----------------------------------- |
| Horizontal | 仅支持水平方向滚动。 |
| Vertical | 仅支持竖直方向滚动。 |
| None | 不可滚动。 |
| Free<sup>(deprecated) </sup> | 支持竖直或水平方向滚动<br/> 从API version 9开始废弃|
| Free<sup>(deprecated) </sup> | 支持竖直或水平方向滚动<br/> 从API version 9开始废弃 |
## 事件
| 名称 | 功能描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| ---------------------------------------- | ---------------------------------------- |
| onScrollBegin<sup>9+</sup>(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | 滚动开始事件回调。<br>参数:<br>- dx:即将发生的水平方向滚动量。<br>- dy:即将发生的竖直方向滚动量。<br>返回值:<br>- dxRemain:水平方向滚动剩余量。<br>- dyRemain:竖直方向滚动剩余量。 |
| onScroll(event: (xOffset: number, yOffset: number) => void) | 滚动事件回调,&nbsp;返回滚动时水平、竖直方向偏移量。 |
| onScrollEdge(event: (side: Edge) => void) | 滚动到边缘事件回调。 |
......@@ -73,7 +73,7 @@ scrollTo(value: { xOffset: number | string, yOffset: number | string, animation?
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| --------- | ---------------------------------------- | ---- | ---------------------------------------- |
| xOffset | Length | 是 | 水平滑动偏移。 |
| yOffset | Length | 是 | 竖直滑动偏移。 |
| animation | {<br/>duration:&nbsp;number,<br/>curve:&nbsp;[Curve](ts-animatorproperty.md)<br/>} | 否 | 动画配置:<br/>-&nbsp;duration:&nbsp;滚动时长设置。<br/>-&nbsp;curve:&nbsp;滚动曲线设置。 |
......@@ -89,7 +89,7 @@ scrollEdge(value: Edge): void
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ----- | ---- | ---- | --------- |
| ----- | --------------------------------- | ---- | --------- |
| value | [Edge](ts-appendix-enums.md#edge) | 是 | 滚动到的边缘位置。 |
......@@ -102,7 +102,7 @@ scrollPage(value: { next: boolean, direction?: Axis }): void
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| --------- | ------- | ---- | ------------------------------ |
| --------------------------------- | --------------------------------- | ---- | --------------------------------------- |
| next | boolean | 是 | 是否向下翻页。true表示向下翻页,false表示向上翻页。 |
| direction<sup>(deprecated) </sup> | [Axis](ts-appendix-enums.md#axis) | 否 | 设置滚动方向为水平或竖直方向。<br/> 从API version 9开始废弃 |
......@@ -136,7 +136,7 @@ scrollToIndex(value: number): void
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ------ | -------- | ---- | ---------------------------------- |
| ----- | ------ | ---- | ----------------- |
| value | number | 是 | 要滑动到的列表项在列表中的索引值。 |
......@@ -155,7 +155,7 @@ scrollBy(dx: Length, dy: Length): void
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ----- | ------ | ---- | ----------------- |
| ---- | ------ | ---- | ------------------ |
| dx | Length | 是 | 水平方向滚动距离,不支持百分比形式。 |
| dy | Length | 是 | 竖直方向滚动距离,不支持百分比形式。 |
......
......@@ -540,7 +540,6 @@
- JS服务卡片UI组件参考
- JS服务卡片UI框架说明
- [文件组织](reference/js-service-widget-ui/js-service-widget-file.md)
- [配置文件](reference/js-service-widget-ui/js-service-widget-config-file.md)
- 语法
- [HML语法参考](reference/js-service-widget-ui/js-service-widget-syntax-hml.md)
- [CSS语法参考](reference/js-service-widget-ui/js-service-widget-syntax-css.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册