# fluent

> Localization library for expressive translations.

Latest version **0.13.0** (published 2019-07-25) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.13.0 |
| Published | 2019-07-25 |
| First published | 2011-10-31 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | separate (@types/fluent) |
| Module format | ESM + CommonJS |
| Node | >=8.9.0 |
| Dependencies | 0 |
| Unpacked size | 138.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1008 |
| Author | Mozilla |
| Maintainers | mozpike, stasm, zbraniecki |
| Keywords | localization, l10n, internationalization, i18n, ftl, plural, gender, locale, language, formatting, translate, translation, format, parser |

## Links

- npm: https://www.npmjs.com/package/fluent
- Repository: https://github.com/projectfluent/fluent.js
- Homepage: http://projectfluent.org
- Issues: https://github.com/projectfluent/fluent.js/issues
- npm.io page: https://npm.io/package/fluent

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.13.0 (latest) — 2019-07-25
- 0.12.0 — 2019-03-26
- 0.11.0 — 2019-02-15
- 0.10.0 — 2018-12-13
- 0.9.1 — 2018-10-23
- 0.9.0 — 2018-10-23
- 0.8.1 — 2018-09-27
- 0.8.0 — 2018-08-20
- 0.7.0 — 2018-07-24
- 0.6.4 — 2018-04-11
- 0.6.3 — 2018-02-10
- 0.4.3 — 2018-02-09
- 0.6.2 — 2018-02-08
- 0.6.0 — 2018-01-31
- 0.4.2 — 2017-11-27
- … 9 more at https://npm.io/package/fluent/versions

## README

# fluent

`fluent` is a JavaScript implementation of Project Fluent, a localization
framework designed to unleash the expressive power of the natural language.


## Installation

`fluent` can be used both on the client-side and the server-side.  You can
install it from the npm registry or use it as a standalone script (as the
`Fluent` global).

    npm install fluent


## How to use

The `FluentBundle` constructor provides the core functionality of formatting
translations from FTL files.

```javascript
import { FluentBundle, ftl } from 'fluent';

const bundle = new FluentBundle('en-US');

const errors = bundle.addMessages(ftl`
    -brand-name = Foo 3000
    welcome = Welcome, { $name }, to { -brand-name }!
`);

if (errors.length) {
  // syntax errors are per-message and don't break the whole resource
}

const welcome = bundle.getMessage('welcome');

bundle.format(welcome, { name: 'Anna' });
// → 'Welcome, Anna, to Foo 3000!'
```

The API reference is available at http://projectfluent.org/fluent.js/fluent.


## Compatibility

`fluent` requires the following `Intl` formatters:

  - `Intl.DateTimeFormat` (standard, well-supported)
  - `Intl.NumberFormat` (standard, well-supported)
  - `Intl.PluralRules` (standard, new in ECMAScript 2018)

`Intl.PluralRules` may already be available in some engines.  In most cases,
however, a polyfill will be required.  We recommend [intl-pluralrules][].

```javascript
import 'intl-pluralrules';
import { FluentBundle } from 'fluent';
```

For legacy browsers, the `compat` build has been transpiled using Babel's [env
preset][]. It requires the regenerator runtime provided by [babel-polyfill][].

```javascript
import { FluentBundle } from 'fluent/compat';
```


## Learn more

Find out more about Project Fluent at [projectfluent.org][], including
documentation of the Fluent file format ([FTL][]), links to other packages and
implementations, and information about how to get involved.


[intl-pluralrules]: https://www.npmjs.com/package/intl-pluralrules
[babel-polyfill]: https://babeljs.io/docs/usage/polyfill/
[Stage 3 proposal]:https://github.com/tc39/proposal-intl-plural-rules
[env preset]: https://babeljs.io/docs/plugins/preset-env/
[projectfluent.org]: http://projectfluent.org
[FTL]: http://projectfluent.org/fluent/guide/

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