diff --git a/assets/js/common/page.js b/assets/js/common/page.js index 868bbd07..d16f4d45 100644 --- a/assets/js/common/page.js +++ b/assets/js/common/page.js @@ -339,10 +339,25 @@ ComunicWeb.common.page = { } } + //Apply required translations + while(templateContent.includes("[[")){ + + //Get the full template inclusion + var source = templateContent.match(/\[\[.*\]\]/i)[0]; + + //Determine lang key + var key = source.replace("[[", "").replace("]]", ""); + var translation = lang(key); + + //Apply lang + while(templateContent.includes(source)) + templateContent = templateContent.replace(source, translation); + } + //Apply template source targetElem.innerHTML = templateContent; - //Make a link live + //Make links live var aElems = targetElem.getElementsByTagName("a"); for(num in aElems){