# multilang

> Tools for multilanguage and Markdown multilang

Latest version **1.2.5** (published 2026-08-13) · MIT license · 0 weekly downloads

## Install

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

Provides the command `multilang`.

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2026-08-13 |
| First published | 2015-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 22 |
| Dependencies | 4 |
| Unpacked size | 31.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 12 |
| Author | Codenautas |
| Maintainers | tute, estefi-capece, etonini, nsalva, u-gene, manueldelapenna, gracanessa |

## Links

- npm: https://www.npmjs.com/package/multilang
- Repository: https://github.com/codenautas/multilang
- Homepage: https://github.com/codenautas/multilang#readme
- Issues: https://github.com/codenautas/multilang/issues
- npm.io page: https://npm.io/package/multilang

## Dependencies (4)

- [js-yaml](https://npm.io/package/js-yaml.md) ^5.2.3
- [commander](https://npm.io/package/commander.md) ^15.0.0
- [best-globals](https://npm.io/package/best-globals.md) ^2.2.2
- [strip-bom-string](https://npm.io/package/strip-bom-string.md) ^1.0.0

## Recent versions

- 1.2.5 (latest) — 2026-08-13
- 1.2.3 — 2026-06-07
- 1.2.2 — 2026-06-07
- 1.2.1 — 2026-05-12
- 1.2.0 — 2022-07-24
- 1.1.0 — 2021-10-01
- 1.0.23 — 2019-06-29
- 1.0.21 — 2018-05-29
- 1.0.20 — 2017-08-20
- 1.0.19 — 2017-05-08
- 1.0.18 — 2016-12-27
- 1.0.17 — 2016-12-14
- 1.0.16 — 2016-12-12
- 1.0.15 — 2016-12-11
- 1.0.14 — 2016-06-14
- … 19 more at https://npm.io/package/multilang/versions

## README

# multilang

Tools for multilanguage &amp; Markdown multilang


[![npm-version](https://img.shields.io/npm/v/multilang.svg)](https://npmjs.org/package/multilang)
[![downloads](https://img.shields.io/npm/dm/multilang.svg)](https://npmjs.org/package/multilang)
[![build](https://github.com/codenautas/multilang/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/codenautas/multilang/actions/workflows/build-and-test.yml)
[![coverage](https://img.shields.io/coveralls/codenautas/multilang/master.svg)](https://coveralls.io/r/codenautas/multilang)
[![security](https://socket.dev/api/badge/npm/package/multilang)](https://socket.dev/npm/package/multilang)
[![qa-control](https://github.com/codenautas/multilang/actions/workflows/qa-control.yml/badge.svg)](https://github.com/codenautas/multilang/actions/workflows/qa-control.yml)


language: ![English](https://raw.githubusercontent.com/codenautas/multilang/master/img/lang-en.png)
also available in:
[![Spanish](https://raw.githubusercontent.com/codenautas/multilang/master/img/lang-es.png)](LEEME.md) -
[![German](https://raw.githubusercontent.com/codenautas/multilang/master/img/lang-de.png)](LIESMICH.md)


In a Markdown or HTML-like file is written the documentation in multiple languages.

One of these languages ​​is the main, the others are commented with ![open](https://raw.githubusercontent.com/codenautas/multilang/master/img/comment-open.png) and ![close](https://raw.githubusercontent.com/codenautas/multilang/master/img/comment-close.png)

Then with ` multilang` the other languages ​​are extracted to generate one file for each of the other languages ​​defined


## Install


```sh
$ npm install multilang -g
```


## How to use


```
$ multilang doc-en.md
```


A .md file is generated for the other languages written in `doc-en.md` file


## Multilanguage document format

Any HTML or Markdown document is a multilenguage document if it has a main *multilanguage* directive.

### Example


```
<!--multilang v0 en:README.md es:LEEME.md fr:LISEZMOI.md de:LIESMICH.md -->
<!--multilang buttons-->

language: ![English](https://raw.githubusercontent.com/codenautas/multilang/master/img/lang-en.png)
also available in:
[Spanish](LEEME.md)  [French](LISEZMOI.md)  [German](LIESMICH.md)

<!--lang:en-->
This is a little example
<!--lang:es--]
Este es un pequeño ejemplo
[!--lang:fr--]
Ce est un petit exemple
[!--lang:de--]
Das ist ein Beispiel
[!--lang:*-->

<!--lang:en-->
"*" means all languages
<!--lang:es--]
"*" es para indicar todos los idiomas
[!--lang:fr--]
"*" est d'indiquer toutes les langues
[!--lang:de--]
"*" steht für alle Sprachen
[!--lang:*-->
All you need is multilang!
```


In this example:


```
<!--multilanguage v0 en:README.md es:LEEME.md fr:LISEZMOI.md-->
```


is the directive for declare the languages


```
<!--multilanguage buttons-->
```


is the directive for declaring the place for the button section


```
[!--lang:fr--]
```


is the directive for declaring the language of the next section (use * for all languages)


## API

```js

var fs = require('fs');
var multilang = require('multilang');

var englishText = fs.readFileSync('README.md', {encoding:'utf8'});

var warnings = multilang.getWarnings(englishText);
if(warnings.lengt){
    console.log('WARN', warnings);
}

var spanishText = multilang.changeDoc(englishText,'es');

console.log('spanish.md',spanishText);
```


(note about the example: do not use ***Sync*** functions in production,
use async
or [promise](http://npmjs.com/package/fs-promise) version
as you can see in [codenautas](https://github.com/codenautas/codenautas/blob/master/examples/promises.md)

function             | use
---------------------|------------------------------
changeDoc(text,lang) | receives a multilang text and a language code and returns de text of specified lang
warnings(text)       | receives a list of warnings and returns a multilang text


## License

[MIT](LICENSE)

...................................

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