What should the API return?

I have the backend now returns an error in Russian. But what if I want to do for example localization in Ukrainian. I don't like very much milf to verify the text of error in Russian and to push there a localization. Came to mind to send error codes. But I am afraid that in 30 IPA wysowa I get confused in the code. I am more than sure that this is solved everywhere.
July 9th 19 at 10:16
2 answers
July 9th 19 at 10:18
Solution
But I am afraid that in 30 IPA wysowa I get confused in the code.

Write documentation
I always write docks. And I don't want for each request to look into its Doc. - Brody_Dickins commented on July 9th 19 at 10:21
: well, usually even add to the code description of the error, especially for debugging. Ie, for example, status:-1, description: 'error ...'; - nicklaus.Will commented on July 9th 19 at 10:24
July 9th 19 at 10:20
Solution
Not yuzayte codes and keys.

return "db.error";
return "db.success";
return "user.created";


And the text extract from the object:

var messages = {
 EN: {
 db: {
 error: "Oops! DB burned.",
 // etc.
}
}
};

Find more questions by tags APIHTMLJavaScript