From e6fc6203ef5bc20ad583c1f6bb06169b38b9cec9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Tue, 3 Oct 2017 15:43:28 +0200 Subject: [PATCH] Prevent js error when language bundle import fail --- .../src/main/js/app/components/LocalizationContainer.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 }); } -- 2.39.5