I have a big problem with pluralize : when 0, it does pluralize the word
pluralize(@posts.size,"post")
if @posts.size equals 0 :
0 posts
if @posts.size equals 1 :
1 post
if @posts.size equals 2 or more :
n posts
As it should not add an s when 0 by default, I'm lost. Is there anyone seeing what's wrong right here ?
I use another method for this :
In my view:
= t('counts.offers', count: project.nb_offers)
# t() is a shortcut for I18n.translate
The first parameter is the path in your file locale file, the second is the thing you want to count.
Then, in your config/locales/xx.yml (fr in my case):
fr:
counts:
offers:
zero: 0 offre
one: 1 offre
other: "%{count} offres"
So I don't have to create a new config file, simply use locales