diff --git a/src/DI/TranslationExtension.php b/src/DI/TranslationExtension.php index f60e3c05..5178400c 100644 --- a/src/DI/TranslationExtension.php +++ b/src/DI/TranslationExtension.php @@ -127,7 +127,7 @@ public function loadConfiguration() $config['cache'] = new Statement($config['cache'], [dirname(Helpers::expand('%tempDir%/cache', $builder->parameters))]); $translator = $builder->addDefinition($this->prefix('default')) - ->setFactory(KdybyTranslator::class, [$this->prefix('@userLocaleResolver'), $config['default']]) + ->setFactory(KdybyTranslator::class, [$this->prefix('@userLocaleResolver')]) ->addSetup('?->setTranslator(?)', [$this->prefix('@userLocaleResolver.param'), '@self']) ->addSetup('setDefaultLocale', [$config['default']]) ->addSetup('setLocaleWhitelist', [$config['whitelist']]); diff --git a/src/Translator.php b/src/Translator.php index 3f4ebe26..9dc44648 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -76,7 +76,6 @@ class Translator extends \Symfony\Component\Translation\Translator implements \K /** * @param \Kdyby\Translation\IUserLocaleResolver $localeResolver - * @param string $locale * @param \Symfony\Component\Translation\Formatter\MessageFormatterInterface $formatter * @param \Kdyby\Translation\CatalogueCompiler $catalogueCompiler * @param \Kdyby\Translation\FallbackResolver $fallbackResolver @@ -85,7 +84,6 @@ class Translator extends \Symfony\Component\Translation\Translator implements \K */ public function __construct( IUserLocaleResolver $localeResolver, - string $locale, MessageFormatterInterface $formatter, CatalogueCompiler $catalogueCompiler, FallbackResolver $fallbackResolver, @@ -98,7 +96,7 @@ public function __construct( $this->fallbackResolver = $fallbackResolver; $this->translationsLoader = $loader; - parent::__construct($locale, $formatter); + parent::__construct('', $formatter); } /** @@ -351,7 +349,7 @@ public function setLocale($locale) */ public function getLocale() { - if (parent::getLocale() === NULL) { + if (parent::getLocale() === '') { $this->setLocale($this->localeResolver->resolve($this)); }