How to resolve this `t9n` translations error when I use its `plural` property?

160 Views Asked by At

I am trying to translate some text using t9n library, but I get this error

Compiling...
Error compiling ICU message for locale en-US: SyntaxError: Expected "=", "}", or identifier but "," found.

To debug this set DEBUG_ICU to 'true'

when I use this piece of code in React JS

`t9n("{count, plural, one {one other}, others {# others}}", { count: userIds.length - 1 })`;

How can I resolve this?

1

There are 1 best solutions below

0
On

Couple of errors comma should not be there before others and others should be other. Also we can change {one other} to {# other} as this is more optimal.

`t9n("{count, plural, one {# other} other {# others}}", { count: userIds.length - 1 });`