8000 [Translation] Added intl message formatter. by Nyholm · Pull Request #27399 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Prev Previous commit
Next Next commit
Fixes according to feedback
  • Loading branch information
Nyholm committed Sep 3, 2018
commit 2aa7181e151437f7b93dc9b5a60c10e65163c53c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
*/
class IntlMessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface
class IntlMessageFormatter implements MessageFormatterInterface
{
/**
* {@inheritdoc}
Expand All @@ -38,12 +38,4 @@ public function format($message, $locale, array $parameters = array())

return $message;
}

/**
* {@inheritdoc}
*/
public function choiceFormat($message, $number, $locale, array $parameters = array())
{
return $this->format($message, $locale, $parameters);
}
}
6 changes: 1 addition & 5 deletions src/Symfony/Component/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,13 @@ public function trans($id, array $parameters = array(), $domain = null, $locale
*/
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
{
if (!$this->formatter instanceof ChoiceMessageFormatterInterface) {
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter)));
}

if (null === $domain) {
$domain = 'messages';
}

$formatter = $this->getFormatter($domain);
if (!$formatter instanceof ChoiceMessageFormatterInterface) {
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', get_class($formatter)));
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($formatter)));
}

$id = (string) $id;
Expand Down
0