Fix #33427
This commit is contained in:
parent
d26a6568b3
commit
414dcebfc4
@ -28,6 +28,11 @@ class IntlFormatter implements IntlFormatterInterface
|
|||||||
*/
|
*/
|
||||||
public function formatIntl(string $message, string $locale, array $parameters = []): string
|
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 (!$formatter = $this->cache[$locale][$message] ?? null) {
|
||||||
if (!($this->hasMessageFormatter ?? $this->hasMessageFormatter = class_exists(\MessageFormatter::class))) {
|
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.');
|
throw new LogicException('Cannot parse message translation: please install the "intl" PHP extension or the "symfony/polyfill-intl-messageformatter" package.');
|
||||||
|
@ -82,6 +82,11 @@ _MSG_;
|
|||||||
'{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree',
|
'{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree',
|
||||||
[4560, 123, 4560 / 123],
|
[4560, 123, 4560 / 123],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
[],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user