Skip to content

Lingua web edition: wait for the translation (it showed [object Promise]) - #131

Merged
juw12 merged 1 commit into
mainfrom
agent/lingua-web-translate
Nov 23, 2026
Merged

juw12 merged 1 commit into
mainfrom
agent/lingua-web-translate

Conversation

@juw12

@juw12 juw12 commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Found while trying a translation on Lingua's page for the new Mac and Android apps.

Fault. CaptionPipeline.update() is synchronous (ported from the laptop app), but in the browser the translate function is a network call that returns a promise. Web capture (web.html) and Mobile translate (mobile.html, text and screenshot) put that promise into the transcript: every line read [object Promise], and the status said "Translated." whether or not the gateway had answered. Read picture awaits its calls and was not affected. Share to phone serves the same pages.

Fix. CaptionPipeline.updateAsync() waits for every translation update() started and puts the text into the lines and the cache; when one fails, what did not arrive is forgotten so the next try asks again, and the error reaches the page's own failure message. The two pages call it. Offline cache name goes to v6.

Tried on this branch in WebKit and in Chromium as a Pixel 7, with a stand-in gateway on the Mac (OpenAI chat format, CORS): two sentences translated and shown one under the other; with the gateway gone the status says "Translate failed: Could not reach the gateway..." and the transcript keeps the earlier lines. On the live page before the fix both engines showed [object Promise].

…le translate showed [object Promise] and said Translated. even when the gateway had not answered)
@juw12
juw12 merged commit 6b12629 into main Nov 23, 2026
2 checks passed
@juw12
juw12 deleted the agent/lingua-web-translate branch November 23, 2026 15:43
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