# arb-convert

> Convert Application Resource Bundle (ARB) translation files to other translation formats and back

Latest version **1.2.1** (published 2021-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install arb-convert
pnpm add arb-convert
yarn add arb-convert
bun add arb-convert
```

Provides the commands `arb2po`, `po2arb`, `arb2xliff`, `xliff2arb`.

## 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.2.1 |
| Published | 2021-07-31 |
| First published | 2019-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 3 |
| Unpacked size | 118 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Malte Dölker |
| Maintainers | mdoelker |
| Keywords | ARB, Application Resource Bundle, XLIFF, gettext, PO, translation, converter, Flutter, Dart |

## Links

- npm: https://www.npmjs.com/package/arb-convert
- Repository: https://github.com/trufi-association/arb-convert
- Homepage: https://github.com/trufi-association/arb-tconvert#readme
- Issues: https://github.com/trufi-association/arb-convert/issues
- npm.io page: https://npm.io/package/arb-convert

## Dependencies (3)

- [tempy](https://npm.io/package/tempy.md) ^1.0.1
- [xml-js](https://npm.io/package/xml-js.md) ^1.6.11
- [commander](https://npm.io/package/commander.md) ^8.1.0

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2021-07-31
- 1.2.0 — 2021-07-31
- 1.1.2 — 2020-04-21
- 1.1.1 — 2020-01-02
- 1.1.0 — 2020-01-02
- 1.0.1 — 2019-12-29
- 1.0.0 — 2019-12-29

## README

# arb-convert

![Build Status](https://github.com/trufi-association/arb-convert/workflows/build/badge.svg)
[![NPM version](https://img.shields.io/npm/v/arb-convert.svg?style=flat)](https://www.npmjs.com/package/arb-convert)
[![Coverage Status](https://coveralls.io/repos/github/trufi-association/arb-convert/badge.svg?branch=master)](https://coveralls.io/github/trufi-association/arb-convert?branch=master)
[![Package dependencies](https://img.shields.io/david/trufi-association/arb-convert.svg)](https://david-dm.org/trufi-association/arb-convert)
[![GitHub license](https://img.shields.io/github/license/trufi-association/arb-convert.svg)](https://github.com/trufi-association/arb-convert/blob/master/LICENSE)

Tool to convert JSON-based [Application Resource Bundle](https://github.com/google/app-resource-bundle) (ARB) localization format by Google to another format and back.

```shell
npm install -g arb-convert
```

## Background

ARB is the format of choice when using the [Dart intl](https://pub.dev/packages/intl) package to localize [Flutter](https://flutter.dev/) apps. It has not seen wide adoption by translation providers however. Since December 2019, Google shut down its Translator Toolkit that has natively supported the ARB format. So now Flutter devs can either migrate to another library and format, edit files by hand or convert to another format. This project aims to aid with the latter.

## Supported formats

* XLIFF 1.2/2.0/2.1
* GNU gettext
* ... add your format, PRs welcome

Please note that ICU placeholders and plural notations are not converted.

## Node.js

```js
const arbConvert = require('arb-convert');
const { convertFromArb, parseToArb } = arbConvert;

const xmlString = convertFromArb('xliff-1.2', {
    source: '{ "@@locale": "en-US", ... }',
    target: '{ "@@locale": "de-DE", ... }', // optional
    original: 'namespace', // optional
    sourceLanguage: 'en-US', // optional (override)
    targetLanguage: 'de-DE', // optional (override)
});

const result = parseToArb('xliff', {
    content: xmlString,
});
// { source, target, original, sourceLanguage, targetLanguage }

```

## Binaries

### arb2xliff

```shell
Usage: arb2xliff [options]

Options:
  --sourcefile <filename>  source ARB file (required)
  --targetfile <filename>  target ARB file
  --original <value>       where the translations come from
  --sourcelang <locale>    source locale override, e.g. en-US, in case it cannot be determined from file content or file name
  --targetlang <locale>    target locale override, e.g. de-DE, in case it cannot be determined from file content or file name
  --outversion <version>   XLIFF version, e.g. 1.2 (default) or 2.0/2.1
  --out <filename>         write XLIFF to file if given or stdout if omitted
  -h, --help               output usage information
```

### xliff2arb

```shell
Usage: xliff2arb [options]

Options:
  --file <filename>       source XLIFF file (required)
  --sourceout <filename>  write source ARB to file if given or stdout if omitted
  --targetout <filename>  write target ARB to file if given
  -h, --help              output usage information
```

### arb2po

```shell
Usage: arb2po [options]

Options:
  --sourcefile <filename>  source ARB file (required)
  --targetfile <filename>  target ARB file
  --original <value>       where the translations come from
  --sourcelang <locale>    source locale override, e.g. en-US, in case it cannot be determined from file content or file name
  --targetlang <locale>    target locale override, e.g. de-DE, in case it cannot be determined from file content or file name
  --out <filename>         write PO to file if given or stdout if omitted
  -h, --help               output usage information
```

### po2arb

```shell
Usage: po2arb [options]

Options:
  --file <filename>       source PO file (required)
  --sourceout <filename>  write source ARB to file if given or stdout if omitted
  --targetout <filename>  write target ARB to file if given
  -h, --help              output usage information
```

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