“6d98ba3074799c21dd577a273d6a33c59d555596”上不存在“paddle/git@gitcode.net:s920243400/PaddleDetection.git”
提交 69f91a39 编写于 作者: S sunyaozu

add syscap to i18n and intl

Signed-off-by: Nsunyaozu <sunyaozu@huawei.com>
上级 123e33ee
...@@ -13,17 +13,14 @@ import i18n from '@ohos.i18n'; ...@@ -13,17 +13,14 @@ import i18n from '@ohos.i18n';
``` ```
## 权限
## i18n.getDisplayLanguage ## i18n.getDisplayLanguage
getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string
获取指定语言的本地化显示文本。 获取指定语言的本地化显示文本。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -49,6 +46,8 @@ getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): stri ...@@ -49,6 +46,8 @@ getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): stri
获取指定国家的本地化显示文本。 获取指定国家的本地化显示文本。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -74,6 +73,8 @@ isRTL(locale: string): boolean ...@@ -74,6 +73,8 @@ isRTL(locale: string): boolean
获取是否为从右至左显示语言。 获取是否为从右至左显示语言。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 说明 | | 参数名 | 类型 | 说明 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
...@@ -97,6 +98,8 @@ getSystemLanguage(): string ...@@ -97,6 +98,8 @@ getSystemLanguage(): string
获取系统语言。 获取系统语言。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -114,6 +117,8 @@ getSystemRegion(): string ...@@ -114,6 +117,8 @@ getSystemRegion(): string
获取系统地区。 获取系统地区。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -131,6 +136,8 @@ getSystemLocale(): string ...@@ -131,6 +136,8 @@ getSystemLocale(): string
获取系统区域。 获取系统区域。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -148,6 +155,8 @@ getCalendar(locale: string, type? : string): Calendar ...@@ -148,6 +155,8 @@ getCalendar(locale: string, type? : string): Calendar
获取日历对象。 获取日历对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -174,6 +183,8 @@ setTime(date: Date): void ...@@ -174,6 +183,8 @@ setTime(date: Date): void
设置日历对象内部的时间日期。 设置日历对象内部的时间日期。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -193,6 +204,8 @@ setTime(time: number): void ...@@ -193,6 +204,8 @@ setTime(time: number): void
设置日历对象内部的时间日期, time为从1970.1.1 00:00:00 GMT逝去的毫秒数。 设置日历对象内部的时间日期, time为从1970.1.1 00:00:00 GMT逝去的毫秒数。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -211,6 +224,8 @@ set(year: number, month: number, date:number, hour?: number, minute?: number, se ...@@ -211,6 +224,8 @@ set(year: number, month: number, date:number, hour?: number, minute?: number, se
设置日历对象的年、月、日、时、分、秒。 设置日历对象的年、月、日、时、分、秒。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -234,6 +249,8 @@ setTimeZone(timezone: string): void ...@@ -234,6 +249,8 @@ setTimeZone(timezone: string): void
设置日历对象的时区。 设置日历对象的时区。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -252,6 +269,8 @@ getTimeZone(): string ...@@ -252,6 +269,8 @@ getTimeZone(): string
获取日历对象的时区。 获取日历对象的时区。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -271,6 +290,8 @@ getFirstDayOfWeek(): number ...@@ -271,6 +290,8 @@ getFirstDayOfWeek(): number
获取日历对象的一周起始日。 获取日历对象的一周起始日。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -289,6 +310,8 @@ setFirstDayOfWeek(value: number): void ...@@ -289,6 +310,8 @@ setFirstDayOfWeek(value: number): void
设置每一周的起始日。 设置每一周的起始日。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -307,6 +330,8 @@ getMinimalDaysInFirstWeek(): number ...@@ -307,6 +330,8 @@ getMinimalDaysInFirstWeek(): number
获取一年中第一周的最小天数。 获取一年中第一周的最小天数。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -325,6 +350,8 @@ setMinimalDaysInFirstWeek(value: number): void ...@@ -325,6 +350,8 @@ setMinimalDaysInFirstWeek(value: number): void
设置一年中第一周的最小天数。 设置一年中第一周的最小天数。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -343,6 +370,8 @@ get(field: string): number ...@@ -343,6 +370,8 @@ get(field: string): number
获取日历对象中与field相关联的值。 获取日历对象中与field相关联的值。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -367,6 +396,8 @@ getDisplayName(locale: string): string ...@@ -367,6 +396,8 @@ getDisplayName(locale: string): string
获取日历对象在locale所指定的区域的名字。 获取日历对象在locale所指定的区域的名字。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -390,6 +421,8 @@ isWeekend(date?: Date): boolean ...@@ -390,6 +421,8 @@ isWeekend(date?: Date): boolean
判断给定的日期是否在日历中是周末。 判断给定的日期是否在日历中是周末。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -419,6 +452,8 @@ constructor(country: string, options?: PhoneNumberFormatOptions) ...@@ -419,6 +452,8 @@ constructor(country: string, options?: PhoneNumberFormatOptions)
创建电话号码格式化对象。 创建电话号码格式化对象。
**系统能力**:SystemCapability.Global.I18n
参数: 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -437,6 +472,8 @@ isValidNumber(number: string): boolean ...@@ -437,6 +472,8 @@ isValidNumber(number: string): boolean
判断传入的电话号码格式是否正确。 判断传入的电话号码格式是否正确。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -460,6 +497,8 @@ format(number: string): string ...@@ -460,6 +497,8 @@ format(number: string): string
对电话号码进行格式化。 对电话号码进行格式化。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -484,7 +523,7 @@ format(number: string): string ...@@ -484,7 +523,7 @@ format(number: string): string
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| type | string | 是 | 是 | 表示对电话号码格式化的类型,取值范围:"E164",&nbsp;"INTERNATIONAL",&nbsp;"NATIONAL",&nbsp;"RFC3966"。 | | type | string | 是 | 是 | 表示对电话号码格式化的类型,取值范围:"E164",&nbsp;"INTERNATIONAL",&nbsp;"NATIONAL",&nbsp;"RFC3966"。<br/>**系统能力**:SystemCapability.Global.I18n |
## UnitInfo<sup>8+</sup> ## UnitInfo<sup>8+</sup>
...@@ -495,7 +534,7 @@ format(number: string): string ...@@ -495,7 +534,7 @@ format(number: string): string
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| unit | string | 是 | 是 | 单位的名称,如:"meter",&nbsp;"inch",&nbsp;"cup"等。 | | unit | string | 是 | 是 | 单位的名称,如:"meter",&nbsp;"inch",&nbsp;"cup"等。 |
| measureSystem | string | 是 | 是 | 单位的度量体系,取值包括:"SI",&nbsp;"US",&nbsp;"UK"。 | | measureSystem | string | 是 | 是 | 单位的度量体系,取值包括:"SI",&nbsp;"US",&nbsp;"UK"。<br/>**系统能力**:SystemCapability.Global.I18n |
## Util<sup>8+</sup> ## Util<sup>8+</sup>
...@@ -507,6 +546,8 @@ unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, ...@@ -507,6 +546,8 @@ unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string,
将fromUnit的单位转换为toUnit的单位,并根据区域与风格进行格式化。 将fromUnit的单位转换为toUnit的单位,并根据区域与风格进行格式化。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -536,6 +577,8 @@ getInstance(): IndexUtil ...@@ -536,6 +577,8 @@ getInstance(): IndexUtil
创建并返回IndexUtil对象。 创建并返回IndexUtil对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -558,6 +601,8 @@ getIndexList(): Array&lt;string&gt; ...@@ -558,6 +601,8 @@ getIndexList(): Array&lt;string&gt;
获取当前locale对应的索引列表。 获取当前locale对应的索引列表。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -576,6 +621,8 @@ addLocale(locale: string) ...@@ -576,6 +621,8 @@ addLocale(locale: string)
将新的locale对应的索引加入当前索引列表。 将新的locale对应的索引加入当前索引列表。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -594,6 +641,8 @@ getIndex(text: string): string ...@@ -594,6 +641,8 @@ getIndex(text: string): string
获取text对应的索引。 获取text对应的索引。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -620,6 +669,8 @@ isDigit(char: string): boolean ...@@ -620,6 +669,8 @@ isDigit(char: string): boolean
判断字符串char是否是数字。 判断字符串char是否是数字。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -642,6 +693,8 @@ isSpaceChar(char: string): boolean ...@@ -642,6 +693,8 @@ isSpaceChar(char: string): boolean
判断字符串char是否是空格符。 判断字符串char是否是空格符。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -664,6 +717,8 @@ isWhitespace(char: string): boolean ...@@ -664,6 +717,8 @@ isWhitespace(char: string): boolean
判断字符串char是否是空白符。 判断字符串char是否是空白符。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -686,6 +741,8 @@ isRTL(char: string): boolean ...@@ -686,6 +741,8 @@ isRTL(char: string): boolean
判断字符串char是否是从右到左语言的字符。 判断字符串char是否是从右到左语言的字符。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -708,6 +765,8 @@ isIdeograph(char: string): boolean ...@@ -708,6 +765,8 @@ isIdeograph(char: string): boolean
判断字符串char是否是表意文字。 判断字符串char是否是表意文字。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -730,6 +789,8 @@ isLetter(char: string): boolean ...@@ -730,6 +789,8 @@ isLetter(char: string): boolean
判断字符串char是否是字母。 判断字符串char是否是字母。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -752,6 +813,8 @@ isLowerCase(char: string): boolean ...@@ -752,6 +813,8 @@ isLowerCase(char: string): boolean
判断字符串char是否是小写字母。 判断字符串char是否是小写字母。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -774,6 +837,8 @@ isUpperCase(char: string): boolean ...@@ -774,6 +837,8 @@ isUpperCase(char: string): boolean
判断字符串char是否是大写字母。 判断字符串char是否是大写字母。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -796,6 +861,8 @@ getType(char: string): string ...@@ -796,6 +861,8 @@ getType(char: string): string
获取输入字符串的一般类别值。 获取输入字符串的一般类别值。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -818,6 +885,8 @@ getLineInstance(locale: string): BreakIterator ...@@ -818,6 +885,8 @@ getLineInstance(locale: string): BreakIterator
获取一个用于断句的[BreakIterator](#breakiterator8)对象。 获取一个用于断句的[BreakIterator](#breakiterator8)对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -843,6 +912,8 @@ setLineBreakText(text: string): void ...@@ -843,6 +912,8 @@ setLineBreakText(text: string): void
设置[BreakIterator](#breakiterator8)要处理的文本。 设置[BreakIterator](#breakiterator8)要处理的文本。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -861,6 +932,8 @@ getLineBreakText(): string ...@@ -861,6 +932,8 @@ getLineBreakText(): string
获取[BreakIterator](#breakiterator8)当前处理的文本。 获取[BreakIterator](#breakiterator8)当前处理的文本。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -880,6 +953,8 @@ current(): number ...@@ -880,6 +953,8 @@ current(): number
获取[BreakIterator](#breakiterator8)对象在当前处理的文本中的位置。 获取[BreakIterator](#breakiterator8)对象在当前处理的文本中的位置。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -899,6 +974,8 @@ first(): number ...@@ -899,6 +974,8 @@ first(): number
[BreakIterator](#breakiterator8)对象设置到第一个可断句的分割点。第一个分割点总是被处理的文本的起始位置。 [BreakIterator](#breakiterator8)对象设置到第一个可断句的分割点。第一个分割点总是被处理的文本的起始位置。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -918,6 +995,8 @@ last(): number ...@@ -918,6 +995,8 @@ last(): number
[BreakIterator](#breakiterator8)对象的位置设置到最后一个可断句的分割点。最后一个分割点总是被处理文本末尾的下一个位置。 [BreakIterator](#breakiterator8)对象的位置设置到最后一个可断句的分割点。最后一个分割点总是被处理文本末尾的下一个位置。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -937,6 +1016,8 @@ next(index?: number): number ...@@ -937,6 +1016,8 @@ next(index?: number): number
如果index给出,并且index是一个正数将[BreakIterator](#breakiterator8)向后移动number个可断句的分割点,如果n是一个负数,向前移动相应个分割点。若index没有给出,则相当于index = 1。 如果index给出,并且index是一个正数将[BreakIterator](#breakiterator8)向后移动number个可断句的分割点,如果n是一个负数,向前移动相应个分割点。若index没有给出,则相当于index = 1。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -963,6 +1044,8 @@ previous(): number ...@@ -963,6 +1044,8 @@ previous(): number
[BreakIterator](#breakiterator8)移动到前一个分割点处。 [BreakIterator](#breakiterator8)移动到前一个分割点处。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -984,6 +1067,8 @@ following(offset: number): number ...@@ -984,6 +1067,8 @@ following(offset: number): number
[BreakIterator](#breakiterator8)设置到由offset指定的位置的后面一个分割点。返回移动后[BreakIterator](#breakiterator8)的位置。 [BreakIterator](#breakiterator8)设置到由offset指定的位置的后面一个分割点。返回移动后[BreakIterator](#breakiterator8)的位置。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1010,6 +1095,8 @@ isBoundary(offset: number): boolean ...@@ -1010,6 +1095,8 @@ isBoundary(offset: number): boolean
如果offset所指定的文本位置是一个分割点,那么返回true,否则返回false。如果返回true, 将[BreakIterator](#breakiterator8)对象设置到offset所指定的位置, 否则相当于调用[following](#following8)(offset) 如果offset所指定的文本位置是一个分割点,那么返回true,否则返回false。如果返回true, 将[BreakIterator](#breakiterator8)对象设置到offset所指定的位置, 否则相当于调用[following](#following8)(offset)
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1029,12 +1116,14 @@ isBoundary(offset: number): boolean ...@@ -1029,12 +1116,14 @@ isBoundary(offset: number): boolean
``` ```
## i18n.is24HourClock ## i18n.is24HourClock<sup>8+</sup>
is24HourClock(): boolean is24HourClock(): boolean
判断系统时间是否为24小时制。 判断系统时间是否为24小时制。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -1046,12 +1135,14 @@ is24HourClock(): boolean ...@@ -1046,12 +1135,14 @@ is24HourClock(): boolean
``` ```
## i18n.set24HourClock ## i18n.set24HourClock<sup>8+</sup>
set24HourClock(option: boolean): boolean set24HourClock(option: boolean): boolean
修改系统时间的24小时制设置。 修改系统时间的24小时制设置。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1069,12 +1160,14 @@ set24HourClock(option: boolean): boolean ...@@ -1069,12 +1160,14 @@ set24HourClock(option: boolean): boolean
``` ```
## i18n.addPreferredLanguage ## i18n.addPreferredLanguage<sup>8+</sup>
addPreferredLanguage(language: string, index?: number): boolean addPreferredLanguage(language: string, index?: number): boolean
在系统偏好语言列表中的指定位置添加偏好语言。 在系统偏好语言列表中的指定位置添加偏好语言。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1095,12 +1188,14 @@ addPreferredLanguage(language: string, index?: number): boolean ...@@ -1095,12 +1188,14 @@ addPreferredLanguage(language: string, index?: number): boolean
``` ```
## i18n.removeDisplayLanguage ## i18n.removeDisplayLanguage<sup>8+</sup>
removeDisplayLanguage(index: number): boolean removeDisplayLanguage(index: number): boolean
删除系统偏好语言列表中指定位置的偏好语言。 删除系统偏好语言列表中指定位置的偏好语言。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -1119,12 +1214,14 @@ removeDisplayLanguage(index: number): boolean ...@@ -1119,12 +1214,14 @@ removeDisplayLanguage(index: number): boolean
``` ```
## i18n.getPreferredLanguageList ## i18n.getPreferredLanguageList<sup>8+</sup>
getPreferredLanguageList(): Array<string> getPreferredLanguageList(): Array<string>
获取系统偏好语言列表。 获取系统偏好语言列表。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -1136,12 +1233,14 @@ getPreferredLanguageList(): Array<string> ...@@ -1136,12 +1233,14 @@ getPreferredLanguageList(): Array<string>
``` ```
## i18n.getFirstPreferredLanguage ## i18n.getFirstPreferredLanguage<sup>8+</sup>
getFirstPreferredLanguage(): string getFirstPreferredLanguage(): string
获取与Hap资源最佳匹配的偏好语言。 获取与Hap资源最佳匹配的偏好语言。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
......
...@@ -13,11 +13,6 @@ import Intl from '@ohos.intl'; ...@@ -13,11 +13,6 @@ import Intl from '@ohos.intl';
``` ```
## 权限列表
## Locale ## Locale
...@@ -25,16 +20,16 @@ import Intl from '@ohos.intl'; ...@@ -25,16 +20,16 @@ import Intl from '@ohos.intl';
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| language | string | 是 | 否 | 与区域设置关联的语,&nbsp;如:zh。 | | language | string | 是 | 否 | 与区域设置关联的语,&nbsp;如:zh。<br/>**系统能力**:SystemCapability.Global.I18n |
| script | string | 是 | 否 | 语言的书写方式,如:Hans。 | | script | string | 是 | 否 | 语言的书写方式,如:Hans。<br/>**系统能力**:SystemCapability.Global.I18n |
| region | string | 是 | 否 | 与区域设置相关的地区,如:CN。 | | region | string | 是 | 否 | 与区域设置相关的地区,如:CN。<br/>**系统能力**:SystemCapability.Global.I18n |
| baseName | string | 是 | 否 | Locale的基本核心信息(由语言脚本与地区组成),如:zh-Hans-CN。 | | baseName | string | 是 | 否 | Locale的基本核心信息(由语言脚本与地区组成),如:zh-Hans-CN。<br/>**系统能力**:SystemCapability.Global.I18n |
| caseFirst | string | 是 | 否 | 区域的整理规则是否考虑大小写,取值包括:"upper",&nbsp;"lower",&nbsp;"false"。 | | caseFirst | string | 是 | 否 | 区域的整理规则是否考虑大小写,取值包括:"upper",&nbsp;"lower",&nbsp;"false"。<br/>**系统能力**:SystemCapability.Global.I18n |
| calendar | string | 是 | 否 | 区域的日历信息,取值包括:"buddhist",&nbsp;"chinese",&nbsp;"coptic","dangi",&nbsp;"ethioaa",&nbsp;"ethiopic",&nbsp;"gregory",&nbsp;"hebrew",&nbsp;"indian",&nbsp;"islamic",&nbsp;"islamic-umalqura",&nbsp;"islamic-tbla",&nbsp;"islamic-civil",&nbsp;"islamic-rgsa",&nbsp;"iso8601",&nbsp;"japanese",&nbsp;"persian",&nbsp;"roc",&nbsp;"islamicc"。 | | calendar | string | 是 | 否 | 区域的日历信息,取值包括:"buddhist",&nbsp;"chinese",&nbsp;"coptic","dangi",&nbsp;"ethioaa",&nbsp;"ethiopic",&nbsp;"gregory",&nbsp;"hebrew",&nbsp;"indian",&nbsp;"islamic",&nbsp;"islamic-umalqura",&nbsp;"islamic-tbla",&nbsp;"islamic-civil",&nbsp;"islamic-rgsa",&nbsp;"iso8601",&nbsp;"japanese",&nbsp;"persian",&nbsp;"roc",&nbsp;"islamicc"。<br/>**系统能力**:SystemCapability.Global.I18n |
| collation | string | 是 | 否 | 区域的排序规则,取值包括:"big5han",&nbsp;"compat",&nbsp;"dict",&nbsp;"direct",&nbsp;"ducet",&nbsp;"eor",&nbsp;"gb2312",&nbsp;"phonebk",&nbsp;"phonetic",&nbsp;"pinyin",&nbsp;"reformed",&nbsp;"searchjl",&nbsp;"stroke",&nbsp;"trad",&nbsp;"unihan",&nbsp;"zhuyin"。 | | collation | string | 是 | 否 | 区域的排序规则,取值包括:"big5han",&nbsp;"compat",&nbsp;"dict",&nbsp;"direct",&nbsp;"ducet",&nbsp;"eor",&nbsp;"gb2312",&nbsp;"phonebk",&nbsp;"phonetic",&nbsp;"pinyin",&nbsp;"reformed",&nbsp;"searchjl",&nbsp;"stroke",&nbsp;"trad",&nbsp;"unihan",&nbsp;"zhuyin"。<br/>**系统能力**:SystemCapability.Global.I18n |
| hourCycle | string | 是 | 否 | 区域的时制信息,取值包括:"h12",&nbsp;"h23",&nbsp;"h11",&nbsp;"h24"。 | | hourCycle | string | 是 | 否 | 区域的时制信息,取值包括:"h12",&nbsp;"h23",&nbsp;"h11",&nbsp;"h24"。<br/>**系统能力**:SystemCapability.Global.I18n |
| numberingSystem | string | 是 | 否 | 区域使用的数字系统,取值包括:"adlm",&nbsp;"ahom",&nbsp;"arab",&nbsp;"arabext",&nbsp;"bali",&nbsp;"beng",&nbsp;"bhks",&nbsp;"brah",&nbsp;"cakm",&nbsp;"cham",&nbsp;"deva",&nbsp;"diak",&nbsp;"fullwide",&nbsp;"gong",&nbsp;"gonm",&nbsp;"gujr",&nbsp;"guru",&nbsp;"hanidec",&nbsp;"hmng",&nbsp;"hmnp",&nbsp;"java",&nbsp;"kali",&nbsp;"khmr",&nbsp;"knda",&nbsp;"lana",&nbsp;"lanatham",&nbsp;"laoo",&nbsp;"latn",&nbsp;"lepc",&nbsp;"limb",&nbsp;"mathbold",&nbsp;"mathdbl",&nbsp;"mathmono",&nbsp;"mathsanb",&nbsp;"mathsans",&nbsp;"mlym",&nbsp;"modi",&nbsp;"mong",&nbsp;"mroo",&nbsp;"mtei",&nbsp;"mymr",&nbsp;"mymrshan",&nbsp;"mymrtlng",&nbsp;"newa",&nbsp;"nkoo",&nbsp;"olck",&nbsp;"orya",&nbsp;"osma",&nbsp;"rohg",&nbsp;"saur",&nbsp;"segment",&nbsp;"shrd",&nbsp;"sind",&nbsp;"sinh",&nbsp;"sora",&nbsp;"sund",&nbsp;"takr",&nbsp;"talu",&nbsp;"tamldec",&nbsp;"telu",&nbsp;"thai",&nbsp;"tibt",&nbsp;"tirh",&nbsp;"vaii",&nbsp;"wara",&nbsp;"wcho"。 | | numberingSystem | string | 是 | 否 | 区域使用的数字系统,取值包括:"adlm",&nbsp;"ahom",&nbsp;"arab",&nbsp;"arabext",&nbsp;"bali",&nbsp;"beng",&nbsp;"bhks",&nbsp;"brah",&nbsp;"cakm",&nbsp;"cham",&nbsp;"deva",&nbsp;"diak",&nbsp;"fullwide",&nbsp;"gong",&nbsp;"gonm",&nbsp;"gujr",&nbsp;"guru",&nbsp;"hanidec",&nbsp;"hmng",&nbsp;"hmnp",&nbsp;"java",&nbsp;"kali",&nbsp;"khmr",&nbsp;"knda",&nbsp;"lana",&nbsp;"lanatham",&nbsp;"laoo",&nbsp;"latn",&nbsp;"lepc",&nbsp;"limb",&nbsp;"mathbold",&nbsp;"mathdbl",&nbsp;"mathmono",&nbsp;"mathsanb",&nbsp;"mathsans",&nbsp;"mlym",&nbsp;"modi",&nbsp;"mong",&nbsp;"mroo",&nbsp;"mtei",&nbsp;"mymr",&nbsp;"mymrshan",&nbsp;"mymrtlng",&nbsp;"newa",&nbsp;"nkoo",&nbsp;"olck",&nbsp;"orya",&nbsp;"osma",&nbsp;"rohg",&nbsp;"saur",&nbsp;"segment",&nbsp;"shrd",&nbsp;"sind",&nbsp;"sinh",&nbsp;"sora",&nbsp;"sund",&nbsp;"takr",&nbsp;"talu",&nbsp;"tamldec",&nbsp;"telu",&nbsp;"thai",&nbsp;"tibt",&nbsp;"tirh",&nbsp;"vaii",&nbsp;"wara",&nbsp;"wcho"。<br/>**系统能力**:SystemCapability.Global.I18n |
| numeric | boolean | 是 | 否 | 是否对数字字符具有特殊的排序规则处理。 | | numeric | boolean | 是 | 否 | 是否对数字字符具有特殊的排序规则处理。<br/>**系统能力**:SystemCapability.Global.I18n |
### constructor ### constructor
...@@ -43,6 +38,8 @@ constructor(locale: string, options?: options) ...@@ -43,6 +38,8 @@ constructor(locale: string, options?: options)
创建区域对象 创建区域对象
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -61,6 +58,8 @@ toString(): string ...@@ -61,6 +58,8 @@ toString(): string
将区域信息转换为字符串 将区域信息转换为字符串
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -79,6 +78,8 @@ maximize(): Locale ...@@ -79,6 +78,8 @@ maximize(): Locale
最大化区域信息,若缺少脚本与地区信息,则补齐。 最大化区域信息,若缺少脚本与地区信息,则补齐。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -97,6 +98,8 @@ minimize(): Locale ...@@ -97,6 +98,8 @@ minimize(): Locale
最小化区域信息,若包含脚本与地区信息,则去除。 最小化区域信息,若包含脚本与地区信息,则去除。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -118,6 +121,8 @@ constructor(locale: string, options?: DateTimeOptions) ...@@ -118,6 +121,8 @@ constructor(locale: string, options?: DateTimeOptions)
创建时间日期格式化对象。 创建时间日期格式化对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -136,6 +141,8 @@ constructor(locales: Array&lt;string&gt;, options?: DateTimeOptions) ...@@ -136,6 +141,8 @@ constructor(locales: Array&lt;string&gt;, options?: DateTimeOptions)
创建时间日期格式化对象。 创建时间日期格式化对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -154,6 +161,8 @@ format(date: Date): string ...@@ -154,6 +161,8 @@ format(date: Date): string
格式化时间日期字符串。 格式化时间日期字符串。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -178,6 +187,8 @@ formatRange(fromDate: Date, toDate: Date): string ...@@ -178,6 +187,8 @@ formatRange(fromDate: Date, toDate: Date): string
格式化时间日期段字符串。 格式化时间日期段字符串。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -204,6 +215,8 @@ resolvedOptions(): DateTimeOptions ...@@ -204,6 +215,8 @@ resolvedOptions(): DateTimeOptions
获取DateTimeFormat对象的格式化选项。 获取DateTimeFormat对象的格式化选项。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -222,25 +235,25 @@ resolvedOptions(): DateTimeOptions ...@@ -222,25 +235,25 @@ resolvedOptions(): DateTimeOptions
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 否 | 区域参数,&nbsp;如:zh-Hans-CN。 | | locale | string | 是 | 否 | 区域参数,&nbsp;如:zh-Hans-CN。<br/>**系统能力**:SystemCapability.Global.I18n |
| dateStyle | string | 是 | 是 | 日期显示格式,取值包括:"long",&nbsp;"short",&nbsp;"medium",&nbsp;"full"。 | | dateStyle | string | 是 | 是 | 日期显示格式,取值包括:"long",&nbsp;"short",&nbsp;"medium",&nbsp;"full"。<br/>**系统能力**:SystemCapability.Global.I18n |
| timeStyle | string | 是 | 是 | 时间显示格式,取值包括:"long",&nbsp;"short",&nbsp;"medium",&nbsp;"full"。 | | timeStyle | string | 是 | 是 | 时间显示格式,取值包括:"long",&nbsp;"short",&nbsp;"medium",&nbsp;"full"。<br/>**系统能力**:SystemCapability.Global.I18n |
| hourCycle | string | 是 | 是 | 时制格式,取值包括:"h11",&nbsp;"h12",&nbsp;"h23",&nbsp;"h24"。 | | hourCycle | string | 是 | 是 | 时制格式,取值包括:"h11",&nbsp;"h12",&nbsp;"h23",&nbsp;"h24"。<br/>**系统能力**:SystemCapability.Global.I18n |
| timeZone | string | 是 | 是 | 使用的时区(合法的IANA时区ID)。 | | timeZone | string | 是 | 是 | 使用的时区(合法的IANA时区ID)。<br/>**系统能力**:SystemCapability.Global.I18n |
| numberingSystem | string | 是 | 是 | 数字系统,取值包括:"adlm",&nbsp;"ahom",&nbsp;"arab",&nbsp;"arabext",&nbsp;"bali",&nbsp;"beng",&nbsp;"bhks",&nbsp;"brah",&nbsp;"cakm",&nbsp;"cham",&nbsp;"deva",&nbsp;"diak",&nbsp;"fullwide",&nbsp;"gong",&nbsp;"gonm",&nbsp;"gujr",&nbsp;"guru",&nbsp;"hanidec",&nbsp;"hmng",&nbsp;"hmnp",&nbsp;"java",&nbsp;"kali",&nbsp;"khmr",&nbsp;"knda",&nbsp;"lana",&nbsp;"lanatham",&nbsp;"laoo",&nbsp;"latn",&nbsp;"lepc",&nbsp;"limb",&nbsp;"mathbold",&nbsp;"mathdbl",&nbsp;"mathmono",&nbsp;"mathsanb",&nbsp;"mathsans",&nbsp;"mlym",&nbsp;"modi",&nbsp;"mong",&nbsp;"mroo",&nbsp;"mtei",&nbsp;"mymr",&nbsp;"mymrshan",&nbsp;"mymrtlng",&nbsp;"newa",&nbsp;"nkoo",&nbsp;"olck",&nbsp;"orya",&nbsp;"osma",&nbsp;"rohg",&nbsp;"saur",&nbsp;"segment",&nbsp;"shrd",&nbsp;"sind",&nbsp;"sinh",&nbsp;"sora",&nbsp;"sund",&nbsp;"takr",&nbsp;"talu",&nbsp;"tamldec",&nbsp;"telu",&nbsp;"thai",&nbsp;"tibt",&nbsp;"tirh",&nbsp;"vaii",&nbsp;"wara",&nbsp;"wcho"。 | | numberingSystem | string | 是 | 是 | 数字系统,取值包括:"adlm",&nbsp;"ahom",&nbsp;"arab",&nbsp;"arabext",&nbsp;"bali",&nbsp;"beng",&nbsp;"bhks",&nbsp;"brah",&nbsp;"cakm",&nbsp;"cham",&nbsp;"deva",&nbsp;"diak",&nbsp;"fullwide",&nbsp;"gong",&nbsp;"gonm",&nbsp;"gujr",&nbsp;"guru",&nbsp;"hanidec",&nbsp;"hmng",&nbsp;"hmnp",&nbsp;"java",&nbsp;"kali",&nbsp;"khmr",&nbsp;"knda",&nbsp;"lana",&nbsp;"lanatham",&nbsp;"laoo",&nbsp;"latn",&nbsp;"lepc",&nbsp;"limb",&nbsp;"mathbold",&nbsp;"mathdbl",&nbsp;"mathmono",&nbsp;"mathsanb",&nbsp;"mathsans",&nbsp;"mlym",&nbsp;"modi",&nbsp;"mong",&nbsp;"mroo",&nbsp;"mtei",&nbsp;"mymr",&nbsp;"mymrshan",&nbsp;"mymrtlng",&nbsp;"newa",&nbsp;"nkoo",&nbsp;"olck",&nbsp;"orya",&nbsp;"osma",&nbsp;"rohg",&nbsp;"saur",&nbsp;"segment",&nbsp;"shrd",&nbsp;"sind",&nbsp;"sinh",&nbsp;"sora",&nbsp;"sund",&nbsp;"takr",&nbsp;"talu",&nbsp;"tamldec",&nbsp;"telu",&nbsp;"thai",&nbsp;"tibt",&nbsp;"tirh",&nbsp;"vaii",&nbsp;"wara",&nbsp;"wcho"。<br/>**系统能力**:SystemCapability.Global.I18n |
| hour12 | boolean | 是 | 是 | 是否使用12小时制。 | | hour12 | boolean | 是 | 是 | 是否使用12小时制。<br/>**系统能力**:SystemCapability.Global.I18n |
| weekday | string | 是 | 是 | 工作日的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。 | | weekday | string | 是 | 是 | 工作日的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。<br/>**系统能力**:SystemCapability.Global.I18n |
| era | string | 是 | 是 | 时代的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。 | | era | string | 是 | 是 | 时代的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。<br/>**系统能力**:SystemCapability.Global.I18n |
| year | string | 是 | 是 | 年份的显示格式,取值包括:"numeric",&nbsp;"2-digit"。 | | year | string | 是 | 是 | 年份的显示格式,取值包括:"numeric",&nbsp;"2-digit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| month | string | 是 | 是 | 月份的显示格式,取值包括:"numeric",&nbsp;"2-digit",&nbsp;"long",&nbsp;"short",&nbsp;"narrow"。 | | month | string | 是 | 是 | 月份的显示格式,取值包括:"numeric",&nbsp;"2-digit",&nbsp;"long",&nbsp;"short",&nbsp;"narrow"。<br/>**系统能力**:SystemCapability.Global.I18n |
| day | string | 是 | 是 | 日期的显示格式,取值包括:"numeric",&nbsp;"2-digit"。 | | day | string | 是 | 是 | 日期的显示格式,取值包括:"numeric",&nbsp;"2-digit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| hour | string | 是 | 是 | 小时的显示格式,取值包括:"numeric",&nbsp;"2-digit"。 | | hour | string | 是 | 是 | 小时的显示格式,取值包括:"numeric",&nbsp;"2-digit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| minute | string | 是 | 是 | 分钟的显示格式,取值包括:"numeric",&nbsp;"2-digit"。 | | minute | string | 是 | 是 | 分钟的显示格式,取值包括:"numeric",&nbsp;"2-digit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| second | string | 是 | 是 | 秒钟的显示格式,取值包括:"numeric",&nbsp;"2-digit"。 | | second | string | 是 | 是 | 秒钟的显示格式,取值包括:"numeric",&nbsp;"2-digit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| timeZoneName | string | 是 | 是 | 时区名称的本地化表示。 | | timeZoneName | string | 是 | 是 | 时区名称的本地化表示。<br/>**系统能力**:SystemCapability.Global.I18n |
| dayPeriod | string | 是 | 是 | 时段的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。 | | dayPeriod | string | 是 | 是 | 时段的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。<br/>**系统能力**:SystemCapability.Global.I18n |
| localeMatcher | string | 是 | 是 | 要使用的区域匹配算法,取值包括:"lookup",&nbsp;"best&nbsp;fit"。 | | localeMatcher | string | 是 | 是 | 要使用的区域匹配算法,取值包括:"lookup",&nbsp;"best&nbsp;fit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| formatMatcher | string | 是 | 是 | 要使用的格式匹配算法,取值包括:"basic",&nbsp;"best&nbsp;fit"。 | | formatMatcher | string | 是 | 是 | 要使用的格式匹配算法,取值包括:"basic",&nbsp;"best&nbsp;fit"。<br/>**系统能力**:SystemCapability.Global.I18n |
## NumberFormat ## NumberFormat
...@@ -252,6 +265,8 @@ constructor(locale: string, options?: NumberOptions) ...@@ -252,6 +265,8 @@ constructor(locale: string, options?: NumberOptions)
创建数字格式化对象。 创建数字格式化对象。
**系统能力**:SystemCapability.Global.I18n
参数: 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -270,6 +285,8 @@ constructor(locales: Array&lt;string&gt;, options?: NumberOptions) ...@@ -270,6 +285,8 @@ constructor(locales: Array&lt;string&gt;, options?: NumberOptions)
创建数字格式化对象。 创建数字格式化对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -288,6 +305,8 @@ format(number: number): string; ...@@ -288,6 +305,8 @@ format(number: number): string;
格式化数字字符串。 格式化数字字符串。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -312,6 +331,8 @@ resolvedOptions(): NumberOptions ...@@ -312,6 +331,8 @@ resolvedOptions(): NumberOptions
获取NumberFormat 对象的格式化选项。 获取NumberFormat 对象的格式化选项。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -331,25 +352,25 @@ resolvedOptions(): NumberOptions ...@@ -331,25 +352,25 @@ resolvedOptions(): NumberOptions
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 否 | 区域参数,&nbsp;如:"zh-Hans-CN"。 | | locale | string | 是 | 否 | 区域参数,&nbsp;如:"zh-Hans-CN"。<br/>**系统能力**:SystemCapability.Global.I18n |
| currency | string | 是 | 是 | 货币单位,&nbsp;如:"EUR","CNY","USD"等。 | | currency | string | 是 | 是 | 货币单位,&nbsp;如:"EUR","CNY","USD"等。<br/>**系统能力**:SystemCapability.Global.I18n |
| currencySign | string | 是 | 是 | 货币单位的符号显示,取值包括:&nbsp;"symbol","narrowSymbol","code","name"&nbsp;。 | | currencySign | string | 是 | 是 | 货币单位的符号显示,取值包括:&nbsp;"symbol","narrowSymbol","code","name"&nbsp;<br/>**系统能力**:SystemCapability.Global.I18n |
| currencyDisplay | string | 是 | 是 | 货币的显示方式,取值包括:"symbol",&nbsp;"narrowSymbol",&nbsp;"code",&nbsp;"name"。 | | currencyDisplay | string | 是 | 是 | 货币的显示方式,取值包括:"symbol",&nbsp;"narrowSymbol",&nbsp;"code",&nbsp;"name"。<br/>**系统能力**:SystemCapability.Global.I18n |
| unit | string | 是 | 是 | 单位名称,如:"meter","inch",“hectare”等。 | | unit | string | 是 | 是 | 单位名称,如:"meter","inch",“hectare”等。<br/>**系统能力**:SystemCapability.Global.I18n |
| unitDisplay | string | 是 | 是 | 单位的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"medium"。 | | unitDisplay | string | 是 | 是 | 单位的显示格式,取值包括:"long",&nbsp;"short",&nbsp;"medium"。<br/>**系统能力**:SystemCapability.Global.I18n |
| unitUsage | string | 是 | 是 | 单位的使用场景,取值包括:"default",&nbsp;"area-land-agricult",&nbsp;"area-land-commercl",&nbsp;"area-land-residntl",&nbsp;"length-person",&nbsp;"length-person-small",&nbsp;"length-rainfall",&nbsp;"length-road",&nbsp;"length-road-small",&nbsp;"length-snowfall",&nbsp;"length-vehicle",&nbsp;"length-visiblty",&nbsp;"length-visiblty-small",&nbsp;"length-person-informal",&nbsp;"length-person-small-informal",&nbsp;"length-road-informal",&nbsp;"speed-road-travel",&nbsp;"speed-wind",&nbsp;"temperature-person",&nbsp;"temperature-weather",&nbsp;"volume-vehicle-fuel"。 | | unitUsage | string | 是 | 是 | 单位的使用场景,取值包括:"default",&nbsp;"area-land-agricult",&nbsp;"area-land-commercl",&nbsp;"area-land-residntl",&nbsp;"length-person",&nbsp;"length-person-small",&nbsp;"length-rainfall",&nbsp;"length-road",&nbsp;"length-road-small",&nbsp;"length-snowfall",&nbsp;"length-vehicle",&nbsp;"length-visiblty",&nbsp;"length-visiblty-small",&nbsp;"length-person-informal",&nbsp;"length-person-small-informal",&nbsp;"length-road-informal",&nbsp;"speed-road-travel",&nbsp;"speed-wind",&nbsp;"temperature-person",&nbsp;"temperature-weather",&nbsp;"volume-vehicle-fuel"。<br/>**系统能力**:SystemCapability.Global.I18n |
| signDisplay | string | 是 | 是 | 数字符号的显示格式,取值包括:"auto",&nbsp;"never",&nbsp;"always",&nbsp;"expectZero"。 | | signDisplay | string | 是 | 是 | 数字符号的显示格式,取值包括:"auto",&nbsp;"never",&nbsp;"always",&nbsp;"expectZero"。<br/>**系统能力**:SystemCapability.Global.I18n |
| compactDisplay | string | 是 | 是 | 紧凑型的显示格式,取值包括:"long",&nbsp;"short"。 | | compactDisplay | string | 是 | 是 | 紧凑型的显示格式,取值包括:"long",&nbsp;"short"。<br/>**系统能力**:SystemCapability.Global.I18n |
| notation | string | 是 | 是 | 数字的格式化规格,取值包括:"standard",&nbsp;"scientific",&nbsp;"engineering",&nbsp;"compact"。 | | notation | string | 是 | 是 | 数字的格式化规格,取值包括:"standard",&nbsp;"scientific",&nbsp;"engineering",&nbsp;"compact"。<br/>**系统能力**:SystemCapability.Global.I18n |
| localeMatcher | string | 是 | 是 | 要使用的区域匹配算法,取值包括:"lookup",&nbsp;"best&nbsp;fit"。 | | localeMatcher | string | 是 | 是 | 要使用的区域匹配算法,取值包括:"lookup",&nbsp;"best&nbsp;fit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| style | string | 是 | 是 | 数字的显示格式,取值包括:"decimal",&nbsp;"currency",&nbsp;"percent",&nbsp;"unit"。 | | style | string | 是 | 是 | 数字的显示格式,取值包括:"decimal",&nbsp;"currency",&nbsp;"percent",&nbsp;"unit"。<br/>**系统能力**:SystemCapability.Global.I18n |
| numberingSystem | string | 是 | 是 | 数字系统,取值包括:"adlm",&nbsp;"ahom",&nbsp;"arab",&nbsp;"arabext",&nbsp;"bali",&nbsp;"beng",&nbsp;"bhks",&nbsp;"brah",&nbsp;"cakm",&nbsp;"cham",&nbsp;"deva",&nbsp;"diak",&nbsp;"fullwide",&nbsp;"gong",&nbsp;"gonm",&nbsp;"gujr",&nbsp;"guru",&nbsp;"hanidec",&nbsp;"hmng",&nbsp;"hmnp",&nbsp;"java",&nbsp;"kali",&nbsp;"khmr",&nbsp;"knda",&nbsp;"lana",&nbsp;"lanatham",&nbsp;"laoo",&nbsp;"latn",&nbsp;"lepc",&nbsp;"limb",&nbsp;"mathbold",&nbsp;"mathdbl",&nbsp;"mathmono",&nbsp;"mathsanb",&nbsp;"mathsans",&nbsp;"mlym",&nbsp;"modi",&nbsp;"mong",&nbsp;"mroo",&nbsp;"mtei",&nbsp;"mymr",&nbsp;"mymrshan",&nbsp;"mymrtlng",&nbsp;"newa",&nbsp;"nkoo",&nbsp;"olck",&nbsp;"orya",&nbsp;"osma",&nbsp;"rohg",&nbsp;"saur",&nbsp;"segment",&nbsp;"shrd",&nbsp;"sind",&nbsp;"sinh",&nbsp;"sora",&nbsp;"sund",&nbsp;"takr",&nbsp;"talu",&nbsp;"tamldec",&nbsp;"telu",&nbsp;"thai",&nbsp;"tibt",&nbsp;"tirh",&nbsp;"vaii",&nbsp;"wara",&nbsp;"wcho"。 | | numberingSystem | string | 是 | 是 | 数字系统,取值包括:"adlm",&nbsp;"ahom",&nbsp;"arab",&nbsp;"arabext",&nbsp;"bali",&nbsp;"beng",&nbsp;"bhks",&nbsp;"brah",&nbsp;"cakm",&nbsp;"cham",&nbsp;"deva",&nbsp;"diak",&nbsp;"fullwide",&nbsp;"gong",&nbsp;"gonm",&nbsp;"gujr",&nbsp;"guru",&nbsp;"hanidec",&nbsp;"hmng",&nbsp;"hmnp",&nbsp;"java",&nbsp;"kali",&nbsp;"khmr",&nbsp;"knda",&nbsp;"lana",&nbsp;"lanatham",&nbsp;"laoo",&nbsp;"latn",&nbsp;"lepc",&nbsp;"limb",&nbsp;"mathbold",&nbsp;"mathdbl",&nbsp;"mathmono",&nbsp;"mathsanb",&nbsp;"mathsans",&nbsp;"mlym",&nbsp;"modi",&nbsp;"mong",&nbsp;"mroo",&nbsp;"mtei",&nbsp;"mymr",&nbsp;"mymrshan",&nbsp;"mymrtlng",&nbsp;"newa",&nbsp;"nkoo",&nbsp;"olck",&nbsp;"orya",&nbsp;"osma",&nbsp;"rohg",&nbsp;"saur",&nbsp;"segment",&nbsp;"shrd",&nbsp;"sind",&nbsp;"sinh",&nbsp;"sora",&nbsp;"sund",&nbsp;"takr",&nbsp;"talu",&nbsp;"tamldec",&nbsp;"telu",&nbsp;"thai",&nbsp;"tibt",&nbsp;"tirh",&nbsp;"vaii",&nbsp;"wara",&nbsp;"wcho"。<br/>**系统能力**:SystemCapability.Global.I18n |
| useGrouping | boolean | 是 | 是 | 是否分组显示。 | | useGrouping | boolean | 是 | 是 | 是否分组显示。<br/>**系统能力**:SystemCapability.Global.I18n |
| miniumumIntegerDigits | number | 是 | 是 | 表示要使用的最小整数位数,取值范围:1~21。 | | miniumumIntegerDigits | number | 是 | 是 | 表示要使用的最小整数位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
| miniumumFractionDigits | number | 是 | 是 | 表示要使用的最小分数位数,取值范围:0~20。 | | miniumumFractionDigits | number | 是 | 是 | 表示要使用的最小分数位数,取值范围:0~20。<br/>**系统能力**:SystemCapability.Global.I18n |
| maxiumumFractionDigits | number | 是 | 是 | 表示要使用的最大分数位数,取值范围:1~21。 | | maxiumumFractionDigits | number | 是 | 是 | 表示要使用的最大分数位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
| miniumumSignificantDigits | number | 是 | 是 | 表示要使用的最低有效位数,取值范围:1~21。 | | miniumumSignificantDigits | number | 是 | 是 | 表示要使用的最低有效位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
| maxiumumSignificantDigits | number | 是 | 是 | 表示要使用的最大有效位数,取值范围:1~21。 | | maxiumumSignificantDigits | number | 是 | 是 | 表示要使用的最大有效位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
## Collator<sup>8+</sup> ## Collator<sup>8+</sup>
...@@ -361,6 +382,8 @@ constructor() ...@@ -361,6 +382,8 @@ constructor()
创建排序对象。 创建排序对象。
**系统能力**:SystemCapability.Global.I18n
- 示例: - 示例:
``` ```
var collator = new Intl.Collator(); var collator = new Intl.Collator();
...@@ -373,6 +396,8 @@ constructor(locale: string | Array&lt;string&gt;, options?: CollatorOptions) ...@@ -373,6 +396,8 @@ constructor(locale: string | Array&lt;string&gt;, options?: CollatorOptions)
创建排序对象。 创建排序对象。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -392,6 +417,8 @@ compare(first: string, second: string): number ...@@ -392,6 +417,8 @@ compare(first: string, second: string): number
依据Collator的排序策略对两个字符串进行比较。 依据Collator的排序策略对两个字符串进行比较。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -416,6 +443,8 @@ resolvedOptions(): CollatorOptions ...@@ -416,6 +443,8 @@ resolvedOptions(): CollatorOptions
返回Collator对象的属性。 返回Collator对象的属性。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -434,13 +463,13 @@ resolvedOptions(): CollatorOptions ...@@ -434,13 +463,13 @@ resolvedOptions(): CollatorOptions
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| localeMatcher | string | 是 | 是 | locale匹配算法,取值范围:"best&nbsp;fit",&nbsp;"lookup"。 | | localeMatcher | string | 是 | 是 | locale匹配算法,取值范围:"best&nbsp;fit",&nbsp;"lookup"。<br/>**系统能力**:SystemCapability.Global.I18n |
| usage | string | 是 | 是 | 比较的用途,取值范围:"sort",&nbsp;"search"。 | | usage | string | 是 | 是 | 比较的用途,取值范围:"sort",&nbsp;"search"。<br/>**系统能力**:SystemCapability.Global.I18n |
| sensitivity | string | 是 | 是 | 表示字符串中的哪些差异会导致非零结果值,取值范围:"base",&nbsp;"accent",&nbsp;"case",&nbsp;"variant"。 | | sensitivity | string | 是 | 是 | 表示字符串中的哪些差异会导致非零结果值,取值范围:"base",&nbsp;"accent",&nbsp;"case",&nbsp;"variant"。<br/>**系统能力**:SystemCapability.Global.I18n |
| ignorePunctuation | boolean | 是 | 是 | 表示是否忽略标点符号,取值范围:true,&nbsp;false。 | | ignorePunctuation | boolean | 是 | 是 | 表示是否忽略标点符号,取值范围:true,&nbsp;false。<br/>**系统能力**:SystemCapability.Global.I18n |
| collation | string | 是 | 是 | 排序规则,取值范围:"big5han",&nbsp;"compat",&nbsp;"dict",&nbsp;"direct",&nbsp;"ducet",&nbsp;"eor",&nbsp;"gb2312",&nbsp;"phonebk",&nbsp;"phonetic",&nbsp;"pinyin",&nbsp;"reformed",&nbsp;"searchjl",&nbsp;"stroke",&nbsp;"trad",&nbsp;"unihan",&nbsp;"zhuyin"。 | | collation | string | 是 | 是 | 排序规则,取值范围:"big5han",&nbsp;"compat",&nbsp;"dict",&nbsp;"direct",&nbsp;"ducet",&nbsp;"eor",&nbsp;"gb2312",&nbsp;"phonebk",&nbsp;"phonetic",&nbsp;"pinyin",&nbsp;"reformed",&nbsp;"searchjl",&nbsp;"stroke",&nbsp;"trad",&nbsp;"unihan",&nbsp;"zhuyin"。<br/>**系统能力**:SystemCapability.Global.I18n |
| numeric | boolean | 是 | 是 | 是否使用数字排序,取值范围:true,&nbsp;false。 | | numeric | boolean | 是 | 是 | 是否使用数字排序,取值范围:true,&nbsp;false。<br/>**系统能力**:SystemCapability.Global.I18n |
| caseFirst | string | 是 | 是 | 表示大写、小写的排序顺序,取值范围:"upper",&nbsp;"lower",&nbsp;"false"。 | | caseFirst | string | 是 | 是 | 表示大写、小写的排序顺序,取值范围:"upper",&nbsp;"lower",&nbsp;"false"。<br/>**系统能力**:SystemCapability.Global.I18n |
## PluralRules<sup>8+</sup> ## PluralRules<sup>8+</sup>
...@@ -452,6 +481,8 @@ constructor() ...@@ -452,6 +481,8 @@ constructor()
创建PluralRules对象。 创建PluralRules对象。
**系统能力**:SystemCapability.Global.I18n
- 示例: - 示例:
``` ```
var pluralRules = new Intl.PluralRules(); var pluralRules = new Intl.PluralRules();
...@@ -464,6 +495,8 @@ constructor(locale: string | Array&lt;string&gt;, options?: PluralRulesOptions) ...@@ -464,6 +495,8 @@ constructor(locale: string | Array&lt;string&gt;, options?: PluralRulesOptions)
创建PluralRules对象。 创建PluralRules对象。
**系统能力**:SystemCapability.Global.I18n
参数: 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -482,6 +515,8 @@ select(n: number): string ...@@ -482,6 +515,8 @@ select(n: number): string
返回一个字符串表示该数字的单复数类别。 返回一个字符串表示该数字的单复数类别。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -505,13 +540,13 @@ select(n: number): string ...@@ -505,13 +540,13 @@ select(n: number): string
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| localeMatcher | string | 是 | 是 | locale匹配算法,取值包括:"best&nbsp;fit",&nbsp;"lookup"。 | | localeMatcher | string | 是 | 是 | locale匹配算法,取值包括:"best&nbsp;fit",&nbsp;"lookup"。<br/>**系统能力**:SystemCapability.Global.I18n |
| type | string | 是 | 是 | 排序的类型,取值包括:"cardinal",&nbsp;"ordinal"。 | | type | string | 是 | 是 | 排序的类型,取值包括:"cardinal",&nbsp;"ordinal"。<br/>**系统能力**:SystemCapability.Global.I18n |
| minimumIntegerDigits | number | 是 | 是 | 表示要使用的最小整数位数,取值范围:1~21。 | | minimumIntegerDigits | number | 是 | 是 | 表示要使用的最小整数位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
| minimumFractionDigits | number | 是 | 是 | 表示要使用的最小分数位数,取值范围:0~20。 | | minimumFractionDigits | number | 是 | 是 | 表示要使用的最小分数位数,取值范围:0~20。<br/>**系统能力**:SystemCapability.Global.I18n |
| maximumFractionDigits | number | 是 | 是 | 表示要使用的最大分数位数,取值范围:1~21。 | | maximumFractionDigits | number | 是 | 是 | 表示要使用的最大分数位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
| minimumSignificantDigits | number | 是 | 是 | 表示要使用的最低有效位数,取值范围:1~21。 | | minimumSignificantDigits | number | 是 | 是 | 表示要使用的最低有效位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
| maximumSignificantDigits | number | 是 | 是 | 表示要使用的最大有效位数,取值范围:1~21。 | | maximumSignificantDigits | number | 是 | 是 | 表示要使用的最大有效位数,取值范围:1~21。<br/>**系统能力**:SystemCapability.Global.I18n |
## RelativeTimeFormat<sup>8+</sup> ## RelativeTimeFormat<sup>8+</sup>
...@@ -523,6 +558,8 @@ constructor() ...@@ -523,6 +558,8 @@ constructor()
创建相对时间格式化对象。 创建相对时间格式化对象。
**系统能力**:SystemCapability.Global.I18n
- 示例: - 示例:
``` ```
var relativetimefmt = new Intl.RelativeTimeFormat(); var relativetimefmt = new Intl.RelativeTimeFormat();
...@@ -535,6 +572,8 @@ constructor(locale: string | Array&lt;string&gt;, options?: RelativeTimeFormatIn ...@@ -535,6 +572,8 @@ constructor(locale: string | Array&lt;string&gt;, options?: RelativeTimeFormatIn
创建相对时间格式化对象。 创建相对时间格式化对象。
**系统能力**:SystemCapability.Global.I18n
参数: 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -553,6 +592,8 @@ format(value: numeric, unit: string): string ...@@ -553,6 +592,8 @@ format(value: numeric, unit: string): string
依据locale和格式化选项,对value和unit进行格式化。 依据locale和格式化选项,对value和unit进行格式化。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -577,6 +618,8 @@ formatToParts(value: numeric, unit: string): Array&lt;Object&gt; ...@@ -577,6 +618,8 @@ formatToParts(value: numeric, unit: string): Array&lt;Object&gt;
返回一个对象数组,表示可用于自定义区域设置格式的相对时间格式。 返回一个对象数组,表示可用于自定义区域设置格式的相对时间格式。
**系统能力**:SystemCapability.Global.I18n
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -601,6 +644,8 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions ...@@ -601,6 +644,8 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions
获取RelativeTimeFormat对象的格式化选项。 获取RelativeTimeFormat对象的格式化选项。
**系统能力**:SystemCapability.Global.I18n
- 返回值: - 返回值:
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
...@@ -619,9 +664,9 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions ...@@ -619,9 +664,9 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| localeMatcher | string | 是 | 是 | locale匹配算法,取值包括:"best&nbsp;fit",&nbsp;"lookup"。 | | localeMatcher | string | 是 | 是 | locale匹配算法,取值包括:"best&nbsp;fit",&nbsp;"lookup"。<br/>**系统能力**:SystemCapability.Global.I18n |
| numeric | string | 是 | 是 | 输出消息的格式,取值包括:"always",&nbsp;"auto"。 | | numeric | string | 是 | 是 | 输出消息的格式,取值包括:"always",&nbsp;"auto"。<br/>**系统能力**:SystemCapability.Global.I18n |
| style | string | 是 | 是 | 国际化消息的长度,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。 | | style | string | 是 | 是 | 国际化消息的长度,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。<br/>**系统能力**:SystemCapability.Global.I18n |
## RelativeTimeFormatResolvedOptions<sup>8+</sup><a name=relativetimeformatresolvedoptions></a> ## RelativeTimeFormatResolvedOptions<sup>8+</sup><a name=relativetimeformatresolvedoptions></a>
...@@ -630,7 +675,7 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions ...@@ -630,7 +675,7 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| locale | string | 是 | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | | locale | string | 是 | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。<br/>**系统能力**:SystemCapability.Global.I18n |
| numeric | string | 是 | 是 | 输出消息的格式,取值包括:"always",&nbsp;"auto"。 | | numeric | string | 是 | 是 | 输出消息的格式,取值包括:"always",&nbsp;"auto"。<br/>**系统能力**:SystemCapability.Global.I18n |
| style | string | 是 | 是 | 国际化消息的长度,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。 | | style | string | 是 | 是 | 国际化消息的长度,取值包括:"long",&nbsp;"short",&nbsp;"narrow"。<br/>**系统能力**:SystemCapability.Global.I18n |
| numberingSystem | string | 是 | 是 | 使用的数字系统。 | | numberingSystem | string | 是 | 是 | 使用的数字系统。<br/>**系统能力**:SystemCapability.Global.I18n |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册