We encountered this same issue - the reason was that when Sitecore creates the AJAX URL for submitting the form data, it does not include a language parameter. So when the form submission is being processed, the context language of the request is not necessarily the language of the page being viewed.
We fixed this by altering the form.renderForm
pipeline to override the InitializeAjaxOptions
step to add this parameter. As it's a standard context parameter, it gets picked up by the request and changes the context accordingly.
public class LanguageAwareInitializeAjaxOptions : InitializeAjaxOptions
{
private const string languageKey = "sc_lang";
public LanguageAwareInitializeAjaxOptions(IFormRenderingContext formRenderingContext)
: base(formRenderingContext)
{
}
public override void Process(RenderFormEventArgs args)
{
if (!args.IsPost && !args.QueryString.ContainsKey(languageKey))
{
args.QueryString.Add(languageKey, Sitecore.Context.Language.Name);
}
base.Process(args);
}
}
You then just need to patch this replacement pipeline in:
<forms.renderForm>
<processor patch:instead="*[@type='Sitecore.ExperienceForms.Mvc.Pipelines.RenderForm.InitializeAjaxOptions, Sitecore.ExperienceForms.Mvc']"
type="Your.Solution.Pipelines.RenderForm.LanguageAwareInitializeAjaxOptions, Your.Solution" resolve="true"/>
</forms.renderForm>
Thank you
page have a version in Chinese language? Do you maybe haveItem Fallback
configured for theThank you
page? Is Language Embedding always required for the site where you put the form?Thank you
page in Chinese language. It requires language embedding as well. I'm using SXA version 1.6 and use Virtual Folder "/zh" for Chinese (e.g zh-HK).