Skip to content

Commit

Permalink
ompatibility with symfony/translation 5.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
aleswita authored Aug 3, 2021
1 parent 8c4c1e8 commit 8565552
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class Translator extends SymfonyTranslator implements ITranslator
/** @var \Contributte\Translation\Tracy\Panel|null */
private $tracyPanel;

/** @var string */
private $initLang;

/**
* @param array<string> $cacheVary
*/
Expand All @@ -69,8 +72,9 @@ public function __construct(
$this->defaultLocale = $defaultLocale;
$this->cacheDir = $cacheDir;
$this->debug = $debug;
$this->initLang = Strings::replace(self::class, '~\\\\~');

parent::__construct('', null, $cacheDir, $debug, $cacheVary);
parent::__construct($this->initLang, null, $cacheDir, $debug, $cacheVary);
}

public function getLocaleResolver(): LocaleResolver
Expand Down Expand Up @@ -226,7 +230,7 @@ public function addResource(
*/
public function getLocale()
{
if (parent::getLocale() === '') {
if (parent::getLocale() === $this->initLang) {
$this->setLocale($this->localeResolver->resolve($this));
}

Expand Down

0 comments on commit 8565552

Please sign in to comment.