How to find the current language of Joomla sites

How to find the current language of Joomla sites

New Issue
Joomla Support Alex
  • (1 Ratings)

How to generate a code that will detect the current website language of Joomla site.

Thanks in advance!

1 Responses

AppClave

6 years ago #187

Hi,

$lang = JFactory::getLanguage();
echo 'Current language is: ' . $lang->getName();

Using for loop:

$lang = JFactory::getLanguage();
foreach($lang->getLocale()  as  $locale) {
    echo 'This language supports the locale: ' . $locale;
}

If you just want to get the selected language tag

$lang = JFactory::getLanguage();
echo 'Current language is: ' . $lang->getTag();

Best Regards 
AppClave Team

Submit Your Response