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:
34
src/Locale/LocaleServiceProvider.php
Normal file
34
src/Locale/LocaleServiceProvider.php
Normal 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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user