Correct the grammar rule for noun agreement after zero

Published on: 20 January 2026. Last updated date: 20 January 2026

 

WordPress, zero, and noun agreement: why “0 comments” can become a problem (especially in French).

There are two certainties in life: WordPress will always remind us that it was designed in English, and we always end up debating grammar on the Internet.

Today, we're talking about a detail that seems trivial, but which immediately raises eyebrows when writing proper French: noun agreement after zero.

You've probably already come across the phrase "0 comment" on French-language websites when you were expecting to see "0 comments." The problem is that WordPress applies a plural rule that doesn't fit with French logic... and sometimes not even with logic at all.

1|Le concept de l’article : “zéro” est-il singulier ou pluriel ?

The problem stems from a somewhat unusual grammatical case: how do you make a noun agree when it is preceded by zero?

It's omnipresent in a website's interface:

  • 0 comment(s)
  • 0 product(s)
  • 0 message(s)
  • 0 result(s)

And since WordPress handles this via its translation system (gettext), it must choose between two forms:

  • a singular form
  • a plural form

Except that… “zero” is not “one”, so it quickly becomes a problem.

The grammar rule: noun agreement after zero (in French)

In French, the most standard rule (and the one expected in an interface) is simple:

After zero, we use the plural. So we write:

  • 0 comments
  • 0 messages
  • 0 results

Why? Because zero expresses a null quantity, and in French, this quantity is treated as a plural in common usage.

Yes, there are stylistic discussions and special cases (especially in poetry or very specific formulations), but in a UI/UX context, “0 comments” is the natural and correct form.

Does this rule apply to all languages? (English vs. French)

And here's where it gets interesting: no, it's not universal.

🇫🇷 French

  • 0 = plural
  • “0 comments”, “0 articles”, etc.

🇬🇧 English

In English, it is also generally:

  • 0 = plural
  • “0 comments”, “0 messages”, etc.

But English is often more flexible in spoken usage, and above all, it has less "grammatical burden" on this type of agreement. In user interfaces, 0 + plural is the norm almost everywhere. So if WordPress generates "0 comments" in English, it's not an "acceptable variant".

Where does the problem in WordPress come from?

WordPress uses gettext translation functions, including _n() to handle singular/plural.

In its simplest form, the engine performs a basic test of the following type:

return 1 === (int) $count ? $singular : $plural;

Human translation:

  • If $count equals 1, WordPress takes the singular form.
  • otherwise (so 0, 2, 42, etc.), WordPress takes the plural form

On paper, it seems reasonable. Except that it rests on one idea: the singular only exists for 1. And if you encounter a language (or a context) where zero doesn't follow the same rule, you'll be stuck. In our case, we want to ensure proper behavior in French, without rewriting the entire _n().

The snippet: force the French rule for zero (0 → plural)

Here is a ready-to-use snippet for WordPress: it intercepts the plural translation via the ngettext filter, and if the number is 0 and the locale is French, it forces the plural “as if we were at 1” in the pluralization system (it’s a clean trick to trigger the expected form).

Objective: Correct the display of translated strings using _n() when $number === 0 in French.

Before using this snippet, make sure you have installed the Code Snippets plugin (free) on your WordPress site. If not, you can download it via the link below. If you have never added a specific feature to your WordPress site, we recommend you start by reading our dedicated guide (link below).



2|Prérequis

Here is the list of extensions required for this snippet to work properly. Make sure to install them before activating the snippet.

WooCommerceNecessary for selling virtual products on your site

3|Snippet WordPress

Add this to the functions.php file (or better yet: in a MU mini-plugin). The comments within the code will guide you on how this snippet works.

Make sure to check the "Run snippet everywhere" box before activating the snippet.

add_filter('ngettext', function ($translation, $single, $plural, $number, $domain) {
  if (is_numeric($number) && 0 === (int) $number) {
    // Zero plural rule
    if ('fr' === substr((string) get_locale(), 0, 2)) {
      // French speaker only
      $translations = get_translations_for_domain($domain);
      $translation  = $translations->translate_plural($single, $plural, 1);
    }
  }
  return $translation;
}, 10, 5);

What this code does:

  • It forces the use of the expected plural form
  • It only affects the case where $number equals 0.
  • It only applies if the locale starts with fr
  • It retrieves translations from the current domain

Conclusion: Why this snippet is useful (and necessary)

This snippet is meant to solve a seemingly trivial problem… until your site displays “0 comments” to thousands of visitors. And you might even get a few comments from eminent linguists!

The main advantage is that we correct a real grammatical case without rewriting the entire translation system, and without breaking other languages. It involves applying a simple rule: in French, zero triggers the plural, period.

Finally, it's also a good "clean" patch for multilingual projects: you only touch the final rendering, only in the FR context, and only on the value 0. Result: your interface becomes natural and credible again, and you avoid your site giving the impression of having been translated by an AI (not quite up to scratch, moreover).

If you would like to further customize your loyalty program, consider consulting the WooRewards documentation or hiring an experienced WordPress developer (see our Custom Developments page).

Our Plugins

We have created powerful and widely acclaimed plugins for WooCommerce. Boost your sales with our solutions

WooRewards

Discover the most powerful loyalty plugin for WooCommerce. Simple or tiered systems, referrals, social networks, badges and achievements, you will find all the tools to build YOUR loyalty program

Learn More

VIP Membership

VIP Memberships is a complete membership management tool for your WooCommerce site. Sell subscriptions to your customers and offer them benefits such as preferential prices or exclusive products.

Learn More

Virtual Wallet

Offer your customers a virtual wallet on your website. Let them save money by purchasing your products and use this credit on future purchases. This extension also offers a complete gift card tool

Learn More

Referral Codes

Win new customers with this complete SEO tool. Whether through influencers or simple referrers, reward them and the new customers they bring

Learn More

Leave a comment

You must be logged in to post a comment.