如何从joomla中的语言管理器获取语言? [英] How can I get languages from the language manager in joomla?
问题描述
我该如何知道如何在joomla的语言管理器中安装语言:
How can I get the languages installed in the language manager in joomla, as I know the following:
-
getLocal()给出本地机器语言,而不是获取应用程序中安装的语言
getLocal() give for local machine language am not get the language installed in the application
getname(),getTag()为您提供当前的语言名称/标签
getname() , getTag() give you the current language name / tag
推荐答案
此代码返回当前语言...
This code returns the current language...
$lang =& JFactory::getLanguage();
echo 'Current language is: ' . $lang->getName();
通过使用以下查询,您可以获取Joomla中安装的所有语言.
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();
如果您在joomla中安装了任何语言,它将使用参数存储到#__extensions表中.因此,您可以从以下查询中获取所有已安装的语言...
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);
这篇关于如何从joomla中的语言管理器获取语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!