From 150d1923f73ba566ec2fd3ba63d6db1c240abb32 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 12 Aug 2018 20:27:51 +0800 Subject: [PATCH] add error prompt when cannot load language resource --- src/scripts/services/ariaNgLanguageLoader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/services/ariaNgLanguageLoader.js b/src/scripts/services/ariaNgLanguageLoader.js index 8e111db..707e52e 100644 --- a/src/scripts/services/ariaNgLanguageLoader.js +++ b/src/scripts/services/ariaNgLanguageLoader.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module('ariaNg').factory('ariaNgLanguageLoader', ['$http', '$q', 'localStorageService', 'ariaNgConstants', 'ariaNgLanguages', function ($http, $q, localStorageService, ariaNgConstants, ariaNgLanguages) { + angular.module('ariaNg').factory('ariaNgLanguageLoader', ['$http', '$q', 'localStorageService', 'ariaNgConstants', 'ariaNgLanguages', 'ariaNgNotificationService', 'ariaNgLogService', function ($http, $q, localStorageService, ariaNgConstants, ariaNgLanguages, ariaNgNotificationService, ariaNgLogService) { var getKeyValuePair = function (line) { for (var i = 0; i < line.length; i++) { if (i > 0 && line.charAt(i - 1) !== '\\' && line.charAt(i) === '=') { @@ -106,6 +106,11 @@ localStorageService.set(languageKey, languageObject); return deferred.resolve(languageObject); }).catch(function onError(response) { + ariaNgLogService.warn('[ariaNgLanguageLoader] cannot get language resource'); + ariaNgNotificationService.notifyInPage('', 'AriaNg cannot get the language resource, please check if the language resource exists and the browser has permission to get.', { + type: 'error', + delay: false + }); return deferred.reject(options.key); });