From d63058c3e05fe75ee5be39ae07ca40a7b0cecfcf Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 20 Aug 2019 21:09:46 +0800 Subject: [PATCH] show load language error only when language resource does not exist in cache --- src/scripts/services/ariaNgLanguageLoader.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/scripts/services/ariaNgLanguageLoader.js b/src/scripts/services/ariaNgLanguageLoader.js index 19b4a78..a867976 100644 --- a/src/scripts/services/ariaNgLanguageLoader.js +++ b/src/scripts/services/ariaNgLanguageLoader.js @@ -100,7 +100,7 @@ var languageObject = getLanguageObject(ariaNgAssetsCacheService.getLanguageAsset(options.key)); ariaNgStorageService.set(languageKey, languageObject); deferred.resolve(languageObject); - + return deferred.promise; } @@ -115,10 +115,12 @@ return deferred.resolve(languageObject); }).catch(function onError(response) { ariaNgLogService.warn('[ariaNgLanguageLoader] cannot get language resource'); - ariaNgNotificationService.notifyInPage('', 'AriaNg cannot get language resources, and will display in default language.', { - type: 'error', - delay: false - }); + if (!languageResource) { + ariaNgNotificationService.notifyInPage('', 'AriaNg cannot get language resources, and will display in default language.', { + type: 'error', + delay: false + }); + } return deferred.reject(options.key); });