This commit is contained in:
Sylvain 2019-09-03 00:53:22 +02:00
parent d26a6568b3
commit 414dcebfc4
2 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,11 @@ class IntlFormatter implements IntlFormatterInterface
*/
public function formatIntl(string $message, string $locale, array $parameters = []): string
{
// MessageFormatter constructor throws an exception if the message is empty
if ('' === $message) {
return '';
}
if (!$formatter = $this->cache[$locale][$message] ?? null) {
if (!($this->hasMessageFormatter ?? $this->hasMessageFormatter = class_exists(\MessageFormatter::class))) {
throw new LogicException('Cannot parse message translation: please install the "intl" PHP extension or the "symfony/polyfill-intl-messageformatter" package.');

View File

@ -82,6 +82,11 @@ _MSG_;
'{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree',
[4560, 123, 4560 / 123],
],
[
'',
'',
[],
],
];
}