i18n-o

9.0.2 • Public • Published

i18n-o

Update

This project is forked form i18n-node. we added an option localesData for load locales data directly from an object so you can just save your locales data in database or get it from remote api.

Lightweight simple translation module with dynamic json storage. Supports plain vanilla node.js apps and should work with any framework (like express, restify and probably more) that exposes an app.use() method passing in res and req objects. Uses common __('...') syntax in app and templates. Stores language files in json files compatible to webtranslateit json format. Adds new strings on-the-fly when first used in your app. No extra parsing needed.

Install

npm install i18n-o --save

Test

npm test

Load

// load modules
var express = require('express'),
    i18n = require("i18n-o");

Configure

var localesData = {
  en: {
    'key_1': 'value 1',
    'key_2': 'value 2'
  },
  zh: {
    'key_1': '值 1',
    'key_2': '值 2'
  }
}
i18n.configure({
    locales:['en', 'zh'],
    directory: false,
    localesData: localesData
});

More document go https://github.com/mashpie/i18n-node

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 9.0.2
    5
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 9.0.2
    5
  • 9.0.1
    0

Package Sidebar

Install

npm i i18n-o

Weekly Downloads

5

Version

9.0.2

License

MIT

Last publish

Collaborators

  • jailbreakc