1.2.0 • Published 9 years ago

mrp-i18n v1.2.0

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

i18n

Simple translation module for node.js

Install

npm install mrp-i18n

test

npm test

usage

Minimal example, just setup two locales and a project specific directory

  1. create the locales directory with two JSON files (bundle.en.json, bundle.fr.json).

  2. load and configure the module within your project

    var i18n = require('i18n').configure({
        locales:['en', 'fr'],
        directory: __dirname + '/locales' // path to  your locales directory
    });

API

The module exposes a single method getCatalog.

getCatalog

When a params of a valid local is given, the module will return the JSON object.

  i18n.getCatalog('en')

// {'Hello': 'Hello World'}

When no params is given, the module will return the full catalog

  i18n.getCatalog()

// { en: { 'Hello World': 'Hello World' },fr: { currency: '€', 'Hello World': 'Bonjour' } }

credit

Inspiration came from the i18n-node module: https://github.com/mashpie/i18n-node

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago