From 6e6dbde8988781920e278a992a5ffc4a5fbb8a0b Mon Sep 17 00:00:00 2001 From: David Battersby Date: Wed, 16 Oct 2024 20:10:40 +0400 Subject: [PATCH] DEV: move chat time formats to core locales (#29236) This change moves the date/time formats to core locales, so that they can be used outside of the plugin. --- config/locales/client.en.yml | 2 ++ .../assets/javascripts/discourse/helpers/format-chat-date.js | 4 ++-- plugins/chat/config/locales/client.en.yml | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index dafc1830bd2..976e63cdae7 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -25,6 +25,8 @@ en: # Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ time: "h:mm a" # Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ + time_short: "h:mm" + # Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ time_with_zone: "hh:mm a (z)" # Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ time_short_day: "ddd, h:mm a" diff --git a/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js b/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js index 2a743b23ab3..c72c36555e1 100644 --- a/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js +++ b/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js @@ -11,8 +11,8 @@ export default function formatChatDate(message, options = {}) { const title = date.format(I18n.t("dates.long_with_year")); const display = options.mode === "tiny" - ? date.format(I18n.t("chat.dates.time_tiny")) - : date.format(I18n.t("chat.dates.time")); + ? date.format(I18n.t("dates.time_short")) + : date.format(I18n.t("dates.time")); if (message.staged) { return htmlSafe( diff --git a/plugins/chat/config/locales/client.en.yml b/plugins/chat/config/locales/client.en.yml index d874c49fd4c..a08dd0c1fb9 100644 --- a/plugins/chat/config/locales/client.en.yml +++ b/plugins/chat/config/locales/client.en.yml @@ -45,8 +45,6 @@ en: deleted_chat_username: deleted dates: yesterday: "Yesterday" - time: "h:mm a" - time_tiny: "h:mm" all_loaded: "Showing all messages" already_enabled: "Chat is already enabled on this topic. Please refresh." disabled_for_topic: "Chat is disabled on this topic."