i18n in WebApps

i18n bundles are stored in the /i18n directory using a JSON format. The name of the file decides the language. A WebApp inherits locale from the containing page.

// en.json
   "showMore": "Show more",
   "name": "Name"
// sv.json
   "showMore": "Visa mer",
   "name": "Namn"

Use the i18n function in a template to retrieve the localized value.

i18n(key [, varSubstitution...]) 

<h2><%- i18n('name') %></h2>

The i18n object is also available in script contexts via the require function.

   i18n = require('i18n'),
localizedName = i18n.get('name');