Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p-baleine/tiny-i18n
small i18n implementation similar to Thomas Fuchs's gist(1364216)
https://github.com/p-baleine/tiny-i18n
Last synced: 21 days ago
JSON representation
small i18n implementation similar to Thomas Fuchs's gist(1364216)
- Host: GitHub
- URL: https://github.com/p-baleine/tiny-i18n
- Owner: p-baleine
- Created: 2012-11-10T00:09:52.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-15T04:23:38.000Z (almost 12 years ago)
- Last Synced: 2024-04-15T19:02:03.278Z (7 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# tiny-i18n
Small i18n implementation similar to Thomas Fuchs's [gist: 1364216](https://gist.github.com/1364216)
## Installation
```
$ component install p-baleine/tiny-i18n
```## API
### i18n(locale)
Return a function which translates based on `locale`
```js
var i18n = require('tiny-i18n');i18n.de = { // set to language, e.g. "i18n.en" or "i18n['en-US']"
'hello': 'Hello',
'X messages': '{{count}} Nachrichten'
};t = i18n('de');
t('hello'); //=> 'Hello'
t('X messages', { count: 5 }); //=> '5 Nachrichten'
```### .l(id)
Return a specific translation string or object.
## License
MIT