Plural Forms
Prev
Next

Plural Forms

Because plural forms are quite a complicated issue, we devote a special section for their support in KBabel.

Note

This section handles about KDE plural forms (to be precise of KDE version 3). From KBabel version 1.11 (KDE 3.5) on, KBabel should be able to read, edit and save the GNU gettext plural forms too.

Every language to which KDE is translated must have set a correct number of plural forms. This is done by translating a specific entry in tdelibs.po. The number is set by selecting the name of a language, which uses the same number and rules for finding the right plural form. The up-to-date list of possible values can be found in the tdelibs source code, in the file tdecore/tdelocale.cpp.

Note

GNU gettext allows to define the number and type of plural forms by a formula and to set this formula independently for each PO file. KDE can only define the number and type of plural forms one time in tdelibs.

KDE plural forms are denoted by comment _n: (including a trailing space) containing the %n argument. This argument is then used in the message itself and it controls which plural form of your language should be used depending on the rules for your language.

The translation of a plural form message has to have a special format. It must contain the correct number of translations (one for each plural form) separated by an end of the line \n, without any _n: sequence (without the space either). For example, “_n: Selected 1 file\nSelected %n files” translated to Slovak would be:

Vybraný %n súbor\n
Vybrané %n súbory\n
Vybraných %n súborov

To check if your translation contains the correct number of plural forms, use the Tools->Validation ->Check Plural Forms (KDE only) menu.

Prev
Next
Home


Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team