You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
675 B

import React from 'react';
import { changeConfirmLocale } from '../modal/confirm';
export default class LocaleProvider extends React.Component {
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);
}
}
LocaleProvider.childContextTypes = {
antLocale: React.PropTypes.object,
};
LocaleProvider.propTypes = {
locale: React.PropTypes.object,
};