1
0
mirror of https://github.com/flarum/core.git synced 2025-08-23 08:33:45 +02:00

Refactor CoreServiceProvider

A good start I think, but still some work to do. If we go ahead with
https://github.com/flarum/core/issues/132#issuecomment-117507974 (which
I am in favour of), we can extract the entity-related stuff into some
smaller service providers (e.g. discussion repo, an event listener,
permissions, and gambits stuff could all go in
Flarum\Core\Discussions\DiscussionsServiceProvider).
This commit is contained in:
Toby Zerner
2015-07-01 22:34:11 +09:30
parent d414ee33ed
commit 56932604db
15 changed files with 239 additions and 217 deletions

View File

@@ -0,0 +1,34 @@
<?php namespace Flarum\Locale;
use Flarum\Support\ServiceProvider;
use Flarum\Extend;
class LocaleServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->setupLocale('en');
}
public function setupLocale($locale)
{
$dir = __DIR__.'/../../locale/'.$locale;
$this->extend(
(new Extend\Locale($locale))
->translations($dir.'/translations.yml')
->config($dir.'/config.php')
->js($dir.'/config.js')
);
}
public function register()
{
$this->app->singleton('flarum.localeManager', 'Flarum\Locale\LocaleManager');
}
}