# Incorrect usage of week/month/year units in a translated string

**URL:** https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931
**Category:** Bug
**Created:** [10월 7, 2018, 10:41오전 UTC](https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931 "2018-10-07T10:41:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dimsuz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dimsuz/32/113634_2.png) [@dimsuz](https://meta.discourse.org/u/dimsuz)
#### Post date: [10월 7, 2018, 10:41오전 UTC](https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931/1 "2018-10-07T10:41:21Z")

</div>

The `topic_stat_sentence` [translateable string](https://github.com/discourse/discourse/blob/master/config/locales/client.en.yml#L582-L584) looks like this:

```plaintext
topic_stat_sentence:
  one: "%{count} new topic in the past %{unit}."
  other: "%{count} new topics in the past %{unit}."

```

And upon formatting this string at [category-list.js.es6](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/models/category-list.js.es6#L55-L58) `count` is applied as a plural argument, but the thing is that this is not enough, there are 2 issues for some languages:

- `unit` can be not in nominative form here, so it is not correct to simply use translation of `js.week` string (for example ) as a `unit`
- `in the past` part translation can change too depending on the `unit` value

For example in Russian the phrase `in the past %{unit}%` translates differently depending on unit:

week → “за предыдущ **ую** неделю”  
month → “за предыдущ **ий** месяц”  
day → “за предыдущ **ий** день”  
minute → “за предыдущ **ую** минуту”

things to note above:

- `in the past` (`за предыдущую`) changes depending on `unit`
- `{unit}` is not nominative in the translation. Nominative for `week/month/day/minute` is `неделя/месяц/день/минута`, but in the phrase we use `неделю/месяц/день/минуту` for Russian.

**Current behavior**

is to translate `in the past week` as “за предыдущ **ий** недел **я** ” which has both words wrong.

**Proposed solution:**

Unit should not be used here separately, instead the whole `in the past week/month/day/year` phrase should be made available for translation as 3 (or 4?) different translatable strings.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [10월 8, 2018, 9:43오전 UTC](https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931/2 "2018-10-08T09:43:39Z")

</div>

I brought that up 4 years ago in [https://meta.discourse.org/t/its-not-possible-to-correctly-translate-topic-stat-sentence/18359](https://meta.discourse.org/t/its-not-possible-to-correctly-translate-topic-stat-sentence/18359)  
This could be a great #starter-task if someone wants to fix the translation. 😉

I’d recommend replacing the existing translation with 4 new ones:

- `topic_stat_sentence_day`
- `topic_stat_sentence_week`
- `topic_stat_sentence_month`
- `topic_stat_sentence_year`

---

<div class="post-metadata">

### Author: ![saurabhp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saurabhp/32/125182_2.png) [@saurabhp](https://meta.discourse.org/u/saurabhp)
#### Post date: [11월 24, 2018, 11:32오전 UTC](https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931/3 "2018-11-24T11:32:56Z")

</div>

Hi @gerhard  
I saw code corresponding to it, `topic_stat_sentence` string is used for translation only when unit is month or week. I have started with them only for now.

I m not an expert at translating so I have just added new variables and kept things backward compatible till we have translations available.

PR for same: [FEAT: split topic\_stat\_sentence to topic\_stat\_sentence\_week and topic… by mrfinch · Pull Request #6663 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/6663)

Let me know if that works.

Thanks

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [11월 28, 2018, 1:28오후 UTC](https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931/4 "2018-11-28T13:28:27Z")

</div>

PR has been merged. Thanks @saurabhp! 👍

The old string was replaced with the following two:

- `topic_stat_sentence_week`
- `topic_stat_sentence_month`

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [11월 28, 2018, 1:28오후 UTC](https://meta.discourse.org/t/incorrect-usage-of-week-month-year-units-in-a-translated-string/98931/5 "2018-11-28T13:28:33Z")

</div>


