Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zbraniecki/i28n

I18n counterpart to mozL10n
https://github.com/zbraniecki/i28n

Last synced: 4 days ago
JSON representation

I18n counterpart to mozL10n

Awesome Lists containing this project

README

        

I28n: Internationalization 2.0
=================================================================

I28n combines the Intl API with Gaia's IntlHelper and L20n's declarative API.

In result it makes HTML internationalizable with minimum JS code required.

How to use i28n
---------------

Include the following code in the `` section of your HTML:

```html

```

In HTML
-------

```html


```

In JS
-----

```javascript

function logDateTime() {
const formatter = document.mozI18n.get('datetime', {
hour: 'numeric',
minute: 'numeric'
});
console.log(formatter.format(Date.now());
}

document.mozI18n.observe('datetime', logDateTime);

```

Development
-----------

```shell
> npm install --dev

> gulp lint # uses es-lint

> gulp build # builds ./dist/i28n.js

> gulp watch # builds and rebuilds on change in ./src

> gulp test # in-browser tests using Firefox nightly
```

In order to test you need to have `FIREFOX_BIN` pointing at Nightly Firefox
executable since i28n uses es6 features available only there.