How do I get the default language in the site frontend of Joomla 2.5?
Asked
Active
Viewed 2,606 times
3 Answers
9
After hours of reading through web and sources, I found this would be the correct answer:
JComponentHelper::getParams('com_languages')->get('site')

tishma
- 1,855
- 1
- 21
- 43
-
This worked for me (default lang is not En). Thanks! – beej Apr 30 '14 at 20:01
-
@beej: en is neither a default lang for me. perhaps that's why other ideas wouldn't work for us. – tishma May 06 '14 at 15:25
-
1This should be the correct answer for the question asked! The accepted answer if for getting the current language(which is not the title of this post! – jakabadambalazs May 28 '14 at 15:22
1
Try this
$lang =& JFactory::getLanguage();
echo 'Current language is: ' . $lang->getName();
http://docs.joomla.org/JFactory/getLanguage
For more details Click here
-
i am not getting the default language,my default language is dutch but its shows en-GB – Mohammed Nagoor Feb 06 '13 at 04:54
-
1
-
thanks for you reply, it works and another code is `$lang = JFactory::getLanguage(); $language_tag = $lang->getTag();` – Mohammed Nagoor Feb 06 '13 at 07:29
-
1So you were really asking for the user's language not the default language for the site? You might want to change the title to reflect that just to avoid future confusion. – Elin Feb 06 '13 at 13:18
1
To get the users language on Joomla 3 you can do
JFactory::getUser()->getParam('language', JFactory::getLanguage()->getTag());

Laoneo
- 1,546
- 1
- 18
- 25