If you are creating a multilingual app then it's better to send it from backend. (My prefer this option)
Otherwse you have to use some package for that for example
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When i make a request from the front end to the back end ( post, get etc) with axios for example
I can use then and catch to handle either a successful or a failed request and flash a message in the front end to give feedback to the user.
For example.
axios.get('/apples')
.then((response) => flash("You got the apples"))
.catch((error) => flash("You didn't get the apples"));
Or i can write the messages in the back end and then use them to flash the messages in the front end.
For example
axios.get('/apples')
.then((response) => flash(response.message)
.catch((error) => flash(error.message));
My question is whether there is a reason to prefer either one, or it does not matter ?
Please or to participate in this conversation.