API16

JLanguage/exists

From Joomla! Documentation

< 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[edit]

Check if a language exists


<! removed transcluded page call, red link never existed >

Syntax[edit]

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[edit]

boolean True if the language exists

Defined in[edit]

libraries/joomla/language/language.php

Importing[edit]

jimport( 'joomla.language.language' );

Source Body[edit]

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[edit]

Code Examples[edit]