diff --git a/editors/demo/src/locale/en.js b/editors/demo/src/locale/en.js index d4a83b4786be81676994af7dfa6d26dce5bb30b7..4bedc8c234d5e7809d6ebc9403fdbada09dcf414 100644 --- a/editors/demo/src/locale/en.js +++ b/editors/demo/src/locale/en.js @@ -21,6 +21,7 @@ const en = { 'Join with above block': 'Join with above block', 'Lift out of enclosing block': 'Lift out of enclosing block', 'Insert Note': 'Insert Note', + 'Insert Code Block': 'Insert Code Block', }, BlockLevel: { 'Block Level': ' Heading styles', @@ -70,7 +71,14 @@ const en = { 'Special Characters': 'Special Characters', Search: 'Search', }, - AI: {}, + AI: { + 'Find a better way to word this': 'Find a better way to word this', + Submit: 'Submit', + 'Replace selected text': 'Replace selected text', + Insert: 'Insert', + 'Try again': 'Try again', + Discard: 'Discard', + }, Tables: { 'Insert table': 'Insert Table', 'Table Options': 'Table Options', diff --git a/editors/demo/src/locale/es.js b/editors/demo/src/locale/es.js index 55c89f7c2f3233df083b74ca1061baaced5e64c5..6603ed32c570216fdfaf9205f29421d1e421ca60 100644 --- a/editors/demo/src/locale/es.js +++ b/editors/demo/src/locale/es.js @@ -21,6 +21,7 @@ const es = { 'Join with above block': 'Unirse al bloque anterior', 'Lift out of enclosing block': 'Levante fuera del bloque envolvente', 'Insert Note': 'Insertar nota', + 'Insert Code Block': 'Insertar bloque de código', }, BlockLevel: { 'Block Level': 'Estilos de encabezado', @@ -70,7 +71,15 @@ const es = { 'Special Characters': 'Caracteres especiales', Search: 'Buscar', }, - AI: {}, + AI: { + 'Find a better way to word this': + 'Encuentre una mejor manera de redactar esto', + Submit: 'Entregar', + 'Replace selected text': 'Reemplazar texto seleccionado', + Insert: 'Insertar', + 'Try again': 'Intentar otra vez', + Discard: 'Desechar', + }, Tables: { 'Insert table': 'Insertar tabla', 'Table Options': 'Opciones de tabla', diff --git a/wax-prosemirror-core/src/components/icons/icons.js b/wax-prosemirror-core/src/components/icons/icons.js index 7790f024db8c27d866b611619003249cc3802add..7b3be0a8e157ea1f97996f3eb4e250697c36048a 100644 --- a/wax-prosemirror-core/src/components/icons/icons.js +++ b/wax-prosemirror-core/src/components/icons/icons.js @@ -602,7 +602,9 @@ export default { width="20" xmlns="http://www.w3.org/2000/svg" > - <title>Delete Icon</title> + <title> + <Translation defaultTrans="Discard" label="Wax.Various.Discard" /> + </title> <path d="M1.65222 5.47827H18.3479" stroke="#FF4E4E" @@ -631,7 +633,9 @@ export default { width="20" xmlns="http://www.w3.org/2000/svg" > - <title>Try Again Icon</title> + <title> + <Translation defaultTrans="Try Again" label="Wax.AI.Try again" /> + </title> <path d="M16.2963 13.0625C16.7471 12.1375 17 11.0983 17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 13.866 6.13401 17 10 17C10.8587 17 11.6812 16.8454 12.4414 16.5625" stroke="#595959" @@ -648,7 +652,9 @@ export default { width="20" xmlns="http://www.w3.org/2000/svg" > - <title>Insert Icon</title> + <title> + <Translation defaultTrans="Insert" label="Wax.AI.Insert" /> + </title> <path d="M4 4H16" stroke="#505050" /> <path d="M4 7H16" stroke="#505050" /> <path d="M7 10L16 10" stroke="#505050" /> @@ -666,7 +672,12 @@ export default { width="20" xmlns="http://www.w3.org/2000/svg" > - <title>Replace</title> + <title> + <Translation + defaultTrans="Replace selected text" + label="Wax.AI.Replace selected text" + /> + </title> <path d="M18 8H2L6 4" stroke="#595959" strokeLinejoin="round" /> <path d="M2 12H18L14 16" stroke="#595959" strokeLinejoin="round" /> </svg> @@ -680,7 +691,9 @@ export default { width="13" xmlns="http://www.w3.org/2000/svg" > - <title>Submit</title> + <title> + <Translation defaultTrans="Submit" label="Wax.AI.Submit" /> + </title> <path d="M0 11H8V1" stroke="#434343" /> <path d="M3.5 4L8 1L12 4" stroke="#434343" /> </svg> diff --git a/wax-prosemirror-services/src/AiService/components/AskAIOverlay.js b/wax-prosemirror-services/src/AiService/components/AskAIOverlay.js index a7a7927ddeac2a78f02b59f5cc4fb1c2d38c1d7a..c6008d9d64c41a735843bd500a9a26cb3059f45c 100644 --- a/wax-prosemirror-services/src/AiService/components/AskAIOverlay.js +++ b/wax-prosemirror-services/src/AiService/components/AskAIOverlay.js @@ -1,6 +1,8 @@ /* eslint-disable react/prop-types */ import React, { useRef, useLayoutEffect, useContext, useState } from 'react'; import styled from 'styled-components'; +import { isEmpty } from 'lodash'; +import { useTranslation } from 'react-i18next'; import { WaxContext, icons } from 'wax-prosemirror-core'; import replaceSelectedText from '../ReplaceSelectedText'; @@ -39,7 +41,7 @@ const ActionSection = styled.div` display: flex; flex-direction: column; justify-content: flex-start; - width: 188px; + width: 250px; `; const ActionText = styled.div` @@ -100,6 +102,7 @@ const SubmitButton = styled.button` `; const AskAIOverlay = ({ setPosition, position, config }) => { + const { t, i18n } = useTranslation(); const { activeView, options } = useContext(WaxContext); const [result, setResult] = useState(''); const [isSubmitted, setIsSubmitted] = useState(false); @@ -198,7 +201,12 @@ const AskAIOverlay = ({ setPosition, position, config }) => { <AskAIFormInput id="askAiInput" onKeyPress={handleKeyDown} - placeholder="Find a better way to word this" + placeholder={ + !isEmpty(i18n) && + i18n.exists(`Wax.AI.Find a better way to word this`) + ? t(`Wax.AI.Find a better way to word this`) + : 'Find a better way to word this' + } ref={inputRef} type="text" /> @@ -214,22 +222,34 @@ const AskAIOverlay = ({ setPosition, position, config }) => { <ActionSection> <ActionButton onClick={handleReplaceText}> <ActionText> - <icons.replaceIco /> Replace selected text + <icons.replaceIco />{' '} + {!isEmpty(i18n) && i18n.exists(`Wax.AI.Replace selected text`) + ? t(`Wax.AI.Replace selected text`) + : 'Replace selected text'} </ActionText> </ActionButton> <ActionButton onClick={handleInsertTextBelow}> <ActionText> - <icons.insertIco /> Insert + <icons.insertIco />{' '} + {!isEmpty(i18n) && i18n.exists(`Wax.AI.Insert`) + ? t(`Wax.AI.Insert`) + : 'Insert'} </ActionText> </ActionButton> <ActionButton onClick={tryAgain}> <ActionText> - <icons.tryAgain /> Try again + <icons.tryAgain />{' '} + {!isEmpty(i18n) && i18n.exists(`Wax.AI. Try again`) + ? t(`Wax.AI. Try again`) + : ' Try again'} </ActionText> </ActionButton> <ActionButton onClick={discardResults}> <ActionText color="#FF4E4E"> - <icons.deleteIco /> Discard + <icons.deleteIco />{' '} + {!isEmpty(i18n) && i18n.exists(`Wax.AI. Discard`) + ? t(`Wax.AI. Discard`) + : ' Discard'} </ActionText> </ActionButton> </ActionSection>