language loader support escape symbol

This commit is contained in:
MaysWind 2017-03-05 23:12:57 +08:00
parent 89feb0cfb9
commit 280858a513

View file

@ -3,18 +3,18 @@
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', function ($http, $q, localStorageService, ariaNgConstants, ariaNgLanguages) {
var getKeyValuePair = function (line) { var getKeyValuePair = function (line) {
var equalSignPos = line.indexOf('='); for (var i = 0; i < line.length; i++) {
if (i > 0 && line.charAt(i - 1) !== '\\' && line.charAt(i) === '=') {
if (equalSignPos > 0) {
return { return {
key: line.substring(0, equalSignPos), key: line.substring(0, i).replace('\\=', '='),
value: line.substring(equalSignPos + 1, line.length) value: line.substring(i + 1, line.length).replace('\\=', '=')
}; };
} else { }
}
return { return {
value: line value: line
}; };
}
}; };
var getCategory = function (langObj, category) { var getCategory = function (langObj, category) {