update some documentation

This commit is contained in:
afc163 2017-03-12 15:20:25 +08:00
parent 0df0659a9d
commit b29bec002e
8 changed files with 143 additions and 22 deletions

View File

@ -55,9 +55,8 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
## TypeScript
tsconfig.json
```js
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
@ -71,14 +70,18 @@ tsconfig.json
> 注意: 不要使用 @types/antd, antd 已经自带了 TypeScript 定义。
## 国际化
参考 [国际化文档](http://ant.design/docs/react/i18n)。
## 链接
- [首页](http://ant.design/index-cn)
- [组件文档](http://ant.design/docs/react/introduce-cn)
- [UI 组件库](http://ant.design/docs/react/introduce-cn)
- [更新日志](CHANGELOG.en-US.md)
- [开发脚手架](https://github.com/dvajs/dva-cli)
- [开发工具文档](http://ant-tool.github.io/)
- [React 基础组件](http://react-component.github.io/)
- [React 底层基础组件](http://react-component.github.io/)
- [移动端组件](http://mobile.ant.design)
- [动效](https://motion.ant.design)
- [设计规范速查手册](https://github.com/ant-design/ant-design/wiki/Ant-Design-%E8%AE%BE%E8%AE%A1%E5%9F%BA%E7%A1%80%E7%AE%80%E7%89%88)

View File

@ -86,9 +86,8 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
## TypeScript
tsconfig.json
```js
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
@ -102,6 +101,10 @@ tsconfig.json
> Note: Don't use @types/antd, antd provide a built-in ts definition already.
## Internationalization
See [i18n](http://ant.design/docs/react/i18n).
## Links
- [Home page](http://ant.design/)
@ -109,7 +112,7 @@ tsconfig.json
- [Change Log](CHANGELOG.en-US.md)
- [Scaffold tool](https://github.com/dvajs/dva-cli/)
- [Development tool](http://ant-tool.github.io/)
- [React components](http://react-component.github.io/)
- [rc-components](http://react-component.github.io/)
- [Mobile UI](http://mobile.ant.design)
- [Motion](https://motion.ant.design)
- [Developer Instruction](https://github.com/ant-design/ant-design/wiki/Development)
@ -120,6 +123,16 @@ tsconfig.json
- [Awesome Ant Design](https://github.com/websemantics/awesome-ant-design)
- [Customize Theme](http://ant.design/docs/react/customize-theme)
## Development
```bash
$ git clone git@github.com:ant-design/ant-design.git
$ npm install
$ npm start
```
Open your browser and visit http://127.0.0.1:8001 .
## Contributing
We welcome all contributions, please read our [CONTRIBUTING.md](https://github.com/ant-design/ant-design/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/ant-design/ant-design/pulls) or as [GitHub issues](https://github.com/ant-design/ant-design/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/ant-design/ant-design/wiki/Development) and have a good time! :)

View File

@ -1,5 +0,0 @@
---
order: 9
title: i18n Solution
link: //github.com/ant-design/intl-example
---

View File

@ -1,5 +0,0 @@
---
order: 9
title: i18n 方案
link: //github.com/ant-design/intl-example
---

41
docs/react/i18n.en-US.md Normal file
View File

@ -0,0 +1,41 @@
---
order: 9
title: Internationalization
---
The default language of `antd@2.x` is still Chinese yet.
If you want to use English or other languages, you can follow instruction below.
## LocaleProvider
antd provide a React Compnent [LocaleProvider](/components/locale-provider) for configuring antd locale text globally.
```jsx
import enUS from 'antd/lib/locale-provider/en_US';
return (
<LocaleProvider locale={enUS}>
<App />
</LocaleProvider>
);
```
Supported languages:
- English - en_US
- French (Belgium) - fr_BE
- Russian - ru_RU
- Spanish - es_ES
- German - de_DE
- Czech - cs_CZ
- Portuguese (Brazil) - pt_BR
- Korean - ko_KR
- Swedish - sv_SE
- Dutch - nl_NL
- Catalan - ca_ES
See usage and contributing way of a new locale package at [LocaleProvider](/components/locale-provider)。
## i18n sample
We also provide you a complete sample of internationalization usage, which is using [react-intl](https://github.com/yahoo/react-intl) and LocaleProvider: https://github.com/ant-design/intl-example .

40
docs/react/i18n.zh-CN.md Normal file
View File

@ -0,0 +1,40 @@
---
order: 9
title: 国际化
---
`antd` 目前的默认文案是中文,如果需要使用英文或其他语言,可以参考下面的方案。
## LocaleProvider
antd 提供了一个 React 组件 [LocaleProvider](/components/locale-provider) 用于全局配置国际化文案。
```jsx
import enUS from 'antd/lib/locale-provider/en_US';
return (
<LocaleProvider locale={enUS}>
<App />
</LocaleProvider>
);
```
目前支持以下语言:
- 英文 - en_US
- 法语(比利时)- fr_BE
- 俄语 - ru_RU
- 西班牙语 - es_ES
- 德语 - de_DE
- 捷克语 - cs_CZ
- 葡萄牙(巴西)- pt_BR
- 韩语 - ko_KR
- 瑞典语 - sv_SE
- 荷兰语 - nl_NL
- 加泰罗尼亚 - ca_ES
具体的使用方法和新语言包贡献方式请参考 [LocaleProvider 文档](/components/locale-provider)。
## i18n 项目示例
我们还提供了一个使用了 [react-intl](https://github.com/yahoo/react-intl) 和 LocaleProvider 的完整的国际化项目示例https://github.com/ant-design/intl-example ,欢迎参考使用。

View File

@ -110,13 +110,30 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
// import 'antd/lib/date-picker/style'; // that will import less
```
## Useful Links
## TypeScript
- [Home page](http://ant.design/)
```js
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
}
```
> Note: set `allowSyntheticDefaultImports` to prevent `error TS1192: Module 'react' has no default export`.
> Note: Don't use @types/antd, antd provide a built-in ts definition already.
## Links
- [Home Page](http://ant.design/)
- [UI library](/docs/react/introduce)
- [Change Log](/changelog)
- [Scaffold tool](https://github.com/dvajs/dva-cli/)
- [React components](http://react-component.github.io/)
- [rc-components](http://react-component.github.io/)
- [Mobile UI](http://mobile.ant.design)
- [Motion](https://motion.ant.design)
- [Developer Instruction](https://github.com/ant-design/ant-design/wiki/Development)

View File

@ -113,14 +113,31 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
// import 'antd/lib/date-picker/style'; // 加载 LESS
```
## TypeScript
```js
// tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
}
}
```
> 注意:设置 `allowSyntheticDefaultImports` 避免 `error TS1192: Module 'react' has no default export` 的错误。
> 注意: 不要使用 @types/antd, antd 已经自带了 TypeScript 定义。
## 链接
- [首页](http://ant.design/)
- [组件文档](/docs/react/introduce)
- [UI 组件库](/docs/react/introduce)
- [更新日志](/changelog)
- [开发脚手架](https://github.com/dvajs/dva-cli/)
- [开发工具文档](http://ant-tool.github.io/)
- [React 基础组件](http://react-component.github.io/)
- [React 底层基础组件](http://react-component.github.io/)
- [移动端组件](http://mobile.ant.design)
- [动效](https://motion.ant.design)
- [设计规范速查手册](https://github.com/ant-design/ant-design/wiki/Ant-Design-%E8%AE%BE%E8%AE%A1%E5%9F%BA%E7%A1%80%E7%AE%80%E7%89%88)