diff --git a/framework/core/src/Locale/LocaleServiceProvider.php b/framework/core/src/Locale/LocaleServiceProvider.php index 05484575b..76a7081ab 100644 --- a/framework/core/src/Locale/LocaleServiceProvider.php +++ b/framework/core/src/Locale/LocaleServiceProvider.php @@ -14,11 +14,10 @@ namespace Flarum\Locale; use Flarum\Event\ConfigureLocales; use Flarum\Foundation\AbstractServiceProvider; use Illuminate\Contracts\Events\Dispatcher; -use Illuminate\Translation\Translator; -use Illuminate\Translation\FileLoader; -//use Symfony\Component\Translation\MessageSelector; -//use Symfony\Component\Translation\Translator; -//use Symfony\Component\Translation\TranslatorInterface; +use Illuminate\Contracts\Translation\Translator as TranslatorContract; +use Symfony\Component\Translation\MessageSelector; +use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\TranslatorInterface; class LocaleServiceProvider extends AbstractServiceProvider { @@ -53,6 +52,7 @@ class LocaleServiceProvider extends AbstractServiceProvider }); $this->app->alias('translator', Translator::class); $this->app->alias('translator', TranslatorInterface::class); + $this->app->alias('translator', TranslatorContract::class); } private function getDefaultLocale() diff --git a/framework/core/src/Locale/Translator.php b/framework/core/src/Locale/Translator.php index 0e68b8280..b80ba7966 100644 --- a/framework/core/src/Locale/Translator.php +++ b/framework/core/src/Locale/Translator.php @@ -13,8 +13,9 @@ namespace Flarum\Locale; use Symfony\Component\Translation\MessageCatalogueInterface; use Symfony\Component\Translation\Translator as BaseTranslator; +use Illuminate\Contracts\Translation\Translator as TranslatorContract; -class Translator extends BaseTranslator +class Translator extends BaseTranslator implements TranslatorContract { const REFERENCE_REGEX = '/^=>\s*([a-z0-9_\-\.]+)$/i';