Problem/Motivation
This is a mix of a question (regarding best practices) and/or a feature request, depending on the outcome of the first.
What is the recommended, language-agnostic way of defining conditionals?
Steps to reproduce
I started off with a German default language and created a Webform.
Added a question with a yes/no type.
Added another one that conditionally shows when the first one is "Ja" (German for "yes").
Works as it should.
I then added English as a secondary language.
Translated the Webform.
The condition now doesn't work, as the comparison seems to be string based, and is equal to "Ja" is not true anymore.
Proposed resolution
There are a few workarounds for this, but none seems proper:
- Match by regex with "Ja|Yes"
- Match by checking "Ja" OR "Yes" as a second condition
- Do not use the provided yes/no question type but create your own. This lets you define actual raw values that can be matched independently of the actual (translated) string and seems to scale best. This is the way I fixed it.
I still feel the builtin yes/no type (and probably others as well) should continue to work after translating a form by encoding raw values that don't change. Those can be used in conditionals and will do so, no matter how many translations are added.
If this ticket does not lead to anything else but a documentation of how this can be solved, then that's still useful. Took me some time to understand why the form stopped working as expected and how it could be solved. I did not find anything on the Internet regarding this problem. The above solutions will hopefully help others in the same shoes.