Skip to content
Snippets Groups Projects
Commit b8cc7276 authored by chris's avatar chris
Browse files

base and annoations tool translations

parent 1079db95
No related branches found
No related tags found
1 merge request!501Translations
...@@ -7,33 +7,16 @@ import Editoria from './Editoria/Editoria'; ...@@ -7,33 +7,16 @@ import Editoria from './Editoria/Editoria';
import HHMI from './HHMI/HHMI'; import HHMI from './HHMI/HHMI';
import NCBI from './NCBI/NCBI'; import NCBI from './NCBI/NCBI';
import OEN from './OEN/OEN'; import OEN from './OEN/OEN';
import en from './locale/en';
import es from './locale/es';
import 'wax-prosemirror-core/dist/index.css'; import 'wax-prosemirror-core/dist/index.css';
import 'wax-prosemirror-services/dist/index.css'; import 'wax-prosemirror-services/dist/index.css';
import 'wax-questions-service/dist/index.css'; import 'wax-questions-service/dist/index.css';
import 'wax-table-service/dist/index.css'; import 'wax-table-service/dist/index.css';
i18next.use(initReactI18next).init({ i18next.use(initReactI18next).init({
resources: { resources: { es },
en: { lng: 'es',
translation: {
Wax: {
Annotations: {
'Toggle code': 'Toggle code translation',
},
},
},
},
es: {
translation: {
Wax: {
Annotations: {
'Toggle code': 'Toggle code translation Spanish',
},
},
},
},
},
lng: 'en',
interpolation: { interpolation: {
escapeValue: false, escapeValue: false,
}, },
......
const en = {
translation: {
Wax: {
Base: {
Undo: 'Undo',
Redo: 'Redo',
'Save changes': 'Save changes',
},
Annotations: {
'Toggle code': 'Toggle code',
'Toggle emphasis': 'Toggle emphasis',
'Toggle Small Caps': 'Toggle Small Caps',
'Toggle strikethrough': 'Toggle strikethrough',
'Toggle strong': 'Toggle strong',
'Toggle subscript': 'Toggle subscript',
'Toggle superscript': 'Toggle superscript',
'Toggle underline': 'Toggle underline',
'Add or remove link': 'Add or remove link',
},
Display: {},
Text: {},
CustomTags: {},
},
},
};
export default en;
const es = {
translation: {
Wax: {
Base: {
Undo: 'Deshacer',
Redo: 'Rehacer',
'Save changes': 'Guardar cambios',
},
Annotations: {
'Toggle code': 'Código de alternancia',
'Toggle emphasis': 'Alternar énfasis',
'Toggle Small Caps': 'Alternar versalitas',
'Toggle strikethrough': 'Alternar tachado',
'Toggle strong': 'Alternar fuerte',
'Toggle subscript': 'Alternar subíndice',
'Toggle superscript': 'Alternar superíndice',
'Toggle underline': 'Alternar subrayado',
'Add or remove link': 'Agregar o eliminar enlace',
},
Display: {},
Text: {},
CustomTags: {},
},
},
};
export default es;
/* eslint react/prop-types: 0 */ /* eslint react/prop-types: 0 */
import React, { useContext, useMemo, useEffect, useState } from 'react'; import React, { useContext, useMemo, useEffect, useState } from 'react';
import { isEmpty } from 'lodash';
import { useTranslation } from 'react-i18next';
import { WaxContext, MenuButton } from 'wax-prosemirror-core'; import { WaxContext, MenuButton } from 'wax-prosemirror-core';
const SaveButton = ({ view = {}, item }) => { const SaveButton = ({ view = {}, item }) => {
const { t, i18n } = useTranslation();
const { icon, label, select, title } = item; const { icon, label, select, title } = item;
const { const {
...@@ -55,7 +58,11 @@ const SaveButton = ({ view = {}, item }) => { ...@@ -55,7 +58,11 @@ const SaveButton = ({ view = {}, item }) => {
iconName={iconTodisplay} iconName={iconTodisplay}
label={label} label={label}
onMouseDown={handleMouseDown} onMouseDown={handleMouseDown}
title={title} title={
!isEmpty(i18n) && i18n.exists(`Wax.Base.${title}`)
? t(`Wax.Base.${title}`)
: title
}
/> />
), ),
[isSaving, isDisabled], [isSaving, isDisabled],
......
/* eslint react/prop-types: 0 */ /* eslint react/prop-types: 0 */
import React, { useContext, useMemo } from 'react'; import React, { useContext, useMemo } from 'react';
import { isEmpty } from 'lodash';
import { useTranslation } from 'react-i18next';
import { WaxContext, MenuButton } from 'wax-prosemirror-core'; import { WaxContext, MenuButton } from 'wax-prosemirror-core';
const UndoRedoButton = ({ view = {}, item }) => { const UndoRedoButton = ({ view = {}, item }) => {
const { t, i18n } = useTranslation();
const { active, icon, label, run, select, title } = item; const { active, icon, label, run, select, title } = item;
const { const {
...@@ -38,7 +41,11 @@ const UndoRedoButton = ({ view = {}, item }) => { ...@@ -38,7 +41,11 @@ const UndoRedoButton = ({ view = {}, item }) => {
iconName={icon} iconName={icon}
label={label} label={label}
onMouseDown={e => handleMouseDown(e, main.state, main.dispatch)} onMouseDown={e => handleMouseDown(e, main.state, main.dispatch)}
title={title} title={
!isEmpty(i18n) && i18n.exists(`Wax.Base.${title}`)
? t(`Wax.Base.${title}`)
: title
}
/> />
), ),
[isActive, isDisabled], [isActive, isDisabled],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment