derby-lang-fs

Filesystem translation loader for Derby Lang.

Derby Lang FS

Load a Derby Lang dictionary from the file system.

$ npm install derby-lang-fs --save

Add the middleware to your server file:

var langFs = require('derby-lang-fs');

expressApp
  // ...
  // ...
  .use(lang())
  .use(langFs({
    dir: '/path/to/dir'
  }))

dir — The directory containing the language files.
path — The path to set the dictionary. Defaults to $lang.dict.

Folder structure:

locale/
+-- en/
  +-- app/
    +-- index.json
+-- es/
  +-- app/
    +-- index.json

Model output:

{
  "$lang": {
    "dict": {
      "en": {
        "app": { /* index.json */ }
      },
      "es": {
        "app": { /* index.json */ }
      },
    }
  }
}