0

I have templates that are compiled on production builds using socketstream and Hogan.js. The problem is that when I am on the client side and fetch the template, I need to bind it to a JSON language file with a set of key value pairs. The files have the naming structure such as de.json and have contents such as: { "thanks": "danke" }

If on the server I know what language the user has selected, how do I deliver the correct language json file to the the client in order to render the correct view for the user?

Abadaba
  • 1,456
  • 7
  • 20
  • 30
  • does your clientside i18n library not load the resource file like in http://i18next.com (node.js and clientside)? – jamuhl Oct 22 '12 at 11:23

1 Answers1

0

Don't you have the language in a session's variable? It'd allow you to easily know what to render.

res.render( user.language + '.json' );
Florian Margaine
  • 58,730
  • 15
  • 91
  • 116