API16:JLanguage/exists
From Joomla! Documentation
Description
Check if a language exists
<! removed transcluded page call, red link never existed >
Syntax
static exists($lang, $basePath=JPATH_BASE)
| Parameter Name | Default Value | Description |
|---|---|---|
| $lang | $lang Language to check | |
| $basePath | JPATH_BASE | $basePath Optional path to check |
Returns
boolean True if the language exists
Defined in
libraries/joomla/language/language.php
Importing
jimport( 'joomla.language.language' );
Source Body
public static function exists($lang, $basePath = JPATH_BASE)
{
static $paths = array();
// Return false if no language was specified
if (! $lang) {
return false;
}
$path = $basePath.DS.'language'.DS.$lang;
// Return previous check results if it exists
if (isset($paths[$path]))
{
return $paths[$path];
}
// Check if the language exists
jimport('joomla.filesystem.folder');
$paths[$path] = JFolder::exists($path);
return $paths[$path];
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples