I'm currently working on a Turborepo project (monorepo architecture) and I have managed t share my locales files to both back-end and front-end parts. This means I share the exact same keys across those 2.
When coming to internationalization, I've asked myself few questions and came to these conclusions:
Server sending back translation keys is great since my applications share them, but adding a new key / modifying it is quite a labor for what it is (or am I overkilling it?)
Server sending back full translated messages is also great because it makes the client-side kind of a dumb renderer. Thing is, the server should keep in mind the user's language. What if there is no language ? (e.g. Wrong Credentials error -> the user is not connected, therefore I have no source of truth regarding its language)
Client-side translation based on HttpCodes sent back by the server and associate a translation on the go, ~meh~.
What is considered "the best practice"?
-
I'm confused by your last two bullet points. What do you mean by "Wrong Credentials"Greg Burghardt– Greg Burghardt06/22/2023 17:37:45Commented Jun 22, 2023 at 17:37
-
Please clarify what you mean by "Client-side translation of HttpCodes". How does the HTTP protocol matter to text that is visible to an end user?Greg Burghardt– Greg Burghardt06/22/2023 17:38:32Commented Jun 22, 2023 at 17:38