1
0
Fork 0

fix: Allow suppresion of translation in list options

Fixes #2604

It's not so easy to handle this frontend side, so I feel it's better to
be explicit and add a `doNotTranslate` attribute to the option.

Added the frontend code to take that into account, as well as a note in
the docs.
This commit is contained in:
Joost De Cock 2022-08-19 09:49:46 +02:00
parent 90483b155f
commit f0761cecf9
4 changed files with 56 additions and 5 deletions

View file

@ -3,8 +3,8 @@ import ClearIcon from 'shared/components/icons/clear.js'
import { useTranslation } from 'next-i18next'
const DesignOptionList = props => {
const { t } = useTranslation(['app'])
const { dflt, list } = props.design.config.options[props.option]
const { t } = useTranslation([`o_${props.design.config.name}`])
const { dflt, list, doNotTranslate=false } = props.design.config.options[props.option]
const val = (typeof props.gist?.options?.[props.option] === 'undefined')
? dflt
: props.gist.options[props.option]
@ -46,7 +46,10 @@ const DesignOptionList = props => {
`}>
<>&deg;</>
</span>
{props.ot(`${props.option}.o.${choice}`)}
{doNotTranslate
? choice
: props.ot(`o_${props.design.config.name}:${props.option}.o.${choice}`)
}
</button>
))}
</div>