Help understanding Translation.GetPluralMessage

Godot Version

4.7.2

Question

What does the second argument in Translation’s _get_plural_message(src_message, src_plural_message, n, context) function do? I’ve tried to test it with code like:

Translation en = new Translation();
en.Locale = "en";
		
en.AddPluralMessage("ExperienceRewardPlural", ["Got {0} experience point", "Got {0} experience points"], "test");

string testString = en.GetPluralMessage("ExperienceRewardPlural", "", 0, "test").ToString();
testString = string.Format(testString, 0);
GD.Print(testString); //prints Got 0 experience points

testString = en.GetPluralMessage("ExperienceRewardPlural", "", 1, "test").ToString();
testString = string.Format(testString, 1);
GD.Print(testString); //prints Got 1 experience point

testString = en.GetPluralMessage("ExperienceRewardPlural", "", 2, "test").ToString();
testString = string.Format(testString, 2);
GD.Print(testString); //prints Got 2 experience points

but no matter what I put in the 2nd argument, be it a blank string, “Got {0} experience point”, something else entirely it always just seems to be ignored. Which is fine. When leaving it blank I’m getting the results that I expect, but I’m curious what the purpose of it is. I’m clearly missing something.

In the GDscript equivalent of the function’s documentation it says

The number n is the number or quantity of the plural object. It will be used to guide the translation system to fetch the correct plural form for the selected language.

Note: Plurals are only supported in gettext-based translations (PO), not CSV.

I think it’s a value used to search some kind of dictionary within your translation file? That’s a conjecture though. But anyway, it just seems like it’s to help you distinguish between like, bee, bees, and swarm in a more compact way (as opposed to having a lengthy switch statement to check which is more correct for the scenario)