diff --git a/packages/sitecore-jss-react-forms/src/components/form.test.tsx b/packages/sitecore-jss-react-forms/src/components/form.test.tsx index d963d33fff..2938c6a5e3 100644 --- a/packages/sitecore-jss-react-forms/src/components/form.test.tsx +++ b/packages/sitecore-jss-react-forms/src/components/form.test.tsx @@ -11,6 +11,7 @@ import FileUpload from './field-templates/file-upload'; describe('
', () => { const p = (): FormProps => ({ + language: 'da-DK', sitecoreApiHost: 'http://jssreactweb', sitecoreApiKey: '{9B8C268A-171D-4DAA-B131-54B64614BBE0}', form: { @@ -193,7 +194,7 @@ describe('', () => { ); expect(c.html()).to.equal( - '

Test

' + '

Test

' ); }); }); diff --git a/packages/sitecore-jss-react-forms/src/components/form.tsx b/packages/sitecore-jss-react-forms/src/components/form.tsx index 2a18b86dcf..41936c5bac 100644 --- a/packages/sitecore-jss-react-forms/src/components/form.tsx +++ b/packages/sitecore-jss-react-forms/src/components/form.tsx @@ -23,6 +23,7 @@ export interface ErrorComponentProps { export interface FormProps { form: SitecoreForm; + language?: string; className?: string; fieldFactory?: FieldFactory; sitecoreApiHost: string; @@ -96,7 +97,9 @@ export class Form extends Component return
Form data invalid. Forget to set the rendering contents resolver?
; } - const action = `${this.props.sitecoreApiHost}/api/jss/formbuilder?fxb.FormItemId=${form.metadata.itemId}&fxb.HtmlPrefix=${form.htmlPrefix}&sc_apikey=${this.props.sitecoreApiKey}&sc_itemid=${form.contextItemId}`; + const qsLanguage = this.props.language ? `&sc_lang=${this.props.language}` : ''; + + const action = `${this.props.sitecoreApiHost}/api/jss/formbuilder?fxb.FormItemId=${form.metadata.itemId}&fxb.HtmlPrefix=${form.htmlPrefix}&sc_apikey=${this.props.sitecoreApiKey}&sc_itemid=${form.contextItemId}${qsLanguage}`; this._tracker.setFormData( form.formItemId.value,