Translations of this page?:

Plurals

Believe it or not some languages have more than one plural form. This fact does come as a surprise to many, especially programmers.

There are two aspects to plurals that you need to be aware of:

  1. Those embedded in existing string eg. “file(s)”
  2. Properly defined plurals forms

Plurals embedded in strings

English adds s to the end of most words to form a plural. Thus you will see many instances where a programmer has simply add (s) to the word to indicate that it can be both singular and plural. Here is an example in Tsonga, in this case plurals add/change text at the beginning of the word, not the end. This often simply looks ugly.

"Show/Hide Axis Description(s)"
"Kombisa/Fihla (Ti)Nhlamuselo ya Tikhona"

Here are the options available to you to deal with these type of plurals:

  1. Use a similar construct if it works in your language
  2. Abandon the singular and use only the plural form. This is what is done in Xhosa where a singular/plural form often involves prefixes so you end up with ”(i)ifayile” or worse. So you simply use the plural “iifayile”
  3. Report the error to the programmer. Only use this option if this is the case for a valid plural ie the translator has used some kind of variable eg ”%n file(s)” or two strings follow each other ”%n file”, ”%n files”

Properly defined plural forms

Program do have the ability handle plurals correctly. This is usually achieved by using the Gettext library or some similar method. When the application runs it will determine which plural form to use based on the number that is being displayed. So in English it would display:

  • 0 files
  • 1 file
  • 2 files
  • 3 files
  • etc.

Gettext plurals

Gettext uses the “Plural-Forms” header in the PO file to define:

  • nplural --- the number of plural forms.
  • plural --- an expression which when evaluated determines which form is appropriate for that number. If a definition does not exist for your language then you will need to create one or get someone to help you.

Once this is defined then your PO editing tool will display the correct number of fields for you to enter the plural forms.

A list with these settings in some languages is available here. To find out how to define these entries, see Plural forms (gettext manual)

Historical KDE plurals

KDE now uses standard Gettext plurals. This section is just for historical reference.

The plural form for KDE is defined in the kdelibs.po file. Choose one of the options or ask for help on their mailing list.

You will recognise KDE plural messages as they all start with ”_n: ” and each form is separated by ”\n”. in your translation you leave out the ”_n: ” and include as many translations as there are plural forms in your language, with each one separated by a ”\n

Language specific notes

guide/translation/plurals.txt · Last modified: 2009/08/13 14:56 by friedelwolff
Recent changes RSS feed Creative Commons License Driven by DokuWiki Get Pootle, Virtaal & the Translate Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads