Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Plural source files

Not all source formats support plural forms. Look into this list for details:

Table 171. Plural support

Adapter Plurals supported    
Array yes    
Csv yes    
Gettext yes    
Ini no    
Qt no    
Tbx no    
Tmx no    
Xliff no    
XmlTm no    

Below you can find examples of plural defined source files.

Array source with plural definitions

An array with plural definitions has to look like the following example.

'plural_0' => array(
'plural_0 (ru)',
'plural_1 (ru)',
'plural_2 (ru)',
'plural_3 (ru)'
'plural_1' => ''

In the above example 'plural_0' and 'plural_1' are the plural definitions from the source code. And the array at 'plural_0' has all translated plural forms available. Take a look at the following example with real content and translation from English source to German.

'Car' => array(
'Cars' => ''

When your translated language supports more plural forms then simply add them to the array below the first plural form. When your source language supports more plural forms, than simply add a new empty translation.

Csv source with plural definitions

A csv file with plural definitions has to look like the following example.

"plural_0";"plural_0 (ru)";"plural_1 (ru)";"plural_2 (ru)";"plural_3 (ru)"

All translated plural forms have to be added after the first plural of the source language. And all further plural forms of the source language have to be added below but without translation. Note that you must add a delimiter to empty source plurals.

Gettext source with plural definitions

Gettext sources support plural forms out of the box. There is no need for adoption as the *.mo file will contain all necessary data.


Note that gettext does not support the usage of source languages which are not using english plural forms. When you plan to use a source language which supports other plural forms like russian for example, then you can not use gettext sources.

Zend Framework