mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 10:25:42 +08:00
parent
e4514d8413
commit
0e5f334a0b
@ -26,14 +26,8 @@ class LocaleServiceProvider extends AbstractServiceProvider
|
||||
*/
|
||||
public function boot(Dispatcher $events)
|
||||
{
|
||||
$locales = $this->app->make('flarum.locales');
|
||||
|
||||
$locales->addLocale($this->getDefaultLocale(), 'Default');
|
||||
|
||||
$events->dispatch(new ConfigureLocales($locales));
|
||||
|
||||
$events->listen(ClearingCache::class, function () use ($locales) {
|
||||
$locales->clearCache();
|
||||
$events->listen(ClearingCache::class, function () {
|
||||
$this->app->make('flarum.locales')->clearCache();
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,10 +37,16 @@ class LocaleServiceProvider extends AbstractServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton(LocaleManager::class, function () {
|
||||
return new LocaleManager(
|
||||
$locales = new LocaleManager(
|
||||
$this->app->make('translator'),
|
||||
$this->getCacheDir()
|
||||
);
|
||||
|
||||
$locales->addLocale($this->getDefaultLocale(), 'Default');
|
||||
|
||||
event(new ConfigureLocales($locales));
|
||||
|
||||
return $locales;
|
||||
});
|
||||
|
||||
$this->app->alias(LocaleManager::class, 'flarum.locales');
|
||||
|
Loading…
x
Reference in New Issue
Block a user