API16

JInstallerComponent/loadLanguage: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Custom loadLanguage method <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowik...
 
m preparing for archive only
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
Custom loadLanguage method
Custom loadLanguage method


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JInstallerComponent/loadLanguage|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JInstallerComponent/loadLanguage}}
 
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 70: Line 68:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JInstallerComponent/loadLanguage|Edit See Also]]<nowiki>]</nowiki>
<! removed transcluded page call, red link never existed >
</span>
{{SeeAlso:JInstallerComponent/loadLanguage}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=loadLanguage
  category=loadLanguage
  category=JInstallerComponent
  category=JInstallerComponent
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API16]]

Latest revision as of 01:49, 25 March 2017

Description

Custom loadLanguage method


<! 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/component.php

Importing

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

Source Body

public function loadLanguage($path)
{
        $this->manifest = &$this->parent->getManifest();
        $name = strtolower(JFilterInput::getInstance()->clean((string)$this->manifest->name, 'cmd'));
        $check = substr($name, 0, 4);
        if ($check="com_") {
        $name = substr($name, 4); }
        $extension = "com_$name";
        $lang =& JFactory::getLanguage();
        $source = $path;
        if($this->manifest->administration->files)
        {
                $element = $this->manifest->administration->files;
        }
        elseif ($this->manifest->files)
        {
                $element = $this->manifest->files;
        }
        else
        {
                $element = null;
        }
        if ($element)
        {
                $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 transcluded page call, red link never existed >

Examples

Code Examples