jsend icon indicating copy to clipboard operation
jsend copied to clipboard

How do you handle multilanguage apps?

Open bryan-gc opened this issue 2 years ago • 0 comments

For example, I have this fail response, but the frontend is a multilanguage app.

{
    "status" : "fail",
    "data" : { "username" : "Username already exists" }
}

Should I specify the language on a header and handle it on the backend? I thought that maybe could be a good idea to add a code in a nested object like this

{
    "status" : "fail",
    "data" : {
		"username" : {
			"message": "Username already exists",
			"code": "usernameExists"
    	}
	 }
}

And the frontend should have a dictionary with "userAlreadyExists" to manage multilanguage error messages.

bryan-gc avatar Feb 06 '22 04:02 bryan-gc