Skip to main content

Module translation

Module translation 

Source
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

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::uuidv7 module path.

Structs§

CueIdGenerator
Stateful UUIDv7 ID generator shared by media discovery and translation.
GlossaryEntry
User-provided glossary entry, parsed from a UTF-8 glossary file.
TerminologyEntry
A single terminology entry returned by the AI extraction pass.
TranslationBatch
A batch of cues sent in a single AI translation request.
TranslationCue
One cue in a translation request, identified by its UUIDv7 cue ID.
TranslationEngine
Orchestrates subtitle translation through an AIProvider.
TranslationOutcome
Outcome metadata for a successful translation pass.
TranslationRequest
Input parameters for translating a single subtitle file.
TranslationResult
Result returned by the engine after translating a single subtitle file.

Functions§

generate_cue_ids
Generate count UUIDv7 IDs in sequence with strict 1ms spacing.
parse_glossary_text
Parse a UTF-8 glossary text file into GlossaryEntry values.
unix_time_ms
Extract the 48-bit unix_time_ts field from a UUIDv7 value.

Type Aliases§

TerminologyMap
Effective terminology map (source term -> target term).