Skip to content

Commit

Permalink
Lazy load language
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Mar 2, 2018
1 parent 11db0af commit 8671960
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libraries/src/Dispatcher/Dispatcher.php
Expand Up @@ -12,7 +12,6 @@

use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Form\FormFactoryAwareInterface;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Input\Input;
Expand Down Expand Up @@ -83,10 +82,13 @@ public function __construct(CMSApplication $app, Input $input = null)
// If option is not provided, detect it from dispatcher class name, ie ContentDispatcher
if (empty($this->option))
{
$this->option = ComponentHelper::getComponentName(
$this,
strtolower(str_replace('Dispatcher', '', get_class($this)))
);
$className = get_class($this);
$pos = strpos($className, 'Dispatcher');

if ($pos !== false)
{
$this->option = 'com_' . strtolower(substr($className, 0, $pos));
}
}
}

Expand Down

0 comments on commit 8671960

Please sign in to comment.