Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidUpdate(prevProps) {
if (this.props.locale !== undefined && this.props.locale !== prevProps.locale) {
try {
i18nLoader(this.props.locale, this.setState, this);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
}
}
componentDidMount() {
if (this.props.locale !== undefined) {
try {
i18nLoader(this.props.locale, this.setState, this);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
}
}
handleLocaleChange(e) {
i18nLoader(e.target.value, this.setState, this);
}
componentDidMount() {
i18nLoader(this.state.locale, this.setState, this);
}
handleLocaleChange(e) {
i18nLoader(e.target.value, this.setState, this);
}
componentDidMount() {
i18nLoader(this.state.locale, this.setState, this);
}
locale = _props.locale,
customMessages = _props.customMessages,
customProps = _objectWithoutProperties(_props, ['children', 'locale', 'customMessages']);
var childComponent = _react2.default.createElement(
'div',
customProps,
children
);
var messages = _extends({}, this.state.messages, customMessages);
if (locale === undefined) return childComponent;
if (!this.state.areTranslationsLoaded) return null;
return _react2.default.createElement(
_terraI18n.I18nProvider,
{ locale: this.state.locale, messages: messages },
childComponent
);
}
}]);