You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
fix symfony prefixed params
This commit is contained in:
@@ -33,7 +33,7 @@ final class Translator implements TranslatorInterface
|
||||
public function translate($id, $parameters = array(), $locale = null)
|
||||
{
|
||||
$order = TranslationStamp::parametersOrder($parameters, $locale);
|
||||
$parameters = $order['parameters'];
|
||||
$parameters = $this->addPrefixedParams($order['parameters']);
|
||||
$locale = $order['locale'];
|
||||
|
||||
if (!$this->translator instanceof TranslatorBagInterface) {
|
||||
@@ -58,4 +58,20 @@ final class Translator implements TranslatorInterface
|
||||
{
|
||||
return $this->translator->getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $parameters
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function addPrefixedParams(array $parameters)
|
||||
{
|
||||
foreach ($parameters as $key => $value) {
|
||||
if (0 !== strpos($key, ':')) {
|
||||
$parameters[':'.$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user