UX: Topic stats were hard to translate

UX: Topic stats were hard to translate

From 49c3cf9c758a35a956570ccc5ffba78b2a2ede9b Mon Sep 17 00:00:00 2001
From: Saurabh Patel <saurabh.finch@gmail.com>
Date: Sat, 24 Nov 2018 16:55:23 +0530
Subject: [PATCH] UX: Topic stats were hard to translate


diff --git a/app/assets/javascripts/discourse/models/category-list.js.es6 b/app/assets/javascripts/discourse/models/category-list.js.es6
index 31aff95..2b49a62 100644
--- a/app/assets/javascripts/discourse/models/category-list.js.es6
+++ b/app/assets/javascripts/discourse/models/category-list.js.es6
@@ -52,10 +52,14 @@ CategoryList.reopenClass({
           const unit = I18n.t(statPeriod);
           if (stat > 0) {
             c.stat = `<span class="value">${stat}</span> / <span class="unit">${unit}</span>`;
-            c.statTitle = I18n.t("categories.topic_stat_sentence", {
-              count: stat,
-              unit: unit
-            });
+
+            c.statTitle = I18n.t(
+              `categories.topic_stat_sentence_${statPeriod}`,
+              {
+                count: stat
+              }
+            );
+
             c[
               "pick" + statPeriod[0].toUpperCase() + statPeriod.slice(1)
             ] = true;
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 3b7ec23..b062705 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -582,9 +582,12 @@ en:
       topic_sentence:
         one: "1 topic"
         other: "%{count} topics"
-      topic_stat_sentence:
-        one: "%{count} new topic in the past %{unit}."
-        other: "%{count} new topics in the past %{unit}."
+      topic_stat_sentence_week:
+        one: "%{count} new topic in the past week."
+        other: "%{count} new topics in the past week."
+      topic_stat_sentence_month:
+        one: "%{count} new topic in the past month."
+        other: "%{count} new topics in the past month."
       n_more: "Categories (%{count} more) ..."
 
     ip_lookup:

GitHub

2 Likes