Fix lots of warnings

This commit is contained in:
rejas
2020-04-21 07:36:18 +02:00
parent 941d5d7cd9
commit d08bd4e866
13 changed files with 26 additions and 32 deletions

View File

@@ -1,4 +1,5 @@
/* exported Translator */
/* Magic Mirror
* Translator (l10n)
*
@@ -129,10 +130,10 @@ var Translator = (function() {
if(Object.prototype.toString.call(template) !== "[object String]") {
return template;
}
if(variables.fallback && !template.match(new RegExp("\{.+\}"))) {
if(variables.fallback && !template.match(new RegExp("{.+}"))) {
template = variables.fallback;
}
return template.replace(new RegExp("\{([^\}]+)\}", "g"), function(_unused, varName){
return template.replace(new RegExp("{([^}]+)}", "g"), function(_unused, varName){
return variables[varName] || "{"+varName+"}";
});
}