aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-03 15:43:28 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-04 12:02:16 +0200
commite6fc6203ef5bc20ad583c1f6bb06169b38b9cec9 (patch)
treea48822173a472a6f6dc91d77359313d9c6679e50
parent23d0f3ac8fd3019820e035411c579a435fbb6e47 (diff)
downloadsonarqube-e6fc6203ef5bc20ad583c1f6bb06169b38b9cec9.tar.gz
sonarqube-e6fc6203ef5bc20ad583c1f6bb06169b38b9cec9.zip
Prevent js error when language bundle import fail
-rw-r--r--server/sonar-web/src/main/js/app/components/LocalizationContainer.tsx7
1 files 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<Props, St
bundleLoaded = (lang: string) => {
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 });
}