# l20n

> A localization library for HTML documents

Latest version **6.0.0** (published 2019-04-16) · Apache-2.0 license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2019-04-16 |
| First published | 2013-05-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 468.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 890 |
| Author | Mozilla |
| Maintainers | mozpike, stasm, zbraniecki |
| Keywords | localization, l10n |

## Links

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

## Dependencies (3)

- [fluent](https://npm.io/package/fluent.md) ~0.3.1
- [fluent-langneg](https://npm.io/package/fluent-langneg.md) ~0.0.2
- [fluent-intl-polyfill](https://npm.io/package/fluent-intl-polyfill.md) ~0.1.0

## Recent versions

- 6.0.0 (latest) — 2019-04-16
- 5.0.0 — 2017-04-26
- 4.0.0-beta.1 — 2017-01-31
- 4.0.0-alpha.3 — 2016-07-06
- 4.0.0-a2 — 2016-07-05
- 3.5.1 — 2016-02-26
- 3.5.0 — 2015-12-23
- 3.4.1 — 2015-11-06
- 3.3.3 — 2015-10-17
- 3.3.2 — 2015-10-16
- 3.3.1 — 2015-10-07
- 3.3.0 — 2015-10-07
- 3.2.0 — 2015-10-05
- 3.1.0 — 2015-09-29
- 3.0.6 — 2015-09-08
- … 12 more at https://npm.io/package/l20n/versions

## README

L20n: Localization 2.0 (Deprecated)
===================================

__L20n.js has been deprecated and is no longer maintained. Please use
[Fluent][], the successor to L20n developed by the same team at Mozilla.
Fluent is a mature localization system currently used in Firefox and in many
other Mozilla projects.__

---

L20n is an opinionated localization library for the Web. It builds on top of
[Fluent][] which was designed to unleash the expressive power of the natural
language.

L20n.js is a good choice for websites which want to offer a best-in-class
translation experience for their users.  L20n takes advantage of modern web
technologies to offer a fast and lean localization of HTML and JavaScript.

[Fluent]: http://projectfluent.org


How to use L20n
---------------

Include the following code in the `<head>` section of your HTML:

```html
<meta name="defaultLanguage" content="en-US">
<meta name="availableLanguages" content="de, en-US, fr, pl">
<link rel="localization" href="locales/myApp.{locale}.ftl">
<script defer src="dist/web/l20n.js"></script>
```
Use the `data-l10n-id` attribute on an HTML element to mark it as localizable.

```html
<p data-l10n-id="about"></p>
```

That's it!  L20n will set up a `MutationObserver` and will make sure the
element is localized even if the DOM changes.  See [docs/html][] for more
information.

[docs/html]: https://github.com/l20n/l20n.js/blob/master/docs/html.md

It is also possible to use L20n programmatically, for instance in order to 
localize dynamic content.  The API is exposed under `document.l10n`.  Refer to
the [docs/][] directory for more details.

[docs/]: https://github.com/l20n/l20n.js/blob/master/docs/


Learn the FTL syntax
--------------------

L20n uses Project Fluent under the hood.  FTL is a localization file format
used for describing translation resources.  FTL stands for _Fluent Translation
List_.

FTL is designed to be simple to read, but at the same time allows to represent
complex concepts from natural languages like gender, plurals, conjugations,
and others.

    hello-user = Hello, { $username }!

[Read the Fluent Syntax Guide][] in order to learn more about the syntax.  If
you're a tool author you may be interested in the formal [EBNF grammar][].

[Read the Fluent Syntax Guide]: http://projectfluent.org/fluent/guide/
[EBNF grammar]: https://github.com/projectfluent/fluent/tree/master/spec

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