FIX: Use count variable for pluralized string

FIX: Use count variable for pluralized string.

From a0022a1771db04d76fdcfe8074558abf6c191208 Mon Sep 17 00:00:00 2001
From: Bianca Nenciu <nenciu.bianca@gmail.com>
Date: Tue, 20 Nov 2018 14:17:31 +0200
Subject: [PATCH] FIX: Use count variable for pluralized string.


diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index ba45644..0a21495 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -239,7 +239,7 @@ en:
     imported_from: "This is a companion discussion topic for the original entry at %{link}"
     in_reply_to: "▶ %{username}"
     replies:
-      one: "1 reply"
+      one: "%{count} reply"
       other: "%{count} replies"
 
   no_mentions_allowed: "Sorry, you can't mention other users."

GitHub

1 Like

I am confused about this pattern, in English we do not need count and one other split is a very English thing. Is this hiding some transifex quirk ? @gschlager

Yes and no. :slight_smile:

I recommend to always use the %{count} variable, even in the one category. A lot of languages use the one category for more than just the number 1. As we recently noticed, French is one of them. :wink:

This fixes two issues with Transifex:

  1. Transifex uses the English text from the one category as suggestion for translations in the one category. When it contains the %{count} variable, we can force translators to use it and the Transifex editor actually makes that very easy. If it doesn’t exist translators might forget or don’t even know that they need to replace the 1 with %{count}.

    Wow. I thought “0” was using the “other” category.

  2. Transifex allows us to force translators to use all interpolation keys that exist in the original text in the translated text. I had to change it from “error” (which disables save) to “warn”, because unfortunately it doesn’t allow adding a variable, that doesn’t exist in English.

3 Likes