Merge pull request #1186 from BonySimon/patch-1

Fix exception on translation of objects
This commit is contained in:
Michael Teeuw 2018-03-25 14:55:52 +02:00 committed by GitHub
commit d0eeb55999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,6 +126,9 @@ var Translator = (function() {
// variables: {timeToWait: "2 hours", work: "painting"}
// to: "Please wait for 2 hours before continuing with painting."
function createStringFromTemplate(template, variables) {
if(Object.prototype.toString.call(template) !== "[object String]") {
return template;
}
if(variables.fallback && !template.match(new RegExp("\{.+\}"))) {
template = variables.fallback;
}