README.md 2.0 KB
Newer Older
M
mamingshuai 已提交
1
# i18n<a name="EN-US_TOPIC_0000001101364976"></a>
马明帅 已提交
2

M
mamingshuai 已提交
3 4 5 6 7
-   [Introduction](#section11660541593)
-   [Directory Structure](#section1464106163817)
-   [Constraints](#section1718733212019)
-   [Usage](#section894511013511)
-   [Repositories Involved](#section15583142420413)
马明帅 已提交
8

M
mamingshuai 已提交
9
## Introduction<a name="section11660541593"></a>
马明帅 已提交
10

M
mamingshuai 已提交
11
The i18n module provides a wide array of internationalization \(i18n\) APIs for implementing functions such as date and time formatting.
马明帅 已提交
12

M
mamingshuai 已提交
13
## Directory Structure<a name="section1464106163817"></a>
马明帅 已提交
14

M
mamingshuai 已提交
15
The directory structure for the i18n module is as follows:
马明帅 已提交
16

M
mamingshuai 已提交
17 18
```
/base/global/
T
the-minions-of-cplu 已提交
19
├── i18n                    # Code repository for the i18n framework
M
mamingshuai 已提交
20 21 22 23 24
│   ├── frameworks          # Core code of the i18n framework
│   ├── interfaces          # APIs
│   │   ├── js              # JavaScript APIs
│   │   └── native          # Native APIs
```
马明帅 已提交
25

M
mamingshuai 已提交
26
## Constraints<a name="section1718733212019"></a>
马明帅 已提交
27

M
mamingshuai 已提交
28
**Development language**: JavaScript
马明帅 已提交
29

M
mamingshuai 已提交
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

M
mamingshuai 已提交
32
## Usage<a name="section894511013511"></a>
马明帅 已提交
33

M
mamingshuai 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
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<a name="section15583142420413"></a>

Globalization subsystem

**global\_i18n\_standard**

global\_resmgr\_standard
马明帅 已提交
49