Skip to content
Snippets Groups Projects
Commit 59565319 authored by Tainan Felipe's avatar Tainan Felipe
Browse files

Add init state for locale comparison

parent b648c26c
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,7 @@ class IntlStartup extends Component {
messages: {},
normalizedLocale: null,
fetching: true,
init: true,
};
if (RTL_LANGUAGES.includes(props.locale)) {
......@@ -153,14 +154,20 @@ class IntlStartup extends Component {
}
componentDidUpdate() {
const { fetching, normalizedLocale } = this.state;
const { fetching, normalizedLocale, init } = this.state;
const { locale } = this.props;
if (!fetching
&& normalizedLocale
&& locale.toLowerCase() !== normalizedLocale.toLowerCase()) {
&& ((locale.toLowerCase() !== normalizedLocale.toLowerCase())
&& (!init && (DEFAULT_LANGUAGE && normalizedLocale.toLowerCase())))) {
this.fetchLocalizedMessages(locale);
}
if (init && !normalizedLocale) {
this.setState({
init: false,
});
}
}
fetchLocalizedMessages(locale, init = false) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment