mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge pull request #1186 from BonySimon/patch-1
Fix exception on translation of objects
This commit is contained in:
commit
d0eeb55999
@ -126,6 +126,9 @@ var Translator = (function() {
|
|||||||
// variables: {timeToWait: "2 hours", work: "painting"}
|
// variables: {timeToWait: "2 hours", work: "painting"}
|
||||||
// to: "Please wait for 2 hours before continuing with painting."
|
// to: "Please wait for 2 hours before continuing with painting."
|
||||||
function createStringFromTemplate(template, variables) {
|
function createStringFromTemplate(template, variables) {
|
||||||
|
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;
|
template = variables.fallback;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user