This is the old documentation used in v1.x.x: for the uptodate documentation please visit: i18next.com
And to unleash the full power of i18next please visit: locize.com (by the creators of i18next)
i18next - translation made easy
i18next is a full-featured i18n javascript library for translating your webapplication.
runs in browser, under node.js, rhino and other javascript runtimes.
if you like i18next - help promoting it:
Benefits
- support for variables
- support for nesting
- support for context
- support for multiple plural forms
- gettext support
- sprintf supported
- detect language
- graceful translation lookup
- jquery function
- get string or object tree
- get resourcefiles from server
- resource caching in browser
- post missing resources to server
- highly configurable
- custom post processing
- translation ui
something missing?
Documentation
Extensions
Extensions:
- NEW code parser: i18next code parser - A simple command line and gulp plugin that lets you parse your code and extract the translations keys in it. by Karel Ledru-Mathé
- Translation UI: i18next-webtranslate
- Simple i18next JSON-File Editor: i18next-editor by auxilium
- gettext: i18next-conv
- Ruby GEM guard: guard-i18next by Jared Scott
- Django Pipeline: django-pipeline-i18next by Jared Scott
- Angular directive: i18next angular ng-i18next by Andre Meyering
- Angular directive: i18next for Angular.js by Mike Frey
- Meteor Wrapper: i18next wrapper for meteor by Costas Kirgoussios
Usage Sample
page source:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="[PATH]/jquery.js" /> // optional
<script type="text/javascript" src="[PATH]/i18next.js" />
</head>
<body>
<ul class="nav">
<li><a href="#" data-i18n="nav.home"></a></li>
<li><a href="#" data-i18n="nav.page1"></a></li>
<li><a href="#" data-i18n="nav.page2"></a></li>
</ul>
</body>
</html>
loaded resource file (locales/en/translation.json):
{
"app": {
"name": "i18next"
},
"nav": {
"home": "Home",
"page1": "Page One",
"page2": "Page Two"
}
}
javascript code:
i18n.init(function(err, t) {
// translate nav
$(".nav").i18n();
// programatical access
var appName = t("app.name");
});