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