Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dizmo/yeoman-generator-dizmo-i18n
Dizmo internationalization
https://github.com/dizmo/yeoman-generator-dizmo-i18n
Last synced: about 15 hours ago
JSON representation
Dizmo internationalization
- Host: GitHub
- URL: https://github.com/dizmo/yeoman-generator-dizmo-i18n
- Owner: dizmo
- License: isc
- Created: 2016-07-04T18:45:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-12T07:57:46.000Z (almost 8 years ago)
- Last Synced: 2024-09-18T14:11:04.169Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/generator-dizmo-i18n
- Size: 104 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dizmo Internationalization
Allows the [i18next](http://i18next.com/) internationalization library to be integrated into a dizmo.
## Build
```bash
npm run install
```The `dist` directory should contain a corresponding `i18n-*.min.js` build.
## HTML Integration
Add a `` tag to the `index.html` markup of your dizmo:
```html
<script src="path/to/i18n-*.min.js">
```Where you should replace the star `*` with the corresponding version number.
## Node Integration
Install package:
```bash
npm install --save generator-dizmo-i18n
```Add a `require` statement to e.g. the `index.js` module of your dizmo:
```js
var i18n = require('generator-dizmo-i18n');
```## Usage
Invoke `i18n` to initialize the translation framework, and then access the translations with the `t` function:
```js
i18n(function (err, t) {
console.log(t('greeting'));
});
```## Translations
Create a `assets/locales/translation.en.json` reference translation:
```json
{
"greeting": "Hello World!"
}
```And optionally, create also a `assets/locales/translation.de.json` translation:
```json
{
"greeting": "Hallo Welt!"
}
```## Service: locize.io
Use [locize.io](http://www.locize.io) to import, translate and export the `translation.*.json` translation files.