diff --git a/editors/demo/src/locale/en.js b/editors/demo/src/locale/en.js index 4bedc8c234d5e7809d6ebc9403fdbada09dcf414..277b4296ee80b6da88b262d122d7061d2bcb067a 100644 --- a/editors/demo/src/locale/en.js +++ b/editors/demo/src/locale/en.js @@ -103,6 +103,11 @@ const en = { 'Show Changes': 'Show Changes', Accept: 'Accept', Reject: 'Reject', + Suggestions: 'Suggestions', + 'Show suggestions': 'Show suggestions', + 'Hide suggestions': 'Hide suggestions', + 'Accept in selection': 'Accept in selection', + 'Reject in selection': 'Reject in selection', }, FindAndReplace: { 'Find And Replace': 'Find And Replace', diff --git a/editors/demo/src/locale/es.js b/editors/demo/src/locale/es.js index 6603ed32c570216fdfaf9205f29421d1e421ca60..fa16961b99f9f94e0d58e9576f5f93fce4fc96a1 100644 --- a/editors/demo/src/locale/es.js +++ b/editors/demo/src/locale/es.js @@ -104,6 +104,11 @@ const es = { 'Show Changes': 'Mostrar cambios', Accept: 'Aceptar', Reject: 'Rechazar', + Suggestions: 'Sugerencias', + 'Show suggestions': 'Mostrar sugerencias', + 'Hide suggestions': 'Ocultar sugerencias', + 'Accept in selection': 'Aceptar en la selección', + 'Reject in selection': 'Rechazar en la selección', }, FindAndReplace: { 'Find And Replace': 'Encontrar y reemplazar', diff --git a/wax-prosemirror-services/src/EditingSuggestingService/components/EditingSuggestingDropDown.js b/wax-prosemirror-services/src/EditingSuggestingService/components/EditingSuggestingDropDown.js index 0fcd273ea655b29868e989edca15a03e7ef602b0..721c3155ce3e750dcf24e931c5ba3b9826f3ffff 100644 --- a/wax-prosemirror-services/src/EditingSuggestingService/components/EditingSuggestingDropDown.js +++ b/wax-prosemirror-services/src/EditingSuggestingService/components/EditingSuggestingDropDown.js @@ -1,6 +1,8 @@ /* eslint react/prop-types: 0 */ import React, { useMemo, useContext } from 'react'; import styled from 'styled-components'; +import { isEmpty } from 'lodash'; +import { useTranslation } from 'react-i18next'; import { WaxContext, ReactDropDownStyles, Icon } from 'wax-prosemirror-core'; import Dropdown from 'react-dropdown'; @@ -45,41 +47,10 @@ const StyledIcon = styled(Icon)` width: 16px; `; -const Editing = () => { - return ( - <span> - <StyledIcon name="editing" /> - Editing - </span> - ); -}; - -const Suggesting = () => { - return ( - <span> - <StyledIcon name="suggesting" /> - Suggesting - </span> - ); -}; - -const Viewing = () => { - return ( - <span> - <StyledIcon name="viewing" /> - Viewing - </span> - ); -}; - -const dropDownOptions = [ - { label: <Editing />, value: 'editing' }, - { label: <Suggesting />, value: 'suggesting' }, -]; - // eslint-disable-next-line no-unused-vars const EditingSuggesting = ({ view: { dispatch, state }, item }) => { const { app, activeView, pmViews } = useContext(WaxContext); + const { t, i18n } = useTranslation(); const enableService = app.config.get('config.EnableTrackChangeService') ? app.config.get('config.EnableTrackChangeService') : { toggle: false }; @@ -99,6 +70,44 @@ const EditingSuggesting = ({ view: { dispatch, state }, item }) => { }, 100); }; + const Editing = () => { + return ( + <span> + <StyledIcon name="editing" /> + {!isEmpty(i18n) && i18n.exists(`Wax.TrackChanges.Editing`) + ? t(`Wax.TrackChanges.Editing`) + : 'Editing'} + </span> + ); + }; + + const Suggesting = () => { + return ( + <span> + <StyledIcon name="suggesting" /> + {!isEmpty(i18n) && i18n.exists(`Wax.TrackChanges.Suggesting`) + ? t(`Wax.TrackChanges.Suggesting`) + : 'Suggesting'} + </span> + ); + }; + + const Viewing = () => { + return ( + <span> + <StyledIcon name="viewing" /> + {!isEmpty(i18n) && i18n.exists(`Wax.TrackChanges.Viewing`) + ? t(`Wax.TrackChanges.Viewing`) + : 'Viewing'} + </span> + ); + }; + + const dropDownOptions = [ + { label: <Editing />, value: 'editing' }, + { label: <Suggesting />, value: 'suggesting' }, + ]; + const selectedOption = () => { if (enableService.enabled) { return dropDownOptions[1]; diff --git a/wax-prosemirror-services/src/FullScreenService/FullScreenTool.js b/wax-prosemirror-services/src/FullScreenService/FullScreenTool.js index 6613c1e7362be5a98701b9cf13d6610a395d9b5f..35fdb8bb65b0fc8bd8701541d7af9366f849b010 100644 --- a/wax-prosemirror-services/src/FullScreenService/FullScreenTool.js +++ b/wax-prosemirror-services/src/FullScreenService/FullScreenTool.js @@ -6,7 +6,7 @@ import FullScreenButton from './components/FullScreenButton'; @injectable() export default class FullScreenTool extends Tools { - title = 'full screen'; + title = 'Full screen'; icon = 'fullScreen'; name = 'FullScreen'; diff --git a/wax-prosemirror-services/src/FullScreenService/components/FullScreenButton.js b/wax-prosemirror-services/src/FullScreenService/components/FullScreenButton.js index 7071a76b2488888d289231146f884a27d8c7bf89..5e55c4310b8583c5ab9a163422053a51bec1c2c2 100644 --- a/wax-prosemirror-services/src/FullScreenService/components/FullScreenButton.js +++ b/wax-prosemirror-services/src/FullScreenService/components/FullScreenButton.js @@ -5,7 +5,7 @@ import { TextSelection } from 'prosemirror-state'; import { WaxContext, MenuButton } from 'wax-prosemirror-core'; const FullScreenButton = ({ view = {}, item }) => { - const { active, icon, label, select, title } = item; + const { active, icon, select } = item; const context = useContext(WaxContext); const { activeViewId, activeView, options } = context; @@ -37,9 +37,7 @@ const FullScreenButton = ({ view = {}, item }) => { active={false} disabled={false} iconName={usedIcon} - label={label} onMouseDown={e => handleMouseDown(e)} - title={title} /> ), [isActive, isDisabled, usedIcon], diff --git a/wax-prosemirror-services/src/TrackOptionsService/components/TrackChangeOptionsComponent.js b/wax-prosemirror-services/src/TrackOptionsService/components/TrackChangeOptionsComponent.js index 733454d01417bb9fc9f77f8ab0c8487e3c5516fd..e2fadce39342df903e4ad44f10a3cbdb87f402fe 100644 --- a/wax-prosemirror-services/src/TrackOptionsService/components/TrackChangeOptionsComponent.js +++ b/wax-prosemirror-services/src/TrackOptionsService/components/TrackChangeOptionsComponent.js @@ -1,8 +1,9 @@ /* eslint-disable react/prop-types */ import React, { useContext } from 'react'; import styled from 'styled-components'; +import { each, isEmpty } from 'lodash'; +import { useTranslation } from 'react-i18next'; import { grid } from '@pubsweet/ui-toolkit'; -import { each } from 'lodash'; import { WaxContext, DocumentHelpers, MenuButton } from 'wax-prosemirror-core'; const Wrapper = styled.div` @@ -18,6 +19,7 @@ const Wrapper = styled.div` const TotalSuggestions = styled.div` color: #bdc2ca; + text-transform: uppercase; `; // const TotalComments = styled.div` @@ -184,6 +186,7 @@ const TrackChangeOptionsComponent = ({ showHiddenValue, }) => { // const [isShownTrack, setIsShownTrack] = useState(false); + const { t, i18n } = useTranslation(); const menuItems = groups[0].items; const { app, pmViews, activeView, activeViewId } = useContext(WaxContext); const { state } = activeView; @@ -201,9 +204,15 @@ const TrackChangeOptionsComponent = ({ menuItem.active(state, activeViewId) && menuItem.select(state, activeViewId) ); - let { label } = menuItem; + let label = + !isEmpty(i18n) && i18n.exists(`Wax.TrackChanges.${menuItem.label}`) + ? t(`Wax.TrackChanges.${menuItem.label}`) + : menuItem.label; if (menuItem.name === 'ShowHideTrackChange' && showHiddenValue) { - label = 'Hide suggestions'; + label = + !isEmpty(i18n) && i18n.exists(`Wax.TrackChanges.Hide suggestions`) + ? t(`Wax.TrackChanges.Hide suggestions`) + : 'Hide suggestions'; } const isDisabled = !menuItem.select(state, activeViewId, activeView); @@ -236,7 +245,10 @@ const TrackChangeOptionsComponent = ({ return ( <Wrapper> <TotalSuggestions> - {inlineTracks + blockTracks} SUGGESTIONS + {inlineTracks + blockTracks}{' '} + {!isEmpty(i18n) && i18n.exists(`Wax.TrackChanges.Suggestions`) + ? t(`Wax.TrackChanges.Suggestions`) + : 'Suggestions'} </TotalSuggestions> <ToolsContainer>{renderTools()}</ToolsContainer> {/* <AcceptRejectAll