feat(docs): add bilingual package documentation site
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: UI 本地化
|
||||
description: 只加载当前语言所需的 UI 词典和日历 locale。
|
||||
order: 21
|
||||
toc:
|
||||
- id: catalog-source
|
||||
title: 词典来源
|
||||
- id: direct-imports
|
||||
title: 直接导入
|
||||
- id: supported-locales
|
||||
title: 支持的语言
|
||||
---
|
||||
|
||||
## 词典来源 {#catalog-source}
|
||||
|
||||
在应用国际化配置中加入 UI 词典来源:
|
||||
|
||||
```json
|
||||
{
|
||||
"catalogSources": ["@workspace/ui/locales/{locale}"]
|
||||
}
|
||||
```
|
||||
|
||||
locales 根入口只包含元数据和类型,不会导入所有语言的词典。
|
||||
|
||||
## 直接导入 {#direct-imports}
|
||||
|
||||
```ts
|
||||
import { calendarLocale, messages } from "@workspace/ui/locales/zh-Hans"
|
||||
```
|
||||
|
||||
每个语言入口还会导出对应的 `react-day-picker` locale。
|
||||
|
||||
## 支持的语言 {#supported-locales}
|
||||
|
||||
UI 词典支持简体中文(`zh-Hans`)和美式英语(`en-US`)。
|
||||
Reference in New Issue
Block a user