How to detect the current language of a multilanguage *joomla* website using javascript?
3 Answers
Try this
<?php
$lang = JFactory::getLanguage();
$lang_code = $lang->getTag();
$lang_name = $lang->getName();
?>
In Js
<script type="text/javascript">
var language_code = "<?php echo $lang_code;?>";
var language_name = "<?php echo $lang_name ;?>";
console.log("Lang Code"+language_code+"Lang Name"+language_name);
</script>
Hope this may help you..