JInstallerComponent/loadLanguage: Difference between revisions
From Joomla! Documentation
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 | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 70: | Line 68: | ||
</source> | </source> | ||
<! removed transcluded page call, red link never existed > | |||
< | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=loadLanguage | category=loadLanguage | ||
category=JInstallerComponent | category=JInstallerComponent | ||
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