xliff-deepl
v0.1.0
Published
Translate XLIFF with DeepL and your glossaries
Readme
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-deeplOption 2: Clone and build from source
git clone https://github.com/maxprograms-com/XliffDeepl.git
cd XliffDeepl
npm install
npm run buildThen 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 moreThe glossary's source/target languages must match the XLIFF file's; translate checks this against DeepL directly before starting.
For help:
xliff-deepl translate -hOutput:
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 messageManage 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-termsuploadreads a CSV file ofsource-term,target-termpairs, creates the glossary on DeepL, and records it locally. It refuses to reuse a name that's already tracked.listonly reads the local record, no network access, no API key needed.deleteremoves the glossary from DeepL first, then from the local record.
For help:
xliff-deepl glossary -hLicense
Eclipse Public License 1.0, see LICENSE for details.
