Developer forum

Forum » Feature requests » Lang as global tag

Lang as global tag


Reply

Hi,

 

Would be nice to have the ISO language of the language/area as a global tag. Currently it is only a master template tag (< !--@Lang-- >).

 

With it we could make multilanguage template with javascript, for example:

 

< script type="text/javascript">

  var lang = "< !--Global:Lang-- >";

 

  if (lang == "pt") {

    document.write("portuguese");

  else

    document.write("other language");

  }

 

< /script>


Replies

 
Reply

I can imagine there would be a lot of instances, where this information would be relevant as a template tag. In case you didn't know, here's a small workaround.

 

If you enter this in the head section of your Master template:

 

<script language="Javascript" type="text/javascript">
 var IsPortuguese = ("<!--@LongLang-->" == "pt-PT");
</script>

 

 You can use it in all other templates used on the page like this:

 

<script language="Javascript" type="text/javascript">
if (IsPortuguese){
 document.write("Portuguese");
}else{
 document.write("Other language");
}
</script>

 

 
Reply

Hi Lars,

 

In fact I tried using it in the past, but the Lang, not the LongLang tag, in the master template. However, the Lang tag is not rendered when you select a stylesheet to a page, so for cases like "Homepages" or pages that require a different stylesheet, we got that problem.

 

I will test this tag to see it works, or has the same bug.

 

Best Regards,

Nuno

 
Reply

Ok, that sounds weird. But please report it, if this doesn't work. I just opened up my master template and typed it in, so that's as much guarantee I can give you for now:)