Expand description
Core subtitle translation engine.
The translation engine sits above the existing crate::core::formats
pipeline. It parses subtitle files into the shared
crate::core::formats::Subtitle data model, builds AI translation
requests with stable UUIDv7 cue IDs, validates AI responses, and
reapplies translated text back to the parsed entries while preserving
timing, cue ordering, cue counts, and metadata supported by the format
parser/writer pipeline.
§Why UUIDv7 cue IDs?
UUIDv7 IDs encode their generation order via the unix_time_ts field,
which makes batch logs, retries, and post-mortem auditing easier than
UUIDv4. The engine intentionally spaces adjacent cue ID generations by at
least 1 millisecond so each ID’s unix_time_ts is strictly greater than
the previous cue ID timestamp, preventing same-millisecond ambiguity.
§Module layout
request- request/response data structures.engine- high-levelengine::TranslationEngine.
The UUIDv7 cue ID generator lives in crate::core::uuidv7 and is
re-exported below for backward compatibility with the original
core::translation::uuidv7 public path.
Modules§
- engine
- High-level translation engine that orchestrates parsing, AI calls, and reapplication of translated text.
- request
- Translation request/response data structures.
- uuidv7
- Backward-compatibility shim for the original
subx_core::core::translation::uuidv7module path.
Structs§
- CueId
Generator - Stateful UUIDv7 ID generator shared by media discovery and translation.
- Glossary
Entry - User-provided glossary entry, parsed from a UTF-8 glossary file.
- Terminology
Entry - A single terminology entry returned by the AI extraction pass.
- Translation
Batch - A batch of cues sent in a single AI translation request.
- Translation
Cue - One cue in a translation request, identified by its UUIDv7 cue ID.
- Translation
Engine - Orchestrates subtitle translation through an
AIProvider. - Translation
Outcome - Outcome metadata for a successful translation pass.
- Translation
Request - Input parameters for translating a single subtitle file.
- Translation
Result - Result returned by the engine after translating a single subtitle file.
Functions§
- generate_
cue_ ids - Generate
countUUIDv7 IDs in sequence with strict 1ms spacing. - parse_
glossary_ text - Parse a UTF-8 glossary text file into
GlossaryEntryvalues. - unix_
time_ ms - Extract the 48-bit
unix_time_tsfield from a UUIDv7 value.
Type Aliases§
- Terminology
Map - Effective terminology map (source term -> target term).