1.0.0 • Published 7 years ago
salak-i18n v1.0.0
salak-i18n
i18n for salak 2.0
Install
$ npm install --save salak-i18nUsage
Config
In plugin:
module.exports = {
plugin: [
{
name: 'i18n',
package: 'salak-i18n'
}
]
}options
root{String} locales file location, defaultpath.join('config', 'locales')defaultLocale{String} defaulten-USqueryField{String} defaultlocalecookieField{String} defaultlocalelocaleAlias{Object} alias for localeswriteCookie{Boolean} defaulttrue
Context
ctx.__(key, ...args)
alias: ctx.gettext
key**{String} i18n keyargs{Array} if set, it will be call util.format
ctx.locale
return current locale
Controller
this.__(key, ...args)
alias: this.gettext
LICENSE
1.0.0
7 years ago