API16

JLanguageHelper/createLanguageList

From Joomla! Documentation

< API16:JLanguageHelper
Revision as of 22:04, 13 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Builds a list of the system languages which can be used in a select option

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

static createLanguageList($actualLanguage, $basePath=JPATH_BASE, $caching=false)
Parameter Name Default Value Description
$actualLanguage Client key for the area
$basePath JPATH_BASE Base path to use
$caching false An array of arrays (text, value, selected)

Defined in[edit]

libraries/joomla/language/helper.php

Importing[edit]

jimport( 'joomla.language.helper' );

Source Body[edit]

public static function createLanguageList($actualLanguage, $basePath = JPATH_BASE, $caching = false)
{
        $list = array ();

        // cache activation
        $langs = JLanguage::getKnownLanguages($basePath);

        foreach ($langs as $lang => $metadata)
        {
                $option = array ();

                $option['text'] = $metadata['name'];
                $option['value'] = $lang;
                if ($lang == $actualLanguage) {
                        $option['selected'] = 'selected="selected"';
                }
                $list[] = $option;
        }

        return $list;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />