node package manager

generator-dizmo-i18n

Dizmo Internationalization

Allows the i18next internationalization library to be integrated into a dizmo.

Build

npm run install

The dist directory should contain a corresponding i18n-*.min.js build.

HTML Integration

Add a <script> tag to the index.html markup of your dizmo:

<script src="path/to/i18n-*.min.js"></script>

Where you should replace the star * with the corresponding version number.

Node Integration

Install package:

npm install --save generator-dizmo-i18n

Add a require statement to e.g. the index.js module of your dizmo:

var i18n = require('generator-dizmo-i18n');

Usage

Invoke i18n to initialize the translation framework, and then access the translations with the t function:

i18n(function (err, t) {
    console.log(t('greeting'));
});

Translations

Create a assets/locales/translation.en.json reference translation:

{
    "greeting": "Hello World!"
}

And optionally, create also a assets/locales/translation.de.json translation:

{
    "greeting": "Hallo Welt!"
}

Service: locize.io

Use locize.io to import, translate and export the translation.*.json translation files.