diff --git a/components/locale-provider/demo/all.md b/components/locale-provider/demo/all.md index 39114fc464..6283844933 100644 --- a/components/locale-provider/demo/all.md +++ b/components/locale-provider/demo/all.md @@ -1,10 +1,18 @@ --- order: 2 -title: 所有组件 +title: + zh-CN: 所有组件 + en-US: All components --- +## zh-CN + 此处列出 Ant Design 中需要国际化支持的组件,你可以在演示里切换语言。 +## en-US + +Components which need localization support are listed here, you can toggle the language in the demo. + ````jsx import { LocaleProvider, Pagination, DatePicker, TimePicker, Calendar, Popconfirm, Table, Modal, Button, Select, Transfer, Radio } from 'antd'; diff --git a/components/locale-provider/demo/basic.md b/components/locale-provider/demo/basic.md index 9c9707e105..62e32231e3 100644 --- a/components/locale-provider/demo/basic.md +++ b/components/locale-provider/demo/basic.md @@ -1,10 +1,18 @@ --- order: 1 -title: 国际化 +title: + zh-CN: 国际化 + en-US: Localization --- +## zh-CN + 用 `LocaleProvider` 包裹你的应用,并引用对应的语言包。 +## en-US + +Wrap you app with `LocaleProvider`, and apply the corresponding language package. + ````jsx import { Pagination, LocaleProvider } from 'antd'; import enUS from 'antd/lib/locale-provider/en_US'; diff --git a/components/locale-provider/index.en-US.md b/components/locale-provider/index.en-US.md new file mode 100644 index 0000000000..4e28155193 --- /dev/null +++ b/components/locale-provider/index.en-US.md @@ -0,0 +1,35 @@ +--- +category: Components +type: Other +cols: 1 +title: LocaleProvider +--- + +`LocaleProvider` provides a uniform localization support for built-in text of components. + +## Usage + +`LocaleProvider` takes use of [context](https://facebook.github.io/react/docs/context.html), a feature of React, to accomplish global effectiveness by wrapping the app only once. + + +```jsx +import enUS from 'antd/lib/locale-provider/en_US'; + +... + +return ; +``` + +### Add a language + +We supply an English locale package. Other language users can create a locale package based on [en_US](https://github.com/ant-design/ant-design/blob/26b1f37392a278285aec6c573b99c6feea09e218/components/locale-provider/en_US.js) and send us a pull request. + +### Other localization needs + +This component aims for localization of the built-in text, if you want to support other documents, we recommend using [react-intl](https://github.com/yahoo/react-intl), refer to [Intl demo 1](http://github.com/ant-design/intl-example) and [Intl demo 2](http://yiminghe.me/learning-react/examples/react-intl.html?locale=en-US). + +## API + +Property | Description | Type | Default +-----|-----|-----|------ +locale | language package setting, you can find the packages in this path: `antd/lib/locale-provider/` | Object | - diff --git a/components/locale-provider/index.md b/components/locale-provider/index.zh-CN.md similarity index 100% rename from components/locale-provider/index.md rename to components/locale-provider/index.zh-CN.md