diff --git a/src/js/form-render.js b/src/js/form-render.js index 8331960eb..9c268e97c 100644 --- a/src/js/form-render.js +++ b/src/js/form-render.js @@ -64,13 +64,14 @@ class FormRender { this.options = jQuery.extend(true, defaults, options) this.instanceContainers = [] - //Override any sanitizer configuration - setSanitizerConfig(this.options.sanitizerOptions) - + this.mi18nLoading = null if (!mi18n.current) { - mi18n.init(this.options.i18n) + this.mi18nLoading = mi18n.init(this.options.i18n) } + //Override any sanitizer configuration + setSanitizerConfig(this.options.sanitizerOptions) + // parse any passed formData if (this.options.formData) { this.options.formData = this.parseFormData(this.options.formData) @@ -186,7 +187,7 @@ class FormRender { * @param {number} instanceIndex - instance index * @return {Object} rendered form */ - render(element = null, instanceIndex = 0) { + async render(element = null, instanceIndex = 0) { const formRender = this const opts = this.options element = this.getElement(element) @@ -197,6 +198,11 @@ class FormRender { } } + if (this.mi18nLoading) { + await this.mi18nLoading + this.mi18nLoading = null + } + // Begin the core plugin const rendered = []