salak-i18n
v1.0.0
Published
salak i18n plugin
Downloads
2
Readme
salak-i18n
i18n for salak 2.0
Install
$ npm install --save salak-i18n
Usage
Config
In plugin:
module.exports = {
plugin: [
{
name: 'i18n',
package: 'salak-i18n'
}
]
}
options
root
{String} locales file location, defaultpath.join('config', 'locales')
defaultLocale
{String} defaulten-US
queryField
{String} defaultlocale
cookieField
{String} defaultlocale
localeAlias
{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