Skip to content

Commit

Permalink
tranlate locale-provider ref ant-design#329 (ant-design#1282)
Browse files Browse the repository at this point in the history
* tranlate locale-provider ref ant-design#329

* update
  • Loading branch information
liqi07 authored and lixiaoyang1992 committed Apr 26, 2018
1 parent 25cc1be commit ba923f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
日期
date
</div>
<div
class="am-list-extra"
>
点击查看国际化
Click to see i18n text
</div>
<div
aria-hidden="true"
Expand Down
8 changes: 4 additions & 4 deletions components/locale-provider/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title:
en-US: i18n
---

`LocaleProvider` 包裹你的应用,并引用对应的语言包。
Wrap your app with `LocaleProvider`, and apply the corresponding language package.

````jsx
import { Pagination, LocaleProvider, List, DatePicker, WhiteSpace, Button } from 'antd-mobile';
Expand All @@ -25,12 +25,12 @@ const Page = () => (
>
<DatePicker
mode="date"
title="选择日期"
extra="点击查看国际化"
title="Select date"
extra="Click to see i18n text"
minDate={minDate}
maxDate={maxDate}
>
<List.Item arrow="horizontal">日期</List.Item>
<List.Item arrow="horizontal">date</List.Item>
</DatePicker>
</List>
</div>
Expand Down
20 changes: 10 additions & 10 deletions components/locale-provider/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: LocaleProvider
type: Other
---

为组件内建文案提供统一的国际化支持。
`LocaleProvider` provides a uniform localization support for built-in text of components.

## 使用
## Usage

LocaleProvider 使用 React 的 [context](https://facebook.github.io/react/docs/context.html) 特性,只需在应用外围包裹一次即可全局生效。
`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
Expand All @@ -19,18 +19,18 @@ import enUS from 'antd-mobile/lib/locale-provider/en_US';
return <LocaleProvider locale={enUS}><App /></LocaleProvider>;
```

我们暂时只提供英语,中文两种语言支持(`默认语言是中文`),所有语言包可以在 [这里](https://github.com/ant-design/ant-design-mobile/blob/master/components/locale-provider/) 找到。
We support English and Chinese temporarily, all locale packages can be found in [here](https://github.com/ant-design/ant-design-mobile/blob/master/components/locale-provider/).

### 增加语言包
### Add a new language

如果你找不到你需要的语言包,欢迎你在 [英文语言包](https://github.com/ant-design/ant-design-mobile/blob/master/components/locale-provider/en_US.tsx) 的基础上创建一个新的语言包,并给我们 Pull Request。
If you can't find your language, you are welcome to create a locale package based on [en_US]((https://github.com/ant-design/ant-design-mobile/blob/master/components/locale-provider/en_US.tsx)) and send us a pull request.

### 其他国际化需求
### Other localization needs

本模块仅用于组件的内建文案,若有业务文案的国际化需求,建议使用 [react-intl](https://github.com/yahoo/react-intl),可参考示例:[Intl demo 1](http://github.com/ant-design/intl-example) [Intl demo 2](http://yiminghe.me/learning-react/examples/react-intl.html?locale=en-US)
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 | 语言包配置,语言包可到 `antd-mobile/lib/locale-provider/` 目录下寻找 | object | - |
| locale | anguage package setting, you can find the packages in this path: `antd-mobile/lib/locale-provider/` | object | - |

0 comments on commit ba923f2

Please sign in to comment.