I’m building a web app using React for the frontend and a Node.js REST API for the backend. Right now I have my error messages translated on the server side but I’m not sure about regular content translation. For example, when a German user requests product information like a banana item, should my API send back the German translation of that product data? Or would it be better to just send the raw data and let the React app handle translating the banana product details on the client side? What are the pros and cons of each approach?
Interesting problem! What’s your target user base like? If you’re expecting heavy traffic from multiple regions, client-side would definitely reduce server load. Are you planning to cache the translations or fetch them fresh every time?
totally depends on ur app. if u got a lot of static stuff, client-side is easier and saves server load. but for dynamic stuff or SEO, server-side is the way to go. i often lean towards client-side since it’s simpler to keep all transalations in 1 place.
I’ve built similar apps and always handle product translations server-side. E-commerce content needs contextual translations - you can’t just swap words. A banana description might be totally different for different markets because of cultural preferences or local regulations. Plus, server-side keeps everything consistent if you expand to mobile or other platforms later. Yeah, it adds server complexity and maybe some latency, but users expect product data to load fast anyway, not sit there watching spinners. I do client-side translations for simple UI stuff like buttons, but core content stays server-side where I can control it better.