From Joomla! Documentation

< API16:JLanguage

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.


Loads a single language file and appends the results to the existing strings

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


load($extension= 'joomla', $basePath=JPATH_BASE, $lang=null, $reload=false, $default=true)
Parameter Name Default Value Description
$extension 'joomla' $extension The extension for which a language file should be loaded
$basePath JPATH_BASE $basePath The basepath to use
$lang null $lang The language to load, default null for the current language
$reload false $reload Flag that will force a language to be reloaded if set to true
$default true $default Flag that force the default language to be loaded if the current does not exist


boolean True, if the file has successfully loaded.

Defined in



jimport( 'joomla.language.language' );

Source Body

public function load($extension = 'joomla', $basePath = JPATH_BASE, $lang = null, $reload = false, $default = true)
        if (! $lang) {
                $lang = $this->_lang;

        $path = self::getLanguagePath($basePath, $lang);

        $internal = $extension == 'joomla' || $extension == '';
        $filename = $internal ? $lang : $lang . '.' . $extension;
        $filename = $path.DS.$filename.'.ini';

        $result = false;
        if (isset($this->_paths[$extension][$filename]) && ! $reload) {
                // Strings for this file have already been loaded
                $result = true;
        } else {
                // Load the language file
                $result = $this->_load($filename, $extension);

                // Check if there was a problem with loading the file
                if ($result === false && $default) {
                        // No strings, so either file doesn't exist or the file is invalid
                        $oldFilename = $filename;

                        // Check the standard file name
                        $path           = self::getLanguagePath($basePath, $this->_default);
                        $filename = $internal ? $this->_default : $this->_default . '.' . $extension;
                        $filename       = $path.DS.$filename.'.ini';

                        // If the one we tried is different than the new name, try again
                        if ($oldFilename != $filename) {
                                $result = $this->_load($filename, $extension, false);
        return $result;

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


Code Examples