/** * {@inheritdoc} */ public function get(string $id, string $domain = 'messages') : string { if (isset($this->messages[$domain][$id])) { return $this->messages[$domain][$id]; } if ($this->fallbackCatalogue !== null) { return $this->fallbackCatalogue->get($id, $domain); } return $id; }
/** * {@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; }