This package has been deprecated

Author message:

Merged to alp-node

alp-translate
TypeScript icon, indicating that this package has built-in type declarations

8.1.1 • Public • Published

alp-translate

Translation in alp framework

Config

config/locales/en.yml

common:
  'Hello %s!': 'Hello %s!'

With Koa

import Koa from 'koa';
import config from 'alp-node-config';
import translate from 'alp-translate';

const app = new Koa();
config(new URL('./config', import.meta.url))(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');
    },

.t(key, ...args)

/alp-translate/

    Package Sidebar

    Install

    npm i alp-translate

    Weekly Downloads

    79

    Version

    8.1.1

    License

    ISC

    Unpacked Size

    37.3 kB

    Total Files

    18

    Last publish

    Collaborators

    • churpeau