removed for in loop

v1.18.x
barisusakli 11 years ago
parent ef4972f66b
commit fb43282a9c

@ -104,7 +104,7 @@
if (value) {
for (var i = 1, ii = variables.length; i < ii; i++) {
var variable = variables[i].replace(']]', '');
value = ('' + value).replace('%' + i, variable);
value = value.replace('%' + i, variable);
}
text = text.replace(key, value);
@ -119,12 +119,17 @@
var keys = data.match(/\[\[.*?\]\]/g),
loading = 0;
for (var key in keys) {
if (keys.hasOwnProperty(key)) {
keys[key] = '' + keys[key];
var variables = keys[key].split(/[,][?\s+]/);
if (!keys) {
return callback(data);
}
for (var i=0; i<keys.length; ++i) {
var key = keys[i];
var parsedKey = keys[key].replace('[[', '').replace(']]', '').split(':');
key = '' + key;
var variables = key.split(/[,][?\s+]/);
var parsedKey = key.replace('[[', '').replace(']]', '').split(':');
if (!(parsedKey[0] && parsedKey[1])) {
continue;
}
@ -133,7 +138,7 @@
parsedKey = ('' + parsedKey[1]).split(',')[0];
if (files.loaded[languageFile]) {
data = insertLanguage(data, keys[key], files.loaded[languageFile][parsedKey], variables);
data = insertLanguage(data, key, files.loaded[languageFile][parsedKey], variables);
} else {
loading++;
(function (languageKey, parsedKey, languageFile, variables) {
@ -142,8 +147,7 @@
loading--;
checkComplete();
});
}(keys[key], parsedKey, languageFile, variables));
}
}(key, parsedKey, languageFile, variables));
}
}
@ -154,7 +158,6 @@
callback(data);
}
}
};
translator.clearLoadedFiles = function() {

Loading…
Cancel
Save