Skip to content

cinematicSubtitles ​

Namespace of @v12-engine/editor

Members ​

applyTranslation beta ​

ts
export declare function applyTranslation(def: CinematicDef, words: ReadonlyMap<string, string>, selection: CinematicSelection, options?: EditOptions): {
    def: CinematicDef;
    selection: CinematicSelection;
    changed: number;
    missing: string[];
    unknown: string[];
};

A cinematic with a translation's words in the place of its lines' (a line by its key, lineKey): what changed, the lines it had no words for, and its keys no line has

keyLines beta ​

ts
export declare function keyLines(def: CinematicDef, selection: CinematicSelection, options?: EditOptions): {
    def: CinematicDef;
    selection: CinematicSelection;
};

Every line without a key given its place's (<cinematic>.<n>, lineKey), one not taken by another line: the game says it by that message from then on, and the line keeps its key as others are put in

lineKey beta ​

ts
lineKey: (def: CinematicDef, line: {
    key?: string;
}, place: number) => string

The key a line is known by: its own (key), else its place among the cinematic's lines (td.intro.3, from 1)

localizationRows beta ​

ts
export declare function localizationRows(def: CinematicDef, options?: EditOptions): LocalizedLine[];

The lines of a cinematic to translate, in the order said: each by its key (lineKey), who says it and its words

LocalizedLine beta ​

ts
export interface LocalizedLine

A line to translate: its key, who says it (their id), its words

readCsv beta ​

ts
export declare function readCsv(text: string): string[][];

The rows of CSV text (RFC 4180: quoted fields with commas, quotes and new lines in them), empty rows left out, a byte order mark at the start too

readTranslation beta ​

ts
export declare function readTranslation(text: string): Map<string, string>;

The words of a translation by key: CSV with a header naming key and text (or rows of key, speaker, text), JSON as the game's messages ({ "td.intro.1": "…" }, or { key: { text } }), or a list of { key, text }. Throws with what it could not read

SubtitleCue beta ​

ts
export interface SubtitleCue

A line as subtitles show it: from when to when, who says it (their name), what

subtitleCues beta ​

ts
export declare function subtitleCues(def: CinematicDef, options?: EditOptions & {
    names?: (speaker: string) => string | undefined;
}): SubtitleCue[];

The lines of a cinematic as subtitles, in the order said: a speaker by their name where names has one

toCsv beta ​

ts
export declare function toCsv(rows: readonly LocalizedLine[]): string;

The lines to translate as CSV: key,speaker,text, a row a line (RFC 4180: fields quoted where they need it)

toMessages beta ​

ts
export declare function toMessages(rows: readonly LocalizedLine[]): Record<string, string>;

The lines to translate as the game's messages take them (GameView.hud.messages): key to words. A translation is another such table

toSrt beta ​

ts
export declare function toSrt(cues: readonly SubtitleCue[], options?: {
    speakers?: boolean;
}): string;

Subtitles as SubRip (.srt): a cue a line, numbered from 1, the speaker before the words (Aldric: Hold the road.) unless speakers is false

toVtt beta ​

ts
export declare function toVtt(cues: readonly SubtitleCue[], options?: {
    speakers?: boolean;
}): string;

Subtitles as WebVTT (.vtt): a cue a line, the speaker as its voice (<v Aldric>Hold the road.) unless speakers is false