Fixes according to feedback
This commit is contained in:
parent
a325a443ed
commit
2aa7181e15
@ -15,7 +15,7 @@ namespace Symfony\Component\Translation\Formatter;
|
|||||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||||
*/
|
*/
|
||||||
class IntlMessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface
|
class IntlMessageFormatter implements MessageFormatterInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -38,12 +38,4 @@ class IntlMessageFormatter implements MessageFormatterInterface, ChoiceMessageFo
|
|||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function choiceFormat($message, $number, $locale, array $parameters = array())
|
|
||||||
{
|
|
||||||
return $this->format($message, $locale, $parameters);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -205,17 +205,13 @@ class Translator implements TranslatorInterface, TranslatorBagInterface
|
|||||||
*/
|
*/
|
||||||
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
|
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) {
|
if (null === $domain) {
|
||||||
$domain = 'messages';
|
$domain = 'messages';
|
||||||
}
|
}
|
||||||
|
|
||||||
$formatter = $this->getFormatter($domain);
|
$formatter = $this->getFormatter($domain);
|
||||||
if (!$formatter instanceof ChoiceMessageFormatterInterface) {
|
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;
|
$id = (string) $id;
|
||||||
|
Reference in New Issue
Block a user