Go to file
zhangdd_ewan f88f695b9f 修改敏感地区名称
Signed-off-by: zhangdd_ewan <zhangdongdong50@huawei.com>
2024-09-30 09:03:50 +08:00
.gitee add pull request template 2024-01-23 17:42:55 +08:00
figures update i18n readme 2022-10-09 11:11:54 +08:00
frameworks 修改敏感地区名称 2024-09-30 09:03:50 +08:00
interfaces 补充i18n桥接层代码 2024-09-18 11:05:49 +08:00
sa_profile 支持多用户 2024-08-17 22:23:55 +08:00
services 独立编译test部分整改 2024-08-29 15:06:57 +08:00
ta 代码一致性问题 2024-06-18 09:41:32 +08:00
tools 代码一致性问题 2024-06-18 09:41:32 +08:00
.gitattributes Signed-off-by:王剑<wangjian497@huawei.com> 2023-07-18 15:33:54 +08:00
bundle.json 支持多用户 2024-08-17 22:23:55 +08:00
i18n.gni 回退googletest部件依赖 2024-07-19 21:58:36 +08:00
LICENSE fix internal source code specification problem 2022-03-07 19:05:49 +08:00
NOTICE.html update notice file 2021-07-21 15:43:55 +08:00
OAT.xml 代码一致性问题 2024-06-18 10:27:26 +08:00
README_zh.md update i18n readme 2022-10-09 11:11:54 +08:00
README.md 修改i18n部件名 2022-04-12 16:54:22 +08:00

i18n

Introduction

The i18n module provides a wide array of internationalization i18n APIs for implementing functions such as date and time formatting.

Directory Structure

The directory structure for the i18n module is as follows:

/base/global/
├── i18n                    # Code repository for the i18n framework
│   ├── frameworks          # Core code of the i18n framework
│   ├── interfaces          # APIs
│   │   ├── js              # JavaScript APIs
│   │   └── native          # Native APIs

Constraints

Development language: JavaScript

Language, script, and country codes: The supported language must be represented by a two- or three-letter code defined in the ISO 639 standard; the supported script must be represented by a four-letter code defined in the ISO 15924 standard; the supported country must be represented by a two-letter code defined in the ISO 3166 standard.

Usage

Change the date and time formats such as the sequence of year, month, and day, month and week names, and 12-hour or 24-hour system following the system settings to adapt to the cultural habits of users in different locales. For details, see the API reference. The sample code is as follows:

const date = new Date(2021, 11, 17, 3, 24, 0); // Create a Date object containing date and time information.
fmt = new Intl.DateTimeFormat('en-US') // Create a DateTimeFormat instance.
console.log(fmt.format(date)); // Format the date and time by using the DateTimeFormat instance.

Repositories Involved

Globalization subsystem

global_i18n_standard

global_resmgr_standard