I18n module for toa.
Wrapped i18n-node v0.5.0
const Toa = require('toa')
const toaI18n = require('toa-i18n')
const app = new Toa()
app.use(function() {
this.body = this.__('Hello')
});
toaI18n(app, {
cookie: 'lang',
locales:['zh', 'en'],
directory: './examples/locales'
})
app.listen(3000)
npm install toa-i18n
const toaI18n = require('toa-i18n')
It will add __
, __n
, getLocale
, setLocale
, getCatalog
method to context
, And locale
getter to context
.
options
is the same as i18n-node.
(The MIT License)