From 523f23269b3c50ea1201f743e68da1c650508feb Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 20 Jun 2017 01:38:38 +0700 Subject: [PATCH] Translate, pep up notifications --- client/coral-admin/src/components/ToastContainer.css | 1 + .../src/routes/Moderation/components/Comment.js | 2 +- .../src/routes/Moderation/containers/Moderation.js | 12 ++++++++---- client/coral-embed-stream/src/components/Comment.js | 3 ++- locales/en.yml | 5 +++++ locales/es.yml | 1 + 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/components/ToastContainer.css b/client/coral-admin/src/components/ToastContainer.css index 57ddf3134..2fcbd7f7d 100644 --- a/client/coral-admin/src/components/ToastContainer.css +++ b/client/coral-admin/src/components/ToastContainer.css @@ -207,6 +207,7 @@ .toastify__body { color: white; + overflow-x: scroll; font-size: 15px; font-weight: 400; } diff --git a/client/coral-admin/src/routes/Moderation/components/Comment.js b/client/coral-admin/src/routes/Moderation/components/Comment.js index 2a5f44f28..41b537f74 100644 --- a/client/coral-admin/src/routes/Moderation/components/Comment.js +++ b/client/coral-admin/src/routes/Moderation/components/Comment.js @@ -95,7 +95,7 @@ class Comment extends React.Component { { (comment.editing && comment.editing.edited) - ?  (Edited) + ?  ({t('comment.edited')}) : null } {props.currentUserId !== comment.user.id && diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index 86c46ac30..ba026abb3 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -34,6 +34,10 @@ import {Spinner} from 'coral-ui'; import Moderation from '../components/Moderation'; import Comment from './Comment'; +function prepareNotificationText(text) { + return truncate(text, {length: 50}).replace('\n', ' '); +} + class ModerationContainer extends Component { subscriptions = []; @@ -50,7 +54,7 @@ class ModerationContainer extends Component { ? {} : { activeQueue: this.activeTab, - text: `${user.username} accepted comment "${truncate(comment.body, {lenght: 50})}"`, + text: t('modqueue.notify_accepted', user.username, prepareNotificationText(comment.body)), anyQueue: false, }; return handleCommentChange(prev, comment, sort, notify); @@ -67,7 +71,7 @@ class ModerationContainer extends Component { ? {} : { activeQueue: this.activeTab, - text: `${user.username} rejected comment "${truncate(comment.body, {lenght: 50})}"`, + text: t('modqueue.notify_rejected', user.username, prepareNotificationText(comment.body)), anyQueue: false, }; return handleCommentChange(prev, comment, sort, notify); @@ -81,7 +85,7 @@ class ModerationContainer extends Component { const sort = this.props.moderation.sortOrder; const notify = { activeQueue: this.activeTab, - text: `${comment.user.username} edited comment to "${truncate(comment.body, {lenght: 50})}"`, + text: t('modqueue.notify_edited', comment.user.username, prepareNotificationText(comment.body)), anyQueue: false, }; return handleCommentChange(prev, comment, sort, notify); @@ -96,7 +100,7 @@ class ModerationContainer extends Component { const sort = this.props.moderation.sortOrder; const notify = { activeQueue: this.activeTab, - text: `${user.username} flagged comment "${truncate(comment.body, {lenght: 50})}"`, + text: t('modqueue.notify_flagged', user.username, prepareNotificationText(comment.body)), anyQueue: true, }; return handleCommentChange(prev, comment, sort, notify); diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index a66b8a224..8626154f4 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -26,6 +26,7 @@ import Slot from 'coral-framework/components/Slot'; import IgnoredCommentTombstone from './IgnoredCommentTombstone'; import {EditableCommentContent} from './EditableCommentContent'; import {getActionSummary, iPerformedThisAction} from 'coral-framework/utils'; +import t from 'coral-framework/services/i18n'; const isStaff = (tags) => !tags.every((t) => t.tag.name !== 'STAFF'); const hasTag = (tags, lookupTag) => !!tags.filter((t) => t.tag.name === lookupTag).length; @@ -415,7 +416,7 @@ export default class Comment extends React.Component { { (comment.editing && comment.editing.edited) - ?  (Edited) + ?  ({t('comment.edited')}) : null } diff --git a/locales/en.yml b/locales/en.yml index de95ddb91..4c2ae7c76 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -13,6 +13,7 @@ en: anon: "Anonymous" ban_user: "Ban User" comment: "Post a comment" + edited: Edited flagged: "flagged" view_context: "View context" comment_box: @@ -241,6 +242,10 @@ en: actions: Actions all: all all_streams: "All Streams" + notify_edited: '{0} edited comment "{1}"' + notify_accepted: '{0} accepted comment "{1}"' + notify_rejected: '{0} rejected comment "{1}"' + notify_flagged: '{0} flagged comment "{1}"' approve: "Approve" approved: "Approved" ban_user: "Ban" diff --git a/locales/es.yml b/locales/es.yml index 6897f6f8b..d174ed0ee 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -13,6 +13,7 @@ es: anon: AnĂ³nimo ban_user: "Usuario Suspendido" comment: "Publicar un comentario" + edited: Editado flagged: reportado view_context: "Ver contexto" comment_box: