Back to TemplateAdapter class

Method loadLanguage

public void
loadLanguage
(mixed $path = null)
Custom loadLanguage method
Parameters
  • string $path The path where to find language files.
Returns
  • void
Since
  • 3.1

Method loadLanguage - Source code

/**
 * Custom loadLanguage method
 *
 * @param   string  $path  The path where to find language files.
 *
 * @return  void
 *
 * @since   3.1
 */
public function loadLanguage($path = null)
{
    $source = $this->parent->getPath('source');
    $basePath = $this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE;
    if (!$source) {
        $this->parent->setPath('source', $basePath . '/templates/' . $this->parent->extension->element);
    }
    $this->setManifest($this->parent->getManifest());
    $client = (string) $this->getManifest()->attributes()->client;
    // Load administrator language if not set.
    if (!$client) {
        $client = 'ADMINISTRATOR';
    }
    $base = \constant('JPATH_' . strtoupper($client));
    $extension = 'tpl_' . $this->getName();
    $source = $path ?: $base . '/templates/' . $this->getName();
    $this->doLoadLanguage($extension, $source, $base);
}