From 7fd63b34b118d13e5e6454434337a29120567f0b Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 3 Feb 2023 03:02:14 +0100 Subject: [PATCH] DEV: Make it obvious that `joined` translation is used by onebox (#20158) This also moves the date as interpolation key into the string which makes translation easier. --- config/locales/server.en.yml | 4 +++- lib/onebox/templates/discourse_user_onebox.mustache | 2 +- lib/oneboxer.rb | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 63a7b004b4..230497e6fb 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -5074,7 +5074,9 @@ en: search_logs: graph_title: "Search Count" - joined: "Joined" + onebox: + discourse: + user_joined_community: "Joined %{date}" discourse_push_notifications: popup: diff --git a/lib/onebox/templates/discourse_user_onebox.mustache b/lib/onebox/templates/discourse_user_onebox.mustache index 9adb3bcaf9..022c357fa4 100644 --- a/lib/onebox/templates/discourse_user_onebox.mustache +++ b/lib/onebox/templates/discourse_user_onebox.mustache @@ -26,7 +26,7 @@ {{#bio}}

{{{bio}}}

{{/bio}} - {{joined}} {{created_at}} + {{joined}}
diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb index eb36ebad21..f07aa63e12 100644 --- a/lib/oneboxer.rb +++ b/lib/oneboxer.rb @@ -459,8 +459,11 @@ module Oneboxer name: name, bio: user.user_profile.bio_excerpt(230), location: Onebox::Helpers.sanitize(user.user_profile.location), - joined: I18n.t("joined"), - created_at: user.created_at.strftime(I18n.t("datetime_formats.formats.date_only")), + joined: + I18n.t( + "onebox.discourse.user_joined_community", + date: user.created_at.strftime(I18n.t("datetime_formats.formats.date_only")), + ), website: user.user_profile.website, website_name: UserSerializer.new(user).website_name, original_url: url,