qwik-i18n icon indicating copy to clipboard operation
qwik-i18n copied to clipboard

using $localize in combination with state doesn't translate to selected language

Open riencoertjens opened this issue 1 year ago • 1 comments

we're having an issue where using state in some way together with $localize doesn't do the proper translation for example

<div>{$localize`translate {state.key}`}</div>

or

<div>{state.key
  ? $localize`translate one thing`
  : $localize`translate another thing`}</div>

doesn't translate to any other language than the default on initial render, when updating the sate (and the component with the key it does do the translation)

if we "force" a component rerender by updating the key it does do the translation. here's a repo with a reproduction

expected $localize string is translated to language selected in the urlParam

actual result $localize string is only translated after updating the state

riencoertjens avatar Jun 08 '23 09:06 riencoertjens