API16

JInstallerModule/loadLanguage

From Joomla! Documentation

< API16:JInstallerModule

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]

Custom loadLanguage method


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

Syntax[edit]

loadLanguage($path)
Parameter Name Default Value Description
$path $path the path where to find language files

Defined in[edit]

libraries/joomla/installer/adapters/module.php

Importing[edit]

jimport( 'joomla.installer.adapters.module' );

Source Body[edit]

public function loadLanguage($path)
{
        $this->manifest = &$this->parent->getManifest();
        if ($this->manifest->files)
        {
                $element = $this->manifest->files;
                $extension = '';
                if (count($element->children()))
                {
                        foreach ($element->children() as $file)
                        {
                                if ((string)$file->attributes()->module)
                                {
                                        $extension = strtolower((string)$file->attributes()->module);
                                        break;
                                }
                        }
                }
                if ($extension)
                {
                        $lang =& JFactory::getLanguage();
                        $source = $path;
                        $folder = (string)$element->attributes()->folder;
                        if ($folder && file_exists("$path/$folder"))
                        {
                                $source = "$path/$folder";
                        }
                        $client = (string)$this->manifest->attributes()->client;
                                $lang->load($extension . '.manage', $source, null, false, false)
                        ||      $lang->load($extension, $source, null, false, false)
                        ||      $lang->load($extension . '.manage', constant('JPATH_' . strtoupper($client)), null, false, false)
                        ||      $lang->load($extension, constant('JPATH_' . strtoupper($client)), null, false, false)
                        ||      $lang->load($extension . '.manage', $source, $lang->getDefault(), false, false)
                        ||      $lang->load($extension, $source, $lang->getDefault(), false, false)
                        ||      $lang->load($extension . '.manage', constant('JPATH_' . strtoupper($client)), $lang->getDefault(), false, false)
                        ||      $lang->load($extension, constant('JPATH_' . strtoupper($client)), $lang->getDefault(), false, false);
                }
        }
}


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

Examples[edit]

Code Examples[edit]