How to bind dropdown select options' labels based on language condition?

I haven’t found a way to translate my dropdown bound options even I have 2 separate properties in variable…

I may choose one or another but no option to do it conditionally based on selected language.

Is there any way to do this ( except duplicate dropdown and show the whole input element conditionally)?

I think one way to do it would be to modify the objects in the array that you pass to the Options property, so that the Label field and Value field see different things based on the conditions that you need.

Like, if the user selected language UK, pass the object {“name”: “<uk version>”, “role”: “user”}

If the user selected language “EN”, pass the object {“name”: “<en version>”, “role”: “user”}

The Label field only looks for the key “name”, so it doesn’t have to have any logic in it.

Edit: formatting cloaked parts of my text

1 Like

We have a feature in the pipeline to let you bind a formula instead of just a path.

In the meantime there is a non documented way to do it.
If your label is an object, with key being the lang, it will work

For example, if your data are with this shape {name: {en: 'English name', fr: 'French name'}, value: "something"}, and you set the label field to be name, the label display will be ‘English Name’ on the en version, and ‘French name’ on the french version