Problem/Motivation
The select element type's #options field does not play well with translations when they contain optgroups and subsequently silently fails to translate some of the options.
Steps to reproduce
Using the following YAML for the webform source :
optgroup_select:
'#type': select
'#title': 'Example select with optgroup'
'#options':
Fruits:
- Banana
- Strawberry
- Mango
Vegetables:
3: Turnip
4: Eggplant
5: Carrot
And translating it to this (in french in my case), either on the translation UI or in a config directory:
Fruits:
- Banane
- Fraise
- Mangue
LΓ©gumes:
3: Navet
4: Aubergine
5: Carotte
Results in the (master) english version:
And the following french version:
Note that the fruits are successfully translated, but not the vegetables.
I think it may be linked to how fruits is an array while vegetables is an object, because changing the fruits IDs to a text value or other numbers makes them untranslated as well.
Additionally, the translation UI shows the same thing as the above screenshot while the config files contain the correct data.
I have attached the configuration files below.
Proposed resolution
We should be able to edit the select's #options fields reliably, even if it contain optgroups.