From: Grégoire Aubert Date: Tue, 3 Oct 2017 13:43:28 +0000 (+0200) Subject: Prevent js error when language bundle import fail X-Git-Tag: 6.6-RC1~53 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e6fc6203ef5bc20ad583c1f6bb06169b38b9cec9;p=sonarqube.git Prevent js error when language bundle import fail --- diff --git a/server/sonar-web/src/main/js/app/components/LocalizationContainer.tsx b/server/sonar-web/src/main/js/app/components/LocalizationContainer.tsx index 4391b8d8379..1077d7e0353 100644 --- a/server/sonar-web/src/main/js/app/components/LocalizationContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/LocalizationContainer.tsx @@ -48,9 +48,12 @@ export default class LocalizationContainer extends React.PureComponent { const langToLoad = lang || DEFAULT_LANGUAGE; - // No need to load english bundle, it's coming wiht react-intl + // No need to load english bundle, it's coming wiht react-intl, use english if it fails if (langToLoad !== 'en') { - import('react-intl/locale-data/' + langToLoad).then(i => this.updateLang(langToLoad, i)); + import('react-intl/locale-data/' + langToLoad).then( + i => this.updateLang(langToLoad, i), + () => {} + ); } else { this.setState({ loading: false, lang: langToLoad }); }