Answer the question
In order to leave comments, you need to log in
Where to store language variables in backend/frontend split projects?
Hey! Tell me, is it worth returning error texts from the server during validation, or is it better to write them directly in js, or like some kind of language file?
Answer the question
In order to leave comments, you need to log in
On the backend is preferable. In the general case, a site can have several languages, but what if there are 20, 40, 50 (languages)? Are you going to store the entire translation table at the front? The backend determines the language locale of the client (front) and then returns, according to the locale, a message in the appropriate language. Even if one language is used, then it makes no sense to store all error messages, for example, on the front, since it is not a fact that this message will be displayed at all, but in the end all messages will be loaded onto the page, which will increase the page size. I hope I explained clearly :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question