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.

i18next v1.7.4 AMD Version v1.7.4

browserify:

npm install i18next-client

node.js:

npm install i18next
   
if you like i18next - help promoting it:

Benefits

  1. support for variables
  2. support for nesting
  3. support for context
  4. support for multiple plural forms
  5. gettext support
  6. sprintf supported
  7. detect language
  8. graceful translation lookup
  9. jquery function
  10. get string or object tree
  11. get resourcefiles from server
  12. resource caching in browser
  13. post missing resources to server
  14. highly configurable
  15. custom post processing
  16. translation ui

  17. something missing?

Documentation

Extensions


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(t) {
 
// translate nav
  $
(".nav").i18n();

 
// programatical access
 
var appName = t("app.name");
});