In English, it's quite straightforward:
The usually internationalized version looks like this:
resourcestring FileCountStr='%d file(s)';
Looks easy, right? It's not. In Polish, there are three plural forms:
Even french is different with regard to plural forms. In English, we use the plural form for zero (0 files, 1 file, 2 files), whereas the french use singular (0 fichier, 1 fichier, 2 fichiers).
With GNU gettext for Delphi, the solution is quite straightforward:
Label1.Caption:=Format(ngettext('%d file','%d files',FileCount),[FileCount]);
Ngettext() will automatically select the right plural form in the local language, even if there are 1, 2, 3 or 4 plural forms, and the translations tools (poedit and kbabel) provide good features for the translator to specify each plural form in good ways.
Post a Comment