📜 ⬆️ ⬇️

Pluralization

There is great news: since version 1.9, Zend Framework supports pluralization. No, you heard right.

On May 1, Thomas (the author of the original article) added a smart opportunity to Zend_Translate and today (July 20) it was accepted by the Zend team. Pluralization support depends on the adapter and is only available with Array, Csv or Gettext (but we are all already on the gettext, right?). So far, Thomas has not found a way to implement support for other adapters — if you have ideas on this, contact him.

How it works



$translate->plural( 'Car' , 'Cars' , $number);

$translate->translate(array( 'Car' , 'Cars' , $number));


* This source code was highlighted with Source Code Highlighter .

')
But in many languages, the plural forms of the word are more than one, unlike English, and the implementation will look like this:

$translate->translate(array( 'Auto' , 'Autos' , 'Auti' , 'Autom' , $number));

* This source code was highlighted with Source Code Highlighter .


More information will be in the documentation.

Source: https://habr.com/ru/post/64975/


All Articles