Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/zbraniecki/i28n
- Owner: zbraniecki
- License: apache-2.0
- Created: 2015-10-03T22:30:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-05T19:00:31.000Z (about 9 years ago)
- Last Synced: 2024-11-25T09:15:01.265Z (2 months ago)
- Language: JavaScript
- Size: 50.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.