show load language error only when language resource does not exist in cache

This commit is contained in:
MaysWind 2019-08-20 21:09:46 +08:00
parent d34aa1ea83
commit d63058c3e0

View file

@ -100,7 +100,7 @@
var languageObject = getLanguageObject(ariaNgAssetsCacheService.getLanguageAsset(options.key)); var languageObject = getLanguageObject(ariaNgAssetsCacheService.getLanguageAsset(options.key));
ariaNgStorageService.set(languageKey, languageObject); ariaNgStorageService.set(languageKey, languageObject);
deferred.resolve(languageObject); deferred.resolve(languageObject);
return deferred.promise; return deferred.promise;
} }
@ -115,10 +115,12 @@
return deferred.resolve(languageObject); return deferred.resolve(languageObject);
}).catch(function onError(response) { }).catch(function onError(response) {
ariaNgLogService.warn('[ariaNgLanguageLoader] cannot get language resource'); ariaNgLogService.warn('[ariaNgLanguageLoader] cannot get language resource');
ariaNgNotificationService.notifyInPage('', 'AriaNg cannot get language resources, and will display in default language.', { if (!languageResource) {
type: 'error', ariaNgNotificationService.notifyInPage('', 'AriaNg cannot get language resources, and will display in default language.', {
delay: false type: 'error',
}); delay: false
});
}
return deferred.reject(options.key); return deferred.reject(options.key);
}); });