Format Text Plural Zero, always returning "other"

In blueprint, I am trying to format text with plural. I have the following:

{Argument}|plural(zero=ZERO,one=ONE,other=OTHER)

212382-format-issue.png

When Argument is an integer of value 0, the text is displayed as “OTHER”. When it is 1, it is “ONE”. Anything higher, it is “OTHER”. I could expect an integer of value 0 to display “ZERO”.

Is this a bug? Unreal claims support for “zero, one, two, few, many, other”.

Thanks.

The cardinal and ordinal plural form rules are defined by the CLDR data for each culture. Not all cultures use all rules, and English only has cardinal plural form rules for ‘one’ or ‘other’.

Thanks for your response! Would there be another way to achieve this?

Something along the lines of
{Argument}|switch(0=ZERO,1=ONE,default=OTHER) ?

The system is working for me perfectly with various languages, but not having zero is making things a bit difficult.

The format argument modifier system is designed to be extensible, so you’re welcome to implement your own that special cases zero.

Take a look at FTextFormatArgumentModifier_PluralForm for the default plural form implementation (TextFormatArgumentModifier.h/.cpp in Engine\Source\Runtime\Core\Private\Internationalization). You could take a copy of that and modify it to suit your needs (it’s registered in the constructor of FTextFormatter since it’s a stock one, but you’d need to call FTextFormatter::RegisterTextArgumentModifier to register yours; FTextFormatter is a singleton that can be accessed via FTextFormatter::Get()).

You’d probably only need to tweak your version of FTextFormatArgumentModifier_PluralForm::Evaluate so that it sets ValuePluralForm to ETextPluralForm::Zero for zero like values in all languages.

Sounds great! Thanks much.