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

The topic_stat_sentence translateable string looks like this:

  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 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.


I brought that up 4 years ago in
This could be a great #starter-task if someone wants to fix the translation. :wink:

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

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:

Let me know if that works.



PR has been merged. Thanks @saurabhp! :+1:

The old string was replaced with the following two:

  • topic_stat_sentence_week
  • topic_stat_sentence_month