How rockbenben/subtitle-translator works
Subtitle Translator is a browser-based batch subtitle translation product, with a CLI also documented as using the same engine. The main web flow accepts subtitle files, manages translation settings and state, translates dialogue through configured services, and presents and exports results. README-documented format conversion, bilingual output, glossary/context controls, multi-language runs, and local caching are preserved as capability branches. The translation implementation directory is absent from the supplied tree, so its internal stages are represented only at the enclosing src/app/lib path; API-route wiring is uncertain.
Main entry points: SubtitleTranslator.tsx Subtitle workspace · useTranslationState.tsx Translation state · lib Translation engine · client.tsx Tool page
Components 21
Web experience
- Tool page
src/app/[locale]/client.tsx - Subtitle workspace
src/app/[locale]/SubtitleTranslator.tsx - File upload
src/app/hooks/useFileUpload.ts - Live results
src/app/[locale]/LiveTranslationResults.tsx - Bilingual review
src/app/[locale]/BilingualReviewPanel.tsx - File export
src/app/hooks/useFileExport.ts
Translation workflow
- Translation state
src/app/hooks/useTranslationState.tsx - Run progress
src/app/hooks/useTranslationProgress.ts - Translation engine
src/app/lib - Subtitle formats
src/app/[locale]/subtitleCues.ts - Glossary controls
src/app/components/glossaryManager/GlossaryManager.tsx - Context controls
src/app/components/ContextTranslationBlock.tsx
Settings and persistence
- API settings
src/app/components/TranslationSettings.tsx - Language selection
src/app/components/LanguageSelector.tsx - Translation presets
src/app/hooks/usePresetCollection.ts - Browser preferences
src/app/hooks/useLocalStorage.ts - Translation cache
src/app/lib/storage/indexedDBStorage.ts
Translation services
- Translation providers
- DeepL relay route
src/app/api/deepl/route.ts - Nvidia relay route
src/app/api/nvidia/route.ts
Other components
- Subtitle user
Connections 21
- Subtitle user → Tool page: opens tool
- Tool page → Subtitle workspace: renders
src/app/[locale]/client.tsx - Subtitle workspace → File upload: accepts files
src/app/[locale]/SubtitleTranslator.tsx - Subtitle workspace → Translation state: uses state
src/app/[locale]/SubtitleTranslator.tsx - Translation state → Translation engine: runs translation
src/app/hooks/useTranslationState.tsx - Translation engine → Translation providers: requests translation
- Translation state → Run progress: tracks run
src/app/hooks/useTranslationState.tsx - Subtitle workspace → Live results: shows results
src/app/[locale]/SubtitleTranslator.tsx - Subtitle workspace → Bilingual review: offers review
src/app/[locale]/SubtitleTranslator.tsx - Bilingual review → File export: exports output
src/app/[locale]/BilingualReviewPanel.tsx - Subtitle workspace → Subtitle formats: supports formats
- Translation engine → Subtitle formats: converts formats
src/app/[locale]/subtitleCues.ts - Translation state → Translation cache: reads and writes
src/app/hooks/useTranslationState.tsx - Subtitle workspace → API settings: configures service
- Subtitle workspace → Language selection: chooses languages
src/app/[locale]/SubtitleTranslator.tsx - API settings → Translation presets: manages presets
- Translation state → Browser preferences: persists settings
src/app/hooks/useTranslationState.tsx - Subtitle workspace → Glossary controls: offers glossary
- Subtitle workspace → Context controls: offers context
src/app/[locale]/SubtitleTranslator.tsx - Translation providers → DeepL relay route: may relay
- Translation providers → Nvidia relay route: may relay