Actions

API16

JLanguage/exists

< 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.

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


Advertisement