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