apply_translation
Writes translated subtitle text into the original file using cue ID mappings while preserving timing, cue order, WebVTT identifiers/settings/notes; flags empty, length, tag, or reading-speed issues.
Instructions
Step 2 of translating a subtitle: write the translated file. Timing, cue order, WebVTT
identifiers/settings/notes are kept exactly; only the text changes. Every id of the file
must be present in mapping (otherwise the call fails and lists the missing ids; partial=true
keeps untranslated cues as they are). Warnings are reported for translations that are
empty, much longer or shorter than the source, that lose or change formatting tags, or that
would read too fast.
Args: path: the SAME file given to chunk_for_translation. mapping: {"1": "translated text", "2": "..."}; keys are the ids from chunk_for_translation. output: where to write (default: .translated.). overwrite: allow replacing an existing output file (default false). partial: allow a mapping that does not cover every cue. encoding: force the input text encoding. output_encoding: encoding of the written file (default utf-8; use utf-8 for non-Latin target languages).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| output | No | ||
| mapping | Yes | ||
| partial | No | ||
| encoding | No | ||
| overwrite | No | ||
| output_encoding | No | utf-8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |