Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XliffDeepl

XliffDeepl is a command-line tool that translates XLIFF 2.1/2.2 files with DeepL, using TypesXLIFF to read the file's own srcLang/trgLang and validate them against the languages DeepL supports. Glossaries can be uploaded to DeepL ahead of time and reused across translation runs.

Installation

Option 1: Install globally with npm

npm install -g xliff-deepl

Option 2: Clone and build from source

git clone https://github.com/maxprograms-com/XliffDeepl.git
cd XliffDeepl
npm install
npm run build

Then run:

./dist/cli.js translate -i <path-to-file.xlf> -o <path-to-output.xlf> -k <apiKey>

Usage

A DeepL API key is required for every command except glossary list. Pass it with -k/--key, or set it once as an environment variable:

export DEEPL_API_KEY=<your-api-key>

Translate a file

xliff-deepl translate -i <input.xlf> -o <output.xlf>

Source and target languages are read from the XLIFF file itself, not passed on the command line. translate rejects files that aren't XLIFF 2.1 or 2.2, and rejects languages DeepL doesn't support.

Apply a previously uploaded glossary, and/or set formality:

xliff-deepl translate -i <input.xlf> -o <output.xlf> -g <glossaryName> -f more

The glossary's source/target languages must match the XLIFF file's; translate checks this against DeepL directly before starting.

For help:

xliff-deepl translate -h

Output:

Usage:
  xliff-deepl translate -i <input.xlf> -o <output.xlf> -k <apiKey> [options]

Required:
  -i, --input <file>        XLIFF file to translate
  -o, --output <file>       Where to write the translated XLIFF file
  -k, --key <apiKey>        DeepL API key (or set DEEPL_API_KEY environment variable)

Options:
  -g, --glossary <name>     Name of a glossary previously uploaded with "glossary upload"
  -f, --formality <value>   default | more | less | prefer_more | prefer_less
  -h, --help                Show this help message

Manage glossaries

Glossaries live on DeepL's servers; XliffDeepl keeps a local record of their names and ids in ~/.cache/XliffDeepl/glossaries.json so you can refer to them by name.

xliff-deepl glossary upload --name legal-terms --source en --target de --file terms.csv
xliff-deepl glossary list
xliff-deepl glossary delete --name legal-terms
  • upload reads a CSV file of source-term,target-term pairs, creates the glossary on DeepL, and records it locally. It refuses to reuse a name that's already tracked.
  • list only reads the local record, no network access, no API key needed.
  • delete removes the glossary from DeepL first, then from the local record.

For help:

xliff-deepl glossary -h

License

Eclipse Public License 1.0, see LICENSE for details.

Releases

Packages

Contributors

Languages