Update jquery.ajaxchimp.js to add support for error messages containing custom information
I have rewritten the "translate and display message part" so that responses don't have to be an EXACT copy of Mailchimp's error message. Some error messages contain custom information (username, email, list name etc.) and would not be translated without this fix.
Good Point @dobiatowski
On a related note: It seems like Mailchimp's API response now includes translated error messages itself so this function may not be necessary any longer. Tested with German, can someone confirm this for other languages?
I confirm - messages are translated but only successful ones. Error messages I get still in English.
@rik84 can you paste your request URL ? Maybe I am missing something.
@alias-mac Non error messages are translated by MailChimp. You can set specific language for every list in MailChimp admin. Only errors messages which starts from "0 - " are generic.
This is what MailChimp should fix on their side - but this is a wish only :D
Translations mapping based on content of messages is not very reliable so in my case I do email validation on my side and only check if response has "0 - " error.
I have a fix for this using regex matches in the dev-2.0 branch, but it comes with some other changes too, so you would might have to change your code a bit. Let me know if you try it out.
@aufmkolk Your changes work like a charm! Now the translation works great, but you need to add "6: 'The username portion of the email address is empty'," this to the response list and translation in case when the user types only a single @ as email-address!