diff --git a/src/components/ActionContext.js b/src/components/ActionContext.js
index 6b8fe71..bf0b07f 100644
--- a/src/components/ActionContext.js
+++ b/src/components/ActionContext.js
@@ -9,7 +9,8 @@ export const ActionProvider = ({
comments,
signinUrl,
signupUrl,
- customInput
+ customInput,
+ i18n
}) => {
const [replies, setReplies] = useState([])
const [user, setUser] = useState()
@@ -140,7 +141,8 @@ export const ActionProvider = ({
signupUrl: signupUrl,
user: user,
customInput: customInput,
- submit: submit
+ submit: submit,
+ i18n: i18n
}}
>
{children}
diff --git a/src/components/CommentStructure.js b/src/components/CommentStructure.js
index 6b6c56e..df55705 100644
--- a/src/components/CommentStructure.js
+++ b/src/components/CommentStructure.js
@@ -41,7 +41,7 @@ const CommentStructure = ({ i, reply, parentId }) => {
disabled={!actions.user}
>
{' '}
- Reply
+ {actions.i18n.comment.reply}
@@ -65,13 +65,13 @@ const CommentStructure = ({ i, reply, parentId }) => {
onClick={() => actions.handleAction(i.comId, edit)}
>
{' '}
- edit
+ {actions.i18n.editComment.action}
delete
+
}
modal
nested
@@ -87,11 +87,11 @@ const CommentStructure = ({ i, reply, parentId }) => {
{' '}
- Delete Comment{' '}
+ {actions.i18n.deleteComment.header}{' '}
{' '}
- Delete your comment permanently?
+ {actions.i18n.deleteComment.content}
diff --git a/src/components/DisplayComments.js b/src/components/DisplayComments.js
index a35bbc8..7bf5c94 100644
--- a/src/components/DisplayComments.js
+++ b/src/components/DisplayComments.js
@@ -33,7 +33,8 @@ const DisplayComments = ({ comments }) => {
parentId: i.comId,
submit: actions.submit,
handleCancel: actions.handleCancel,
- edit: false
+ edit: false,
+ i18n: actions.i18n
})
) : (
@@ -51,7 +52,8 @@ const DisplayComments = ({ comments }) => {
handleCancel: actions.handleCancel,
edit: true,
parentId: i.comId,
- submit: actions.submit
+ submit: actions.submit,
+ i18n: actions.i18n
})
) : (
{
child: true,
submit: actions.submit,
handleCancel: actions.handleCancel,
- edit: false
+ edit: false,
+ i18n: actions.i18n
})
) : (
{
authorImg: action.userImg,
main: true,
handleCancel: action.handleCancel,
- submit: action.submit
+ submit: action.submit,
+ i18n: action.i18n
})
) : (
diff --git a/src/components/InputField.js b/src/components/InputField.js
index 1924e75..ab8c719 100644
--- a/src/components/InputField.js
+++ b/src/components/InputField.js
@@ -33,7 +33,7 @@ const InputField = ({ cancellor, parentId, child, value, edit, main }) => {
{
: { backgroundColor: '#30c3fd' }
}
>
- Post
+ {actions.i18n.post.post}
{(text || parentId) && (
)}
diff --git a/src/components/SignField.js b/src/components/SignField.js
index 123c3e7..ce52340 100644
--- a/src/components/SignField.js
+++ b/src/components/SignField.js
@@ -16,7 +16,7 @@ const SignField = () => {
return (
- Log in or sign up to leave a comment
+ {actions.i18n.sign.boxLine}
diff --git a/src/index.js b/src/index.js
index 4a16e48..6e7e70e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -5,13 +5,66 @@ import { ActionProvider } from './components/ActionContext'
import SignField from './components/SignField'
import Input from './components/Input'
+export const enI18n = {
+ sign: {
+ boxLine: 'Log in or sign up to leave a comment',
+ logIn: 'Log In',
+ signUp: 'Sign Up'
+ },
+ post: {
+ placeholder: 'Type your reply here.',
+ post: 'Post',
+ cancel: 'Cancel',
+ },
+ comment: {
+ reply: 'Reply'
+ },
+ editComment: {
+ action: 'edit'
+ },
+ deleteComment: {
+ action: 'delete',
+ header: 'Delete Comment',
+ content: 'Delete your comment permanently?',
+ confirmButton: 'Delete',
+ cancelButton: 'Cancel'
+ }
+}
+
+export const esI18n = {
+ sign: {
+ boxLine: 'Inicie sesión o regístrese para dejar un comentario',
+ logIn: 'Iniciar Sesión',
+ signUp: 'Registrarse'
+ },
+ post: {
+ placeholder: 'Escriba su respuesta aquí.',
+ post: 'Publicar',
+ cancel: 'Cancelar',
+ },
+ comment: {
+ reply: 'Responder'
+ },
+ editComment: {
+ action: 'editar'
+ },
+ deleteComment: {
+ action: 'eliminar',
+ header: 'Eliminar Comentario',
+ content: '¿Desea eliminar su comentario permanentemente?',
+ confirmButton: 'Eliminar',
+ cancelButton: 'Cancelar'
+ }
+}
+
export const CommentSection = ({
commentsArray,
currentUser,
setComment,
signinUrl,
signupUrl,
- customInput
+ customInput,
+ i18n = enI18n
}) => {
const [comments, setComments] = useState(commentsArray)
useEffect(() => {
@@ -26,6 +79,7 @@ export const CommentSection = ({
signinUrl={signinUrl}
signupUrl={signupUrl}
customInput={customInput}
+ i18n={i18n}
>