/** * {@inheritdoc} */ public function transChoice(string $id, $number, array $parameters = [], string $domain = 'messages') : string { if (is_array($number) || $number instanceof Countable) { $number = count($number); } if (preg_match("/^(.*?)\\[(.*?)\\]\$/", $id, $match)) { $id = $match[1]; } $trans = strtr($this->selector->choose($this->catalogue->get($id, $domain), $number, $this->locale), $parameters); $trans = $this->applyFilters($trans); $trans = $this->applyHelpers(empty($match) ? $trans : $trans . '[' . $match[2] . ']'); if ($this->logger !== null) { $this->log($id, $domain); } return $trans; }