提交 907bbd4d 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 f4d973a2
# Internationalization – i18n # Internationalization – i18n
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> >
> - This module contains enhanced i18n APIs, which are not defined in ECMA 402. > - This module contains enhanced i18n APIs, which are not defined in ECMA 402.
...@@ -28,7 +28,7 @@ Obtains the localized script for the specified language. ...@@ -28,7 +28,7 @@ Obtains the localized script for the specified language.
| locale | string | Yes | Locale ID. | | 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** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------- | | ------ | ------------- |
| string | Localized script for the specified language.| | string | Localized script for the specified language.|
...@@ -55,7 +55,7 @@ Obtains the localized script for the specified country. ...@@ -55,7 +55,7 @@ Obtains the localized script for the specified country.
| locale | string | Yes | Locale ID. | | 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** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------- | | ------ | ------------- |
| string | Localized script for the specified country.| | string | Localized script for the specified country.|
...@@ -80,7 +80,7 @@ Checks whether the localized script for the specified language is displayed from ...@@ -80,7 +80,7 @@ Checks whether the localized script for the specified language is displayed from
| ------ | ------ | ------- | | ------ | ------ | ------- |
| locale | string | Locale ID.| | locale | string | Locale ID.|
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -100,7 +100,7 @@ Obtains the system language. ...@@ -100,7 +100,7 @@ Obtains the system language.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ------- | | ------ | ------- |
| string | System language ID.| | string | System language ID.|
...@@ -117,16 +117,18 @@ setSystemLanguage(language: string): boolean ...@@ -117,16 +117,18 @@ setSystemLanguage(language: string): boolean
Sets the system language. Sets the system language.
**Required permission**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Description |
| -------- | ------ | ----- | | -------- | ------ | ----- |
| language | string | Language ID.| | language | string | Language ID.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------- | ------------------------------------- | | ------- | ------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -145,7 +147,9 @@ Obtains the list of system languages. ...@@ -145,7 +147,9 @@ Obtains the list of system languages.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **System API**: This is a system API and cannot be called by third-party applications.
**Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------ | | ------------------- | ------------ |
| Array&lt;string&gt; | List of the IDs of system languages.| | Array&lt;string&gt; | List of the IDs of system languages.|
...@@ -164,12 +168,14 @@ Obtains the list of countries and regions supported for the specified language. ...@@ -164,12 +168,14 @@ Obtains the list of countries and regions supported for the specified language.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Description |
| -------- | ------ | ----- | | -------- | ------ | ----- |
| language | string | Language ID.| | language | string | Language ID.|
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -188,7 +194,7 @@ Obtains the system region. ...@@ -188,7 +194,7 @@ Obtains the system region.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ------- | | ------ | ------- |
| string | System region ID.| | string | System region ID.|
...@@ -205,23 +211,25 @@ setSystemRegion(region: string): boolean ...@@ -205,23 +211,25 @@ setSystemRegion(region: string): boolean
Sets the system region. Sets the system region.
**Required permission**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Description |
| ------ | ------ | ----- | | ------ | ------ | ----- |
| region | string | Region ID.| | region | string | Region ID.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
i18n.setSystemRegion(); i18n.setSystemRegion('CN');
``` ```
...@@ -233,7 +241,7 @@ Obtains the system locale. ...@@ -233,7 +241,7 @@ Obtains the system locale.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ------- | | ------ | ------- |
| string | System locale ID.| | string | System locale ID.|
...@@ -250,16 +258,18 @@ setSystemLocale(locale: string): boolean ...@@ -250,16 +258,18 @@ setSystemLocale(locale: string): boolean
Sets the system locale. Sets the system locale.
**Required permission**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Description |
| ------ | ------ | --------------- | | ------ | ------ | --------------- |
| locale | string | System locale ID, for example, **zh-CN**.| | locale | string | System locale ID, for example, **zh-CN**.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------- | ---------------------------------------- | | ------- | ---------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -278,13 +288,15 @@ Checks whether the system language matches the specified region. ...@@ -278,13 +288,15 @@ Checks whether the system language matches the specified region.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | 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**. | | region | string | No | Valid region ID, for example, **CN**. |
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -309,7 +321,7 @@ Obtains a **Calendar** object. ...@@ -309,7 +321,7 @@ Obtains a **Calendar** object.
| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. | | 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** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ----- | | ---------------------- | ----- |
| [Calendar](#calendar8) | **Calendar** object.| | [Calendar](#calendar8) | **Calendar** object.|
...@@ -338,7 +350,7 @@ Sets the date for this **Calendar** object. ...@@ -338,7 +350,7 @@ Sets the date for this **Calendar** object.
**Example** **Example**
``` ```
var calendar = I18n.getCalendar("en-US", "gregory"); var calendar = i18n.getCalendar("en-US", "gregory");
var date = new Date(2021, 10, 7, 8, 0, 0, 0); var date = new Date(2021, 10, 7, 8, 0, 0, 0);
calendar.setTime(date); calendar.setTime(date);
``` ```
...@@ -359,7 +371,7 @@ Sets the date and time for this **Calendar** object. The value is represented by ...@@ -359,7 +371,7 @@ Sets the date and time for this **Calendar** object. The value is represented by
**Example** **Example**
``` ```
var calendar = I18n.getCalendar("en-US", "gregory"); var calendar = i18n.getCalendar("en-US", "gregory");
calendar.setTime(10540800000); calendar.setTime(10540800000);
``` ```
...@@ -385,7 +397,7 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object ...@@ -385,7 +397,7 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object
**Example** **Example**
``` ```
var calendar = i18n.getCalendar("zh-Hans"); var calendar = i18n.getCalendar("zh-Hans");
calendar.setTime(2021, 10, 1, 8, 0, 0); // set time to 2021.10.1 08:00:00 calendar.set(2021, 10, 1, 8, 0, 0); // set time to 2021.10.1 08:00:00
``` ```
...@@ -417,7 +429,7 @@ Obtains the time zone of this **Calendar** object. ...@@ -417,7 +429,7 @@ Obtains the time zone of this **Calendar** object.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ---------- | | ------ | ---------- |
| string | Time zone of the **Calendar** object.| | string | Time zone of the **Calendar** object.|
...@@ -438,14 +450,14 @@ Obtains the start day of a week for this **Calendar** object. ...@@ -438,14 +450,14 @@ Obtains the start day of a week for this **Calendar** object.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var calendar = I18n.getCalendar("en-US", "gregory"); var calendar = i18n.getCalendar("en-US", "gregory");
calendar.getFirstDayOfWeek(); calendar.getFirstDayOfWeek();
``` ```
...@@ -478,7 +490,7 @@ Obtains the minimum number of days in the first week of a year. ...@@ -478,7 +490,7 @@ Obtains the minimum number of days in the first week of a year.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -523,7 +535,7 @@ Obtains the value of the specified field in the **Calendar** object. ...@@ -523,7 +535,7 @@ Obtains the value of the specified field in the **Calendar** object.
| ----- | ------ | ---- | ---------------------------------------- | | ----- | ------ | ---- | ---------------------------------------- |
| 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** **Return value**
| Type | Description | | 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**.|
...@@ -531,7 +543,7 @@ Obtains the value of the specified field in the **Calendar** object. ...@@ -531,7 +543,7 @@ Obtains the value of the specified field in the **Calendar** object.
**Example** **Example**
``` ```
var calendar = i18n.getCalendar("zh-Hans"); var calendar = i18n.getCalendar("zh-Hans");
calendar.setTime(2021, 10, 1, 8, 0, 0); // set time to 2021.10.1 08:00:00 calendar.set(2021, 10, 1, 8, 0, 0); // set time to 2021.10.1 08:00:00
calendar.get("hour_of_day"); // 8 calendar.get("hour_of_day"); // 8
``` ```
...@@ -549,7 +561,7 @@ Obtains the name of the **Calendar** object displayed for the specified locale. ...@@ -549,7 +561,7 @@ Obtains the name of the **Calendar** object displayed for the specified locale.
| ------ | ------ | ---- | ---------------------------------------- | | ------ | ------ | ---- | ---------------------------------------- |
| 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** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------------- | | ------ | ------------------- |
| string | Name of the **Calendar** object displayed for the specified locale.| | string | Name of the **Calendar** object displayed for the specified locale.|
...@@ -574,7 +586,7 @@ Checks whether the specified date in this **Calendar** object is a weekend. ...@@ -574,7 +586,7 @@ Checks whether the specified date in this **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.| | 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** **Return value**
| Type | Description | | 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.|
...@@ -582,7 +594,7 @@ Checks whether the specified date in this **Calendar** object is a weekend. ...@@ -582,7 +594,7 @@ Checks whether the specified date in this **Calendar** object is a weekend.
**Example** **Example**
``` ```
var calendar = i18n.getCalendar("zh-Hans"); var calendar = i18n.getCalendar("zh-Hans");
calendar.setTime(2021, 11, 11, 8, 0, 0); // set time to 2021.11.11 08:00:00 calendar.set(2021, 11, 11, 8, 0, 0); // set time to 2021.11.11 08:00:00
calendar.isWeekend(); // false calendar.isWeekend(); // false
var date = new Date(2011, 11, 6, 9, 0, 0); var date = new Date(2011, 11, 6, 9, 0, 0);
calendar.isWeekend(date); // true calendar.isWeekend(date); // true
...@@ -625,7 +637,7 @@ Checks whether the format of the specified phone number is valid. ...@@ -625,7 +637,7 @@ Checks whether the format of the specified phone number is valid.
| ------ | ------ | ---- | --------- | | ------ | ------ | ---- | --------- |
| number | string | Yes | Phone number to be checked.| | number | string | Yes | Phone number to be checked.|
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -650,7 +662,7 @@ Formats a phone number. ...@@ -650,7 +662,7 @@ Formats a phone number.
| ------ | ------ | ---- | ---------- | | ------ | ------ | ---- | ---------- |
| number | string | Yes | Phone number to be formatted.| | number | string | Yes | Phone number to be formatted.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ---------- | | ------ | ---------- |
| string | Formatted phone number.| | string | Formatted phone number.|
...@@ -670,7 +682,7 @@ Defines the options for this PhoneNumberFormat object. ...@@ -670,7 +682,7 @@ Defines the options for this PhoneNumberFormat object.
| Name | Type | Readable | Writable | Description | | 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 available options are as follows: E164,&nbsp;INTERNATIONAL,&nbsp;NATIONAL, and&nbsp;RFC3966.|
## UnitInfo<sup>8+</sup> ## UnitInfo<sup>8+</sup>
...@@ -682,7 +694,7 @@ Defines the measurement unit information. ...@@ -682,7 +694,7 @@ Defines the measurement unit information.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ------------- | ------ | ---- | ---- | ---------------------------------------- | | ------------- | ------ | ---- | ---- | ---------------------------------------- |
| unit | string | Yes | Yes | Name of the measurement unit, for example, **meter**, **inch**, or **cup**.| | 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**.| | measureSystem | string | Yes | Yes | Measurement system. The value can be **SI**,&nbsp;**US**, or&nbsp;**UK**.|
## Util<sup>8+</sup> ## Util<sup>8+</sup>
...@@ -705,14 +717,14 @@ Converts one measurement unit into another and formats the unit based on the spe ...@@ -705,14 +717,14 @@ Converts one measurement unit into another and formats the unit based on the spe
| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. | | 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 **narrow**.| | style | string | No | Style used for formatting. The value can be **long**, **short**, or **narrow**.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
I18n.Util.unitConvert({unit: "cup", measureSystem: "US"}, {unit: "liter", measureSystem: "SI"}, 1000, "en-US", "long"); i18n.Util.unitConvert({unit: "cup", measureSystem: "US"}, {unit: "liter", measureSystem: "SI"}, 1000, "en-US", "long");
``` ```
...@@ -729,14 +741,14 @@ Creates an **IndexUtil** object. ...@@ -729,14 +741,14 @@ Creates an **IndexUtil** object.
| ------ | ------ | ---- | ---------------------------- | | ------ | ------ | ---- | ---------------------------- |
| 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** **Return value**
| Type | Description | | Type | Description |
| ------------------------ | --------------------- | | ------------------------ | --------------------- |
| [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale.| | [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale.|
**Example** **Example**
``` ```
var indexUtil= i18n.IndexUtil.getInstance("zh-CN"); var indexUtil= i18n.getInstance("zh-CN");
``` ```
...@@ -751,7 +763,7 @@ Obtains the index list for this **locale** object. ...@@ -751,7 +763,7 @@ Obtains the index list for this **locale** object.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------------ | | ------------------- | ------------------ |
| Array&lt;string&gt; | Index list for this **locale** object.| | Array&lt;string&gt; | Index list for this **locale** object.|
...@@ -796,7 +808,7 @@ Obtains the index of a text object. ...@@ -796,7 +808,7 @@ Obtains the index of a text object.
| ---- | ------ | ---- | ------------ | | ---- | ------ | ---- | ------------ |
| text | string | Yes | **text** object whose index is to be obtained.| | text | string | Yes | **text** object whose index is to be obtained.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ----------- | | ------ | ----------- |
| string | Index of the **text** object.| | string | Index of the **text** object.|
...@@ -824,14 +836,14 @@ Checks whether the input character string is composed of digits. ...@@ -824,14 +836,14 @@ Checks whether the input character string is composed of digits.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var isdigit = Character.isDigit("1"); // Return true. var isdigit = i18n.Character.isDigit("1"); // Return true.
``` ```
...@@ -848,14 +860,14 @@ Checks whether the input character is a space. ...@@ -848,14 +860,14 @@ Checks whether the input character is a space.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var isspacechar = Character.isSpaceChar("a"); // Return false. var isspacechar = i18n.Character.isSpaceChar("a"); // Return false.
``` ```
...@@ -872,14 +884,14 @@ Checks whether the input character is a white space. ...@@ -872,14 +884,14 @@ Checks whether the input character is a white space.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var iswhitespace = Character.isWhitespace("a"); // Return false. var isspacechar = i18n.Character.isSpaceChar("a"); // Return false.
``` ```
...@@ -896,14 +908,14 @@ Checks whether the input character is of the right to left (RTL) language. ...@@ -896,14 +908,14 @@ Checks whether the input character is of the right to left (RTL) language.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var isrtl = Character.isRTL("a"); // Return false. var isrtl = i18n.Character.isRTL("a"); // Return false.
``` ```
...@@ -920,14 +932,14 @@ Checks whether the input character is an ideographic character. ...@@ -920,14 +932,14 @@ Checks whether the input character is an ideographic character.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var isideograph = Character.isIdeograph("a"); // Return false. var isideograph = i18n.Character.isIdeograph("a"); // Return false.
``` ```
...@@ -944,14 +956,14 @@ Checks whether the input character is a letter. ...@@ -944,14 +956,14 @@ Checks whether the input character is a letter.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var isletter = Character.isLetter("a"); // Return true. var isletter = i18n.Character.isLetter("a"); // Return true.
``` ```
...@@ -968,14 +980,14 @@ Checks whether the input character is a lowercase letter. ...@@ -968,14 +980,14 @@ Checks whether the input character is a lowercase letter.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var islowercase = Character.isLowerCase("a"); // Return true. var islowercase = i18n.Character.isLowerCase("a"); // Return true.
``` ```
...@@ -992,14 +1004,14 @@ Checks whether the input character is an uppercase letter. ...@@ -992,14 +1004,14 @@ Checks whether the input character is an uppercase letter.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
var isuppercase = Character.isUpperCase("a"); // Return false. var isuppercase = i18n.Character.isUpperCase("a"); // Return false.
``` ```
...@@ -1016,14 +1028,14 @@ Obtains the type of the input character string. ...@@ -1016,14 +1028,14 @@ Obtains the type of the input character string.
| ---- | ------ | ---- | ----- | | ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.| | char | string | Yes | Input character.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ----------- | | ------ | ----------- |
| string | Type of the input character.| | string | Type of the input character.|
**Example** **Example**
``` ```
var type = Character.getType("a"); var type = i18n.Character.getType("a");
``` ```
...@@ -1040,14 +1052,14 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation. ...@@ -1040,14 +1052,14 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation.
| ------ | ------ | ---- | ---------------------------------------- | | ------ | ------ | ---- | ---------------------------------------- |
| 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** **Return value**
| Type | Description | | Type | Description |
| -------------------------------- | ----------- | | -------------------------------- | ----------- |
| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.| | [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.|
**Example** **Example**
``` ```
i18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
``` ```
...@@ -1069,7 +1081,7 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object. ...@@ -1069,7 +1081,7 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object.
**Example** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
``` ```
...@@ -1082,14 +1094,14 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object. ...@@ -1082,14 +1094,14 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ---------------------- | | ------ | ---------------------- |
| string | Text being processed by the **BreakIterator** object.| | string | Text being processed by the **BreakIterator** object.|
**Example** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.getLineBreakText(); // Apple is my favorite fruit. iterator.getLineBreakText(); // Apple is my favorite fruit.
``` ```
...@@ -1103,14 +1115,14 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text ...@@ -1103,14 +1115,14 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
breakIter.current(); // 0 breakIter.current(); // 0
``` ```
...@@ -1124,14 +1136,14 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi ...@@ -1124,14 +1136,14 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
breakIter.first(); // 0 breakIter.first(); // 0
``` ```
...@@ -1145,14 +1157,14 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic ...@@ -1145,14 +1157,14 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.last(); // 27 iterator.last(); // 27
``` ```
...@@ -1171,14 +1183,14 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb ...@@ -1171,14 +1183,14 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb
| ----- | ------ | ---- | ---------------------------------------- | | ----- | ------ | ---- | ---------------------------------------- |
| 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** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.first(); // 0 iterator.first(); // 0
iterator.next(); // 6 iterator.next(); // 6
...@@ -1194,14 +1206,14 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary. ...@@ -1194,14 +1206,14 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.first(); // 0 iterator.first(); // 0
iterator.next(3); // 12 iterator.next(3); // 12
...@@ -1222,14 +1234,14 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the ...@@ -1222,14 +1234,14 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the
| ------ | ------ | ---- | ---------------------------------------- | | ------ | ------ | ---- | ---------------------------------------- |
| 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** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.following(0); // 6 iterator.following(0); // 6
iterator.following(100); // -1 iterator.following(100); // -1
...@@ -1250,14 +1262,14 @@ Checks whether the position specified by the offset is a text boundary. If **tru ...@@ -1250,14 +1262,14 @@ Checks whether the position specified by the offset is a text boundary. If **tru
| ------ | ------ | ---- | ----------- | | ------ | ------ | ---- | ----------- |
| offset | number | Yes | Position to check.| | offset | number | Yes | Position to check.|
**Return Value** **Return value**
| Type | Description | | 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** **Example**
``` ```
iterator = I18n.getLineInstance("en"); var iterator = i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.isBoundary(0); // true; iterator.isBoundary(0); // true;
iterator.isBoundary(5); // false; iterator.isBoundary(5); // false;
...@@ -1272,7 +1284,7 @@ Checks whether the 24-hour clock is used. ...@@ -1272,7 +1284,7 @@ Checks whether the 24-hour clock is used.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -1289,7 +1301,7 @@ set24HourClock(option: boolean): boolean ...@@ -1289,7 +1301,7 @@ set24HourClock(option: boolean): boolean
Sets the 24-hour clock. Sets the 24-hour clock.
**Required permission**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
...@@ -1298,7 +1310,7 @@ Sets the 24-hour clock. ...@@ -1298,7 +1310,7 @@ Sets the 24-hour clock.
| ------ | ------- | ---- | ---------------------------------------- | | ------ | ------- | ---- | ---------------------------------------- |
| 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** **Return value**
| Type | Description | | 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.|
...@@ -1306,7 +1318,7 @@ Sets the 24-hour clock. ...@@ -1306,7 +1318,7 @@ Sets the 24-hour clock.
**Example** **Example**
``` ```
// Set the system time to the 24-hour clock. // Set the system time to the 24-hour clock.
var success = I18n.set24HourClock(true); var success = i18n.set24HourClock(true);
``` ```
...@@ -1316,7 +1328,7 @@ addPreferredLanguage(language: string, index?: number): boolean ...@@ -1316,7 +1328,7 @@ addPreferredLanguage(language: string, index?: number): boolean
Adds a preferred language to the specified position on the preferred language list. Adds a preferred language to the specified position on the preferred language list.
**Required permission**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
...@@ -1326,7 +1338,7 @@ Adds a preferred language to the specified position on the preferred language li ...@@ -1326,7 +1338,7 @@ Adds a preferred language to the specified position on the preferred language li
| language | string | Yes | Preferred language to add. | | 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** **Return value**
| Type | Description | | 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.|
...@@ -1346,7 +1358,7 @@ removePreferredLanguage(index: number): boolean ...@@ -1346,7 +1358,7 @@ removePreferredLanguage(index: number): boolean
Deletes a preferred language from the specified position on the preferred language list. Deletes a preferred language from the specified position on the preferred language list.
**Required permission**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
...@@ -1355,7 +1367,7 @@ Deletes a preferred language from the specified position on the preferred langua ...@@ -1355,7 +1367,7 @@ Deletes a preferred language from the specified position on the preferred langua
| ----- | ------ | ---- | --------------------- | | ----- | ------ | ---- | --------------------- |
| index | number | Yes | Position of the preferred language to delete.| | index | number | Yes | Position of the preferred language to delete.|
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -1376,7 +1388,7 @@ Obtains the list of preferred languages. ...@@ -1376,7 +1388,7 @@ Obtains the list of preferred languages.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | --------- | | ------------------- | --------- |
| Array&lt;string&gt; | List of preferred languages.| | Array&lt;string&gt; | List of preferred languages.|
...@@ -1395,7 +1407,7 @@ Obtains the first language in the preferred language list. ...@@ -1395,7 +1407,7 @@ Obtains the first language in the preferred language list.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | -------------- | | ------ | -------------- |
| string | First language in the preferred language list.| | string | First language in the preferred language list.|
...@@ -1406,6 +1418,25 @@ Obtains the first language in the preferred language list. ...@@ -1406,6 +1418,25 @@ Obtains the first language in the preferred language list.
``` ```
## i18n.getAppPreferredLanguage<sup>9+</sup>
getAppPreferredLanguage(): string
Obtains the preferred language of an application.
**System capability**: SystemCapability.Global.I18n
**Return value**
| Type | Description |
| ------ | -------------- |
| string | Preferred language of the application.|
**Example**
```
var appPreferredLanguage = i18n.getAppPreferredLanguage();
```
## i18n.getTimeZone<sup>7+</sup> ## i18n.getTimeZone<sup>7+</sup>
getTimeZone(zoneID?: string): TimeZone getTimeZone(zoneID?: string): TimeZone
...@@ -1419,7 +1450,7 @@ Obtains the **TimeZone** object corresponding to the specified time zone ID. ...@@ -1419,7 +1450,7 @@ Obtains the **TimeZone** object corresponding to the specified time zone ID.
| ------ | ------ | ---- | ----- | | ------ | ------ | ---- | ----- |
| zondID | string | No | Time zone ID.| | zondID | string | No | Time zone ID.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| -------- | ------------ | | -------- | ------------ |
| TimeZone | **TimeZone** object corresponding to the time zone ID.| | TimeZone | **TimeZone** object corresponding to the time zone ID.|
...@@ -1441,7 +1472,7 @@ Obtains the ID of the specified **TimeZone** object. ...@@ -1441,7 +1472,7 @@ Obtains the ID of the specified **TimeZone** object.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------ | | ------ | ------------ |
| string | Time zone ID corresponding to the **TimeZone** object.| | string | Time zone ID corresponding to the **TimeZone** object.|
...@@ -1467,7 +1498,7 @@ Obtains the representation of a **TimeZone** object in the specified locale. ...@@ -1467,7 +1498,7 @@ Obtains the representation of a **TimeZone** object in the specified locale.
| locale | string | No | System locale ID. | | 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** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------- | | ------ | ------------- |
| string | Representation of the **TimeZone** object in the specified locale.| | string | Representation of the **TimeZone** object in the specified locale.|
...@@ -1487,7 +1518,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an ...@@ -1487,7 +1518,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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.|
...@@ -1507,7 +1538,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an ...@@ -1507,7 +1538,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
**Return Value** **Return value**
| Type | Description | | 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.|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册