From 08a6760164f25f230427b72c0a7f5228adbd9c5f Mon Sep 17 00:00:00 2001 From: Maki Nishifuji <nishimaki10@users.noreply.github.com> Date: Wed, 13 Apr 2016 00:25:01 +0900 Subject: [PATCH] Add date/time format settings (#2852) --- packages/rocketchat-lib/i18n/en.i18n.json | 6 +++++- packages/rocketchat-lib/i18n/ja.i18n.json | 6 +++++- packages/rocketchat-lib/server/startup/settings.coffee | 2 ++ packages/rocketchat-ui-message/message/message.coffee | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/rocketchat-lib/i18n/en.i18n.json b/packages/rocketchat-lib/i18n/en.i18n.json index c44779feee2..b1df833078b 100644 --- a/packages/rocketchat-lib/i18n/en.i18n.json +++ b/packages/rocketchat-lib/i18n/en.i18n.json @@ -550,6 +550,8 @@ "Message_AllowStarring" : "Allow Message Starring", "Message_AudioRecorderEnabled" : "Audio Recorder Enabled", "Message_AudioRecorderEnabledDescription" : "Requires 'audio/wav' files to be an accepted media type within 'File Upload' settings.", + "Message_DateFormat" : "Date Format", + "Message_DateFormat_Description" : "See also: <a href=\"http://momentjs.com/docs/#/displaying/format/\" target=\"momemt\">Moment.js</a>", "Message_deleting_not_allowed" : "Message deleting not allowed", "Message_editing_blocked" : "This message cannot be edited anymore", "Message_editing_not_allowed" : "Message editing not allowed", @@ -564,6 +566,8 @@ "Message_ShowDeletedStatus" : "Show Deleted Status", "Message_ShowEditedStatus" : "Show Edited Status", "Message_ShowFormattingTips" : "Show Formatting Tips", + "Message_TimeFormat" : "Time Format", + "Message_TimeFormat_Description" : "See also: <a href=\"http://momentjs.com/docs/#/displaying/format/\" target=\"momemt\">Moment.js</a>", "Message_too_long" : "Message too long", "Messages" : "Messages", "Messages_that_are_sent_to_the_Incoming_WebHook_will_be_posted_here" : "Messages that are sent to the Incoming WebHook will be posted here.", @@ -1074,4 +1078,4 @@ "Your_Open_Source_solution" : "Your own Open Source chat solution", "Your_password_is_wrong" : "Your password is wrong!", "Your_push_was_sent_to_s_devices" : "Your push was sent to %s devices" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/ja.i18n.json b/packages/rocketchat-lib/i18n/ja.i18n.json index 047f399c6fe..54fdbf93e83 100644 --- a/packages/rocketchat-lib/i18n/ja.i18n.json +++ b/packages/rocketchat-lib/i18n/ja.i18n.json @@ -514,6 +514,8 @@ "Message_AllowStarring" : "メッセージã¸ã®ã‚¹ã‚¿ãƒ¼ã‚’許å¯ã™ã‚‹", "Message_AudioRecorderEnabled" : "音声録音を有効ã«ã™ã‚‹", "Message_AudioRecorderEnabledDescription" : "'audio/wav' ㌠'ファイルアップãƒãƒ¼ãƒ‰' è¨å®šã®ãƒ¡ãƒ‡ã‚£ã‚¢ç¨®é¡žã§è¨±å¯ã•ã‚Œã¦ã„ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“", + "Message_DateFormat" : "日付ã®ãƒ•ã‚©ãƒ¼ãƒžãƒƒãƒˆ", + "Message_DateFormat_Description" : "å‚考: <a href=\"http://momentjs.com/docs/#/displaying/format/\" target=\"momemt\">Moment.js</a>", "Message_deleting_not_allowed" : "メッセージを削除ã™ã‚‹æ¨©é™ãŒã‚ã‚Šã¾ã›ã‚“", "Message_editing_blocked" : "ã“ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’編集ã§ãã¾ã›ã‚“", "Message_editing_not_allowed" : "メッセージを編集ã™ã‚‹æ¨©é™ãŒã‚ã‚Šã¾ã›ã‚“", @@ -528,6 +530,8 @@ "Message_ShowDeletedStatus" : "削除ã—ãŸçŠ¶æ…‹ã‚’表示ã™ã‚‹", "Message_ShowEditedStatus" : "編集ã—ãŸçŠ¶æ…‹ã‚’表示ã™ã‚‹", "Message_ShowFormattingTips" : "書å¼ã®ãƒ’ントを表示ã™ã‚‹", + "Message_TimeFormat" : "時刻ã®ãƒ•ã‚©ãƒ¼ãƒžãƒƒãƒˆ", + "Message_TimeFormat_Description" : "å‚考: <a href=\"http://momentjs.com/docs/#/displaying/format/\" target=\"momemt\">Moment.js</a>", "Message_too_long" : "メッセージãŒé•·ã™ãŽã§ã™", "Messages" : "メッセージ", "Messages_that_are_sent_to_the_Incoming_WebHook_will_be_posted_here" : "Incoming WebHook ã¸é€ä¿¡ã•ã‚ŒãŸãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¯ã€ã“ã¡ã‚‰ã¸æŠ•ç¨¿ã•ã‚Œã¾ã™ã€‚", @@ -1023,4 +1027,4 @@ "Your_Open_Source_solution" : "独自ã®ã‚ªãƒ¼ãƒ—ンソースãƒãƒ£ãƒƒãƒˆã‚½ãƒªãƒ¥ãƒ¼ã‚·ãƒ§ãƒ³", "Your_password_is_wrong" : "パスワードãŒé–“é•ã£ã¦ã„ã¾ã™!", "Your_push_was_sent_to_s_devices" : "プッシュ通知㌠%s å°ã®ãƒ‡ãƒã‚¤ã‚¹ã¸é€ä¿¡ã•ã‚Œã¾ã—ãŸ" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee index 2870af94e47..a5ce021e8dc 100644 --- a/packages/rocketchat-lib/server/startup/settings.coffee +++ b/packages/rocketchat-lib/server/startup/settings.coffee @@ -130,6 +130,8 @@ RocketChat.settings.addGroup 'Message', -> @add 'Message_GroupingPeriod', 300, { type: 'int', public: true, i18nDescription: 'Message_GroupingPeriodDescription' } @add 'API_Embed', true, { type: 'boolean', public: true } @add 'API_EmbedDisabledFor', '', { type: 'string', public: true, i18nDescription: 'API_EmbedDisabledFor_Description' } + @add 'Message_TimeFormat', 'LT', { type: 'string', public: true, i18nDescription: 'Message_TimeFormat_Description' } + @add 'Message_DateFormat', 'LL', { type: 'string', public: true, i18nDescription: 'Message_DateFormat_Description' } RocketChat.settings.addGroup 'Meta', -> diff --git a/packages/rocketchat-ui-message/message/message.coffee b/packages/rocketchat-ui-message/message/message.coffee index 9d46d8f1af9..43b77920e69 100644 --- a/packages/rocketchat-ui-message/message/message.coffee +++ b/packages/rocketchat-ui-message/message/message.coffee @@ -17,9 +17,9 @@ Template.message.helpers chatops: -> return 'chatops-message' if this.u?.username is RocketChat.settings.get('Chatops_Username') time: -> - return moment(this.ts).format('LT') + return moment(this.ts).format(RocketChat.settings.get('Message_TimeFormat')) date: -> - return moment(this.ts).format('LL') + return moment(this.ts).format(RocketChat.settings.get('Message_DateFormat')) isTemp: -> if @temp is true return 'temp' -- GitLab