# 嵌入：日期未本地化

**URL:** https://meta.discourse.org/t/embed-dates-are-not-localized/27997
**Category:** Feature
**Tags:** embedding, pr-welcome, completed
**Created:** [2015年四月27日 14:42 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997 "2015-04-27T14:42:06Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![probus](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@probus](https://meta.discourse.org/u/probus)
#### Post date: [2015年四月27日 14:42 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/1 "2015-04-27T14:42:06Z")

</div>

Dates always show up in default (US) locale in embedded comments.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [2015年四月27日 15:56 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/2 "2015-04-27T15:56:14Z")

</div>

Hmm. What do you mean “embedded comments”? Can you provide some detailed steps to reproduce this bug?

---

<div class="post-metadata">

### Author: ![probus](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@probus](https://meta.discourse.org/u/probus)
#### Post date: [2015年四月28日 05:14 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/3 "2015-04-28T05:14:57Z")

</div>

1. Switch Discourse locale to any other than English
2. Embed Discourse comments on a website
3. UI is localised but dates are not on the embedded (iframe) comments

---

<div class="post-metadata">

### Author: ![probus](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@probus](https://meta.discourse.org/u/probus)
#### Post date: [2015年八月12日 11:42 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/4 "2015-08-12T11:42:06Z")

</div>

Any updates on this?

---

<div class="post-metadata">

### Author: ![probus](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@probus](https://meta.discourse.org/u/probus)
#### Post date: [2015年十二月2日 09:47 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/5 "2015-12-02T09:47:49Z")

</div>

Still in English, but we can now at least hide them with CSS.

---

<div class="post-metadata">

### Author: ![probus](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@probus](https://meta.discourse.org/u/probus)
#### Post date: [2016年四月15日 13:45 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/6 "2016-04-15T13:45:37Z")

</div>

Happy anniversary! 🎂 🎁

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [2016年四月15日 18:57 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/7 "2016-04-15T18:57:02Z")

</div>

Darkness leads me to this bug under the pale moonlight 🌑

But as a general tip, it would be definitely better if there is a link or screenshots. I can hardly understand what you are talking about if I haven’t translated the documentation ☹

Embed comments:

 ![](https://global.discourse-cdn.com/meta/original/3X/0/0/008188b818eae91aa6aae2e936acbbed182a975d.png)

The problem is in `embed/comments.html.erb`:

> <https://github.com/discourse/discourse/blob/main/app/views/embed/comments.html.erb#L13>

then `ember_helper.rb`:

> <https://github.com/discourse/discourse/blob/main/app/helpers/embed_helper.rb#L3>

The fix can be either using the `FreedomPatches::Rails4.distance_of_time_in_words`, ` I18n.localize(dt, format: I18n.t("datetime_formats.formats.short_no_year"))` or replace the link by a different translation string as the digest email.

; I don’t quite understand the current status of server time formats so I won’t fire PR here.

---

<div class="post-metadata">

### Author: ![weber-s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/weber-s/32/341470_2.png) [@weber-s](https://meta.discourse.org/u/weber-s)
#### Post date: [2024年二月27日 15:34 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/9 "2024-02-27T15:34:32Z")

</div>

您好，

我遇到了同样的问题。

我看到了本地化方面的问题，因为可能没有用户连接，所以很难估算其语言环境……但这可能是一个设置吗？对于仅针对单一语言社区的 Discourse 实例来说，这很有意义！

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2024年二月28日 08:23 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/10 "2024-02-28T08:23:53Z")

</div>

这个似乎已经存在一段时间了。我在想，这是否让它更偏向于 #Contribute > Feature request（功能请求）领域，而不是 #Contribute > Bug（错误报告）类别。🤔

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [2024年七月22日 10:44 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/14 "2024-07-22T10:44:47Z")

</div>

我在这里提交了一个修复程序：

> <https://github.com/discourse/discourse/pull/28014>
>
> Previously, the time format for embedded comments was hardcoded. This commit cha…nges it to the time format defined in I18n.
> 
> Related meta topic: https://meta.discourse.org/t/embed-dates-are-not-localized/27997/
> 
> \## Screenshot:
> 
> before: 
> !\[image\](https://github.com/user-attachments/assets/b7e2d411-d7ca-4fd9-877a-fe6c3ca6ba55)
> 
> after
> 
> !\[image\](https://github.com/user-attachments/assets/52099768-6459-4108-864b-56befbe41c43)

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [2024年七月24日 10:45 UTC](https://meta.discourse.org/t/embed-dates-are-not-localized/27997/15 "2024-07-24T10:45:08Z")

</div>

该主题在上次回复后 2 天自动关闭。不再允许新回复。
