Open Eric-Guan-Z opened 2 years ago
Hi @Eric-Guan-Z,
As far as I know, Dart's intl
package does not treat #
as a placeholder in plural messages.
However, some other localization libraries (e.g. react-intl) support such syntax in messages.
Alternatively, you can use a slightly different approach to achieve the same goal.
"pluralMessageExample": "{count, plural, one {{count} item} other {{count} items}}"
Some useful links:
Hi @Eric-Guan-Z,
As far as I know, Dart's
intl
package does not treat#
as a placeholder in plural messages. However, some other localization libraries (e.g. react-intl) support such syntax in messages.Alternatively, you can use a slightly different approach to achieve the same goal.
"pluralMessageExample": "{count, plural, one {{count} item} other {{count} items}}"
Some useful links:
Thanks for the example, it clearly shows how to achieve dynamic data. However, the problem here is that there are multiple platforms developers following the same ICU standard in the company, so the arb files we could receive from the globalization team will always use "#" as a placeholder in plural messages. If dart will not support this kind of feature, I guess the only possible solution left for me is to use regex to force the replacement of all "#" to the first number param LOL
According to ICU document In a pluralized form message like
The special # symbol will display the given count in the active locale’s number system.
Currently it seems
flutterw pub run intl_utils:generate
will not replace # to the given number param.For example:
{number, plural, one {Temporarily inactive (# day left)} other {Temporarily inactive (# days left)}}
will generate
just wonder is there any way to achieve this kind of feature?