In my Express app, I want to return error descriptions in all supported languages of my frontend app.
Payload should be ideally something like:
{ errors: [messages: { de: “Passwort zu kurz”, en: “Password too short” }] }
As I don’t want to put the language dependent text directly in my route coding, I thought about using i18n-next. However, I don’t want to get one language back using the t(key) function but all of the languages of the respective language jsons for a specific key.
So ideally I would get something like:
{ errors: [message: functionINeed(“password_short”)] }
I would then have two language files for de and en from which the text is drawn from.
Does anyone know how to achieve this?