0.0.2 • Published 10 years ago

mojo-i18n v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

Features

  • ability to dynamically reload i18n strings without reloading the application

Example

var Application = require("mojo-application"),
views = require("mojo-views"),
paperclip = require("mojo-paperclip"),
i18n = require("mojo-i18n");

var app = new Application();
app.use(views, paperclip, i18n);

var view = new views.Base({
  message: "hello",
  paper: "{{ message | t | titlecase }}!"
});

// dynamically set the i18n translations
app.set("i18n.translations", {
  "en-us": {
    hello: "hello"
  },
  "es-ES": {    
    hello : "hola"
  }
});

app.set("i18n.locale", "en-ES");

console.log(view.render()); // Hola!

app.set("i18n.locale", "en-us");

console.log(view.render()); // Hello!
0.0.2

10 years ago