note 112445 added to function.ngettext

From: Date: Mon, 17 Jun 2013 20:40:31 +0000
Subject: note 112445 added to function.ngettext
Groups: php.notes 
Request: Send a blank email to php-notes+get-195256@lists.php.net to get a copy of this message
Even though "hek at theeks dot net"'s answer is valid, I would not recommend using the abs() hack recommended. Even though it is by far the most common, not all languages treat (n != 1) as plural. Other languages are much more complex, for example, here is how you determine plurals in Macedonian. n==1 || n%10==1 ? 0 : 1 In Arabic there are actually 5 different types of plurals: n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5 If you are using only specific languages that use the (n != 1) format AND -1 is singular, by all means, use abs(), but be careful and don't forget that you have done this when adding a new language to your project 3 years down the road. ---- Server IP: 69.147.83.199 Probable Submitter: 186.15.1.63 ---- Manual Page -- http://php.net/manual/en/function.ngettext.php Edit -- https://master.php.net/note/edit/112445 Del: integrated -- https://master.php.net/note/delete/112445/integrated Del: useless -- https://master.php.net/note/delete/112445/useless Del: bad code -- https://master.php.net/note/delete/112445/bad+code Del: spam -- https://master.php.net/note/delete/112445/spam Del: non-english -- https://master.php.net/note/delete/112445/non-english Del: in docs -- https://master.php.net/note/delete/112445/in+docs Del: other reasons-- https://master.php.net/note/delete/112445 Reject -- https://master.php.net/note/reject/112445 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195256) next »