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.

Re-exports§

pub use crate::core::uuidv7::Uuidv7Generator as CueIdGenerator;
pub use crate::core::uuidv7::generate_ids as generate_cue_ids;
pub use crate::core::uuidv7::unix_time_ms;
pub use engine::TranslationEngine;
pub use engine::parse_glossary_text;
pub use request::GlossaryEntry;
pub use request::TerminologyEntry;
pub use request::TerminologyMap;
pub use request::TranslationBatch;
pub use request::TranslationCue;
pub use request::TranslationOutcome;
pub use request::TranslationRequest;
pub use request::TranslationResult;

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