1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Enhancement to language-class installed() method. Can now return a list of installed languages with native names.

This commit is contained in:
Cameron 2015-10-03 14:18:28 -07:00
parent 04f61dae08
commit 6dfe7bc64c

View File

@ -389,10 +389,12 @@ class language{
/**
* Return a list of Installed Language Packs
*
* @param str $type - English or Native.
* @example type = english: array(0=>'English', 1=>'French' ...)
* @example type = native: array('English'=>'English', 'French'=>'Francais'...)
* @return array
*/
function installed()
function installed($type='english')
{
if(null == $this->lanlist)
{
@ -412,6 +414,19 @@ class language{
$this->lanlist = array_intersect($lanlist,$this->list);
}
if($type == 'native')
{
$natList = array();
foreach($this->lanlist as $lang)
{
$natList[$lang] = $this->toNative($lang);
}
natsort($natList);
return $natList;
}
return $this->lanlist;
}