API16

JInstallerPlugin/loadLanguage

From Joomla! Documentation

< API16:JInstallerPlugin
Revision as of 17:53, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Custom loadLanguage method <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

[Edit Descripton]

Template:Description:JInstallerPlugin/loadLanguage

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/plugin.php

Importing[edit]

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

Source Body[edit]

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

[Edit See Also] Template:SeeAlso:JInstallerPlugin/loadLanguage

Examples[edit]

<CodeExamplesForm />