1
0
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:
Toby Zerner
2015-07-29 21:00:09 +09:30
parent d71d8f59c2
commit f96cac6057
13 changed files with 313 additions and 17 deletions

View File

@@ -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])) {

View File

@@ -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');