diff --git a/sites/shared/components/workbench/draft/text/index.js b/sites/shared/components/workbench/draft/text/index.js index a64547e7793..6bdd4e065f1 100644 --- a/sites/shared/components/workbench/draft/text/index.js +++ b/sites/shared/components/workbench/draft/text/index.js @@ -57,8 +57,8 @@ const TextSpans = ({ point, className='', style={}, onClick=null }) => { let text = [] // Handle translation let translated = '' - for (let string of point.attributes.getAsArray('data-text')) { - translated += t(string.toString()).replace(/"/g, '"') + ' ' + for (const string of point.attributes.getAsArray('data-text')) { + if (string) translated += t(string.toString()).replace(/"/g, '"') + ' ' } // Handle muti-line text if (translated.indexOf('\n') !== -1) { diff --git a/sites/shared/components/workbench/inputs/design-option-list.js b/sites/shared/components/workbench/inputs/design-option-list.js index 572fcf52c07..aa8be17b110 100644 --- a/sites/shared/components/workbench/inputs/design-option-list.js +++ b/sites/shared/components/workbench/inputs/design-option-list.js @@ -3,7 +3,7 @@ import ClearIcon from 'shared/components/icons/clear.js' import { useTranslation } from 'next-i18next' const DesignOptionList = props => { - const { t } = useTranslation([`o_${props.design.config.name}`]) + const { t } = useTranslation([`o_${props.design.config.data.name}`]) const { dflt, list, doNotTranslate=false } = props.design.config.options[props.option] const val = (typeof props.gist?.options?.[props.option] === 'undefined') ? dflt @@ -48,7 +48,7 @@ const DesignOptionList = props => { {doNotTranslate ? choice - : props.ot(`o_${props.design.config.name}:${props.option}.o.${choice}`) + : props.ot(`o_${props.design.config.data.name}:${props.option}.o.${choice}`) } ))} diff --git a/sites/shared/components/workbench/layout/cut/index.js b/sites/shared/components/workbench/layout/cut/index.js index c31869875ac..df7d5e55ed0 100644 --- a/sites/shared/components/workbench/layout/cut/index.js +++ b/sites/shared/components/workbench/layout/cut/index.js @@ -8,7 +8,7 @@ const CutLayout = props => {

{ - t('layoutThing', { thing: props.design.config.name }) + t('layoutThing', { thing: props.design.config.data.name }) + ': ' + t('forCutting') } diff --git a/sites/shared/components/workbench/layout/print/index.js b/sites/shared/components/workbench/layout/print/index.js index 9cb60701901..8dab919cd6e 100644 --- a/sites/shared/components/workbench/layout/print/index.js +++ b/sites/shared/components/workbench/layout/print/index.js @@ -48,7 +48,7 @@ const PrintLayout = props => {

{ - t('layoutThing', { thing: props.design.config.name }) + t('layoutThing', { thing: props.design.config.data.name }) + ': ' + t('forPrinting') } diff --git a/sites/shared/components/workbench/measurements/index.js b/sites/shared/components/workbench/measurements/index.js index 037abe459ae..c762f3f0449 100644 --- a/sites/shared/components/workbench/measurements/index.js +++ b/sites/shared/components/workbench/measurements/index.js @@ -52,7 +52,7 @@ const WorkbenchMeasurements = ({ app, design, gist, updateGist, gistReady }) =>

- {design.config.name}: + {design.config.data.name}: {t('measurements')}

{t('cfp:preloadMeasurements')}

diff --git a/sites/shared/components/workbench/menu/design-options/option.js b/sites/shared/components/workbench/menu/design-options/option.js index ab6aaa036c5..d6d210555b7 100644 --- a/sites/shared/components/workbench/menu/design-options/option.js +++ b/sites/shared/components/workbench/menu/design-options/option.js @@ -6,7 +6,7 @@ import {values} from 'shared/components/workbench/menu/design-options/option-val import {inputs} from 'shared/components/workbench/menu/design-options/option-input' const Option = props => { - const { t } = useTranslation([`o_${props.design.config.name}`]) + const { t } = useTranslation([`o_${props.design.config.data.name}`]) const opt = props.design.config.options[props.option]; const type = optionType(opt) const Input = inputs[type] diff --git a/sites/shared/components/workbench/menu/test-design-options/option.js b/sites/shared/components/workbench/menu/test-design-options/option.js index 1caacd6cbd7..a7ccd7c692d 100644 --- a/sites/shared/components/workbench/menu/test-design-options/option.js +++ b/sites/shared/components/workbench/menu/test-design-options/option.js @@ -29,7 +29,7 @@ const SumDiv = (props) => ( ) const Option = props => { - const { t } = useTranslation([`o_${props.design.config.name}`, 'workbench']) + const { t } = useTranslation([`o_${props.design.config.data.name}`, 'workbench']) const active = ( props.gist.sample?.type === 'option' && props.gist.sample?.option === props.option @@ -56,7 +56,7 @@ const Option = props => { {active ? : °} - {t(`o_${props.design.config.name}:${props.option}.t`)} + {t(`o_${props.design.config.data.name}:${props.option}.t`)} diff --git a/sites/shared/components/workbench/menu/view.js b/sites/shared/components/workbench/menu/view.js index 8d10af31a97..10732f879bf 100644 --- a/sites/shared/components/workbench/menu/view.js +++ b/sites/shared/components/workbench/menu/view.js @@ -13,29 +13,29 @@ const View = props => { }, { name: 'draft', - title: t('draftDesign', { design: props.design.config.name }), + title: t('draftDesign', { design: props.design.config.data.name }), onClick: () => props.updateGist(['_state', 'view'], 'draft', true) }, { name: 'test', - title: t('testDesign', { design: props.design.config.name }), + title: t('testDesign', { design: props.design.config.data.name }), onClick: () => props.updateGist(['_state', 'view'], 'test', true) }, { name: 'printingLayout', - title: t('layoutThing', { thing: props.design.config.name }) + title: t('layoutThing', { thing: props.design.config.data.name }) + ': ' + t('forPrinting'), onClick: () => props.updateGist(['_state', 'view'], 'printingLayout', true) }, { name: 'cuttingLayout', - title: t('layoutThing', { thing: props.design.config.name }) + title: t('layoutThing', { thing: props.design.config.data.name }) + ': ' + t('forCutting'), onClick: () => props.updateGist(['_state', 'view'], 'cuttingLayout', true) }, { name: 'export', - title: t('exportThing', { thing: props.design.config.name }), + title: t('exportThing', { thing: props.design.config.data.name }), onClick: () => props.updateGist(['_state', 'view'], 'export', true) }, { diff --git a/sites/shared/components/workbench/preload.js b/sites/shared/components/workbench/preload.js index 4011f144dc5..aff74339012 100644 --- a/sites/shared/components/workbench/preload.js +++ b/sites/shared/components/workbench/preload.js @@ -15,8 +15,8 @@ const preload = { if (result.data.files['pattern.yaml'].content) { let g = yaml.load(result.data.files['pattern.yaml'].content) - if (g.design !== undefined && g.design !== design.config.name) return [ - false, `You tried loading a configuration for ${g.design} into a ${design.config.name} development environment` + if (g.design !== undefined && g.design !== design.config.data.name) return [ + false, `You tried loading a configuration for ${g.design} into a ${design.config.data.name} development environment` ] return g diff --git a/sites/shared/hooks/useGist.js b/sites/shared/hooks/useGist.js index 7b55d2f4553..87b1f0db475 100644 --- a/sites/shared/hooks/useGist.js +++ b/sites/shared/hooks/useGist.js @@ -8,7 +8,7 @@ import {useState} from 'react' // Generates a default design gist to start from export const defaultGist = (design, locale='en') => { const gist = { - design: design.config.name, + design: design.config.data.name, version: design.config.version, ...defaultSettings, _state: {view: 'draft'}