How can I get the languages installed in the language manager in joomla, as I know the following:
getLocal() give for local machine language am not get the language installed in the application
getname() , getTag() give you the current language name / tag
This code returns the current language...
$lang =& JFactory::getLanguage();
echo 'Current language is: ' . $lang->getName();
By using the below query you can get all the languages installed in Joomla.
$db =& JFactory::getDbo();
$db->setQuery(
'SELECT sef, title_native' .
' FROM #__languages' .
' ORDER BY sef ASC'
);
$options = $db->loadObjectList();
If you installed any languages in joomla it will stored to #__extensions table with params. So you can get all the installed languages from the below query...
$db =& JFactory::getDbo();
$query = "SELECT name FROM #__extensions WHERE type='package'";
$db->SetQuery($query);
$options = $db->loadObjectList();
echo "<pre>"; print_r($options);
From contentlanguage field type:
http://docs.joomla.org/Standard_form_field_types
JLanguage::getKnownLanguages()
You get a list like this:
Array
(
[en-GB] => Array
(
[name] => English (United Kingdom)
[tag] => en-GB
[rtl] => 0
[locale] => en_GB.utf8, en_GB.UTF-8, en_GB, eng_GB, en, english, english-uk, uk, gbr, britain, england, great britain, uk, united kingdom, united-kingdom
[firstDay] => 0
[weekEnd] => 0,6
)
[es-ES] => Array
(
[name] => Spanish (español)
[tag] => es-ES
[rtl] => 0
[locale] => es_ES.utf8, es_ES.UTF-8, es_ES, spanish
[weekEnd] => 0,6
)
)
This line returns an array of published languages
$languages = JLanguageHelper::getLanguages();