Change pluralize method to return the singular form of a word if the count is 0 and the last argument to true. #13676

wants to merge 1 commit into


None yet
3 participants

GRoguelon commented Jan 11, 2014


Currently with the ActionView::Helpers::TextHelper#pluralize method, we can't deal with the specific language rule about the zero value. For instance, in french, we use the singular form with the zero value:

  • 0 cats <> 0 chat
  • 1 cat == 1 chat
  • 2 cats == 2 chats

This pull request tries to solve this problem.


Change ActionView::Helpers::TextHelper#pluralize to return the singul…
…ar form of a word if the count is 0 and the last argument to true.

robin850 commented Jan 11, 2014

Hello @GRoguelon,

Thanks for your patch. I'm pretty sure this will be rejected, you should rely on I18n instead (see for instance #8620 and this stackoverflow post) but I may be wrong so let's wait some feedback.


josevalim commented Jan 11, 2014

I believe this is properly tackled by I18n gem. The issue is that this pull request solves the issue for french (and possibly a couple of other languages), but it doesn't solve the underlying issue of pluralization. For example, languages that pluralize with singular, few, and many still won't be supported.

@josevalim josevalim closed this Jan 11, 2014


GRoguelon commented Jan 11, 2014

I had not taken this into account, thank you for your reply. 😄

@GRoguelon GRoguelon deleted the GRoguelon:pluralize_zero_value branch Jan 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment