node.js backend layer for i18next using fs module to load resources from filesystem
Switch branches/tags
greenkeeper-babel-6.3.26 greenkeeper-babel-6.5.0 greenkeeper-babel-6.5.1 greenkeeper-babel-6.5.2 greenkeeper-babel-core-6.7.4 greenkeeper-babel-core-6.7.5 greenkeeper-babel-core-6.7.6 greenkeeper-babel-core-6.7.7 greenkeeper-babel-core-6.8.0 greenkeeper-babel-core-6.9.0 greenkeeper-babel-core-6.9.1 greenkeeper-babel-core-6.10.4 greenkeeper-babel-core-6.11.4 greenkeeper-babel-core-6.13.0 greenkeeper-babel-core-6.13.1 greenkeeper-babel-core-6.13.2 greenkeeper-babel-core-6.14.0 greenkeeper-babel-core-6.16.0 greenkeeper-babel-core-6.17.0 greenkeeper-babel-core-6.18.0 greenkeeper-babel-core-6.18.1 greenkeeper-babel-core-6.18.2 greenkeeper-babel-eslint-4.1.7 greenkeeper-babel-eslint-4.1.8 greenkeeper-babel-eslint-5.0.0 greenkeeper-babel-eslint-5.0.1 greenkeeper-babel-eslint-6.0.0 greenkeeper-babel-eslint-6.0.1 greenkeeper-babel-eslint-6.0.2 greenkeeper-babel-eslint-6.0.3 greenkeeper-babel-eslint-6.0.4 greenkeeper-babel-eslint-6.1.0 greenkeeper-babel-eslint-6.1.1 greenkeeper-babel-eslint-6.1.2 greenkeeper-babel-eslint-7.0.0 greenkeeper-babel-eslint-7.1.0 greenkeeper-coveralls-2.11.7 greenkeeper-coveralls-2.11.8 greenkeeper-coveralls-2.11.9 greenkeeper-coveralls-2.11.10 greenkeeper-coveralls-2.11.11 greenkeeper-coveralls-2.11.12 greenkeeper-coveralls-2.11.13 greenkeeper-coveralls-2.11.14 greenkeeper-eslint-2.5.0 greenkeeper-eslint-2.5.1 greenkeeper-eslint-2.5.2 greenkeeper-eslint-2.5.3 greenkeeper-eslint-2.6.0 greenkeeper-eslint-2.7.0 greenkeeper-eslint-2.8.0 greenkeeper-eslint-2.9.0 greenkeeper-eslint-2.10.0 greenkeeper-eslint-2.10.1 greenkeeper-eslint-2.10.2 greenkeeper-eslint-2.11.0 greenkeeper-eslint-2.11.1 greenkeeper-eslint-2.12.0 greenkeeper-eslint-2.13.0 greenkeeper-eslint-2.13.1 greenkeeper-eslint-3.0.0 greenkeeper-eslint-3.0.1 greenkeeper-eslint-3.1.0 greenkeeper-eslint-3.1.1 greenkeeper-eslint-3.2.0 greenkeeper-eslint-3.2.1 greenkeeper-eslint-3.2.2 greenkeeper-eslint-3.3.0 greenkeeper-eslint-3.3.1 greenkeeper-eslint-3.4.0 greenkeeper-eslint-3.5.0 greenkeeper-eslint-3.6.0 greenkeeper-eslint-3.6.1 greenkeeper-eslint-3.7.0 greenkeeper-eslint-3.7.1 greenkeeper-eslint-3.8.0 greenkeeper-eslint-3.9.0 greenkeeper-eslint-3.9.1 greenkeeper-gulp-3.9.1 greenkeeper-gulp-babel-6.1.2 greenkeeper-gulp-bump-2.1.0 greenkeeper-gulp-bump-2.2.0 greenkeeper-gulp-bump-2.4.0 greenkeeper-gulp-bump-2.5.0 greenkeeper-gulp-eslint-2.0.0 greenkeeper-gulp-eslint-2.1.0 greenkeeper-gulp-eslint-3.0.0 greenkeeper-gulp-eslint-3.0.1 greenkeeper-gulp-git-1.7.0 greenkeeper-gulp-git-1.7.1 greenkeeper-gulp-git-1.7.2 greenkeeper-gulp-git-1.8.0 greenkeeper-gulp-git-1.9.0 greenkeeper-gulp-git-1.10.0 greenkeeper-gulp-git-1.11.0 greenkeeper-gulp-git-1.11.1 greenkeeper-gulp-git-1.11.2 greenkeeper-gulp-git-1.11.3 greenkeeper-gulp-git-1.12.0 greenkeeper-gulp-if-2.0.1 greenkeeper-gulp-prompt-0.2.0 greenkeeper-gulp-shell-0.5.2 greenkeeper-i18next-2.4.0 greenkeeper-i18next-2.4.1 greenkeeper-i18next-2.5.0 greenkeeper-i18next-2.5.1 greenkeeper-i18next-3.0.0 greenkeeper-i18next-3.1.0 greenkeeper-i18next-3.2.0 greenkeeper-i18next-3.3.0 greenkeeper-i18next-3.3.1 greenkeeper-i18next-3.4.0 greenkeeper-i18next-3.4.1 greenkeeper-i18next-3.4.2 greenkeeper-i18next-3.4.3 greenkeeper-i18next-3.4.4 greenkeeper-istanbul-0.4.2 greenkeeper-istanbul-0.4.3 greenkeeper-istanbul-0.4.4 greenkeeper-istanbul-0.4.5 greenkeeper-js-yaml-3.5.5 greenkeeper-js-yaml-3.6.0 greenkeeper-js-yaml-3.6.1 greenkeeper-mocha-2.4.1 greenkeeper-mocha-2.4.2 greenkeeper-mocha-2.4.3 greenkeeper-mocha-2.4.4 greenkeeper-mocha-2.4.5 greenkeeper-mocha-2.5.0 greenkeeper-mocha-2.5.1 greenkeeper-mocha-2.5.2 greenkeeper-mocha-2.5.3 greenkeeper-mocha-3.0.0 greenkeeper-mocha-3.0.1 greenkeeper-mocha-3.0.2 greenkeeper-mocha-3.1.0 greenkeeper-mocha-3.1.1 greenkeeper-mocha-3.1.2 greenkeeper-mockery-1.5.1 greenkeeper-mockery-1.6.2 greenkeeper-mockery-1.7.0 greenkeeper-mockery-2.0.0 greenkeeper-sinon-1.17.3 greenkeeper-sinon-1.17.4 greenkeeper-sinon-1.17.5 greenkeeper-sinon-1.17.6 greenkeeper-update-all greenkeeper-watchify-3.7.0 greenkeeper-yargs-4.4.0 greenkeeper-yargs-4.6.0 greenkeeper-yargs-4.7.0 greenkeeper-yargs-4.7.1 greenkeeper-yargs-4.8.0 greenkeeper-yargs-4.8.1 greenkeeper-yargs-5.0.0 greenkeeper-yargs-6.0.0 greenkeeper-yargs-6.1.1 greenkeeper-yargs-6.2.0 greenkeeper-yargs-6.3.0 master
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib rebuild Dec 10, 2018
src fix [ReferenceError: language is not defined] Dec 10, 2018
test update build Apr 30, 2017
.babelrc transpile to ES5 Sep 6, 2018
.coveralls.yml add coveralls.yml Jan 6, 2016
.editorconfig initial version Nov 2, 2015
.eslintignore initial version Nov 2, 2015
.eslintrc initial version Nov 2, 2015
.gitignore adds support for keySeparator = false Jul 6, 2018
.npmignore initial version Nov 2, 2015
.travis.yml update travis target Aug 17, 2018
CHANGELOG.md rebuild Dec 10, 2018
LICENSE initial version Nov 2, 2015
README.md remove cson parser, adds option.parse for custom parsing Aug 17, 2018
index.js update build Apr 30, 2017
package.json rebuild Dec 10, 2018

README.md

Introduction

Travis Coveralls npm version David

This is a i18next backend to be used node.js. It will load resources from filesystem. Right now it supports following filetypes:

  • .json
  • .json5
  • .yml
  • .cson

Getting started

Source can be loaded via npm.

$ npm install i18next-node-fs-backend

Wiring up:

var i18next = require("i18next");
var Backend = require("i18next-node-fs-backend");

i18next.use(Backend).init(i18nextOptions);

As with all modules you can either pass the constructor function (class) to the i18next.use or a concrete instance.

Backend Options

{
  // path where resources get loaded from
  loadPath: '/locales/{{lng}}/{{ns}}.json',

  // path to post missing resources
  addPath: '/locales/{{lng}}/{{ns}}.missing.json',

  // jsonIndent to use when storing json files
  jsonIndent: 2,

  // custom parser
  parse: function(data) { return data; }
}

hint {{lng}}, {{ns}} use the same prefix, suffix you define in interpolation for translations!!!

Options can be passed in:

preferred - by setting options.backend in i18next.init:

var i18next = require("i18next");
var Backend = require("i18next-node-fs-backend");

i18next.use(Backend).init({
  backend: options
});

on construction:

var Backend = require("i18next-node-fs-backend");
var backend = new Backend(null, options);

by calling init:

var Backend = require("i18next-node-fs-backend");
var backend = new Backend();
backend.init(options);

Gold Sponsors