Closed dimag0g closed 2 years ago
Hello. Isn't it already handled by gettext and .po with a header like:
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
and string should be like:
msgid "{:d} Goblin"
msgid_plural "{:d} Goblins"
msgstr[0] "{:d} гоблин"
msgstr[1] "{:d} гоблина"
msgstr[2] "{:d} гоблинов"
@AAS This will only handle cases like recruit/dismiss 1/2/5 Goblins?
. I'm not sure we actually have those.
What we have is:
a few Goblins
-> note that a few
in Russian requires a plural form which is different from 1
or 2
, even if few
actually means 1 or 2. You'll need an n>4
plural form here (Genitive case plural).the Hut produces Goblins
, attack Goblins
, etc. -> in Russian, these can be translated with a form that corresponds to n>4
plural form, not sure about other languages.Goblins
, as on the troop info page -> in Russian, none of the ngettext
plural forms would work, you need a Nominative case plural. The original H2 game simply uses a singular form.This IMO leaves us with the following options:
Goblins
with the nominative case, and use translations like Goblins (few)
and Goblins (attack)
to work around translations which require the n>4
plural form. Problem: such Russian translations look unnatural. Polish HoMM2 uses such translations to some extent, not sure how natural they sound, but my gut feeling tells me they are bad.Goblins
with the n>4
plural form, and use Goblin
in the game code for things like troop info pages where the n>4
plural form wouldn't work. Problem: the singular form looks unnatural in English/French/German (though it will match the original game).Goblins
with the n>4
plural form, and leave the game code as is. Russian/Polish translations will look OK everywhere, except the troop info pages.Note that none of the options use the ngettext
plural forms. I currently have an open PR (#3913) which essentially implements the third option (or the first one, there is no difference between the two as far as the source code is concerned).
I'm closing this for now, feel free to comment and reopen if you think you have a better idea on this matter.
There is a problem with
Monster::GetPluralName
for which I don't see a good fix. Right now it uses_n( )
which is incompatible withMonster::GetName
andMonster::GetMultiName
which use_( )
. It works for most of the monsters where singular and plural forms are next to each other in the.mo
file, but e.g. forGoblin/Goblins
there will beGoblin Hut
in between, so we'll end up with "Goblins" translated as "Goblin Hut" by_n( )
. We need to either use_( )
everywhere and hard-code the plural form logic inMonster::GetPluralName
, or use_n( )
everywhere.However, fixing this issue completely with just
_n( )
will not be possible for languages like Russian, where "monsters" and "5 monsters" have different forms (the latter is Genitive case). I'm not familiar with Polish, but I expect a similar problem there as well.One solution would be to use the singular form everywhere except for troop quantities (![homm2_ru](https://user-images.githubusercontent.com/10945319/127575329-adc01284-10d3-4e29-b5eb-f067775e58a4.png)
5 goblins
/several goblins
), like the original HoMM2 version does. This avoids the problem in Russian there it simply says "goblin" on e.g. troop info pages, regardless of how many goblins you have:Another solution is to use the form![homm2_pl](https://user-images.githubusercontent.com/10945319/127576396-8562d3a6-688f-4fed-9855-401899cef028.png)
goblins (5)
/goblins (several)
for troop quantities, like the Polish version does, though it doesn't sound very natural: