I18n plugin for hapi
Install hapi18n by either running npm install hapi18n
in your sites working directory or add 'hapi18n' to the dependencies section of the 'package.json' file and run npm install.
hapi18n does not require permissions to be granted on the server.
In your route handlers :
handler: function () {
this.reply(
this.i18n.__("My localized string")
);
}
In your templates :
<%= i18n.__("My localized string") %>
hapi18n: {
// Available locales
locales: ['en', 'fr', 'es', 'de'],
// The path to the directory of your locale files
directory: './locales',
// Locale files extension
extension: '.json',
// Add missing locale keys to your files when true
devMode: false,
// Wether to check the locale from the subdomain
// ex : http://es.domain.com
subdomain: true,
// Wether to check the locale from this cookie name
cookie: 'lang',
// Domain configuration object
domain: false, // OR
domain: {
'tree.com': 'en',
'trees.es': 'es',
'tree.fr': 'fr'
}
}