From 280858a513343fa59fa3f774dc6e3299fa5fac57 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 5 Mar 2017 23:12:57 +0800 Subject: [PATCH] language loader support escape symbol --- src/scripts/services/ariaNgLanguageLoader.js | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/scripts/services/ariaNgLanguageLoader.js b/src/scripts/services/ariaNgLanguageLoader.js index d146300..99aec37 100644 --- a/src/scripts/services/ariaNgLanguageLoader.js +++ b/src/scripts/services/ariaNgLanguageLoader.js @@ -3,18 +3,18 @@ angular.module('ariaNg').factory('ariaNgLanguageLoader', ['$http', '$q', 'localStorageService', 'ariaNgConstants', 'ariaNgLanguages', function ($http, $q, localStorageService, ariaNgConstants, ariaNgLanguages) { var getKeyValuePair = function (line) { - var equalSignPos = line.indexOf('='); - - if (equalSignPos > 0) { - return { - key: line.substring(0, equalSignPos), - value: line.substring(equalSignPos + 1, line.length) - }; - } else { - return { - value: line - }; + for (var i = 0; i < line.length; i++) { + if (i > 0 && line.charAt(i - 1) !== '\\' && line.charAt(i) === '=') { + return { + key: line.substring(0, i).replace('\\=', '='), + value: line.substring(i + 1, line.length).replace('\\=', '=') + }; + } } + + return { + value: line + }; }; var getCategory = function (langObj, category) {