javascript
javascript copied to clipboard
Configuration Wizard: MailChimp error messages are not translated
Splitting this out from https://github.com/Yoast/yoast-components/issues/843
The Mailchimp email input field uses some validation via the Mailchimp API: the error messages returned are not translated:
Suggested on https://github.com/Yoast/yoast-components/issues/843:
We should see whether we can (automatically and hidden) specify a form language based on the user language in the MailChimp form, as I think MailChimp does have translated error messages available.
Mailchimp docs: https://mailchimp.com/help/translate-signup-forms-and-emails/
Implementing it might be as simple as setting the language header on the request to mailchimp. It might be more complex 😄
Not sure. Those docs seem related to the embedded form. Instead, we're using our own input field. Also, as of #5511 / #5512 we're using jsonp for the response and as far as I know, it's not possible to add headers to a jsonp request.
Even changing method, I'm not sure the Mailchimp response actually reacts to an Accept-Language header, couldn't find anything related in their documentation.
Lastly, I'm not sure sendRequest from ajaxHelper.js correctly sets the ajax request headers.
Seems more complicated than expected, thinking it would need some expert eyes.