/**
* Custom loadLanguage method
*
* @param string $path The path where we find language files
*
* @return void
*
* @since 3.4
*/
public function loadLanguage($path = null)
{
$source = $this->parent->getPath('source');
$client = $this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE;
if (!$source) {
$this->parent->setPath('source', $client . '/modules/' . $this->parent->extension->element);
}
$this->setManifest($this->parent->getManifest());
if ($this->getManifest()->files) {
$extension = $this->getElement();
if ($extension) {
$source = $path ?: ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $extension;
$folder = (string) $this->getManifest()->files->attributes()->folder;
if ($folder && file_exists($path . '/' . $folder)) {
$source = $path . '/' . $folder;
}
$client = (string) $this->getManifest()->attributes()->client;
$this->doLoadLanguage($extension, $source, \constant('JPATH_' . strtoupper($client)));
}
}
}