updated-packages
This commit is contained in:
@@ -22,39 +22,55 @@ use Symfony\Contracts\Translation\TranslatorTrait;
|
||||
*/
|
||||
class IdentityTranslator implements LegacyTranslatorInterface, TranslatorInterface
|
||||
{
|
||||
use TranslatorTrait;
|
||||
use TranslatorTrait {
|
||||
trans as private doTrans;
|
||||
setLocale as private doSetLocale;
|
||||
}
|
||||
|
||||
private $selector;
|
||||
|
||||
/**
|
||||
* @param MessageSelector|null $selector The message selector for pluralization
|
||||
*/
|
||||
public function __construct(MessageSelector $selector = null)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
@trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.'), E_USER_DEPRECATED);
|
||||
if (__CLASS__ !== static::class) {
|
||||
@trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function trans($id, array $parameters = [], $domain = null, $locale = null)
|
||||
{
|
||||
return $this->doTrans($id, $parameters, $domain, $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->doSetLocale($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter
|
||||
*/
|
||||
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
|
||||
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%count%" parameter.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
if ($this->selector) {
|
||||
return strtr($this->selector->choose((string) $id, $number, $locale ?: $this->getLocale()), $parameters);
|
||||
}
|
||||
|
||||
return $this->trans($id, array('%count%' => $number) + $parameters, $domain, $locale);
|
||||
return $this->trans($id, ['%count%' => $number] + $parameters, $domain, $locale);
|
||||
}
|
||||
|
||||
private function getPluralizationRule(int $number, string $locale): int
|
||||
private function getPluralizationRule(float $number, string $locale): int
|
||||
{
|
||||
return PluralizationRules::get($number, $locale, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user