- 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Toggling the Language on a Form From English to Spanish
- Updated on 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.13.0 |
Root Folder | Example Lab - Toggling Form Language |
Modules | None |
Dependencies | None |
This Example Lab Project demonstrates how to dynamically change the language in a Form from English to Spanish.
Explanation
This Example Project uses the label Form components with the "Text from Data Name" checkbox selected in the properties panel. This allows the data that's passed to the label to be created using Data Flows and changed without the need for another label to be displayed.
When the Form is first run the labels are populated in English by running the "Populate Labels in English" Flow. This Flow is very simple, the only edits that were done to the Flow are the start step was connected to the end step and the outputs were all set to the constant type. Here the user can enter the original Engish text that is desired to be displayed in the Form. Once the "En Espanol?" box is checked the second Data Flow named "Update Label Language" is run. This Flow has a Rule which executes as true if the button is checked when the Flow was initiated. The true path of the rule uses a Create Data step to create a new output for each label with the Spanish translation.
If the rule returns false another Create Data step is used to output the original English text values again. The Rule in this Flow is necessary because without it the user would be unable to toggle back to English once they toggled to Spanish for the first time. This is because the "Update Label Language" Flow is run every time the checkbox value is changed, therefore without the rule to verify the status of the checkbox the labels would simply be populated with the same Spanish text each time the Flow ran.