2015-10-23 17:57:02 +08:00
|
|
|
# 国际化
|
|
|
|
|
|
|
|
- order: 9
|
|
|
|
|
2015-11-16 14:10:42 +08:00
|
|
|
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
|
2015-10-23 17:57:02 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
2015-12-10 16:12:10 +08:00
|
|
|
import { DatePicker } from 'antd';
|
|
|
|
import enUS from 'antd/lib/date-picker/locale/en_US';
|
2015-11-25 17:35:49 +08:00
|
|
|
import assign from 'object-assign';
|
2015-10-23 17:57:02 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const App = React.createClass({
|
2015-10-23 17:57:02 +08:00
|
|
|
getInitialState() {
|
|
|
|
return {
|
2015-11-16 16:12:39 +08:00
|
|
|
locale: assign({}, enUS, {
|
2015-10-23 17:57:02 +08:00
|
|
|
timezoneOffset: 0 * 60,
|
|
|
|
firstDayOfWeek: 0,
|
2015-11-16 14:10:42 +08:00
|
|
|
minimalDaysInFirstWeek: 1
|
2015-11-16 16:12:39 +08:00
|
|
|
})
|
2015-10-23 17:57:02 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
render() {
|
2015-12-10 16:12:10 +08:00
|
|
|
return <DatePicker locale={this.state.locale} />;
|
2015-10-23 17:57:02 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-10 16:12:10 +08:00
|
|
|
ReactDOM.render(<App />, document.getElementById('components-date-picker-demo-locale'));
|
2015-10-23 17:57:02 +08:00
|
|
|
````
|
|
|
|
|