Urgent.News

What's breaking now, across hundreds of outlets.

AI

Building a Layout-Preserving Bilingual Web Translator & Streaming Batch LLM Extension in MV3

Most browser translation extensions suffer from three recurring UX problems: Appending translated or tags inline breaks compact flex navbars and buttons. Translating an entire article sentence-by-sentence with an LLM is slow and wastes tokens on repeated system prompts. Many modern extensions require accounts, subscriptions, or inject ads. I built Modern Translator (GPL-3.0, v1.1.1) — a…

Browser translation extensions often encounter three common user experience issues: translated font or span tags disrupt compact flex navigation bars and buttons. Translating lengthy articles sentence by sentence with an LLM is sluggish and inefficient, wasting tokens on repetitive system prompts. Many contemporary extensions demand user accounts, subscriptions, or intrusive advertisements.

To address these problems, I developed Modern Translator (GPL-3.0, v1.1.1), an entirely free, ad-free, and open-source browser extension for Chrome, Edge, and Firefox (version 140 and above).

Modern Translator employs a layout engine called Spatial-Budget Bilingual Layout & Ruby Rail Solver. Rather than indiscriminately appending text beside each DOM node, the engine calculates available spatial budgets for inline and block elements. Regular prose paragraphs are rendered in smooth bilingual blocks. Compact UI elements, such as navigation bars, buttons, and badges, automatically transition to Ruby dual-line stacking, preventing translations from overflowing or awkwardly wrapping menus.

Translation segments identical to the source text (like code identifiers, proper nouns, and matching abbreviations) are skipped automatically.

The Super-Streaming LLM Batch Scheduler in Manifest V3 service worker (src/background/llmBatchStream.js) is another key feature. By grouping adjacent viewport segments into streaming batch calls, the latency is reduced, and token usage is minimized by sharing context across paragraphs. This scheduling works in harmony with a global translation cache (translationCache.js), ensuring that toggling between bilingual, original, and translation modes is instantaneous.

The extension supports Google Translate, Microsoft Translator, any OpenAI-compatible endpoint, and an optional community-sponsored free LLM quota.

Modern Translator also incorporates Shadow DOM Isolation and Cross-Iframe Selection. Popovers and floating controls are mounted within isolated Shadow DOM trees (react-shadow), ensuring that host stylesheets (from sites like GitHub, Notion, and documentation pages) do not leak. Chrome MV3 clipboard writes and TTS audio playback occur via an offscreen document, while Firefox utilizes a compatible background.scripts manifest automatically.

In version 1.1, Modern Translator expanded its functionality to transform video players into a language study workspace. Subtitle jump and replay functions (represented by / shortcuts) are integrated directly within the player. The AI pre-study component creates vocabulary flashcards, extracted chapter by chapter (including IPA pronunciation, CEFR level, timestamp jump, and self-test mode).

A local wordbook, complete with mastery tracking and one-click TSV export compatible with Anki and Excel, is also included. All settings, custom API keys, and the wordbook remain strictly on your device; no login is required. Modern Translator's source code is freely available on GitHub under the GPL-3.0 license, and it is available on the Chrome Web Store and Microsoft Edge Add-ons. Users are encouraged to provide feedback, report issues, and submit pull requests.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in AI

AI May Have Cracked Math's Most Famous Unsolved Problem

An AI-assisted proof 17 million lines long may have just cracked the most famous unsolved problem in mathematics. It is called the Riemann Hypothesis.

  • Mathematicians claim to have solved the Riemann Hypothesis using AI.
  • Levent Alpöge released a 17 million line proof on November 20, 2026.
  • Rival human-only proof proposed by Alessandro Masullo on same day.

Shipping Verified Local Alerts With an AI Breaking News Video Generator

Running an AI breaking news video generator inside a small regional newsroom makes sense only when it speeds up formatting, never when it shortcuts verification. At 6:40 a.m., when monsoon runoff closes a provincial highway junction or a municipal water main fails before morning traffic builds, a two-person digital desk faces an immediate…

  • AI generator expedites video formatting without sacrificing verification.
  • Editors prepare concise copy under 120 words with location, corridor, time window, official source.

More from Saturday, 28 November 2026 →