From ff4e778dde8501dec407a2d2666976df634f69f7 Mon Sep 17 00:00:00 2001 From: David Jay Date: Thu, 10 Nov 2016 17:34:26 -0500 Subject: [PATCH] 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 &&