From b29bec002ec9b6b7a92c52f34261c74c86a71d30 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 12 Mar 2017 15:20:25 +0800 Subject: [PATCH] update some documentation --- README-zh_CN.md | 11 ++++++--- README.md | 19 +++++++++++--- docs/react/i18n-solution.en-US.md | 5 ---- docs/react/i18n-solution.zh-CN.md | 5 ---- docs/react/i18n.en-US.md | 41 +++++++++++++++++++++++++++++++ docs/react/i18n.zh-CN.md | 40 ++++++++++++++++++++++++++++++ docs/react/introduce.en-US.md | 23 ++++++++++++++--- docs/react/introduce.zh-CN.md | 21 ++++++++++++++-- 8 files changed, 143 insertions(+), 22 deletions(-) delete mode 100644 docs/react/i18n-solution.en-US.md delete mode 100644 docs/react/i18n-solution.zh-CN.md create mode 100644 docs/react/i18n.en-US.md create mode 100644 docs/react/i18n.zh-CN.md diff --git a/README-zh_CN.md b/README-zh_CN.md index db3ea2a053..44143a4b1d 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -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) diff --git a/README.md b/README.md index 3d62fb1ddb..34ad202c44 100644 --- a/README.md +++ b/README.md @@ -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! :) diff --git a/docs/react/i18n-solution.en-US.md b/docs/react/i18n-solution.en-US.md deleted file mode 100644 index f61019c454..0000000000 --- a/docs/react/i18n-solution.en-US.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -order: 9 -title: i18n Solution -link: //github.com/ant-design/intl-example ---- diff --git a/docs/react/i18n-solution.zh-CN.md b/docs/react/i18n-solution.zh-CN.md deleted file mode 100644 index d444d6182c..0000000000 --- a/docs/react/i18n-solution.zh-CN.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -order: 9 -title: i18n 方案 -link: //github.com/ant-design/intl-example ---- diff --git a/docs/react/i18n.en-US.md b/docs/react/i18n.en-US.md new file mode 100644 index 0000000000..7d482df0b7 --- /dev/null +++ b/docs/react/i18n.en-US.md @@ -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 ( + + + +); +``` + +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 . diff --git a/docs/react/i18n.zh-CN.md b/docs/react/i18n.zh-CN.md new file mode 100644 index 0000000000..409857a983 --- /dev/null +++ b/docs/react/i18n.zh-CN.md @@ -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 ( + + + +); +``` + +目前支持以下语言: + +- 英文 - 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 ,欢迎参考使用。 diff --git a/docs/react/introduce.en-US.md b/docs/react/introduce.en-US.md index 089f7aa2af..d3bed634e5 100644 --- a/docs/react/introduce.en-US.md +++ b/docs/react/introduce.en-US.md @@ -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) diff --git a/docs/react/introduce.zh-CN.md b/docs/react/introduce.zh-CN.md index 60763bd493..1ad76380be 100644 --- a/docs/react/introduce.zh-CN.md +++ b/docs/react/introduce.zh-CN.md @@ -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)