**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Description |
| ------ | ------ | --------------- |
...
...
@@ -275,7 +275,7 @@ Sets the system locale.
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
```
```js
i18n.setSystemLocale('zh-CN');
```
...
...
@@ -302,7 +302,7 @@ Checks whether the system language matches the specified region.
| boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise.|
**Example**
```
```js
i18n.isSuggested('zh','CN');
```
...
...
@@ -327,7 +327,7 @@ Obtains a **Calendar** object.
| [Calendar](#calendar8) | **Calendar** object.|
**Example**
```
```js
i18n.getCalendar("zh-Hans","gregory");
```
...
...
@@ -349,7 +349,7 @@ Sets the date for this **Calendar** object.
| date | Date | Yes | Date to be set for the **Calendar** object.|
**Example**
```
```js
varcalendar=i18n.getCalendar("en-US","gregory");
vardate=newDate(2021,10,7,8,0,0,0);
calendar.setTime(date);
...
...
@@ -370,7 +370,7 @@ Sets the date and time for this **Calendar** object. The value is represented by
| time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch.|
**Example**
```
```js
varcalendar=i18n.getCalendar("en-US","gregory");
calendar.setTime(10540800000);
```
...
...
@@ -395,7 +395,7 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object
| second | number | No | Second to set. |
**Example**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.set(2021,10,1,8,0,0);// set time to 2021.10.1 08:00:00
```
...
...
@@ -415,7 +415,7 @@ Sets the time zone of this **Calendar** object.
| timezone | string | Yes | Time zone, for example, **Asia/Shanghai**.|
**Example**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.setTimeZone("Asia/Shanghai");
```
...
...
@@ -435,7 +435,7 @@ Obtains the time zone of this **Calendar** object.
| string | Time zone of the **Calendar** object.|
**Example**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.setTimeZone("Asia/Shanghai");
calendar.getTimeZone();// Asia/Shanghai"
...
...
@@ -456,7 +456,7 @@ Obtains the start day of a week for this **Calendar** object.
| number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
**Example**
```
```js
varcalendar=i18n.getCalendar("en-US","gregory");
calendar.getFirstDayOfWeek();
```
...
...
@@ -476,7 +476,7 @@ Sets the start day of a week for this **Calendar** object.
| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
**Example**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.setFirstDayOfWeek(0);
```
...
...
@@ -496,7 +496,7 @@ Obtains the minimum number of days in the first week of a year.
| number | Minimum number of days in the first week of a year.|
**Example**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.getMinimalDaysInFirstWeek();
```
...
...
@@ -516,7 +516,7 @@ Sets the 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**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.setMinimalDaysInFirstWeek(3);
```
...
...
@@ -541,7 +541,7 @@ Obtains the value of the specified field in the **Calendar** object.
| 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**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.set(2021,10,1,8,0,0);// set time to 2021.10.1 08:00:00
calendar.get("hour_of_day");// 8
...
...
@@ -567,7 +567,7 @@ Obtains the name of the **Calendar** object displayed for the specified locale.
| string | Name of the **Calendar** object displayed for the specified locale.|
**Example**
```
```js
varcalendar=i18n.getCalendar("en-US","buddhist");
calendar.getDisplayName("zh");// Obtain the name of the Buddhist calendar in zh.
```
...
...
@@ -592,7 +592,7 @@ Checks whether the specified date in this **Calendar** object is a weekend.
| boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday.|
**Example**
```
```js
varcalendar=i18n.getCalendar("zh-Hans");
calendar.set(2021,11,11,8,0,0);// set time to 2021.11.11 08:00:00
calendar.isWeekend();// false
...
...
@@ -619,7 +619,7 @@ Parameters
| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. |
@@ -1034,7 +1059,7 @@ Obtains the type of the input character string.
| string | Type of the input character.|
**Example**
```
```js
vartype=i18n.Character.getType("a");
```
...
...
@@ -1058,7 +1083,7 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation.
| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
```
...
...
@@ -1080,7 +1105,7 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object.
| text | string | Yes | Text to be processed by the **BreakIterator** object.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
```
...
...
@@ -1100,7 +1125,7 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object.
| string | Text being processed by the **BreakIterator** object.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.getLineBreakText();// Apple is my favorite fruit.
...
...
@@ -1121,7 +1146,7 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text
| number | Position of the **BreakIterator** object in the text being processed.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.current();// 0
...
...
@@ -1142,7 +1167,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi
| number | Offset to the first text boundary of the processed text.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.first();// 0
...
...
@@ -1163,7 +1188,7 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic
| number | Offset of the last text boundary of the processed text.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.last();// 27
...
...
@@ -1189,7 +1214,7 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb
| 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**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.first();// 0
...
...
@@ -1212,7 +1237,7 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary.
| 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**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.first();// 0
...
...
@@ -1240,7 +1265,7 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the
| 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**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.following(0);// 6
...
...
@@ -1268,7 +1293,7 @@ Checks whether the position specified by the offset is a text boundary. If **tru
| boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise.|
**Example**
```
```js
variterator=i18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit.");
iterator.isBoundary(0);// true;
...
...
@@ -1290,7 +1315,7 @@ Checks whether the 24-hour clock is used.
| boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise.|
**Example**
```
```js
varis24HourClock=i18n.is24HourClock();
```
...
...
@@ -1316,7 +1341,7 @@ Sets the 24-hour clock.
| boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise.|
**Example**
```
```js
// Set the system time to the 24-hour clock.
varsuccess=i18n.set24HourClock(true);
```
...
...
@@ -1344,7 +1369,7 @@ Adds a preferred language to the specified position on the preferred language li
| boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise.|
**Example**
```
```js
// Add zh-CN to the preferred language list.
varlanguage='zh-CN';
varindex=0;
...
...
@@ -1373,7 +1398,7 @@ Deletes a preferred language from the specified position on the preferred langua
| boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise.|
**Example**
```
```js
// Delete the first preferred language from the preferred language list.
varindex=0;
varsuccess=i18n.removePreferredLanguage(index);
...
...
@@ -1394,7 +1419,7 @@ Obtains the list of preferred languages.
| Array<string> | List of preferred languages.|
| 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.|
**Example**
```js
varstatus=i18n.setUsingLocalDigit(true);
```
## i18n.getUsingLocalDigit<sup>9+</sup>
getUsingLocalDigit(): boolean
Checks whether the local digit switch is turned on.
| 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.|
| **Source code of the Latest Release**| **Version Information**| **Site**| **SHA-256 Verification Code**|
| Full code base (for mini, small, and standard systems)| 3.2 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/code-v3.2-Beta1.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/code-v3.2-Beta1.tar.gz.sha256)|
| RK3568 standard system solution (binary)| 3.2 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta1/standard_rk3568.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/standard_rk3568.tar.gz.sha256)|
| Full code base (for mini, small, and standard systems)| 3.2 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta2/code-v3.2-Beta2.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta2/code-v3.2-Beta2.tar.gz.sha256)|
| RK3568 standard system solution (binary)| 3.2 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta2/standard_rk3568.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/standard_rk3568.tar.gz.sha256)|