# koa-fluent

> Fluent middleware for koa

Latest version **1.0.7** (published 2019-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-fluent
pnpm add koa-fluent
yarn add koa-fluent
bun add koa-fluent
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2019-12-30 |
| First published | 2019-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 29.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Colin Cheng |
| Maintainers | zbinlin |
| Keywords | koa, i18n, l10n, l20n, middleware, fluent |

## Links

- npm: https://www.npmjs.com/package/koa-fluent
- Repository: https://github.com/zbinlin/koa-fluent
- Homepage: https://github.com/zbinlin/koa-fluent#readme
- Issues: https://github.com/zbinlin/koa-fluent/issues
- npm.io page: https://npm.io/package/koa-fluent

## Dependencies (6)

- [koa](https://npm.io/package/koa.md) ^2.11.0
- [fluent](https://npm.io/package/fluent.md) ^0.12.0
- [@types/koa](https://npm.io/package/@types/koa.md) ^2.11.0
- [@types/fluent](https://npm.io/package/@types/fluent.md) ^0.11.3
- [fluent-langneg](https://npm.io/package/fluent-langneg.md) ^0.1.1
- [@types/fluent-langneg](https://npm.io/package/@types/fluent-langneg.md) ^0.1.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2019-12-30
- 1.0.5 — 2019-12-28
- 1.0.4 — 2019-06-20
- 1.0.3 — 2019-06-13
- 1.0.2 — 2019-06-03
- 1.0.1 — 2019-06-02

## README

# koa-fluent

Fluent middleware for koa


## Install

```shell
npm install koa-fluent
```


## Usage

```javascript
import * as Koa from "koa";
import fluent from "koa-fluent";

const app = new Koa();

/**
 *
 * Adds `ftl` function to app.context
 * dirs list tree
 * ./locales
 * ├── en-US.ftl
 * ├── jp.ftl
 * └── zh-CN.ftl
 */
fluent(app, {
    dirs: "./locales", // locales dir
    defaultLanguage: "en-US", // optional
    functionName: "ftl", // optional
    queryField: "ftl_locale", // optional
    cookieField: "ftl_locale", // optional
});

/**
 * Use ctx.ftl to format message
 */
app.use(async (ctx, next) => {
    ctx.body = ctx.ftl("welcome", {
        name: "colin",
    });
});
```

---
_Source: https://npm.io/package/koa-fluent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
