Embed: dates are not localized

AI-generated summary

A discussion is ongoing about an issue where dates in embedded Discourse comments are not localized, always displaying in the US locale. probus initially reported the issue and provided steps to reproduce it. After some investigation, fantasticfears found that the problem lies in the embed/comments.html.erb and ember_helper.rb files and suggested possible fixes. weber-s pointed out that estimating the locale can be complicated when no user is connected, but proposed that it could be a setting for Discourse instances targeting a single language community. JammyDodger wondered if this issue should be considered a feature request rather than a bug. Eventually, Lhc_fl submitted a fix in a pull request on GitHub.

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

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

  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
2 Likes

Any updates on this?

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

Happy anniversary! :birthday: :gift:

1 Like

Darkness leads me to this bug under the pale moonlight :new_moon:

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 :frowning:

Embed comments:

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

then ember_helper.rb:

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.

1 Like

Hello,

Just ran into the same issue.

I see the issue with the localization here because potentially no user is connected so it is complicated to estimate its locale… but could it be a setting? For discourse instance targeting only one language community, it would make sens!

This one seems to have been around for quite awhile. I wonder if this pushes it more into the Contribute > Feature request territory rather than the Contribute > Bug bucket. :thinking:

2 Likes

I have submitted a fix here:

https://github.com/discourse/discourse/pull/28014

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.