auk-translate
v1.1.0
Published
Translation in auk server
Downloads
8
Readme
auk-translate
config/locales/en.yml
common:
'Hello %s!': "Hello %s!"
index.server.js
import Koa from 'koa';
import config from 'auk-config';
import translate from 'auk-translate';
const app = new Auk();
config(__dirname + '/config')(app);
translate('locales')(app);
index(ctx) {
const name = ctx.params.string('name').notEmpty().value;
ctx.body = this.t('Hello %s!', ctx.params.isValid() ? name : 'World');
},