cancel
Showing results for 
Search instead for 
Did you mean: 

Plural support

Plural support

Feature request from alexdrupal, posted on GitHub Feb 11, 2014

Hi Folks!

Does magento has plural support for translations? If no, I think it should be added to the todo list of Magento2 team.

At least, Zend framework having plural support since 1.6 Thanks!

6 Comments
apiuser
New Member
Status changed to: Investigating
 
apiuser
New Member

Comment from tanya-soroka, posted on GitHub Feb 20, 2014

Hello @alexdrupal Thank you for your submission! I created an improvement and added it to the product backlog. Due to other priorities, it is unlikely that we will be able to include declension of words in the initial Magento 2.0 release, but we will consider it for a follow-on release.

apiuser
New Member

Comment from tanya-soroka, posted on GitHub Mar 18, 2015

Ticket number is MAGETWO-21570 in Magento 2 project.

apiuser
New Member

Comment from piotrekkaminski, posted on GitHub May 10, 2016

This proposal makes sense but is currently not our priority. It was added to backlog and will be handled with other i18n/l10n issues.

nikita_yakushev
Regular Visitor

I know in magento 2.x added declension of nouns based on numeral argument value:

%1 [%1|cat|cats] -> 1 cat / 2 cats

 But i don't know how it works.

marcelorod21e7
New Member

This is possible by using `MessageFormatter` annotation:

 

__('{0, plural, =0{0 cats} one{1 cat} other{# cats}}', 0)->render();
//0 cats
__('{0, plural, =0{0 cats} one{1 cat} other{# cats}}', 1)->render();
//1 cat
__('{0, plural, =0{0 cats} one{1 cat} other{# cats}}', 2)->render();
//2 cats