Translation in alp framework
config/locales/en.yml
common:
'Hello %s!': "Hello %s!"
import Koa from 'koa';
import config from 'alp-config';
import translate from 'alp-translate';
const app = new Koa();
config(__dirname + '/config')(app);
translate('locales')(app);
index(ctx) {
const name = ctx.params.string('name').notEmpty().value;
ctx.body = ctx.t('Hello %s!', ctx.params.isValid() ? name : 'World');
},