ant-design/components/calendar/demo/locale.md

31 lines
655 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
2017-01-13 17:11:26 +08:00
order: 3
title:
zh-CN: 国际化
en-US: locale
2016-03-31 09:40:55 +08:00
---
2015-11-16 20:24:37 +08:00
## zh-CN
通过 `locale` 配置语言, 默认支持 en_US, zh_CN
2015-11-16 20:24:37 +08:00
2016-08-15 11:42:44 +08:00
## en-US
To set the language. en_US, zh_CN are supported by default.
2017-02-13 10:55:53 +08:00
````jsx
2015-11-16 20:24:37 +08:00
import { Calendar } from 'antd';
import enUS from 'antd/lib/calendar/locale/en_US';
import moment from 'moment';
// It's recommended to set moment locale globally, otherwise, you need to set it by `value` or `defaultValue`
// moment.locale('en');
2015-11-16 20:24:37 +08:00
function onPanelChange(value, mode) {
console.log(value, mode);
}
ReactDOM.render(
<Calendar defaultValue={moment().locale('en')} onPanelChange={onPanelChange} locale={enUS} />
, mountNode);
2015-11-16 20:24:37 +08:00
````