Commaaa2
This commit is contained in:
@@ -23,7 +23,7 @@ class TranslatableMessage implements TranslatableInterface
|
||||
private array $parameters;
|
||||
private ?string $domain;
|
||||
|
||||
public function __construct(string $message, array $parameters = [], string $domain = null)
|
||||
public function __construct(string $message, array $parameters = [], ?string $domain = null)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->parameters = $parameters;
|
||||
@@ -50,12 +50,10 @@ class TranslatableMessage implements TranslatableInterface
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
public function trans(TranslatorInterface $translator, string $locale = null): string
|
||||
public function trans(TranslatorInterface $translator, ?string $locale = null): string
|
||||
{
|
||||
return $translator->trans($this->getMessage(), array_map(
|
||||
static function ($parameter) use ($translator, $locale) {
|
||||
return $parameter instanceof TranslatableInterface ? $parameter->trans($translator, $locale) : $parameter;
|
||||
},
|
||||
static fn ($parameter) => $parameter instanceof TranslatableInterface ? $parameter->trans($translator, $locale) : $parameter,
|
||||
$this->getParameters()
|
||||
), $this->getDomain(), $locale);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user