mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
chore: i18n contributing docs improve (#33760)
* chore: i18n contributing docs improve * update * Update docs/react/i18n.zh-CN.md Co-authored-by: afc163 <afc163@gmail.com> * update * update * fix name * 空格 * fix name * update * Update docs/react/i18n.zh-CN.md Co-authored-by: afc163 <afc163@gmail.com> * update * update * update * 添加英文版本 * update * the * update * update * fix list * Revert "fix list" This reverts commit c6f3e2c699d133f74e0f4ce0424c1fd4ad43dcbf. * fix list * 指向源文件 Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
parent
9cf0dca8fc
commit
75adc23fe3
@ -100,3 +100,29 @@ See more usage at [ConfigProvider](/components/config-provider).
|
||||
## Adding new language
|
||||
|
||||
If your language is not in above list, feel free to create a locale package based on the [en_US](https://github.com/ant-design/ant-design/blob/master/components/locale/en_US.tsx) lanugage pack and send us a pull request. For reference, you can refer to the pull request of adding the [Azerbaijani](https://github.com/ant-design/ant-design/pull/21387) language as a sample.
|
||||
|
||||
Do it step by step:
|
||||
|
||||
1. Fork `antd` and git clone to local, switch to `feature` branch, pull it to make sure it's up-to-date, create a new branch based on `feature` branch, all work will be done in it.
|
||||
|
||||
```bash
|
||||
git clone git@github.com:<your organization>/ant-design.git
|
||||
cd ant-design/
|
||||
git remote add upstream origin git@github.com:ant-design/ant-design.git
|
||||
git checkout -b <your new branch name>
|
||||
```
|
||||
|
||||
2. Add the language support for [rc-picker](https://github.com/react-component/picker), for example [this](https://github.com/react-component/picker/blob/master/src/locale/en_US.ts).
|
||||
3. Add the language support for [rc-pagination](https://github.com/react-component/pagination), for example [this](https://github.com/react-component/pagination/blob/master/src/locale/en_US.js).
|
||||
4. Wait for `rc-picker` and `rc-pagination` to release the new version containing the above.
|
||||
5. Update the `rc-picker` and `rc-pagination` versions in `antd` and add the remaining other necessary content for the language. for example [Azerbaijani PR](https://github.com/ant-design/ant-design/pull/21387).
|
||||
6. Add a test case for the language in [index.test.js](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/__tests__/index.test.js).
|
||||
7. update snapshots, you may also need to delete `node_modules`, lock files (`yarn.lock` or `package-lock.json`) and reinstall at first.
|
||||
|
||||
```bash
|
||||
npm run test -- components/locale-provider -u
|
||||
```
|
||||
|
||||
8. Add the language to i18n list [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.en-US.md) and [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md).
|
||||
9. Watch out the CI status, and if it failed, look at the logs and make some changes until it all passes.
|
||||
10. Ok, now everything is ready for review.
|
||||
|
@ -98,6 +98,32 @@ return (
|
||||
|
||||
如果你找不到你需要的语言包,欢迎你在 [英文语言包](https://github.com/ant-design/ant-design/blob/master/components/locale/en_US.tsx) 的基础上创建一个新的语言包,并给我们发一个 Pull Request,可以参考 [阿塞拜疆语的 PR](https://github.com/ant-design/ant-design/pull/21387)。
|
||||
|
||||
基本步骤如下:
|
||||
|
||||
1. Fork `antd` 并 git clone 到本地,切换到 `feature` 分支,执行一次拉取确保最新,基于 `feature` 分支切换一个新分支,以下工作将在新分支完成。
|
||||
|
||||
```bash
|
||||
git clone git@github.com:<your organization>/ant-design.git
|
||||
cd ant-design/
|
||||
git remote add upstream origin git@github.com:ant-design/ant-design.git
|
||||
git checkout -b <your new branch name>
|
||||
```
|
||||
|
||||
2. 为 [rc-picker](https://github.com/react-component/picker) 添加对应语言,参考 [这个](https://github.com/react-component/picker/blob/master/src/locale/en_US.ts)。
|
||||
3. 为 [rc-pagination](https://github.com/react-component/pagination) 添加对应语言,参考 [这个](https://github.com/react-component/pagination/blob/master/src/locale/en_US.js)。
|
||||
4. 等待 `rc-picker` 和 `rc-pagination` 发布含上述内容的最低版本。
|
||||
5. 参考 [阿塞拜疆语的 PR](https://github.com/ant-design/ant-design/pull/21387) 向 `antd` 发起 PR,完善对应语言的其他内容和更新 `rc-picker` 和 `rc-pagination` 版本。
|
||||
6. 在 [index.test.js](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/__tests__/index.test.js) 添加该语言的测试用例。
|
||||
7. 更新 snapshot,在这之前或许你还需要先删除 `node_modules` 和 lock 文件 (`yarn.lock` or `package-lock.json`) 并全新安装。
|
||||
|
||||
```bash
|
||||
npm run test -- components/locale-provider -u
|
||||
```
|
||||
|
||||
8. 更新 [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md) 和 [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md),将对应语言添加到文档列表。
|
||||
9. 观察 CI 是否通过,若未通过,根据日志进行修改直至通过。
|
||||
10. 万事俱备等待 review 。
|
||||
|
||||
## i18n 项目示例
|
||||
|
||||
你可以参考 [Ant Design Pro 国际化文档](https://pro.ant.design/docs/i18n-cn) 查看完整的国际化项目示例。
|
||||
|
Loading…
Reference in New Issue
Block a user