JLanguage/load
From Joomla! Documentation
< API15:JLanguageRevision as of 13:34, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
Revision as of 13:34, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
The "API15" 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]
Loads a single language file and appends the results to the existing strings
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
load($extension= 'joomla', $basePath=JPATH_BASE, $lang=null, $reload=false)
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 |
Returns[edit]
boolean True, if the file has successfully loaded.
Defined in[edit]
libraries/joomla/language/language.php
Importing[edit]
jimport( 'joomla.language.language' );
Source Body[edit]
function load( $extension = 'joomla', $basePath = JPATH_BASE, $lang = null, $reload = false )
{
if ( ! $lang ) {
$lang = $this->_lang;
}
$path = JLanguage::getLanguagePath( $basePath, $lang);
if ( !strlen( $extension ) ) {
$extension = 'joomla';
}
$filename = ( $extension == 'joomla' ) ? $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 )
{
// No strings, which probably means that the language file does not exist
$path = JLanguage::getLanguagePath( $basePath, $this->_default);
$filename = ( $extension == 'joomla' ) ? $this->_default : $this->_default . '.' . $extension ;
$filename = $path.DS.$filename.'.ini';
$result = $this->_load( $filename, $extension, false );
}
}
return $result;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />