API16:JLanguage/exists
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Check if a language exists
[<! removed edit link to red link >]
<! 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 edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
