Description
Description:
If you create a custom control that references strings via mi18n that are set in a custom .lang file.
All works fine in the builder and strings are set correctly, however if you then render the form the strings that are set show as undefined.
If you then render a second time strings will set correctly.
Below test custom control in builder
Then when rendered
When rendered a second time show as normal.
It will also work as expected if you render the form first before adding the custom control then adding the control and rendering.
Example of the ref in code to one of the strings.
And the i18n options passed to render in the main index (for this test)
In debugging it seemed that the html is displayed before the applyLanguage function has finished.
Environment Details:
- formBuilder Version: 3.19.7
- Browser: Chrome
- OS: Windows
Expected Behavior
Strings should be applied from the custom lang file on first render.
Actual Behavior
Strings do not get applied from the custom .land file until second render.
Steps to Reproduce
Create a custom .lang file and add the details to the i18n location.
Create a custom control and add refs to any custom strings in your custom lang file using controlClass.mi18n("yourCustomStringKey").
Start Form builder and add your control to your form (All strings added as expected)
Render the form (Custom strings used show as undefined)
Render again (Strings now show as expected)
You can also.
In form builder have either blank or any other controls (NOT your custom) added.
Render
Go back to builder and add your custom control
Strings in your control show as expected as its a second render.