Actions

API16

JInstallerPlugin/loadLanguage

From Joomla! Documentation

< API16:JInstallerPlugin
Revision as of 22:02, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Custom loadLanguage method

[<! removed edit link to red link >]

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

Syntax

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

Defined in

libraries/joomla/installer/adapters/plugin.php

Importing

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

Source Body

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);
                }
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />