# 帖子时间戳错误（仅限俄语界面）

**URL:** https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390
**Category:** Translations
**Created:** [2018年三月20日 11:49 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390 "2018-03-20T11:49:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [2018年三月20日 11:49 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/1 "2018-03-20T11:49:26Z")

</div>

Hi, we are on 1.9.4 stable. Possible found a bug in post time delta (don’t know how to say).

Look in the picture, please (sorry for non-English). The original post date is February 27th, but today (March 20th) it shows the post as written 1 day ago:

 ![Py5049](https://global.discourse-cdn.com/meta/original/3X/4/9/493c8372cbc0863823be99eeb6673da267743b9f.png)

This post is shown correctly in the list of latest, but has the same 1-day-ago stamp:

 ![yg5049](https://global.discourse-cdn.com/meta/original/3X/f/a/fa947d113b86e818a1d6b23da5d6396f756490db.png)

Links:

> **[PopupButton: свойство autoClose](https://www.cuba-platform.ru/discuss/t/popupbutton-svojstvo-autoclose/1374)**
>
> Доброе время суток) При изменении у PopupButton свойства autoClose в студии (на форме экрана редактирования) не происходит заявленное автоматическое закрытие всплывающего меню. А если прописать значение свойства в xml экрана - закрывается

> **[Динамическое обновление цветов в календаре](https://www.cuba-platform.ru/discuss/t/dinamicheskoe-obnovlenie-czvetov-v-kalendare/1384)**
>
> Добрый день. Есть экран календаря, есть сущность события, атрибутом которой является style с указанием на стиль для события на календаре. Вопрос: Как управлять цветами событий, не переписывая значение атрибута стиль у события? Например я...

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2018年三月21日 05:12 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/2 "2018-03-21T05:12:50Z")

</div>

We need a repro here. Could be a per-language issue as well, depending on the translations.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [2018年三月21日 10:15 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/3 "2018-03-21T10:15:43Z")

</div>

Thank you, it should be 21 instead 1 😀. Today the problem has gone away. Another posts become bad, the magic number is 21.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [2018年三月21日 18:55 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/4 "2018-03-21T18:55:24Z")

</div>

We’ve had problems like this [reported over the years](https://meta.discourse.org/t/error-while-pulling-translations-from-transifex/16575/13). I suspect it’s something wrong with [this pluralization logic](https://github.com/discourse/discourse/blob/master/lib/javascripts/locale/ru.js), but I would expect it to have been reported by now:

```plaintext
MessageFormat.locale.ru = function (n) {
  var r10 = n % 10, r100 = n % 100;

  if (r10 == 1 && r100 != 11)
    return 'one';

  if (r10 >= 2 && r10 <= 4 && (r100 < 12 || r100 > 14) && n == Math.floor(n))
    return 'few';

  return 'other';
};

```

That logic is very strange to us English-speakers… 😉

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年三月22日 00:22 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/5 "2018-03-22T00:22:11Z")

</div>

I have 101 problem understanding this.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [2018年三月22日 08:32 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/6 "2018-03-22T08:32:04Z")

</div>

That’s really funny moment 🙂

Here is a case suitable for phrase “This topic has been written N days ago” (“Эта тема была написана N дн **ей** назад”). The word “ **days** ” in Russian depends on N:

‘few’ (дн **я** ) = **2,3,4, 22,23,24** , 32,33,34…  
‘other’ (дн **ей** ) = **5-20, 25-30** , 35-40…  
‘one’ (д **е** н **ь** ) = **1, 21** , 31, 41…

I see that delta \> 30 days is not used in UI, day+month is used instead. I tried to test modified code but without success.

---

<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: [2018年三月27日 13:28 UTC](https://meta.discourse.org/t/incorrect-time-delta-on-post-ru-interface-only/83390/7 "2018-03-27T13:28:46Z")

</div>

This issue is caused by wrong translations. In Russian the “one” key isn’t only used for the value 1, but also for 21, 31, 41,… That’s why you should always use `%{count}` instead of the value “1” within translations, otherwise all those values will be truncated to 1. 😉

So, you’ll need to update all pluralized strings and make sure that the “one” key contains the appropriate `count` variable instead of the value `1`. You can use the “pluralized: yes” filter on Transifex to find all the affected strings.

* * *

As an aside, the plural rules used by Discourse aren’t 100% correct. According to the [Unicode Plural Rules](http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html#ruhttp://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html#ru) there should be “one”, “few”, “many” and “other”.

[“many” was removed in 2014](https://github.com/discourse/discourse/commit/c42a5551a1ebde70e3984fcff9c4626d674bd751#diff-dcff8e4ed6f8dde319a5c13a0529abba), because there was an issue with Transifex, which seems to be fixed since 2015. We never added it back and looking at the plural rules I think it doesn’t matter a lot, because I believe we aren’t displaying decimal numbers anywhere in the UI. But please be aware that Discourse is currently using “other” where it should be using “many”!
