hapi18n

I18n plugin for hapi

npm install hapi18n
3 downloads in the last week
38 downloads in the last month

hapi18n

I18n plugin for hapi

Getting Started

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.

Required permissions

hapi18n does not require permissions to be granted on the server.

What you get

In your route handlers :

handler: function () {
  this.reply(
    this.i18n.__("My localized string")
  );
}

In your templates :

  <%= i18n.__("My localized string") %>

Available options

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'
    }
}
npm loves you