mashpie / i18n-node-book

WIP: Getting started with i18n. Cookbook, Exampes, Best Practice and Reference

Home Page:https://mashpie.gitbooks.io/i18n-node/content/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

i18n in node.js

Howto get started with the i18n module in an node.js cli, application or website.

Install

npm install i18n --save

Load

var express = require('express'),
    i18n = require("i18n");

Configure

i18n.configure({
    locales:['en', 'de'],
    directory: __dirname + '/locales'
});

Use

app.use(i18n.init());

app.get('/de', function(req, res){
  var greeting = res.__('Hello');
});

Translate

{
    "Hello": "Hallo"
}

go ahead to learn about the details.

About

WIP: Getting started with i18n. Cookbook, Exampes, Best Practice and Reference

https://mashpie.gitbooks.io/i18n-node/content/