如何在joomla php中获取当前语言的URL语言代码?

I have configured everything that is needed for multilingual website. In the template's code, I see that the link of the logo is pointing to / rather than to /index.php/<language_code>. Therefore, I wanted to put correct link with the current language code.

My problem is that when I click on the logo it takes me to the default language's main page, rather than taking me to the current language's main page. How can I get it working?

Check if this works with your template

<?php
  $app = JFactory::getApplication();
  $lang = JFactory::getLanguage();
  echo $this->language;
?>

Good luck!