mirror of
https://github.com/flarum/core.git
synced 2025-10-18 02:06:08 +02:00
Rework public API based on events
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
<?php namespace Flarum\Extend;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
|
||||
class Locale implements ExtenderInterface
|
||||
{
|
||||
protected $locale;
|
||||
|
||||
protected $translations;
|
||||
|
||||
protected $config;
|
||||
|
||||
protected $js;
|
||||
|
||||
public function __construct($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
public function translations($translations)
|
||||
{
|
||||
$this->translations = $translations;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function config($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function js($js)
|
||||
{
|
||||
$this->js = $js;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function extend(Container $container)
|
||||
{
|
||||
$manager = $container->make('flarum.localeManager');
|
||||
|
||||
if ($this->translations) {
|
||||
$manager->addTranslations($this->locale, $this->translations);
|
||||
}
|
||||
|
||||
if ($this->config) {
|
||||
$manager->addConfig($this->locale, $this->config);
|
||||
}
|
||||
|
||||
if ($this->js) {
|
||||
$manager->addJsFile($this->locale, $this->js);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user