From 7c2c47aee2bb6cb13e8cc0adfb7ee354f24528aa Mon Sep 17 00:00:00 2001 From: Maki Nishifuji Date: Wed, 13 Apr 2016 00:04:45 +0900 Subject: [PATCH] Add date/time format settings --- 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 c44779feee29..b1df833078bd 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: Moment.js", "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: Moment.js", "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 047f399c6feb..54fdbf93e83a 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" : "参考: Moment.js", "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" : "参考: Moment.js", "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 2870af94e47d..a5ce021e8dc4 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 9d46d8f1af97..43b77920e693 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'