[Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post Reply
curiosity
Filter Inserter
Filter Inserter
Posts: 407
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

[Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post by curiosity »

To reproduce:
1. Make the following locale entry: n-items=__1__ __plural_for_parameter_1_{1=item|rest=items}__
2. Launch the game and run the following command: /c game.print{'n-items', 0.5}
3. Observe the following output: 0.5 1

Expected behavior:
The "rest" form gets used, producing the following output: 0.5 items

Comment:
There should probably be more pluralization categories to properly support non-integer pluralization, but that's beyond the scope of a bug report. The proposed above fix would not get in the way of adding such categories in the future: since these categories don't exist now, there would be no conflict with existing mods should you wish to add them.

Genhis
Factorio Staff
Factorio Staff
Posts: 132
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post by Genhis »

Thanks for the report. This has been broken for a long time and is unlikely to get fixed in 1.1. For 2.0, I refactored the localization code and adding proper decimal numbers support is on my to-do list.

curiosity
Filter Inserter
Filter Inserter
Posts: 407
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: [Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post by curiosity »

I see. Thank you for telling me. Workaround time, I guess.

curiosity
Filter Inserter
Filter Inserter
Posts: 407
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: [Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post by curiosity »

FYI, it doesn't understand negative numbers either.

Genhis
Factorio Staff
Factorio Staff
Posts: 132
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post by Genhis »

This has been fixed for 2.0. All decimal numbers will match "decimal" or "rest" patterns. Negative numbers will behave as positive numbers.

curiosity
Filter Inserter
Filter Inserter
Posts: 407
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: [Genhis] [1.1.94] Plural forms in locale break when given a non-integer number

Post by curiosity »

That's great news! Thank you.

Post Reply

Return to “Fixed for 2.0”