Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ function loadTranslationsPath(id,path,reload){
}

try {
translations = "(function(){return "+translations+";})();";
// remove `"use strict";` at the beginning of the file (add generally by tanspiler like typescript) if present
if (/^\s*("use\sstrict");?/.test(translations)) {
translations = translations.replace(/^\s*"use\sstrict";?\s*/, '');
}
if (translations.trim().endsWith(";")) {
translations = "(function(){return " + translations + "})();";
} else {
translations = "(function(){return " + translations + ";})();";
}
if(!jshint(translations)){
var checkfail = jshint.data().errors;
var jsHintError = new Error("Sheet sintax error");
Expand Down Expand Up @@ -189,4 +197,4 @@ function functionBody(func){
end = end.exec(source);
if(end){end = end.index;} else {end = source.length;}
return source.substring(ini,end);
}
}