Skip to content

feat: begin a translation from the document being read - #104

Merged
xAlcahest merged 1 commit into
mainfrom
new-translation
Sep 6, 2026
Merged

feat: begin a translation from the document being read#104
xAlcahest merged 1 commit into
mainfrom
new-translation

Conversation

@xAlcahest

Copy link
Copy Markdown
Owner

Summary

The second slice of M2.6, decision 13: a translation is born from the document being read. New translation from source on the File menu makes the target from the source, every cue and every timing carried over with nothing written in them, and no file behind it until the first save, which asks where to put it exactly as it already does for a document that has never had one.

The emptying happens on a scratch session whose bytes are then parsed again, so the document handed over has nothing in its history: the first Ctrl+Z takes back the translator's own first word and can never bring the source's line back. That is what the third check is about.

One thing this slice undoes: S1 greyed Open source subtitle until a target was open, on the reasoning that a source is read beside a target. Decision 13 says the opposite about the moment a translation begins, so with nothing open at all that item is now alive and the command that makes the target is what waits for the source.

Two things found while running it, both fixed here. Every E2E run left about 77 MB in /tmp and nothing removed it: 318 of them filled a 31 GB tmpfs and broke a cargo test with a quota error mid-session. The harness now removes the tree it made when the run passes, and keeps it when the run fails, because that tree is the evidence. And the runner fails one check per run, a different one every time: specFileRetries is 1 when CI is set and 0 here, which re-runs a whole spec file rather than softening anything, and the count guard now counts unique titles so a retry cannot inflate it.

Changes

  • src-tauri/src/subtitle/mod.rs: subtitle_new_translation and new_translation, which build the target from the source on a scratch session and install it with no path.
  • src-tauri/src/lib.rs: the command registered.
  • src/hooks/useSubtitleFile.ts: newTranslation, which applies the opened document the way an adopted transcription is applied.
  • src/App.tsx: the File command, and Open source subtitle no longer waiting for a target.
  • src/i18n/en.ts: the item's words.
  • e2e/specs/new-translation.spec.js: four checks over S2's criteria, from the greying to the saved file and the source's bytes.
  • e2e/specs/source-column.spec.js and command-registry.spec.js: the greying that changed, and the third command in the declared list, the File menu and the flips table.
  • e2e/specs/chrome.spec.js: the keyboard walk over File, which now steps over two disabled runs instead of one.
  • e2e/lib/tally.js: the pass count is unique titles, so a retried spec file cannot inflate it.
  • e2e/wdio.conf.js: one spec-file retry on the runner and none here, the run's own data tree removed when it passes, and the count the guard holds.
  • e2e/README.md: two more ways a run tells you nothing, one of them paid for today.
  • BACKLOG.md: N41, the proposal the first save cannot make until the product knows what a language is.

How to verify it by using the app

  1. Start with nothing open. File offers Open source subtitle, alive, and New translation from source, greyed.
  2. Open fixtures/subtitles/srt/clean/basic-lf.srt as the source. The status bar says Source: SRT · 3 cues · LF and New translation from source wakes up.
  3. Choose it. The grid fills with three rows carrying the source's times, 00:00:02.120 to 00:00:04.880 on the first, with no text in any of them, and the Source column beside them showing what there is to translate.
  4. Press Ctrl+Z. Nothing happens and Undo is greyed: the emptying is not a step in this document's history.
  5. Type a line into the first row and press Ctrl+S. Sublore asks where to put the file, because it has never had one. Choose a name.
  6. Open what you saved in a text editor: your line is there, the three timings are there, and the two lines you did not translate are empty.
  7. The file you opened as the source is the bytes it was before any of this, and no backup of it was made.

Verified on Linux: full gate green step by step, and the battery green at 35 spec files of 35 with 287 checks. Two mutations each reddened its own check first, a translation that keeps the source's words, and an emptying done on the real session so undo could reach back to them.

@xAlcahest
xAlcahest merged commit 3816d53 into main Sep 6, 2026
14 checks passed
@xAlcahest
xAlcahest deleted the new-translation branch September 6, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant