1
0
Fork 0

fix(shared): translations in workbench test view

This commit is contained in:
Joost De Cock 2023-08-28 15:00:59 +02:00
parent e4464beed5
commit 0072ce0bad
3 changed files with 25 additions and 7 deletions

View file

@ -48,11 +48,8 @@ exportForEditing: Export for editing
exportAsData: Export as data
exportPattern-txt: Export a PDF suitable for your printer, or download this pattern in a variety of formats
exportPattern: Export pattern
testThis.option: Test this option
testThis.measurement: Test this measurement
measurements.d: Test the effect of a measurement on the way this pattern looks
designOptions.d: Test the effect of an option on the way this pattern looks
testDesignThing: "Test {design}: {thing}"
yamlEditViewTitleThing: 'Edit Pattern Configuration for {thing}'
yamlEditViewError: Issues with YAML
yamlEditViewErrorDesc: We saved your input, but it might not work for the following reasons
@ -65,3 +62,7 @@ testMeasurements: Test measurements
testMeasurementsDesc: Test how the design adapts to changes to a specific measurement
testSets: Test measurements sets
testSetsDesc: Test how the design adapts across different measurements sets
testDesignOption: "Test {design} design options: {option}"
testDesignMeasurement: "Test {design} measurements: {measurement}"
testDesignSets: "Test {design} across measurements sets"

View file

@ -24,7 +24,24 @@ export const TestView = ({
const renderProps = pattern.getRenderProps()
const patternConfig = pattern.getConfig()
const title = t('testThing', { design, thing: t(settings.sample?.[settings.sample.type]) })
/*
* Translation of the title needs some work
*/
let title = t('workbench:testDesignOption', {
design,
option: t(`${design}:${settings.sample.option}.t`),
})
if (settings.sample.type === 'measurement')
title = t('workbench:testDesignMeasurement', {
design,
measurement: t(`measurements:${settings.sample.measurement}`),
})
else if (settings.sample.type === 'sets')
title = t('workbench:testDesignSets', {
design,
thing: 'fixme views/test/index.mjs',
})
return (
<PatternWithMenu
{...{
@ -33,7 +50,7 @@ export const TestView = ({
update,
control: account.control,
setSettings,
title: <h2 className="px-2 capitalize">{title}</h2>,
title: <h2>{title}</h2>,
pattern: <PanZoomPattern {...{ renderProps }} />,
menu: (
<TestMenu

View file

@ -69,7 +69,7 @@ export const TestMenu = ({
if (value) update.settings(['sample'], { type: 'option', option: value })
else update.settings(['sample'])
}}
current={settings.sample.option}
current={settings?.sample?.option}
/>,
],
[
@ -90,7 +90,7 @@ export const TestMenu = ({
if (value) update.settings(['sample'], { type: 'measurement', measurement: value })
else update.settings(['sample'])
}}
current={settings.sample.measurement}
current={settings?.sample?.measurement}
/>,
],
[