From ff4e778dde8501dec407a2d2666976df634f69f7 Mon Sep 17 00:00:00 2001 From: David Jay Date: Thu, 10 Nov 2016 17:34:26 -0500 Subject: [PATCH 1/5] Adding seperate translation files for packages. --- .../coral-admin/public/translations/en.json | 24 ------------------- .../coral-admin/public/translations/es.json | 13 ---------- .../CommentCount.js | 9 ++++--- .../translations.json | 10 ++++++++ client/coral-plugin-commentbox/CommentBox.js | 14 ++--------- .../coral-plugin-commentbox/translations.json | 12 ++++++++++ client/coral-plugin-flags/FlagButton.js | 8 +++++-- client/coral-plugin-flags/translations.json | 10 ++++++++ client/coral-plugin-replies/ReplyBox.js | 2 +- client/coral-plugin-replies/ReplyButton.js | 10 ++------ client/coral-plugin-replies/translations.json | 8 +++++++ 11 files changed, 57 insertions(+), 63 deletions(-) delete mode 100644 client/coral-admin/public/translations/en.json delete mode 100644 client/coral-admin/public/translations/es.json create mode 100644 client/coral-plugin-comment-count/translations.json create mode 100644 client/coral-plugin-commentbox/translations.json create mode 100644 client/coral-plugin-flags/translations.json create mode 100644 client/coral-plugin-replies/translations.json diff --git a/client/coral-admin/public/translations/en.json b/client/coral-admin/public/translations/en.json deleted file mode 100644 index 591de1754..000000000 --- a/client/coral-admin/public/translations/en.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "modqueue": { - "pending": "pending", - "rejected": "rejected", - "flagged": "flagged", - "shortcuts": "Shortcuts", - "close": "Close", - "actions": "Actions", - "navigation": "Navigation", - "approve": "Approve comment", - "reject": "Reject comment", - "nextcomment": "Go to the next comment", - "prevcomment": "Go to the previous comment", - "singleview": "Toggle single comment edit view", - "thismenu": "Open this menu" - }, - "comment": { - "flagged": "flagged", - "anon": "Anonymous" - }, - "embedlink": { - "copy": "Copy to Clipboard" - } -} diff --git a/client/coral-admin/public/translations/es.json b/client/coral-admin/public/translations/es.json deleted file mode 100644 index d151cf13c..000000000 --- a/client/coral-admin/public/translations/es.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "modqueue": { - "pending": "pendiente", - "rejected": "rechazado", - "flagged": "marcado", - "shortcuts": "Atajos de teclado", - "close": "Cerrar" - }, - "comment": { - "flagged": "marcado", - "anon": "Anónimo" - } -} diff --git a/client/coral-plugin-comment-count/CommentCount.js b/client/coral-plugin-comment-count/CommentCount.js index b0d7312e2..47f00ffb5 100644 --- a/client/coral-plugin-comment-count/CommentCount.js +++ b/client/coral-plugin-comment-count/CommentCount.js @@ -1,5 +1,6 @@ import React from 'react'; - +import {I18n} from '../coral-framework'; +import translations from './translations.json'; const name = 'coral-plugin-comment-count'; const CommentCount = ({items, id}) => { @@ -15,9 +16,11 @@ const CommentCount = ({items, id}) => { } } - return
- {`${count } ${ count === 1 ? 'Comment' : 'Comments'}`} + return
+ {`${count} ${count === 1 ? lang.t('comment') : lang.t('comment-plural')}`}
; }; export default CommentCount; + +const lang = new I18n(translations); diff --git a/client/coral-plugin-comment-count/translations.json b/client/coral-plugin-comment-count/translations.json new file mode 100644 index 000000000..bf2522a47 --- /dev/null +++ b/client/coral-plugin-comment-count/translations.json @@ -0,0 +1,10 @@ +{ + "en": { + "comment": "Comment", + "comment-plural": "Comments", + }, + "es": { + "comment": "Comentario", + "comment-plural": "Comentarios" + } +} diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index a4e32d73b..349a589a6 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -1,5 +1,6 @@ import React, {Component, PropTypes} from 'react'; import {I18n} from '../coral-framework'; +import translations from './translations.json' const name = 'coral-plugin-commentbox'; @@ -88,15 +89,4 @@ class CommentBox extends Component { export default CommentBox; -const lang = new I18n({ - en: { - post: 'Post', - reply: 'Reply', - comment: 'Comment', - }, - es: { - post: 'Publicar', - reply: 'Respuesta', - comment: 'Comentario' - } -}); +const lang = new I18n(translations); diff --git a/client/coral-plugin-commentbox/translations.json b/client/coral-plugin-commentbox/translations.json new file mode 100644 index 000000000..86e9ade54 --- /dev/null +++ b/client/coral-plugin-commentbox/translations.json @@ -0,0 +1,12 @@ +{ + "en": { + "post": "Post", + "reply": "Reply", + "comment": "Comment", + }, + "es": { + "post": "Publicar", + "reply": "Respuesta", + "comment": "Comentario" + } +} diff --git a/client/coral-plugin-flags/FlagButton.js b/client/coral-plugin-flags/FlagButton.js index eeeb5e3f5..a920edc33 100644 --- a/client/coral-plugin-flags/FlagButton.js +++ b/client/coral-plugin-flags/FlagButton.js @@ -1,4 +1,6 @@ import React from 'react'; +import {I18n} from '../coral-framework'; +import translations from './translations.json'; const name = 'coral-plugin-flags'; @@ -20,8 +22,8 @@ const FlagButton = ({flag, id, postAction, addItem, updateItem, addNotification} aria-hidden={true}>flag { flagged - ? Flagged - : Flag + ? lang.t('flag') + : lang.t('flagged') }
; @@ -37,3 +39,5 @@ const styles = { color: 'inherit' } }; + +const lang = new I18n(translations); diff --git a/client/coral-plugin-flags/translations.json b/client/coral-plugin-flags/translations.json new file mode 100644 index 000000000..f5fb9ba9a --- /dev/null +++ b/client/coral-plugin-flags/translations.json @@ -0,0 +1,10 @@ +{ + "en": { + "flag": "Flag", + "flagged": "Flagged" + }, + "es": { + "flag": "¡traduceme!", + "flagged": "¡traduceme!" + } +} diff --git a/client/coral-plugin-replies/ReplyBox.js b/client/coral-plugin-replies/ReplyBox.js index cd226181b..6d7c1fb34 100644 --- a/client/coral-plugin-replies/ReplyBox.js +++ b/client/coral-plugin-replies/ReplyBox.js @@ -4,7 +4,7 @@ import CommentBox from '../coral-plugin-commentbox/CommentBox'; const name = 'coral-plugin-replies'; const ReplyBox = (props) =>
{ props.showReply &&
; From 309f53b359e3cf6db5aeb112a91674f243857c79 Mon Sep 17 00:00:00 2001 From: David Jay Date: Fri, 11 Nov 2016 11:44:50 -0500 Subject: [PATCH 3/5] Adding notifcation translations. --- client/coral-plugin-commentbox/translations.json | 6 ++++-- client/coral-plugin-flags/translations.json | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/coral-plugin-commentbox/translations.json b/client/coral-plugin-commentbox/translations.json index eee577b2a..7e68b44b5 100644 --- a/client/coral-plugin-commentbox/translations.json +++ b/client/coral-plugin-commentbox/translations.json @@ -2,11 +2,13 @@ "en": { "post": "Post", "reply": "Reply", - "comment": "Comment" + "comment": "Comment", + "comment-post-notif": "Your comment has been posted." }, "es": { "post": "Publicar", "reply": "Respuesta", - "comment": "Comentario" + "comment": "Comentario", + "comment-post-notif": "¡traduceme!" } } diff --git a/client/coral-plugin-flags/translations.json b/client/coral-plugin-flags/translations.json index f5fb9ba9a..0721d3e00 100644 --- a/client/coral-plugin-flags/translations.json +++ b/client/coral-plugin-flags/translations.json @@ -1,10 +1,12 @@ { "en": { "flag": "Flag", - "flagged": "Flagged" + "flagged": "Flagged", + "flag-notif": "Thank you for reporting this comment. Our moderation team has been notified and will review it shortly." }, "es": { "flag": "¡traduceme!", - "flagged": "¡traduceme!" + "flagged": "¡traduceme!", + "flag-notif": "¡traduceme!" } } From aeefa89e0a38900e05b277ee6f2531b4753e58f1 Mon Sep 17 00:00:00 2001 From: gaba Date: Fri, 11 Nov 2016 09:22:05 -0800 Subject: [PATCH 4/5] Fix spanish translations. --- client/coral-plugin-commentbox/translations.json | 4 ++-- client/coral-plugin-flags/translations.json | 6 +++--- client/coral-plugin-replies/translations.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/coral-plugin-commentbox/translations.json b/client/coral-plugin-commentbox/translations.json index 7e68b44b5..cf407bdae 100644 --- a/client/coral-plugin-commentbox/translations.json +++ b/client/coral-plugin-commentbox/translations.json @@ -7,8 +7,8 @@ }, "es": { "post": "Publicar", - "reply": "Respuesta", + "reply": "Responder", "comment": "Comentario", - "comment-post-notif": "¡traduceme!" + "comment-post-notif": "Tu comentario fue publicado." } } diff --git a/client/coral-plugin-flags/translations.json b/client/coral-plugin-flags/translations.json index 0721d3e00..28eb9f8cb 100644 --- a/client/coral-plugin-flags/translations.json +++ b/client/coral-plugin-flags/translations.json @@ -5,8 +5,8 @@ "flag-notif": "Thank you for reporting this comment. Our moderation team has been notified and will review it shortly." }, "es": { - "flag": "¡traduceme!", - "flagged": "¡traduceme!", - "flag-notif": "¡traduceme!" + "flag": "Marcar", + "flagged": "Marcado", + "flag-notif": "Gracias por marcar este comentario. Nuestro equipo de moderación ha sido notificado y muy pronto lo va a revisar." } } diff --git a/client/coral-plugin-replies/translations.json b/client/coral-plugin-replies/translations.json index b54e2b398..b4d820c44 100644 --- a/client/coral-plugin-replies/translations.json +++ b/client/coral-plugin-replies/translations.json @@ -3,6 +3,6 @@ "reply": "Reply" }, "es": { - "reply": "Respuesta" + "reply": "Responder" } } From ba43e9d6ddea953d2b11405c0646091f6193324d Mon Sep 17 00:00:00 2001 From: David Jay Date: Fri, 11 Nov 2016 13:46:35 -0500 Subject: [PATCH 5/5] Adding translations for comment post notifications. --- client/coral-plugin-commentbox/CommentBox.js | 6 +++--- client/coral-plugin-commentbox/translations.json | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 0018c6866..9032ad328 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -40,7 +40,7 @@ class CommentBox extends Component { postItem(comment, 'comments') .then((comment_id) => { if (premod === 'pre') { - addNotification('success', 'Your comment has been posted and is being reviewed by our moderation team.'); + addNotification('success', lang.t('comment-post-notif-premod')); } else { appendItemArray(parent_id || id, related, comment_id, !parent_id, parent_type); addNotification('success', 'Your comment has been posted.'); @@ -60,7 +60,7 @@ class CommentBox extends Component { style={styles && styles.textarea} value={this.state.username} id={reply ? 'replyUser' : 'commentUser'} - placeholder='Name' + placeholder={lang.t('name')} onChange={(e) => this.setState({username: e.target.value})}/>
this.setState({body: e.target.value})} rows={3}/> diff --git a/client/coral-plugin-commentbox/translations.json b/client/coral-plugin-commentbox/translations.json index 7e68b44b5..e8eb8ad52 100644 --- a/client/coral-plugin-commentbox/translations.json +++ b/client/coral-plugin-commentbox/translations.json @@ -3,12 +3,16 @@ "post": "Post", "reply": "Reply", "comment": "Comment", - "comment-post-notif": "Your comment has been posted." + "name": "Name", + "comment-post-notif": "Your comment has been posted.", + "comment-post-notif-premod": "Thank you for reporting this comment. Our moderation team has been notified and will review it shortly." }, "es": { "post": "Publicar", "reply": "Respuesta", "comment": "Comentario", - "comment-post-notif": "¡traduceme!" + "name": "Nombre", + "comment-post-notif": "¡traduceme!", + "comment-post-notif-premod": "¡traduceme!" } }