Should translation happen on server side or client side

I’m building a web app using AngularJS for the frontend and a Java REST API for the backend. I already have error message translation working on the server side. Now I’m not sure where to handle the translation of actual data returned from my API. For example, when a French user requests product information, should my backend return the data already translated to French, or should I send the raw data and let the frontend handle the translation? What’s the best practice for handling multilingual content in this kind of setup?

Interesting dilemma! What kind of product data are you working with? Are these descriptions that change often or static catalog info? How does your caching strategy factor into this? Does translation complexity vary much between your different data types?

It really depends on your data setup and what performance you’re after. I’ve used both approaches in production, and server-side translation usually wins for database content. When your multilingual data lives in the database, translating server-side means you don’t have to send multiple language versions to the client - cuts down payload size and network load. Plus it keeps all your translation logic in one place, which makes maintaining different client apps way easier. Client-side translation works great for static stuff like UI labels and system messages though, especially with libraries like Angular Translate. I’d go hybrid: handle dynamic database content server-side, manage static interface elements client-side. You get better performance and maintainability without making your architecture messy.

client-side is def the way to go for most apps. users love instant language switching, right? browsers cache stuff, so no wait time on server calls. think about it: if everyone hit your server for translations, that’d be a huge load. plus, you can lazy-load translations if ur app needs it!