mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-25 21:39:21 +00:00
Made translation of templates easier
This commit is contained in:
parent
28097368e1
commit
cb2a7a5b04
@ -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){
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user