diff --git a/packages/freesewing.shared/components/workbench/draft/error.js b/packages/freesewing.shared/components/workbench/draft/error.js index ff05f20ea30..43fc2e2f316 100644 --- a/packages/freesewing.shared/components/workbench/draft/error.js +++ b/packages/freesewing.shared/components/workbench/draft/error.js @@ -1,15 +1,21 @@ import Robot from 'shared/components/robot/index.js' import Events from './events.js' +import { useTranslation } from 'next-i18next' -const Error = props => ( -
-
-

{props.app.t('errors.something')}

-
+const Error = props => { + const { t } = useTranslation(['errors']) + + return ( +
+
+

{t('errors:something')}

+
+
+
- -
-) + ) +} + export default Error diff --git a/packages/freesewing.shared/components/workbench/draft/text-on-path/index.js b/packages/freesewing.shared/components/workbench/draft/text-on-path/index.js index 29eb91d25c0..9714cfb95b5 100644 --- a/packages/freesewing.shared/components/workbench/draft/text-on-path/index.js +++ b/packages/freesewing.shared/components/workbench/draft/text-on-path/index.js @@ -1,9 +1,12 @@ +import { useTranslation } from 'next-i18next' + const TextOnPath = (props) => { + const { t } = useTranslation(['app']) const text = [] // Handle translation (and spaces) let translated = '' for (let string of props.path.attributes.getAsArray('data-text')) { - translated += props.app.t(string, false, props.locale).replace(/"/g, '"') + ' ' + translated += t(string).replace(/"/g, '"') + ' ' } const textPathProps = { xlinkHref: '#' + props.pathId, diff --git a/packages/freesewing.shared/components/workbench/draft/text/index.js b/packages/freesewing.shared/components/workbench/draft/text/index.js index c75044569c1..7671e38e2b1 100644 --- a/packages/freesewing.shared/components/workbench/draft/text/index.js +++ b/packages/freesewing.shared/components/workbench/draft/text/index.js @@ -1,9 +1,12 @@ +import { useTranslation } from 'next-i18next' + const Text = (props) => { + const { t } = useTranslation(['app']) let text = [] // Handle translation let translated = '' for (let string of props.point.attributes.getAsArray('data-text')) { - translated += props.app.t(string.toString(), false, props.locale).replace(/"/g, '"') + ' ' + translated += t(string.toString()).replace(/"/g, '"') + ' ' } // Handle muti-line text if (translated.indexOf('\n') !== -1) { diff --git a/packages/freesewing.shared/components/workbench/inputs/design-option-count.js b/packages/freesewing.shared/components/workbench/inputs/design-option-count.js index d69c2693307..20bb961ec3a 100644 --- a/packages/freesewing.shared/components/workbench/inputs/design-option-count.js +++ b/packages/freesewing.shared/components/workbench/inputs/design-option-count.js @@ -1,6 +1,7 @@ import { useState } from 'react' import ClearIcon from 'shared/components/icons/clear.js' import EditIcon from 'shared/components/icons/edit.js' +import { useTranslation } from 'next-i18next' const EditCount = props => (
@@ -25,6 +26,7 @@ const EditCount = props => ( const DesignOptionCount = props => { + const { t } = useTranslation(['app']) const { count, max, min } = props.pattern.config.options[props.option] const val = (typeof props.gist?.options?.[props.option] === 'undefined') ? count @@ -53,7 +55,7 @@ const DesignOptionCount = props => { min={min} max={max} setEditCount={setEditCount} - t={props.app.t} + t={t} /> : ( <> @@ -84,7 +86,7 @@ const DesignOptionCount = props => {
))}
- {props.app.t('cfp.thingIsDisabled', { thing: props.app.t('settings.xray.title') })} + {t('cfp:thingIsDisabled', { thing: t('settings:xray.title') })} ) diff --git a/packages/freesewing.shared/components/workbench/menu/xray/list.js b/packages/freesewing.shared/components/workbench/menu/xray/list.js index aa67a5e96d2..1134dee3be3 100644 --- a/packages/freesewing.shared/components/workbench/menu/xray/list.js +++ b/packages/freesewing.shared/components/workbench/menu/xray/list.js @@ -5,6 +5,7 @@ import SearchIcon from 'shared/components/icons/search.js' import { Ul, Li, Details, Summary, SumDiv, Deg } from 'shared/components/workbench/menu' import Path from './path.js' import Point from './point.js' +import { useTranslation } from 'next-i18next' const types = { paths: Path, @@ -12,8 +13,9 @@ const types = { } const XrayList = props => { + const { t } = useTranslation(['app', 'parts']) - let title = props.app.t(`parts.${props.partName}`) + let title = t(`parts.${props.partName}`) if (title !== props.partName || true) title + ` (${props.partName})` const part = props.gist.xray.parts[props.partName] @@ -36,7 +38,7 @@ const XrayList = props => {