• Home
Name Date Size #Lines LOC

..--

figures/12-May-2024-

frameworks/12-May-2024-26,33720,808

interfaces/12-May-2024-8,7487,608

sa_profile/12-May-2024-3229

services/12-May-2024-1,9481,242

tools/12-May-2024-155133

.gitattributesD12-May-2024589 1514

LICENSED12-May-20249.9 KiB177150

NOTICE.htmlD12-May-20242 KiB2212

OAT.xmlD12-May-20241.6 KiB3718

README.mdD12-May-20242 KiB5032

README_zh.mdD12-May-20241.9 KiB4324

bundle.jsonD12-May-20244.5 KiB136135

i18n.gniD12-May-2024679 1816

README.md

1# i18n<a name="EN-US_TOPIC_0000001101364976"></a>
2
3-   [Introduction](#section11660541593)
4-   [Directory Structure](#section1464106163817)
5-   [Constraints](#section1718733212019)
6-   [Usage](#section894511013511)
7-   [Repositories Involved](#section15583142420413)
8
9## Introduction<a name="section11660541593"></a>
10
11The i18n module provides a wide array of internationalization \(i18n\) APIs for implementing functions such as date and time formatting.
12
13## Directory Structure<a name="section1464106163817"></a>
14
15The directory structure for the i18n module is as follows:
16
17```
18/base/global/
19├── i18n                    # Code repository for the i18n framework
20│   ├── frameworks          # Core code of the i18n framework
21│   ├── interfaces          # APIs
22│   │   ├── js              # JavaScript APIs
23│   │   └── native          # Native APIs
24```
25
26## Constraints<a name="section1718733212019"></a>
27
28**Development language**: JavaScript
29
30**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.
31
32## Usage<a name="section894511013511"></a>
33
34Change 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:
35
36```
37const date = new Date(2021, 11, 17, 3, 24, 0); // Create a Date object containing date and time information.
38fmt = new Intl.DateTimeFormat('en-US') // Create a DateTimeFormat instance.
39console.log(fmt.format(date)); // Format the date and time by using the DateTimeFormat instance.
40```
41
42## Repositories Involved<a name="section15583142420413"></a>
43
44Globalization subsystem
45
46**global\_i18n\_standard**
47
48global\_resmgr\_standard
49
50

README_zh.md

1# 国际化部件
2
3## 简介
4
5**国际化部件**为应用提供了一系列国际化接口,包括:时间日期格式化、相对时间格式化、数字格式化、排序、单复数、日历、电话号码格式化、度量衡、字符属性、时区、音译、本地化数字、24小时制、换行符、索引、系统语言、系统地区、系统区域、偏好语言等相关接口。基于这些国际化接口,开发者可以设计并实现具有良好国际化能力的应用,从而可以高效、低成本的实现应用的本地化。国际化部件支持如下设备:润和DAYU200 RK3568。
6
7![](figures/i18n.png)
8
9**国际化部件架构图说明:**
10
11- **Kits**为对外提供的js接口,分为intl和i18n两个模块。intl模块中包含了在ECMA 402标准定义的国际化接口,i18n模块包含了其他非ECMA 402定义的国际化接口。
12
13- **frameworks**为js接口的底层c++实现。
14
15- **libs**为js接口所依赖的国际化数据,包括ICU和libphonenumber两部分。
16
17
18## 目录
19
20国际化组件源代码目录结构如下所示:
21
22```
23/base/global/
24├── i18n                    # 国际化框架代码仓
25│   ├── frameworks          # 国际化框架核心代码
26│   ├── interfaces          # 国际化框架接口
27│   │   ├── js              # 国际化框架JavaScript接口
28│   │   └── native          # 国际化框架native接口
29```
30
31## 约束
32
33**语言限制**:JavaScript语言
34
35**支持范围限制**:支持的语言符合 ISO 639 标准 2 字母或 3 字母语言码,支持的文本符合 ISO 15924 标准 4 字母文本码,支持的国家符合 ISO 3166 标准 2 字母国家码。
36
37
38## 相关仓
39
40[全球化子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%85%A8%E7%90%83%E5%8C%96%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
41
42[global\_resource\_management](https://gitee.com/openharmony/global_resource_management/blob/master/README_zh.md)
43