Merge pull request #2393 from MikeBishop/translator_falsy_vars

Permit substituting a falsy value in translator variables
This commit is contained in:
Michael Teeuw 2020-12-31 16:27:43 +01:00 committed by GitHub
commit 353cc3b00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -58,6 +58,7 @@ _This release is scheduled to be released on 2021-01-01._
- update node-ical version again, 0.12.5, change RRULE fix (#2371, #2379) - update node-ical version again, 0.12.5, change RRULE fix (#2371, #2379)
- Added missing function call in module.show() - Added missing function call in module.show()
- remove undefined objects from modules array (#2382) - remove undefined objects from modules array (#2382)
- Translator variables can have falsy values (e.g. empty string)
## [2.13.0] - 2020-10-01 ## [2.13.0] - 2020-10-01

View File

@ -68,7 +68,7 @@ var Translator = (function () {
template = variables.fallback; 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 + "}"; return varName in variables ? variables[varName] : "{" + varName + "}";
}); });
} }