Merge pull request #61 from coralproject/i18n

I18n
This commit is contained in:
Gabriela Rodríguez Berón
2016-11-11 10:54:06 -08:00
committed by GitHub
11 changed files with 69 additions and 67 deletions
@@ -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"
}
}
@@ -1,13 +0,0 @@
{
"modqueue": {
"pending": "pendiente",
"rejected": "rechazado",
"flagged": "marcado",
"shortcuts": "Atajos de teclado",
"close": "Cerrar"
},
"comment": {
"flagged": "marcado",
"anon": "Anónimo"
}
}
@@ -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 <div className={`${name }-text`}>
{`${count } ${ count === 1 ? 'Comment' : 'Comments'}`}
return <div className={`${name}-text`}>
{`${count} ${count === 1 ? lang.t('comment') : lang.t('comment-plural')}`}
</div>;
};
export default CommentCount;
const lang = new I18n(translations);
@@ -0,0 +1,10 @@
{
"en": {
"comment": "Comment",
"comment-plural": "Comments"
},
"es": {
"comment": "Comentario",
"comment-plural": "Comentarios"
}
}
+5 -15
View File
@@ -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';
@@ -39,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.');
@@ -59,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})}/>
</div>
<div
@@ -74,7 +75,7 @@ class CommentBox extends Component {
className={`${name}-textarea`}
style={styles && styles.textarea}
value={this.state.body}
placeholder='Comment'
placeholder={lang.t('comment')}
id={reply ? 'replyText' : 'commentText'}
onChange={(e) => this.setState({body: e.target.value})}
rows={3}/>
@@ -93,15 +94,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);
@@ -0,0 +1,18 @@
{
"en": {
"post": "Post",
"reply": "Reply",
"comment": "Comment",
"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",
"name": "Nombre",
"comment-post-notif": "¡traduceme!",
"comment-post-notif-premod": "¡traduceme!"
}
}
+7 -3
View File
@@ -1,4 +1,6 @@
import React from 'react';
import {I18n} from '../coral-framework';
import translations from './translations.json';
const name = 'coral-plugin-flags';
@@ -10,7 +12,7 @@ const FlagButton = ({flag, id, postAction, addItem, updateItem, addNotification}
addItem({...action, current_user:true}, 'actions');
updateItem(action.item_id, action.action_type, action.id, 'comments');
});
addNotification('success', 'Thank you for reporting this comment. Our moderation team has been notified and will review it shortly.');
addNotification('success', lang.t('flag-notif'));
};
return <div className={`${name }-container`}>
@@ -20,8 +22,8 @@ const FlagButton = ({flag, id, postAction, addItem, updateItem, addNotification}
aria-hidden={true}>flag</i>
{
flagged
? <span className={`${name }-button-text`}>Flagged</span>
: <span className={`${name }-button-text`}>Flag</span>
? <span className={`${name}-button-text`}>{lang.t('flag')}</span>
: <span className={`${name}-button-text`}>{lang.t('flagged')}</span>
}
</button>
</div>;
@@ -37,3 +39,5 @@ const styles = {
color: 'inherit'
}
};
const lang = new I18n(translations);
@@ -0,0 +1,12 @@
{
"en": {
"flag": "Flag",
"flagged": "Flagged",
"flag-notif": "Thank you for reporting this comment. Our moderation team has been notified and will review it shortly."
},
"es": {
"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."
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ import CommentBox from '../coral-plugin-commentbox/CommentBox';
const name = 'coral-plugin-replies';
const ReplyBox = (props) => <div
className={`${name }-textarea`}
className={`${name}-textarea`}
style={props.styles && props.styles.container}>
{
props.showReply && <CommentBox
+2 -8
View File
@@ -1,5 +1,6 @@
import React from 'react';
import {I18n} from '../coral-framework';
import translations from './translations.json';
const name = 'coral-plugin-replies';
@@ -13,11 +14,4 @@ const ReplyButton = (props) => <button
export default ReplyButton;
const lang = new I18n({
en: {
'reply': 'Reply'
},
es: {
'reply': '¡traduceme!'
}
});
const lang = new I18n(translations);
@@ -0,0 +1,8 @@
{
"en": {
"reply": "Reply"
},
"es": {
"reply": "Responder"
}
}