How deepl/deepl-cli works
DeepL CLI takes user commands and local text or localization files, then returns translations, writing improvements, or localization updates. The main translation path runs from CLI handlers through services and API clients to DeepL; the separate sync workflow parses and compares project files, coordinates translation and glossary support, and writes updated files. The README documents additional capabilities whose wiring is not fully visible in the sampled source; those branches are represented without asserting unsampled internal call chains.
Main entry points: index.ts CLI entry · sync-service.ts Sync service · translation.ts Translation service · deepl-client.ts DeepL client
Components 27
CLI and setup
- CLI entry
src/cli/index.ts - Service factory
src/cli/commands/service-factory.ts
Translation workflows
- Translate command
src/cli/commands/translate.ts - Text handler
src/cli/commands/translate/text-translation-handler.ts - File handler
src/cli/commands/translate/file-translation-handler.ts - Translation service
src/services/translation.ts - Document service
src/services/document-translation.ts
Localization sync
- Format registry
src/formats/index.ts - Sync command
src/cli/commands/sync-command.ts - Sync service
src/sync/sync-service.ts - TMS client
src/sync/tms-client.ts
Additional capabilities
- Watch service
src/services/watch.ts - Write service
src/services/write.ts - Voice service
src/services/voice.ts - Voice stream session
src/services/voice-stream-session.ts - Glossary service
src/services/glossary.ts - Translation memory
src/services/translation-memory.ts
Runtime services
- DeepL client
src/api/deepl-client.ts - Translation API client
src/api/translation-client.ts - HTTP client
src/api/http-client.ts - Local cache
src/storage/cache.ts - Configuration
src/storage/config.ts
Other components
- CLI user
- Project files
- DeepL API
- Voice API
- TMS server
Connections 37
- CLI user → CLI entry: runs command
- CLI entry → Configuration: reads settings
- CLI entry → Service factory: creates services
- Service factory → Translation service: creates
- Service factory → Document service: creates
- CLI entry → Translate command: dispatches
- Translate command → Text handler: handles text
- Translate command → File handler: handles files
- Text handler → Translation service: requests translation
- File handler → Translation service: requests translation
- File handler → Document service: uses document API
- Translation service → DeepL client: calls
- Document service → DeepL client: calls
- DeepL client → Translation API client: delegates translation
- Translation API client → HTTP client: sends requests
- HTTP client → DeepL API: HTTP requests
- CLI entry → Sync command: dispatches
- Sync command → Sync service: runs sync
- Sync service → Project files: scans and updates
- Sync service → Format registry: uses parsers
- Sync service → Translation service: requests translations
- Sync service → Glossary service: resolves glossary
- Sync service → Translation memory: resolves memory
- Sync service → TMS client: uses TMS
- TMS client → TMS server: exchanges data
- CLI entry → Watch service: dispatches watch
- Watch service → Translation service: auto-translates
- CLI entry → Write service: dispatches writing
- Write service → DeepL client: calls
- CLI entry → Voice service: dispatches voice
- Voice service → Voice stream session: manages stream
- Voice stream session → Voice API: streams audio
- CLI entry → Glossary service: dispatches glossary
- Glossary service → DeepL client: calls
- CLI entry → Translation memory: dispatches memory
- Translation memory → DeepL client: calls
- Translation service → Local cache: uses cache