i18n with polyglot.js and rendr.js

Polyglot.js  – is a tiny I18n helper js library, made to work both in the browser and in CommonJS environments (Node).
Rendr js –

Rendr is a isomprphic – small library that allows you to run your Backbone.js apps seamlessly on both the client and the server.

Isomorphic JavaScript apps are JavaScript applications that can run both client-side and server-side.
The backend and frontend share the same code.

Here is an best arrticle on internationalization a Node/Express web application by John.
http://ejohn.org/blog/a-strategy-for-i18n-and-node/

Issue – How to internationalizes Rendr js app?

After some research i found some git issues related to i18n rendr app. but those issues does not addresses all code base.

https://github.com/rendrjs/rendr/issues/473
https://github.com/rendrjs/rendr/issues/298

So decided to write full article on this.

Steps:

  1.  Store user selected language – for serving content
  2.  Creating locale files and serving
  3.  Server side rendering
  4.  Client side rendering
  5.  HBS helper for i18n strings

Here is a Gist added with source files.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s