Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

arb-convert

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

ARB, Application Resource Bundle, XLIFF, gettext, PO, translation, converter, Flutter, Dart

readme

arb-convert

Build Status NPM version Coverage Status Package dependencies GitHub license

Tool to convert JSON-based Application Resource Bundle (ARB) localization format by Google to another format and back.

npm install -g arb-convert

Background

ARB is the format of choice when using the Dart intl package to localize Flutter 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

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

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

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

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

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

1.1.2 - 2020-04-21

Fixed

  • Fix error on key mismatch in source and target input files in arb convert #2

Security

  • Update dependencies and fix audit issues

1.1.1 - 2020-01-02

Fixed

  • Add arb2po and po2arb as npm bins

1.1.0 - 2020-01-02

Added

  • GNU gettext PO format support
  • Full test coverage

1.0.1 - 2019-12-30

Fixed

  • Removed unnecessary files from NPM release

1.0.0 - 2019-12-29

Added

  • XLIFF 1.2/2.0/2.1 format support