afc163
8 years ago
8 changed files with 143 additions and 22 deletions
@ -1,5 +0,0 @@ |
|||
--- |
|||
order: 9 |
|||
title: i18n Solution |
|||
link: //github.com/ant-design/intl-example |
|||
--- |
@ -1,5 +0,0 @@ |
|||
--- |
|||
order: 9 |
|||
title: i18n 方案 |
|||
link: //github.com/ant-design/intl-example |
|||
--- |
@ -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 . |
@ -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 ,欢迎参考使用。 |
Loading…
Reference in new issue