diff --git a/OAT.xml b/OAT.xml
index 9705a1cbe38d1ac277d21d688189b738b49a37d6..79ead97564866e6d5272597ac61b72ce1092936f 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -1346,6 +1346,10 @@ Note:If the text contains special characters, please escape them according to th
+
+
+
+
@@ -1472,6 +1476,66 @@ Note:If the text contains special characters, please escape them according to th
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/CalendarReminder.ets b/code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/CalendarReminder.ets
index 5c27a781ef08a37962f36a208bb3b296a92ea01d..4920c60736e2811e452e18232b504a168ac1cdc9 100644
--- a/code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/CalendarReminder.ets
+++ b/code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/CalendarReminder.ets
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -14,13 +14,13 @@
*/
import reminderAgent from '@ohos.reminderAgentManager';
-import vibrator from '@ohos.vibrator'
-import AudioPlayer from './AudioPlayer'
-import Constant from '../common/Constant'
-import Logger from './Logger'
-import PreferencesDataManager from './PreferencesDataManager'
-import { Reminder } from '../common/Reminder'
-import TimeConversion from './TimeConversion'
+import vibrator from '@ohos.vibrator';
+import AudioPlayer from './AudioPlayer';
+import Constant from '../common/Constant';
+import Logger from './Logger';
+import PreferencesDataManager from './PreferencesDataManager';
+import { Reminder } from '../common/Reminder';
+import TimeConversion from './TimeConversion';
import common from '@ohos.app.ability.common';
import notificationManager from '@ohos.notificationManager';
import { BusinessError, deviceInfo } from '@kit.BasicServicesKit';
@@ -30,10 +30,10 @@ import { promptAction } from '@kit.ArkUI';
let deviceTypeInfo: string = deviceInfo.deviceType;
let calendar: calendarManager.Calendar | undefined = undefined;
-const TAG: string = 'CalendarReminder'
+const TAG: string = 'CalendarReminder';
class CalendarReminder {
- public calendarReminders: Reminder[] = []
+ public calendarReminders: Reminder[] = [];
setCalendarReminder() {
let config: calendarManager.CalendarConfig = {
@@ -60,8 +60,8 @@ class CalendarReminder {
let month = date.month! < 9 ? `0${date.month! + 1}` : `${date.month! + 1}`;
let day = date.day! < 10 ? `0${date.day}` : date.day;
let context = getContext(this) as common.UIAbilityContext;
- let selectCalendar: string = `${date.year}-${month}-${day}`
- let isExistName = this.calendarReminders.find(element => element.reminderName === selectCalendar) !== undefined
+ let selectCalendar: string = `${date.year}-${month}-${day}`;
+ let isExistName = this.calendarReminders.find(element => element.reminderName === selectCalendar) !== undefined;
if (!isExistName) {
let reminder: Reminder = {
audioSrc: '',
@@ -95,11 +95,11 @@ class CalendarReminder {
content: context.resourceManager.getStringSync($r('app.string.calendar_reach').id),
slotType: notificationManager.SlotType.CONTENT_INFORMATION
}
- Logger.info(TAG, `setCalendar this calendar is ${JSON.stringify(calendar)}}`)
+ Logger.info(TAG, `setCalendar this calendar is ${JSON.stringify(calendar)}}`);
reminder.reminderRequestCalendar = calendar
reminder.isStart = false
this.calendarReminders.push(reminder)
- Logger.info(TAG, `setCalendar this all calendar is ${JSON.stringify(this.calendarReminders)}`)
+ Logger.info(TAG, `setCalendar this all calendar is ${JSON.stringify(this.calendarReminders)}`);
await PreferencesDataManager.putData('Calendar', this.calendarReminders)
this.setCalendarReminder();
} else {
@@ -120,10 +120,9 @@ class CalendarReminder {
this.calendarReminders[index].reminderId = reminderId;
} else {
let context = getContext(this) as common.UIAbilityContext;
- let date = new Date();
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- let day = date.getDate();
+ let year = this.calendarReminders[index].reminderRequestCalendar!.dateTime.year;
+ let month = this.calendarReminders[index].reminderRequestCalendar!.dateTime.month;
+ let day = this.calendarReminders[index].reminderRequestCalendar!.dateTime.day;
let dateHour = this.calendarReminders[index].reminderRequestCalendar!.dateTime.hour;
let dateMinute = this.calendarReminders[index].reminderRequestCalendar!.dateTime.minute;
let hour = dateHour < 10 ? `0${dateHour}` : dateHour;
@@ -156,7 +155,7 @@ class CalendarReminder {
this.calendarReminders[index].reminderRequestCalendar!.dateTime.day,
this.calendarReminders[index].reminderRequestCalendar!.dateTime.hour,
this.calendarReminders[index].reminderRequestCalendar!.dateTime.minute) * Constant.SECONDS_MILLISECONDS);
- this.calendarReminders[index].audioTimeouts = audioIndex;
+ this.calendarReminders[index].audioTimeouts = audioIndex;
}
await PreferencesDataManager.putData('Calendar', this.calendarReminders)
if (this.calendarReminders[index].isVibrator) {
@@ -171,9 +170,9 @@ class CalendarReminder {
usage: 'alarm'
}, (err) => {
if (err) {
- Logger.error(TAG, `setToggle this vibrator is failed err is ${JSON.stringify(err)}`)
+ Logger.error(TAG, `setToggle this vibrator is failed err is ${JSON.stringify(err)}`);
} else {
- Logger.info(TAG, `setToggle this vibrator is successed`)
+ Logger.info(TAG, `setToggle this vibrator is successed`);
}
})
}, TimeConversion.dateToMillisecond(this.calendarReminders[index].reminderRequestCalendar!.dateTime.year,
diff --git a/code/DocsSample/International/Internationalization/.gitignore b/code/DocsSample/International/Internationalization/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/AppScope/app.json5 b/code/DocsSample/International/Internationalization/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..789ce3dec92fed62e2d085120c42a1f787485a95
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.internationalization",
+ "vendor": "sample",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/code/DocsSample/International/Internationalization/AppScope/resources/base/element/string.json b/code/DocsSample/International/Internationalization/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..999cd2ffc592f588885f354853a12461aa7f682b
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Internationalization"
+ }
+ ]
+}
diff --git a/code/DocsSample/International/Internationalization/AppScope/resources/base/media/app_icon.png b/code/DocsSample/International/Internationalization/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/code/DocsSample/International/Internationalization/AppScope/resources/base/media/app_icon.png differ
diff --git a/code/DocsSample/International/Internationalization/README_zh.md b/code/DocsSample/International/Internationalization/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..e037c2c5b5180876b0106bce5fd871192d95e077
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/README_zh.md
@@ -0,0 +1,90 @@
+# 国际化Internationalization
+
+## 介绍
+
+本示例依照指南 开发->应用框架->Localization Kit(本地化开发服务)->[本地化开发服务(应用国际化)](https://gitee.com/openharmony/docs/tree/OpenHarmony-5.0.1-Release/zh-cn/application-dev/internationalization)进行编写。
+本示例主要展示了国际化的相关基础功能,通过调用`intl`,`i18n`实现简单的国际化操作。
+
+### 效果预览
+
+| **主页面** | **区域标识与文化习惯划分界面** | **设置日历和历法界面** | **时间日期国际化界面** |
+| ------------------------------------- | ------------------------------------------------------------ | --------------------------------------------------- | --------------------------------------------------------- |
+|  |  |  |  |
+
+使用说明:
+
+1. 修改HarmonyAppProvision配置文件为system_basic等级系统应用。
+2. 启动应用,进入主页面。
+3. 点击主页面不同的功能按钮,进入对应国际化功能输出判断显示界面。
+4. 功能界面中点击返回按钮,返回主页面。
+5. 测试超时设置为:Time out(s):30。
+
+### 工程目录
+
+```
+Internationalization
+entry/src/main
+ │ module.json5 // 模块配置文件
+ │
+ ├─ets
+ │ ├─component
+ │ │ TitleBar.ets // 公共标题栏
+ │ │ AssertEqual.ets // 断言判断函数
+ │ │
+ │ ├─entryability
+ │ │ EntryAbility.ets // 程序入口类
+ │ │
+ │ ├─entrybackupability
+ │ │ EntryBackupAbility.ets
+ │ │
+ │ ├─i18napplication // 页面文件
+ │ │ CalendarSetting.ets // 设置日历和历法界面
+ │ │ CharacterProcessing.ets // 字符处理界面
+ │ │ DateTimeFormatting.ets // 时间日期国际化界面
+ │ │ LanguagePreferenceSetting.ets // 设置语言与用户偏好界面
+ │ │ LocaleCulturalDivision.ets // 区域标识与文化习惯划分界面
+ │ │ MultilingualSorting.ets // 多语言排序界面
+ │ │ NameLocalization.ets // 本地化名称界面
+ │ │ NumberMeasurementFormatting.ets // 数字与度量衡国际化界面
+ │ │ PhoneNumberFormatting.ets // 电话号码格式化界面
+ │ │ TimezoneDstSetting.ets // 时区与夏时令国际化界面
+ │ │
+ │ └─pages
+ │ Index.ets // 主界面
+ │
+ └─resources // 资源文件目录
+```
+
+### 具体实现
+
+- 设置在主页面集成所有功能界面模块,将`Listitem`中`Row`组件设置点击事件进入相关需求界面模块的展示。
+
+- 每个子模块页面的实现代码对应国际化开发指南中的具体章节,子模块目录按其功能进行命名,如`DateTimeFormatting(时间日期格式化)`,示例代码内容由`Text`文本输出显示。
+
+- 公共功能(如标题栏)提取为公共组件供各个子模块复用,设置公共组件`TitleBar`标题栏展示需求界面模块的功能名称,公共功能(如标题栏)提取为公共组件供各个子模块复用。
+
+### 相关权限
+
+[ohos.permission.UPDATE_CONFIGURATION](https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0-Beta1/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionupdate_configuration)
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:RK3568。
+2. 本示例为Stage模型,支持API14版本SDK,版本号:5.1.0.44。
+3. 支持的IDE版本:本示例已支持DevEco Studio 5.0.1 Release (构建版本:5.0.5.306,构建 2024年12月6日)编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/International/Internationalization > .git/info/sparse-checkout
+git remote add origin https://gitee.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/build-profile.json5 b/code/DocsSample/International/Internationalization/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9b050d3379574473f892f128254ce383d5513793
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": 14,
+ "compileSdkVersion": 14,
+ "targetSdkVersion": 14,
+ "runtimeOS": "OpenHarmony"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug"
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/.gitignore b/code/DocsSample/International/Internationalization/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/build-profile.json5 b/code/DocsSample/International/Internationalization/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b7b723d6bc9df0cec043eac828cc8bc1bb0beaf9
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/build-profile.json5
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ "runtimeOS": "OpenHarmony"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/hvigorfile.ts b/code/DocsSample/International/Internationalization/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/code/DocsSample/International/Internationalization/entry/obfuscation-rules.txt b/code/DocsSample/International/Internationalization/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/oh-package.json5 b/code/DocsSample/International/Internationalization/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/component/AssertEqual.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/component/AssertEqual.ets
new file mode 100644
index 0000000000000000000000000000000000000000..74ad4c496a7a3a8cdd2ae589637309fecfec98b5
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/component/AssertEqual.ets
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export function assertEqual(actual: T, expected: T, description: Resource): string {
+ if (actual === expected) {
+ return `${getContext().resourceManager.getStringSync(description)}${expected} --passed`;
+ } else {
+ return `${getContext().resourceManager
+ .getStringSync(description)} --failed: expected ${expected}, but got ${actual}`;
+ }
+}
+
+export function assertEqualLong(actual: string, expected: string[], description: Resource): string {
+ if (expected.every(expected => actual.includes(expected))) {
+ return `${getContext().resourceManager.getStringSync(description)}passed`;
+ } else {
+ return `${getContext().resourceManager.getStringSync(description)}failed: expected ${expected}, but got ${actual}`;
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/component/TitleBar.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/component/TitleBar.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f3cbe555d1961c2149ac4679d5b34bf2a49cf3f1
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/component/TitleBar.ets
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import router from '@ohos.router';
+
+@Component
+export default struct TitleBar {
+ private title: string | Resource = $r('app.string.Internationalization');
+ private hasBackPress: boolean = false;
+
+ build() {
+ Row() {
+ if (this.hasBackPress) {
+ Row() {
+ Image($r('app.media.back'))
+ .id('btnBack')
+ .width(12)
+ .height(12)
+ }
+ .height('100%')
+ .aspectRatio(1)
+ .margin({ left: 24 })
+ .onClick(() => {
+ router.back()
+ })
+ }
+ Text(this.title)
+ .fontSize(20)
+ .fontColor(Color.Black)
+ .margin(this.hasBackPress ? {} : { left: 24 })
+ Blank()
+ }
+ .width('100%')
+ .height(56)
+ .backgroundColor(Color.Transparent)
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/entryability/EntryAbility.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0f2f8b94aa24b0a50e272270e4e18b6df93ac5fd
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/CalendarSetting.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/CalendarSetting.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5d6f3da17f340c428a0f38b100fbc644adfb89d9
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/CalendarSetting.ets
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import TitleBar from '../component/TitleBar';
+import { assertEqual } from '../component/AssertEqual';
+import { i18n } from '@kit.LocalizationKit';
+
+// 设置日历和历法开发实例
+// 公历相关用法
+let calendar: i18n.Calendar = i18n.getCalendar('zh-Hans', 'gregory');
+
+// 设置日历对象的日期
+calendar.setTime(new Date(2022, 5, 13, 8, 0, 0));
+calendar.setTime(10540800000);
+
+// 设置日历对象的年、月、日、时、分、秒
+calendar.set(2022, 5, 13, 8, 0, 0);
+
+// 设置日历对象的时区
+calendar.setTimeZone('Asia/Shanghai');
+
+// 获取日历对象的时区
+let timezone: string = calendar.getTimeZone(); // Asia/Shanghai
+
+// 获取日历对象的一周起始日
+let firstDayOfWeek: number = calendar.getFirstDayOfWeek(); // 1
+
+// 设置每一周的起始日
+calendar.setFirstDayOfWeek(1);
+
+// 获取一年中第一周的最小天数
+let minimalDaysInFirstWeek: number = calendar.getMinimalDaysInFirstWeek(); // 1
+
+// 设置一年中第一周的最小天数
+calendar.setMinimalDaysInFirstWeek(3);
+
+// 获取日历对象中与field相关联的值
+let value: number = calendar.get('year'); // 2022
+
+// 获取日历对象本地化名称
+let calendarName: string = calendar.getDisplayName('zh-Hans'); // 公历
+
+// 判断指定的日期在日历中是否为周末
+let isWeekend: boolean = calendar.isWeekend(new Date(2023, 9, 15)); // true
+
+// 在日历的给定字段进行加减操作
+calendar.set(2023, 10, 15);
+calendar.add('date', 2);
+calendar.get('date'); // 17
+
+// 比较日历和指定日期相差的天数
+calendar.compareDays(new Date(2023, 10, 15)); // -3
+
+// 获取公历对应的农历日期
+let calendar_ch: i18n.Calendar = i18n.getCalendar('zh-Hans', 'chinese');
+
+// 将公历信息设置到calendar对象
+calendar_ch.setTime(new Date(2023, 6, 25, 8, 0, 0));
+
+// 获取农历年月日
+calendar_ch.get('year'); // 返回干支纪年40,范围1-60
+calendar_ch.get('month'); // 结果为5,指6月
+calendar_ch.get('date'); // 8日
+
+const expectedTimezone = 'Asia/Shanghai';
+const expectedFirstDayOfWeek = 1;
+const expectedMinimalDaysInFirstWeek = 1;
+const expectedValue = 2022;
+const expectedCalendarName = '公历';
+const expectedIsWeekend = true;
+const expectedDateAddTwoDays = 17;
+const expectedCompareDays = -3;
+const expectedCalendarYear = 40;
+const expectedCalendarMonth = 5;
+const expectedCalendarDate = 8;
+
+@Extend(Text)
+function textStyle() {
+ .fontSize(20).margin({ top: 15, left: 20, right: 20 });
+}
+
+@Entry
+@Component
+struct CalendarSetting {
+ build() {
+ Column() {
+ TitleBar({ hasBackPress: true, title: $r('app.string.CalendarSetting') })
+ Text($r('app.string.ResultsOfTheGregorianCalendar'))
+ .textStyle()
+ .fontWeight(FontWeight.Bold)
+ Text($r('app.string.TheGregorianCalendarSets'))
+ .textStyle()
+ Text(assertEqual(timezone, expectedTimezone, $r('app.string.Timezone')))
+ .textStyle()
+ Text(assertEqual(firstDayOfWeek, expectedFirstDayOfWeek, $r('app.string.FirstDayOfWeek')))
+ .textStyle()
+ Text(assertEqual(minimalDaysInFirstWeek, expectedMinimalDaysInFirstWeek, $r('app.string.MinimalDaysInFirstWeek')))
+ .textStyle()
+ Text($r('app.string.SetMinimalDaysInFirstWeek'))
+ .textStyle()
+ .fontWeight(FontWeight.Bold)
+ Text(assertEqual(value, expectedValue, $r('app.string.YearOfTheFirstWeekIs3')))
+ .textStyle()
+ Text(assertEqual(calendarName, expectedCalendarName, $r('app.string.LocalizedCalendarName')))
+ .textStyle()
+ Text(assertEqual(isWeekend, expectedIsWeekend, $r('app.string.IsWeekend')))
+ .textStyle()
+ Text(assertEqual(calendar.get('date'), expectedDateAddTwoDays, $r('app.string.DateAfterAddingDays')))
+ .textStyle()
+ Text(assertEqual(calendar.compareDays(new Date(2023, 10, 15)), expectedCompareDays,
+ $r('app.string.DaysBetweenDates')))
+ .textStyle()
+ Text($r('app.string.LunarCalendar'))
+ .textStyle().fontWeight(FontWeight.Bold)
+ Text(assertEqual(calendar_ch.get('year'), expectedCalendarYear, $r('app.string.LunarYear')))
+ .textStyle()
+ Text(assertEqual(calendar_ch.get('month'), expectedCalendarMonth, $r('app.string.LunarMonth')))
+ .textStyle()
+ Text(assertEqual(calendar_ch.get('date'), expectedCalendarDate, $r('app.string.LunarDate')))
+ .textStyle()
+ }.width('100%').height('100%').alignItems(HorizontalAlign.Start)
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/CharacterProcessing.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/CharacterProcessing.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c5d2a067a08118bb6b4ed564dbc5710f8befd047
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/CharacterProcessing.ets
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import TitleBar from '../component/TitleBar';
+import { assertEqual, assertEqualLong } from '../component/AssertEqual';
+import { i18n } from '@kit.LocalizationKit';
+
+/**********************************************************************************************************************
+ * 字符属性开发参考步骤
+ * 1. 导入模块
+ * import { i18n } from '@kit.LocalizationKit';
+ * 2. 判断字符属性
+ * let isDigit: boolean = i18n.Unicode.isDigit(char: string);
+ * 3. 以一般类别值为例,判断字符类类型,具体请参考getType接口文档
+ * let type = i18n.Unicode.getType(char: string);
+ *********************************************************************************************************************/
+
+// 判断字符是否是数字
+let isDigit = i18n.Unicode.isDigit('1'); // isDigit: true
+
+// 判断字符是否是从右到左语言的字符
+let isRTL = i18n.Unicode.isRTL('a'); // isRTL: false
+
+// 判断字符是否是表意文字
+let isIdeograph = i18n.Unicode.isIdeograph('华'); // isIdeograph: true
+
+// 获取字符的一般类别值
+let type = i18n.Unicode.getType('a'); // type: U_LOWERCASE_LETTER
+
+/**********************************************************************************************************************
+ * 音译开发参考步骤
+ * 1. 导入模块
+ * import { i18n } from '@kit.LocalizationKit';
+ * 2. 创建Transliterator对象,获取音译列表
+ * // 传入音译支持的ID,创建Transliterator对象
+ * let transliterator: i18n.Transliterator = i18n.Transliterator.getInstance(id: string);
+ * let ids: string[] = i18n.Transliterator.getAvailableIDs(); // 获取音译支持的ID列表
+ * 3. 音译文本
+ * let res: string = transliterator.transform(text: string); // 对text内容进行音译
+ *********************************************************************************************************************/
+
+// 音译成Latn格式
+let transliterator = i18n.Transliterator.getInstance('Any-Latn');
+let wordArray = ['中国', '德国', '美国', '法国']
+let transRes: Array = [];
+for (let i = 0; i < wordArray.length; i++) {
+ let res = transliterator.transform(wordArray[i]); // res: zhōng guó, dé guó, měi guó, fǎ guó
+ transRes.push(res);
+}
+
+// 汉语音译去声调
+let transliter = i18n.Transliterator.getInstance('Any-Latn;Latin-Ascii');
+let result = transliter.transform('中国'); // result: zhong guo
+
+// 汉语姓氏读音
+let nameTransliter = i18n.Transliterator.getInstance('Han-Latin/Names');
+let result1 = nameTransliter.transform('单老师'); // result1: shàn lǎo shī
+let result2 = nameTransliter.transform('长孙无忌'); // result2: zhǎng sūn wú jì
+
+// 获取音译支持的ID列表
+let ids = i18n.Transliterator.getAvailableIDs(); // ids: ['ASCII-Latin', 'Accents-Any', ...]
+
+/**********************************************************************************************************************
+ * 字符标准化开发参考步骤
+ * 1. 导入模块
+ * import { i18n } from '@kit.LocalizationKit';
+ * 2. 创建标准化对象
+ * let normalizer: i18n.Normalizer = i18n.Normalizer.getInstance(mode: NormalizerMode);
+ * 3. 文本标准化
+ * let normalizedText: string = normalizer.normalize(text: string); // 对text文本进行标准化
+ *********************************************************************************************************************/
+
+// 以NFC范式标准化字符
+let normalizer = i18n.Normalizer.getInstance(i18n.NormalizerMode.NFC);
+let normalizedText = normalizer.normalize('\u1E9B\u0323'); // normalizedText: \u1E9B\u0323
+
+/**********************************************************************************************************************
+ * 断词换行开发参考步骤
+ * 1. 导入模块
+ * import { i18n } from '@kit.LocalizationKit';
+ * 2. 创建用于断句的对象
+ * let iterator: i18n.BreakIterator = i18n.getLineInstance(locale: string);
+ * 3. 设置要处理的文本
+ * iterator.setLineBreakText(text: string); // 设置要处理的文本
+ * let breakText: string = iterator.getLineBreakText(); // 查看iterator正在处理的文本
+ * 4. 获取可断句的位置
+ * // 获取iterator在当前所处理文本中的位置
+ * let currentPos: number = iterator.current();
+ * // 设置为第一个可断句的分割点,返回该分割点的位置。第一个分割点总是在文本的起始位置,firstPos = 0
+ * let firstPos: number = iterator.first();
+ * // 将iterator移动number数量个分割点,number为正数代表向后移动,number为负数代表向前移动,默认值为1。
+ * // nextPos为移动后在文本中的位置,如果超出文本的长度范围,返回-1
+ * let nextPos: number = iterator.next(number);
+ * // 判断number位置是否是分割点
+ * let isBoundary: boolean = iterator.isBoundary(number);
+ *********************************************************************************************************************/
+
+// 断句对象
+let iterator = i18n.getLineInstance('en-GB');
+
+// 断句文本
+iterator.setLineBreakText('Apple is my favorite fruit.');
+
+// 将BreakIterator对象移动到文本起始位置
+let firstPos = iterator.first(); // firstPos: 0
+
+// 将BreakIterator对象移动几个分割点
+let nextPos = iterator.next(2); // nextPos: 9
+
+// 判断某个位置是否是分割点
+let isBoundary = iterator.isBoundary(9); // isBoundary: true
+
+// 获取BreakIterator对象处理的文本
+let breakText = iterator.getLineBreakText(); // breakText: Apple is my favorite fruit.
+
+const expectedIsDigit = true;
+const expectedIsRTL = false;
+const expectedIsIdeograph = true;
+const expectedType = 'U_LOWERCASE_LETTER';
+const expectedTransResult = 'zhōng guó,dé guó,měi guó,fǎ guó';
+const expectedResult = 'zhong guo';
+const expectedResult1 = 'shàn lǎo shī';
+const expectedResult2 = 'zhǎng sūn wú jì';
+const expectedIds = ['ASCII-Latin', 'Accents-Any'];
+const expectedNormalizedText = 'ẛ̣';
+const expectedFirstPos = 0;
+const expectedNextPos = 9;
+const expectedIsBoundary = true;
+const expectedBreakText = 'Apple is my favorite fruit.';
+
+@Extend(Text)
+function textStyle() {
+ .fontSize(18)
+ .margin({ top: 15, left: 20, right: 20 });
+}
+
+@Entry
+@Component
+export default struct CharacterProcessing {
+ build() {
+ Column() {
+ TitleBar({ hasBackPress: true, title: $r('app.string.CharacterProcessing') })
+ Scroll() {
+ Column() {
+ Text($r('app.string.ResultsOfCharacterType'))
+ .textStyle()
+ .fontWeight(FontWeight.Bold)
+ Text(assertEqual(isDigit, expectedIsDigit, $r('app.string.Character1IsNumber')))
+ .textStyle()
+ Text(assertEqual(isRTL, expectedIsRTL, $r('app.string.AIsRightToLeft')))
+ .textStyle()
+ Text(assertEqual(isIdeograph, expectedIsIdeograph, $r('app.string.HuaIsIdeograph')))
+ .textStyle()
+ Text(assertEqual(type, expectedType, $r('app.string.AGetType')))
+ .textStyle()
+ Text($r('app.string.ResultsOfTrans'))
+ .textStyle()
+ .fontWeight(FontWeight.Bold)
+ Text(assertEqual(transRes.join(','), expectedTransResult, $r('app.string.CharacterTransResult')))
+ .textStyle()
+ Text(assertEqual(result, expectedResult, $r('app.string.ChinaTrans')))
+ .textStyle()
+ Text(assertEqual(result1, expectedResult1, $r('app.string.TeachersSurnameTrans')))
+ .textStyle()
+ Text(assertEqual(result2, expectedResult2, $r('app.string.ZhangSunWuJiTrans')))
+ .textStyle()
+ Text(assertEqualLong(ids.join(', '), expectedIds, $r('app.string.ResultsOfSupportedId')))
+ .textStyle()
+ Scroll() {
+ Text(ids.join(', '))
+ .textStyle()
+ .id('transIdsText')
+ }
+ .id('transIdsScroll')
+ .margin({ left: 50 })
+ .border({
+ width: 2,
+ color: $r('app.color.Border_Gray'),
+ style: BorderStyle.Solid,
+ radius: 10
+ })
+ .width('80%')
+ .height('20%')
+
+ Text($r('app.string.ResultsOfNormalize'))
+ .textStyle()
+ .fontWeight(FontWeight.Bold)
+ Text(assertEqual(normalizedText, expectedNormalizedText, $r('app.string.NFCNormalizeResult')))
+ .textStyle()
+ Text($r('app.string.ResultsOfBreakIterator'))
+ .textStyle()
+ .fontWeight(FontWeight.Bold)
+ Text(assertEqual(firstPos, expectedFirstPos, $r('app.string.FirstPos')))
+ .textStyle()
+ Text(assertEqual(nextPos, expectedNextPos, $r('app.string.NextPos')))
+ .textStyle()
+ Text(assertEqual(isBoundary, expectedIsBoundary, $r('app.string.IsBoundary')))
+ .textStyle()
+ Text(assertEqual(breakText, expectedBreakText, $r('app.string.BreakText')))
+ .textStyle()
+ Blank().height('10%')
+ }
+ .alignItems(HorizontalAlign.Start)
+ }
+ .id('outerScrollInCharacter')
+ .width('100%')
+ .height('100%')
+ }
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/DateTimeFormatting.ets b/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/DateTimeFormatting.ets
new file mode 100644
index 0000000000000000000000000000000000000000..aee2558aca713dbf572a0bab4e271850c0796a29
--- /dev/null
+++ b/code/DocsSample/International/Internationalization/entry/src/main/ets/i18napplication/DateTimeFormatting.ets
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import TitleBar from '../component/TitleBar';
+import { assertEqual } from '../component/AssertEqual';
+import { intl } from '@kit.LocalizationKit';
+
+/**********************************************************************************************************************
+ * 时间日期格式化开发参考步骤
+ * 1. 导入模块
+ * import { intl } from '@kit.LocalizationKit';
+ * 2. 创建DateTimeFormat对象
+ * let dateFormat: intl.DateTimeFormat =
+ * new intl.DateTimeFormat(locale: string | Array, options?: DateTimeOptions);
+ * let dateFormat: intl.DateTimeFormat = new intl.DateTimeFormat(); //不传入locale参数
+ * 3. 时间日期和相对时间格式化
+ * - 时间日期格式化
+ * let formattedDate: string = dateFormat.format(date: Date);
+ * - 相对时间格式化
+ * let formattedDate: string = dateFormat.format(date: Date);
+ * 4. 获取格式化选项,查看对象的设置信息
+ * let options: intl.DateTimeOptions = dateFormat.resolvedOptions();
+ *********************************************************************************************************************/
+
+// 时间日期格式化开发实例
+// 设置要格式化的日期
+let date = new Date(2021, 8, 17, 13, 4, 0);
+let startDate = new Date(2021, 8, 17, 13, 4, 0);
+let endDate = new Date(2021, 8, 18, 13, 4, 0);
+
+// 在软件上展示完整的时间信息
+let dateFormat1 = new intl.DateTimeFormat('zh-CN', { dateStyle: 'full', timeStyle: 'full' });
+let formattedDate1 = dateFormat1.format(date); // formattedDate1: 2021年9月17日星期五 中国标准时间 13:04:00
+
+// 在有限的空间展示简短的时间信息
+let dateFormat2 = new intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'short' });
+let formattedDate2 = dateFormat2.format(date); // formattedDate2: 2021/9/17 13:04
+
+// 自定义年月日时分秒的显示效果
+let dateFormat3 = new intl.DateTimeFormat('zh-CN', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit'
+});
+let formattedDate3 = dateFormat3.format(date); // formattedDate3: 2021/09/17 13:04:00
+
+// 仅显示一部分时间
+let dateFormat4 = new intl.DateTimeFormat('zh-CN', { month: 'long', day: 'numeric', weekday: 'long' });
+let formattedDate4 = dateFormat4.format(date); // formattedDate4: 9月17日星期五
+
+// 自定义时制格式
+let dateFormat5 = new intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'short', hourCycle: 'h11' });
+let formattedDate5 = dateFormat5.format(date); // formattedDate5: 2021/9/17 下午13:04
+
+// 面向习惯于其他数字系统的用户
+let dateFormat6 = new intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'short', numberingSystem: 'arab' });
+let formattedDate6 = dateFormat6.format(date); // formattedDate6: ٢٠٢١/٩/١٧ ١٣:٠٤
+
+// 格式化时间段
+let dataFormat7 = new intl.DateTimeFormat('en-GB');
+let formattedDateRange = dataFormat7.formatRange(startDate, endDate); // formattedDateRange: 17/09/2021 - 18/09/2021
+
+// 获取格式化选项
+let dataFormat8 = new intl.DateTimeFormat('en-GB', { dateStyle: 'full' });
+let options = dataFormat8.resolvedOptions();
+let dateStyle = options.dateStyle; // dateStyle: full
+
+/**********************************************************************************************************************
+ * 相对时间格式化开发参考步骤
+ * 1. 导入模块
+ * import { intl } from '@kit.LocalizationKit';
+ * 2. 创建RelativeTimeFormat对象
+ * let relativeTimeFormat: intl.RelativeTimeFormat =
+ * new intl.RelativeTimeFormat(locale: string | Array, options?: RelativeTimeFormatInputOptions);
+ * 3. 格式化相对时间
+ * let formattedRelativeTime: string = relativeTimeFormat.format(value: number, unit: string);
+ * 4. 自定义相对时间的格式化
+ * let parts: Array