mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
36 lines
672 B
JavaScript
36 lines
672 B
JavaScript
import React from 'react';
|
|
import { changeConfirmLocale } from '../modal/locale';
|
|
|
|
export default class LocaleProvider extends React.Component {
|
|
static propTypes = {
|
|
locale: React.PropTypes.object,
|
|
}
|
|
|
|
static childContextTypes = {
|
|
antLocale: React.PropTypes.object,
|
|
}
|
|
|
|
getChildContext() {
|
|
return {
|
|
antLocale: this.props.locale,
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.componentDidUpdate();
|
|
}
|
|
|
|
componentDidUpdate() {
|
|
const { locale } = this.props;
|
|
changeConfirmLocale(locale && locale.Modal);
|
|
}
|
|
|
|
componentWillUnMount() {
|
|
changeConfirmLocale();
|
|
}
|
|
|
|
render() {
|
|
return React.Children.only(this.props.children);
|
|
}
|
|
}
|