summaryrefslogtreecommitdiff
path: root/translate.go
diff options
context:
space:
mode:
authorwuhei <wuhei@users.noreply.github.com>2026-11-19 18:36:43 +0100
committerwuhei <wuhei@users.noreply.github.com>2026-11-19 18:36:43 +0100
commitb457d19d9b2c634570300d0f73087e18b4ec4a4a (patch)
tree36e066cbe7abb486cb215ba9ccab6ba1550bb315 /translate.go
parentf5181ead5b0969fc1806fb714097b17b8d62d53b (diff)
downloadlilchinese-b457d19d9b2c634570300d0f73087e18b4ec4a4a.tar.gz
Enter keeps the sentence: green on screen, appended to a session log
- Enter (kiosk) turns the sentence green and appends it to a Markdown session log, default sessions/session-<timestamp>.md, -log to override. Written lazily, so a run that kept nothing leaves no file. - logs the whole sentence rather than the 9 characters on screen; the snapshot waits 450ms so the model's lookahead has decoded the final syllables - the English in the log is a fresh translation of that sentence, done on a single ordered worker off the audio path, so it never delays recognition - green clears with the next sentence, like the red cut screen - double Enter within 2s does not duplicate a line - tests: keep state, sentence selection, log format and dedupe
Diffstat (limited to 'translate.go')
-rw-r--r--translate.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/translate.go b/translate.go
index 66cee26..508e5db 100644
--- a/translate.go
+++ b/translate.go
@@ -115,6 +115,9 @@ func (t *translator) run() {
}
}
+// translateText is the synchronous form, used when a sentence is kept for the log.
+func (t *translator) translateText(text string) (string, error) { return t.translate(text) }
+
func (t *translator) translate(text string) (string, error) {
ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second)
defer cancel()