Taewoo Park

Projects

claude-korean-translator

A model reasons best in one language and I think best in another, and that gap is a tax paid in nuance. This extension removes it in both directions without letting a single character of code get translated.

Think in your own language without giving up the model's best reasoning

Write the prompt in Korean and press an injected send button; it is translated to English in place and sent, so the model reasons in the language it is strongest in. Every English answer then carries a collapsible Korean block beneath it, toggled per message.

The aim I set myself in the semester retrospective was exactly that narrow: preserve the code and the Markdown, and lower only the language barrier. Nothing about the conversation changes except which language each side of it is read in.

It is an unofficial client-side assistant with no affiliation to the model's vendor, running inside the user's own session — which is the only position from which the person who has this problem can fix it.

An English answer rendered in Korean with headings, lists and code blocks intact
An English answer rendered in Korean with headings, lists and code blocks intact

The obvious implementation answers the question instead of translating it

Handing a prompt to a language model and asking it to translate has a specific, reliable failure: explain useEffect comes back as an explanation of useEffect. The instruction is read as an instruction rather than as a string, and the user's actual question is consumed on the way.

So I never let that happen here. The translation path is only a translation path — the text is transformed and passed on, and nothing in the pipeline is in a position to respond to it.

Placeholder masking, because machine translation translates everything

Left alone, a translation model translates everything it can see. It turns useEffect into UseEffect, translates the comments inside a code block, and breaks URLs. A model backend can at least be told not to touch them; an on-device neural translator has no such handle, so the protection has to happen before the text is handed over.

The scheme runs in two steps. Fenced blocks are lifted out of the translation stream entirely, preserved byte for byte down to their line breaks, and re-inserted at exactly the same position — the model never sees them at all. Then, in the remaining prose, inline code spans, URLs, email addresses and file paths are replaced with rare mathematical bracket sentinels that machine translation reliably passes through untouched, and restored afterwards.

I enumerate what is protected rather than guessing at it: fenced blocks, inline code, https:// URLs, address-shaped strings, and relative, absolute and Windows-style file paths. The net effect is that my code reaches the model exactly as written and its code comes back exactly as sent, while only the natural language around them changes language.

Backend selection, and the one-time on-device model download
Backend selection, and the one-time on-device model download

Two backends, and the default is the one that costs nothing

The default backend is Chrome's built-in on-device neural translator. It is free, needs no key, downloads its model once per language pair in a few seconds, and works offline permanently afterwards. Nothing leaves the device — there is no server and no telemetry in that path at all.

The optional backend is the user's own Anthropic key running a small fast model, which buys a step up in nuance at the cost of their own usage, and sends text only to the vendor's API. My original design had this as the only path; keeping it as an option while moving the default on-device is the whole shape of the argument I am making.

Both protect code identically. The key-based backend can additionally instruct the model to leave marked spans alone, but it still runs the same masking underneath, because an instruction is a request and a mask is a guarantee.

Where the key lives, and where it deliberately does not

On the on-device path everything happens inside the content script: translate, restore the masks, write the result back. Nothing is transmitted anywhere. On the key path the text goes to the extension's service worker and the key exists only there — never exposed to the page — held in the browser's local extension storage and read by the worker alone.

Under Manifest V3 there is no remote code: everything that runs is bundled with the extension. I added no logging layer. The privacy posture is short enough to state in full, which is itself the feature.

Writing into an editor that fights back

The composer on the target site is a rich-text editor, which means the naive approach fails in a way that only shows up later: write the translated text straight into the DOM and the site's own draft restore quietly reverts it. So I set the editor's content through the editor's own interface, updating the real document state rather than its rendering.

I collect the site's obfuscated selectors into a single module so a UI change is a one-file patch, and a diagnostic function can be called from the page console to report which selectors are still resolving. The repository keeps DOM fixtures and an integration harness that performs a real round trip, with the verification record written down.

Unofficial, and honest about what that costs

Installation is from an unpacked folder or a release archive, because Chrome blocks automatic installation of packaged extensions from outside its store. Developer mode, load the folder, open the options page, download the on-device model once — or switch to the key backend and paste a key.

I state the maintenance cost rather than hiding it: the target site changes its interface often, and when a selector breaks the fix is a patch to the module that holds them. The on-device engine needs a recent Chrome that ships the built-in translator; without it the extension falls back to the key backend.

It is a small piece of software with a precise claim — Korean in the box, English on the wire, Korean on the screen, and the code untouched from one end to the other.