/**
* Checks if a language exists.
*
* This is a simple, quick check for the directory that should contain language files for the given user.
*
* @param string $lang Language to check.
* @param string $basePath Optional path to check.
*
* @return boolean True if the language exists.
*
* @since 3.7.0
*/
public static function exists($lang, $basePath = JPATH_BASE)
{
static $paths = array();
// Return false if no language was specified
if (!$lang) {
return false;
}
$path = $basePath . '/language/' . $lang;
// Return previous check results if it exists
if (isset($paths[$path])) {
return $paths[$path];
}
// Check if the language exists
$paths[$path] = is_dir($path);
return $paths[$path];
}