XliffDeepl - DeepL Integration for XLIFF Translation
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.
The source code is available on GitHub under the Eclipse
Public License v1.0. Developers can clone, adapt, and ship the library under the
terms of that license, or contact Maxprograms for commercial arrangements.
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 <formality>
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 a glossary from DeepL and from the local record.
For help:
xliff-deepl glossary -h