mirror of
https://github.com/flarum/core.git
synced 2025-08-17 13:54:18 +02:00
Implement basic settings page
This commit is contained in:
@@ -2,12 +2,24 @@
|
||||
|
||||
class LocaleManager
|
||||
{
|
||||
protected $locales = [];
|
||||
|
||||
protected $translations = [];
|
||||
|
||||
protected $js = [];
|
||||
|
||||
protected $config = [];
|
||||
|
||||
public function addLocale($locale, $name)
|
||||
{
|
||||
$this->locales[$locale] = $name;
|
||||
}
|
||||
|
||||
public function getLocales()
|
||||
{
|
||||
return $this->locales;
|
||||
}
|
||||
|
||||
public function addTranslations($locale, $translations)
|
||||
{
|
||||
if (! isset($this->translations[$locale])) {
|
||||
|
@@ -14,15 +14,16 @@ class LocaleServiceProvider extends ServiceProvider
|
||||
{
|
||||
$manager = $this->app->make('flarum.localeManager');
|
||||
|
||||
$this->registerLocale($manager, 'en');
|
||||
$this->registerLocale($manager, 'en', 'English');
|
||||
|
||||
event(new RegisterLocales($manager));
|
||||
}
|
||||
|
||||
public function registerLocale(LocaleManager $manager, $locale)
|
||||
public function registerLocale(LocaleManager $manager, $locale, $title)
|
||||
{
|
||||
$path = __DIR__.'/../../locale/'.$locale;
|
||||
|
||||
$manager->addLocale($locale, $title);
|
||||
$manager->addTranslations($locale, $path.'.yml');
|
||||
$manager->addConfig($locale, $path.'.php');
|
||||
$manager->addJsFile($locale, $path.'.js');
|
||||
|
Reference in New Issue
Block a user