internationalized fieldError messages
internationalized fieldError messages
Hi,
right now, if the backend finds some data received from the frontend to be invalid, it responds by populating the fieldErrors array in the server's JSON response.
Now as we want to keep the backend free from verbose, internationalized messages, our backend does not return a verbose error message for the end user but instead a message key to an i18n message in an properties file, evaluated later by jquery-i18nproperties.
Is there a possibility to hook between the receiption of the fieldError and the actual output, so that the message key can be translated into its verbose form?
Thanks in advance!
This question has an accepted answers - jump to answer
Answers
well, to answer my own question, there is a postSubmit hook that allows modifying the JSON returned from the server before it it processed by the editor itself and that's exactly the place where I can turn the message keys into their translated representations.
Hi,
Apologies for missing your question a couple of days ago. You are absolutely correct - what you can do is use the
postSubmit
event to perform the translation. You could have the backend return a token for the error messages if you wanted to have that looked up, regardless of the language.Allan