probus
(probus)
27.Апрель.2015 14:42:06
1
Dates always show up in default (US) locale in embedded comments.
downey
(Michael Downey)
27.Апрель.2015 15:56:14
2
Hmm. What do you mean “embedded comments”? Can you provide some detailed steps to reproduce this bug?
probus
(probus)
02.Декабрь.2015 09:47:49
5
Still in English, but we can now at least hide them with CSS.
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:
The problem is in embed/comments.html.erb:
<%= link_to(I18n.t('embed.start_discussion'), @topic_view.topic.url, class: 'button', target: '_blank') %>
<% elsif @reply_count >= 10 %>
<%= link_to(I18n.t('embed.continue'), @second_post_url, class: 'button', target: '_blank') %>
<% end %>
<span class='replies'><%= I18n.t('embed.replies', count: @reply_count) %></span>
</header>
<%- if @topic_view.posts.present? %>
<%- @topic_view.posts.each do |post| %>
<article class='post<%- if post.trashed? %> deleted<% end %>' id='post-<%= post.id.to_s %>'>
<%= link_to embed_post_date(post.created_at), post.full_url, title: post.created_at.strftime("%B %e, %Y %l:%M%P"), class: 'post-date', target: "_blank" %>
<%- if post.reply_to_post.present? && !post.cooked.index('aside') %>
<%= link_to I18n.t('embed.in_reply_to', username: post.reply_to_post.username), post.reply_to_post.full_url, 'data-link-to-post' => post.reply_to_post.id.to_s, :class => 'in-reply-to', target: "_blank" %>
<%- end %>
<div class='author'>
<a rel='nofollow' href='<%= Discourse.base_url %>/u/<%= post.username %>' target="_blank"><img src='<%= post.user.small_avatar_url %>' alt=''></a>
</div>
<div class='cooked'>
<h3 class='username'>
<a rel='nofollow' href='<%= Discourse.base_url %>/u/<%= post.username %>' target="_blank" class='<% if post.user.staff? %>staff<% end %><% if post.user.new_user? %>new-user<% end %>'><%= post.user.username %></a>
then ember_helper.rb:
# frozen_string_literal: true
module EmbedHelper
def embed_post_date(dt)
current = Time.now
if dt >= 1.day.ago
distance_of_time_in_words(dt, current)
else
if dt.year == current.year
dt.strftime I18n.t("datetime_formats.formats.short_no_year")
else
dt.strftime I18n.t("datetime_formats.formats.no_day")
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 лайк
weber-s
(Samuël Weber/GwendalD)
27.Февраль.2024 15:34:32
9
Здравствуйте,
Я столкнулся с той же проблемой.
Вижу проблему с локализацией здесь, так как потенциально ни один пользователь не подключен, и поэтому сложно определить его локаль… но может ли это быть настройкой? Для экземпляра Discourse, ориентированного только на одноязычное сообщество, это имело бы смысл!
Похоже, это существует уже довольно давно. Интересно, стоит ли это относить к категории #feature request, а не к bug bucket.
2 лайка
Lhc_fl
(Linca)
22.Июль.2024 10:44:47
14
Я отправил исправление здесь:
main ← ux-localize-embed-posts
merged 10:42AM - 22 Jul 24 UTC
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:

after

3 лайка
Lhc_fl
(Linca)
Закрыл(а) тему
24.Июль.2024 10:45:08
15
Эта тема была автоматически закрыта через 2 дня после последнего ответа. Новые ответы больше не принимаются.