Use vendor/es6-promise for loading translations

This commit is contained in:
Julia Radzhabova 2019-09-18 14:16:37 +03:00
parent 8ec738fa18
commit b338820d20
3 changed files with 16 additions and 5 deletions

View file

@ -42,10 +42,8 @@ Common.Locale = new(function() {
var _applyLocalization = function(callback) {
try {
console.log('_applyLocalization');
callback && (loadcallback = callback);
if (l10n) {
console.log('_apply ok');
for (var prop in l10n) {
var p = prop.split('.');
if (p && p.length > 2) {
@ -114,7 +112,6 @@ Common.Locale = new(function() {
l10n = l10n || {};
apply && _applyLocalization();
if ( e.message == 'loaded' ) {
console.log('loaded');
} else
console.log('fetch error: ' + e);
});
@ -124,7 +121,7 @@ Common.Locale = new(function() {
/* use fetch polifill if native method isn't supported */
var polyfills = ['../vendor/fetch/fetch.umd'];
if ( !window.Promise ) {
require(['//cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js'],
require(['../vendor/es6-promise/es6-promise.auto.min.js'],
function () {
require(polyfills, _requireLang);
});

View file

@ -165,6 +165,7 @@ module.exports = function(grunt) {
doRegisterTask('bootstrap');
doRegisterTask('iscroll');
doRegisterTask('fetch');
doRegisterTask('es6-promise');
doRegisterTask('jszip');
doRegisterTask('jsziputils');
doRegisterTask('requirejs', function(defaultConfig, packageFile) {
@ -511,6 +512,7 @@ module.exports = function(grunt) {
grunt.registerTask('deploy-jszip', ['jszip-init', 'clean', 'copy']);
grunt.registerTask('deploy-jsziputils', ['jsziputils-init', 'clean', 'copy']);
grunt.registerTask('deploy-requirejs', ['requirejs-init', 'clean', 'uglify']);
grunt.registerTask('deploy-es6-promise', ['es6-promise-init', 'clean', 'copy']);
grunt.registerTask('deploy-app-main', ['main-app-init', 'clean:prebuild', 'imagemin', 'less', 'requirejs', 'concat',
'copy', 'svgmin', 'inline', 'json-minify',

View file

@ -205,6 +205,17 @@
}
}
},
"es6-promise": {
"clean": [
"../deploy/web-apps/vendor/es6-promise"
],
"copy": {
"script": {
"src": "../vendor/es6-promise/es6-promise.auto.min.js",
"dest": "../deploy/web-apps/vendor/es6-promise/es6-promise.auto.min.js"
}
}
},
"requirejs": {
"clean": [
"../deploy/web-apps/vendor/requirejs"
@ -229,7 +240,8 @@
"deploy-iscroll",
"deploy-fetch",
"deploy-jszip",
"deploy-jsziputils"
"deploy-jsziputils",
"deploy-es6-promise"
]
}
}