Say you're making an cooking game, and in your game there are many ingredients: eggs, lemons, ants, acorns etc.
You want to be able to show text like this:
"You added 3 acorns to the soup"
You have a bunch of item definitions with their names, but dang it they're all singular. You tried slapping an "s" on the end of the word but "strawberrys" isn't making the cut.
You've put all your terms in a localization table and you're loading it with C++ by using a handy tutorial
Fixing Our Localization Table
We can use
FText::Format's support for plural forms to describe how each of our words should be pluralized.
strawberry now becomes
This means that if we pass
FText::Format, the correct plural
form will automatically be displayed.
For more information on
FText::Format see the tutorial on UI
Adding a C++ Function
Next, we need to make a C++ function that we can use every time we want to
display an item name in single or plural form.
Now whenever we need to show an ingredient name we pass in how many we're showing, and we can get the correct plural form!