How do you make a full stack app multi language? Especially the backend/database etc

Viewed 656

I found a million answers for how to add multi language support to a website/frontend. I can not find anyone talking about how to make the backend or API support multi language.

Simple example from my current project:

  • Nextjs React server for the frontend
  • Nodejs Express server on the backend exposing a GraphQL API
  • MongoDB connected to the backend server

So I know how to translate the frontend UI (e.g. button texts, paragraphs, headers, etc.) using the built in support from Nextjs. But how do I translate the information comming from the backend?

As an example I'll take the error messages returned by the API from the backend. Do I use a system so that the API knows which language the frontend requested and translate the error message on the backend? Do I send all data from the backend in english and translate on the frontend? Do I scrap any string data coming from the backend and just use codes, which need to be parsed to the right language on the frontend? If I use only codes, how can I have multi lingual data in my database?

I need information on what the standards or best practices are in a situation like this, where you have a full stack application that needs to deliver data in multiple languages.

0 Answers
Related