Live — extension v2.6.0
Learn Languages As You Browse
Translation that lives inside the page you are reading. Two clients, one wire format, and an answer that arrives while it is still being written.
The problem
A translation was a request that returned a finished object. The reader stared at a spinner for as long as the slowest of four languages took.
The result
Answers stream as they are written, a parser reads the JSON before it is valid, and pricing changes on the server without a store review.

The card, over the page you were already reading

Four languages at once, each written as it arrives

Practice, built from the words you actually saved
The engineering decisions, one line each. Open any for the detail.
Problem
Four languages arrive in one model response. Waiting for the closing brace means the reader stares at a spinner for the length of the slowest one, and JSON.parse refuses everything up to the final character.
Approach
A hand-written scanner walks the partial buffer and emits whatever has closed so far, so a value can be shown before its own closing quote arrives. It tracks escape state, and trims a dangling \u12 rather than decoding a broken surrogate. Deltas land as fast as the network delivers them; the view coalesces them into one paint per animation frame, so a hundred tokens a second cost sixty renders.
Problem
chrome.runtime.sendMessage is request/response — it cannot carry tokens as they arrive. A content script also runs in the host page's origin, so it is bound by that page's CORS policy and cannot call the API at all. And an MV3 service worker is killed when it looks idle, which a long stream does.
Approach
Every lookup opens a named port to the worker. The worker is the only thing that fetches, so there is one device id, one cache and one error vocabulary across the card, the popup and the options page. The port staying open is also what keeps the worker alive for the length of the request — and closing it, when a card is dismissed or a retry starts, aborts the fetch behind it instead of leaving it to finish into nothing.
Problem
The card renders on any page on the web. Every one of those pages has its own CSS, its own stacking contexts, its own transformed and scrolling ancestors — and none of them were written with a guest in mind.
Approach
One fixed, pointer-transparent layer is attached to the document element and everything lives inside its shadow root, so no rule crosses in either direction. The card is positioned in viewport coordinates against a live Range rather than the click's page coordinates, which is what makes the anchoring hold inside scroll containers, transformed ancestors and iframes as the reader scrolls.
Problem
Every translation costs a model call. Anonymous readers, free accounts and subscribers cannot share a bucket, and a limit that lives in the extension bundle can only be changed by shipping a release and waiting for the store to review it.
Approach
The edge middleware resolves the caller to an audience — guest, free or pro — and spends both a burst window and a daily window in Upstash Redis before the route runs. Every response carries the limit, the usage and the tier as headers; every rejection carries them in the body along with the reset time. The client renders the server's numbers, and keeps its own hardcoded copies only as a fallback for a deployment older than the current one.
Problem
Languages, tone and interface language can be changed in the extension or on the website, offline or online, and both write the same account document. Naive syncing either loses the older device's edit or bounces one change between the two forever.
Approach
syncDecision() settles it from three timestamps — the server's updatedAt, the stamp the extension last adopted, and when the reader last changed something on this device — so the newest edit stands and a tie goes to the account. Adopting the server's copy is written with a fromRemote flag that deliberately does not stamp a local change, which is what stops the echo. It reconciles on install, on browser start, whenever either page opens, and 1.5 seconds after a local change settles. Device-shaped preferences — theme, trigger mode, per-site rules — never leave the device.
Problem
An extension that hardcodes its backend URL has to be edited before every release, and a stored origin in chrome.storage can outlive the build that wrote it — leaving a production copy quietly talking to a dev server.
Approach
The origin is one tagged line in constants.js that the build script rewrites in a staged copy, resolved from NEXT_PUBLIC_APP_URL — the same variable the web app reads — through --url=, the environment, then the app's own .env files in Next.js's precedence order. Tracked source carries localhost, so an unbuilt checkout works unpacked and a production URL is never committed. Packaging refuses a loopback or plain-http origin outright, and the apiUrl setting was removed so nothing can be stranded in storage.
Problem
chrome.i18n is pinned to the browser's UI language. That is exactly right for a Web Store listing and exactly wrong for an interface that has to follow whatever the signed-in reader chose on the website.
Approach
The store listing keeps chrome.i18n and four keys across 51 store locales. Everything rendered at runtime is resolved separately: English is compiled into the bundle so nothing is ever blank, the other eleven locales are fetched on first use, and the active one follows the LASU_LOCALE cookie the website sets — mirrored into storage by the worker on startup and on change. Language names and relative times are formatted through Intl.DisplayNames and Intl.RelativeTimeFormat rather than translated by hand. Every request also carries explainLang, so the meaning and the usage note come back in the reader's language whatever is being translated into whatever — and it is part of both cache keys, so switching languages never serves a stale explanation.
Problem
A vocabulary drill that only accepts exact strings punishes an accent, a trailing article or a single slipped key — which teaches the reader to distrust it rather than to learn from it.
Approach
Answers are normalised first — decomposed to strip diacritics, lowercased, depunctuated, leading articles removed in each of the languages that has them. What survives is compared by Levenshtein distance against a tolerance that scales with the length of the expected word, so a long word forgives two edits and a short one forgives none. That produces three verdicts rather than two: correct, close, and wrong. The XP curve behind it is quadratic, so each level costs more than the last.
Have a project? Let’s talk.