support embedding all assets and packaging them into a single html
This commit is contained in:
parent
72a6c10bcb
commit
395442fd0a
61
gulpfile.js
61
gulpfile.js
|
@ -2,6 +2,7 @@ var gulp = require('gulp');
|
||||||
var gulpLoadPlugins = require('gulp-load-plugins');
|
var gulpLoadPlugins = require('gulp-load-plugins');
|
||||||
var browserSync = require('browser-sync');
|
var browserSync = require('browser-sync');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
var $ = gulpLoadPlugins();
|
var $ = gulpLoadPlugins();
|
||||||
var reload = browserSync.reload;
|
var reload = browserSync.reload;
|
||||||
|
@ -149,6 +150,66 @@ gulp.task('info', function () {
|
||||||
|
|
||||||
gulp.task('build', $.sequence('lint', 'html', 'langs', 'images', 'fonts', 'manifest', 'extras', 'info'));
|
gulp.task('build', $.sequence('lint', 'html', 'langs', 'images', 'fonts', 'manifest', 'extras', 'info'));
|
||||||
|
|
||||||
|
gulp.task('bundle-assets', function () {
|
||||||
|
return gulp.src('dist/index.html')
|
||||||
|
.pipe($.replace(/<link rel="stylesheet" href="(css\/[a-zA-Z0-9\-_.]+\.css)">/g, function(match, fileName) {
|
||||||
|
var content = fs.readFileSync('dist/' + fileName, 'utf8');
|
||||||
|
return '<style type="text/css">' + content + '</style>';
|
||||||
|
}))
|
||||||
|
.pipe($.replace(/<script src="(js\/[a-zA-Z0-9\-_.]+\.js)"><\/script>/g, function(match, fileName) {
|
||||||
|
var content = fs.readFileSync('dist/' + fileName, 'utf8');
|
||||||
|
return '<script type="application/javascript">' + content + '</script>';
|
||||||
|
}))
|
||||||
|
.pipe($.replace(/url\(\.\.\/(fonts\/[a-zA-Z0-9\-]+\.woff)(\?[a-zA-Z0-9\-_=.]+)?\)/g, function(match, fileName) {
|
||||||
|
if (!fs.existsSync('dist/' + fileName)) {
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentBuffer = fs.readFileSync('dist/' + fileName);
|
||||||
|
var contentBase64 = contentBuffer.toString('base64');
|
||||||
|
return 'url(data:application/x-font-woff;base64,' + contentBase64 + ')';
|
||||||
|
}))
|
||||||
|
.pipe($.replace(/<\/body>/g, function(match) {
|
||||||
|
var langDir = 'src/langs/';
|
||||||
|
var result = '</body>';
|
||||||
|
var fileNames = fs.readdirSync(langDir, 'utf8');
|
||||||
|
|
||||||
|
if (fileNames.length > 0) {
|
||||||
|
var script = '<script type="application/javascript">' +
|
||||||
|
'angular.module("ariaNg").config(["ariaNgAssetsCacheServiceProvider",function(e){';
|
||||||
|
|
||||||
|
for (var i = 0; i < fileNames.length; i++) {
|
||||||
|
var fileName = fileNames[i];
|
||||||
|
var content = fs.readFileSync(langDir + fileName, 'utf8');
|
||||||
|
|
||||||
|
var lastPointIndex = fileName.lastIndexOf('.');
|
||||||
|
var languageName = fileName.substr(0, lastPointIndex);
|
||||||
|
|
||||||
|
content = content.replace(/\n/g, '\\n');
|
||||||
|
content = content.replace(/"/g, '\\"');
|
||||||
|
script += 'e.setLanguageAsset(\'' + languageName + '\',"' + content + '");';
|
||||||
|
}
|
||||||
|
|
||||||
|
script += '}]);</script>';
|
||||||
|
result = script + result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}))
|
||||||
|
.pipe($.replace(/<[a-z]+( [a-z\-]+="[a-zA-Z0-9\- ]+")* [a-z\-]+="((favicon.ico)|(favicon.png)|(tileicon.png)|(touchicon.png))"\/?>/g, ''))
|
||||||
|
.pipe(gulp.dest('dist'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('bundle-extras', function () {
|
||||||
|
return gulp.src([
|
||||||
|
'LICENSE'
|
||||||
|
]).pipe(gulp.dest('dist'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('bundle-clean', del.bind(null, ['dist/css', 'dist/js', 'dist/fonts']));
|
||||||
|
|
||||||
|
gulp.task('build-bundle', $.sequence('lint', 'html', 'images', 'fonts', 'bundle-assets', 'bundle-extras', 'bundle-clean', 'info'));
|
||||||
|
|
||||||
gulp.task('default', ['clean'], function () {
|
gulp.task('default', ['clean'], function () {
|
||||||
gulp.start('build');
|
gulp.start('build');
|
||||||
});
|
});
|
||||||
|
|
61
package-lock.json
generated
61
package-lock.json
generated
|
@ -3406,7 +3406,8 @@
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
|
@ -3427,12 +3428,14 @@
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
|
@ -3447,17 +3450,20 @@
|
||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
|
@ -3574,7 +3580,8 @@
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
|
@ -3586,6 +3593,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -3600,6 +3608,7 @@
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
|
@ -3607,12 +3616,14 @@
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.1",
|
"safe-buffer": "^5.1.1",
|
||||||
"yallist": "^3.0.0"
|
"yallist": "^3.0.0"
|
||||||
|
@ -3631,6 +3642,7 @@
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
|
@ -3711,7 +3723,8 @@
|
||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
|
@ -3723,6 +3736,7 @@
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
|
@ -3808,7 +3822,8 @@
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
|
@ -3844,6 +3859,7 @@
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
|
@ -3863,6 +3879,7 @@
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
@ -3906,12 +3923,14 @@
|
||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4042,7 +4061,7 @@
|
||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "1.0.34",
|
"version": "1.0.34",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -4060,7 +4079,7 @@
|
||||||
},
|
},
|
||||||
"through2": {
|
"through2": {
|
||||||
"version": "0.6.5",
|
"version": "0.6.5",
|
||||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
|
"resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
|
||||||
"integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
|
"integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -4072,7 +4091,7 @@
|
||||||
},
|
},
|
||||||
"glob-watcher": {
|
"glob-watcher": {
|
||||||
"version": "0.0.6",
|
"version": "0.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz",
|
"resolved": "http://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz",
|
||||||
"integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=",
|
"integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -4155,7 +4174,7 @@
|
||||||
},
|
},
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz",
|
"resolved": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz",
|
||||||
"integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=",
|
"integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
@ -4167,7 +4186,7 @@
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz",
|
"resolved": "http://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz",
|
||||||
"integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=",
|
"integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
@ -4200,7 +4219,7 @@
|
||||||
},
|
},
|
||||||
"gulp": {
|
"gulp": {
|
||||||
"version": "3.9.1",
|
"version": "3.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz",
|
"resolved": "http://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz",
|
||||||
"integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=",
|
"integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -4221,7 +4240,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "4.3.6",
|
"version": "4.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
|
"resolved": "http://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
|
||||||
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=",
|
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
|
@ -10858,7 +10877,7 @@
|
||||||
},
|
},
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "3.0.11",
|
"version": "3.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz",
|
"resolved": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz",
|
||||||
"integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=",
|
"integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -10873,7 +10892,7 @@
|
||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "1.0.34",
|
"version": "1.0.34",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -10901,7 +10920,7 @@
|
||||||
},
|
},
|
||||||
"through2": {
|
"through2": {
|
||||||
"version": "0.6.5",
|
"version": "0.6.5",
|
||||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
|
"resolved": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
|
||||||
"integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
|
"integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
|
@ -388,6 +388,7 @@
|
||||||
<script src="scripts/filters/taskOrderBy.js"></script>
|
<script src="scripts/filters/taskOrderBy.js"></script>
|
||||||
<script src="scripts/filters/taskStatus.js"></script>
|
<script src="scripts/filters/taskStatus.js"></script>
|
||||||
<script src="scripts/filters/volume.js"></script>
|
<script src="scripts/filters/volume.js"></script>
|
||||||
|
<script src="scripts/services/ariaNgAssetsCacheService.js"></script>
|
||||||
<script src="scripts/services/ariaNgLanguageLoader.js"></script>
|
<script src="scripts/services/ariaNgLanguageLoader.js"></script>
|
||||||
<script src="scripts/services/ariaNgCommonService.js"></script>
|
<script src="scripts/services/ariaNgCommonService.js"></script>
|
||||||
<script src="scripts/services/ariaNgNotificationService.js"></script>
|
<script src="scripts/services/ariaNgNotificationService.js"></script>
|
||||||
|
|
56
src/scripts/services/ariaNgAssetsCacheService.js
Normal file
56
src/scripts/services/ariaNgAssetsCacheService.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('ariaNg').provider('ariaNgAssetsCacheService', [function () {
|
||||||
|
var assetsRoot = {};
|
||||||
|
var languageAssetsPrefix = 'languages.';
|
||||||
|
|
||||||
|
var getAsset = function (path) {
|
||||||
|
var parts = path.split('.'),
|
||||||
|
result = assetsRoot;
|
||||||
|
|
||||||
|
for (var i = 0; i < parts.length; i++) {
|
||||||
|
if (angular.isUndefined(result[parts[i]])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = result[parts[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
var setAsset = function (path, value) {
|
||||||
|
var parts = path.split('.'),
|
||||||
|
result = assetsRoot;
|
||||||
|
|
||||||
|
for (var i = 0; i < parts.length - 1; i++) {
|
||||||
|
if (angular.isUndefined(result[parts[i]])) {
|
||||||
|
result[parts[i]] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
result = result[parts[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
result[parts[parts.length - 1]] = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getLanguageAsset = function (languageName) {
|
||||||
|
return getAsset(languageAssetsPrefix + languageName);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.setLanguageAsset = function (languageName, languageContent) {
|
||||||
|
setAsset(languageAssetsPrefix + languageName, languageContent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$get = function () {
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
return {
|
||||||
|
getLanguageAsset: function (languageName) {
|
||||||
|
return that.getLanguageAsset(languageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}]);
|
||||||
|
}());
|
|
@ -1,7 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').factory('ariaNgLanguageLoader', ['$http', '$q', 'ariaNgConstants', 'ariaNgLanguages', 'ariaNgNotificationService', 'ariaNgLogService', 'ariaNgStorageService', function ($http, $q, ariaNgConstants, ariaNgLanguages, ariaNgNotificationService, ariaNgLogService, ariaNgStorageService) {
|
angular.module('ariaNg').factory('ariaNgLanguageLoader', ['$http', '$q', 'ariaNgConstants', 'ariaNgLanguages', 'ariaNgAssetsCacheService', 'ariaNgNotificationService', 'ariaNgLogService', 'ariaNgStorageService', function ($http, $q, ariaNgConstants, ariaNgLanguages, ariaNgAssetsCacheService, ariaNgNotificationService, ariaNgLogService, ariaNgStorageService) {
|
||||||
var getKeyValuePair = function (line) {
|
var getKeyValuePair = function (line) {
|
||||||
for (var i = 0; i < line.length; i++) {
|
for (var i = 0; i < line.length; i++) {
|
||||||
if (i > 0 && line.charAt(i - 1) !== '\\' && line.charAt(i) === '=') {
|
if (i > 0 && line.charAt(i - 1) !== '\\' && line.charAt(i) === '=') {
|
||||||
|
@ -96,6 +96,14 @@
|
||||||
deferred.resolve(languageResource);
|
deferred.resolve(languageResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ariaNgAssetsCacheService.getLanguageAsset(options.key)) {
|
||||||
|
var languageObject = getLanguageObject(ariaNgAssetsCacheService.getLanguageAsset(options.key));
|
||||||
|
ariaNgStorageService.set(languageKey, languageObject);
|
||||||
|
deferred.resolve(languageObject);
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
||||||
var languagePath = ariaNgConstants.languagePath + '/' + options.key + ariaNgConstants.languageFileExtension;
|
var languagePath = ariaNgConstants.languagePath + '/' + options.key + ariaNgConstants.languageFileExtension;
|
||||||
|
|
||||||
$http({
|
$http({
|
||||||
|
|
Reference in a new issue