wip(lab): Migrated translation to next-i18next
This commit is contained in:
parent
538f22a1e6
commit
bbb2b2c23f
25 changed files with 72 additions and 71 deletions
|
@ -14,7 +14,7 @@ const values = {
|
|||
return (
|
||||
<span className={
|
||||
val=== props.pattern.config.options[props.option].pct/100
|
||||
? 'text-secondary'
|
||||
? 'text-secondary-focus'
|
||||
: 'text-accent'
|
||||
}>
|
||||
{formatPercentage(val)}
|
||||
|
@ -26,17 +26,18 @@ const values = {
|
|||
)
|
||||
},
|
||||
bool: props => {
|
||||
const { t } = useTranslation(['app'])
|
||||
const dflt = props.pattern.config.options[props.option].bool
|
||||
const current = props.gist?.options?.[props.option]
|
||||
return (
|
||||
<span className={
|
||||
(dflt==current || typeof current === 'undefined')
|
||||
? 'text-secondary'
|
||||
? 'text-secondary-focus'
|
||||
: 'text-accent'
|
||||
}>
|
||||
{props.gist?.options?.[props.option]
|
||||
? props.t('app.yes')
|
||||
: props.t('app.no')
|
||||
? t('yes')
|
||||
: t('no')
|
||||
}
|
||||
</span>
|
||||
)
|
||||
|
@ -45,22 +46,22 @@ const values = {
|
|||
const dflt = props.pattern.config.options[props.option].count
|
||||
const current = props.gist?.options?.[props.option]
|
||||
return (dflt==current || typeof current === 'undefined')
|
||||
? <span className="text-secondary">{dflt}</span>
|
||||
? <span className="text-secondary-focus">{dflt}</span>
|
||||
: <span className="text-accent">{current}</span>
|
||||
},
|
||||
list: props => {
|
||||
const dflt = props.pattern.config.options[props.option].dflt
|
||||
const current = props.gist?.options?.[props.option]
|
||||
const prefix = `options.${props.pattern.config.name}.${props.option}.options.`
|
||||
const prefix = `${props.option}.o.`
|
||||
return (dflt==current || typeof current === 'undefined')
|
||||
? <span className="text-secondary">{props.t(prefix+dflt)}</span>
|
||||
? <span className="text-secondary-focus">{props.t(prefix+dflt)}</span>
|
||||
: <span className="text-accent">{props.t(prefix+current)}</span>
|
||||
},
|
||||
deg: props => {
|
||||
const dflt = props.pattern.config.options[props.option].deg
|
||||
const current = props.gist?.options?.[props.option]
|
||||
return (dflt==current || typeof current === 'undefined')
|
||||
? <span className="text-secondary">{dflt}°</span>
|
||||
? <span className="text-secondary-focus">{dflt}°</span>
|
||||
: <span className="text-accent">{current}°</span>
|
||||
},
|
||||
mm: props => {
|
||||
|
@ -84,7 +85,7 @@ const inputs = {
|
|||
|
||||
|
||||
const Option = props => {
|
||||
const { t } = useTranslation(['app'])
|
||||
const { t } = useTranslation([`o_${props.pattern.config.name}`])
|
||||
const type = optionType(props.pattern.config.options[props.option])
|
||||
const Input = inputs[type]
|
||||
const Value = values[type]
|
||||
|
@ -103,9 +104,7 @@ const Option = props => {
|
|||
<SumButton onClick={toggleBoolean}>
|
||||
<SumDiv>
|
||||
<Deg />
|
||||
<span>
|
||||
{ t(`options.${props.pattern.config.name}.${props.option}.title`) }
|
||||
</span>
|
||||
<span>{t(`${props.option}.t`) }</span>
|
||||
</SumDiv>
|
||||
<Value type={type} {...props} t={t} />
|
||||
</SumButton>
|
||||
|
@ -116,14 +115,12 @@ const Option = props => {
|
|||
<Summary>
|
||||
<SumDiv>
|
||||
<Deg />
|
||||
<span>
|
||||
{ t(`options.${props.pattern.config.name}.${props.option}.title`) }
|
||||
</span>
|
||||
<span>{t(`${props.option}.t`)}</span>
|
||||
</SumDiv>
|
||||
<Value type={type} {...props} t={t} />
|
||||
<Chevron w={6} m={3}/>
|
||||
</Summary>
|
||||
<Input {...props} />
|
||||
<Input {...props} ot={t} />
|
||||
</Details>
|
||||
</Li>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue