mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 09:42:21 -04:00
Merge pull request #1186 from BonySimon/patch-1
Fix exception on translation of objects
This commit is contained in:
commit
d0eeb55999
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue