Urgent.News

What's breaking now, across thousands of outlets.

Tech

I'm still learning Swedish, so I built a dual-subtitle extension for Nordic public TV

I'm a developer living in Sweden, and I'm still learning Swedish. The best practice material I've found isn't a course: it's public TV. SVT Play, UR, NRK and DR have huge free libraries, and almost every programme comes with subtitles in the original language. The problem is the player. It shows one subtitle track at a time, and there is no subtitle in my language. Swedish-only subtitles are too…

I am a writer based in Sweden, and I am still learning the Swedish language. The most effective learning material I have discovered is public television. SVT Play, UR, NRK, and DR provide extensive libraries of free content, with subtitles available in the original language for nearly every program. The challenge lies in the player, which displays a single subtitle track at a time, and there is no support for my language.

Swedish-only subtitles are too difficult for beginners, and pausing to look up words disrupts the viewing experience. Language learning tools like Language Reactor work well for platforms like Netflix and YouTube, but not for the Nordic broadcasters. Therefore, I created Nordic Dual Subs, a free browser extension that displays both the original Swedish or Norwegian/Danish subtitle line and its translation in your chosen language, perfectly synchronized.

The extension presents two subtitle lines simultaneously on SVT Play, SVT Barn, UR Play, NRK TV, and DR TV: the original Swedish, Norwegian, or Danish line alongside its translation (covering 29 languages, including Arabic, Persian, Somali, Tigrinya, Ukrainian, and Chinese, with right-to-left languages supported). Clicking any word pauses the video, providing the meaning, base form (e.g., sprang → springa), English gloss, and the option to save the word with its sentence for later review via spaced repetition or export to Anki as a CSV file.

For videos where Swedish text is embedded in the picture, the extension uses Tesseract (via WebAssembly) to read the text and provide translations.

Key technical aspects include capturing the appropriate subtitle files (in WebVTT format) from each broadcaster's APIs, which all utilize the same infrastructure as their native players. A content script determines the currently playing program by monitoring URL changes across the five sites, triggers the background worker to fetch and parse the subtitle file, and overlays the translation within the site's own player interface, ensuring no overlap with the native subtitles.

The broadcaster's original subtitles are hidden to avoid visual clutter. Translation is performed without incurring costs by leveraging Google's free web endpoint from each browser's IP address, with translation pairs sent to a backend for aggregation. A line is deemed trustworthy when confirmed by translations from two different networks (ensuring consistency, as Google's translations are deterministic).

Trusted translations are then distributed to users based on a hash of the subtitle line, preventing unauthorized access to the subtitle text. In case of Google rate limits, a DeepL fallback is utilized to maintain translation coverage near the current playback position. The backend infrastructure utilizes Cloudflare's free tier, comprising a single Worker and a D1 SQLite database for anonymous installations secured with HMAC session tokens, along with optional Google sign-in for word sync and Stripe for a potential future Pro plan.

To manage API usage, a small GitHub Action monitors daily limits, sending an email warning if thresholds are approached.

The project employs a unified codebase to generate builds for Chrome/Edge and Firefox, with slight modifications for Firefox (MV3 service worker replaced with background scripts, OCR functionality moved to a background page, and the inclusion of touch controls for Android). Upon initial release, the extension encountered issues with DR TV, which requires a login and geo-restricts content within Denmark.

The latest version addresses these concerns by providing clear error messages (e.g., requiring DR login or indicating regional restrictions). The development process incorporated significant assistance from an AI coding assistant, handling much of the coding and testing while I focused on project direction, manual testing, and troubleshooting.

The open-source nature of the project allows users to access the full source code and documentation at https://dualsubs.zexa.se, with extensions available on the Chrome Web Store and Firefox Add-ons pages.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Pertulma ultramarina: two measurements at zero and what Bing taught me

Pertulma ultramarina is the phrase of the SEO challenge among friends that Andrés Londoño organizes at londo.info/reto-seo.

  • Pertulma ultramarina challenge organized by Andrés Londoño, launched November 6, 2026
  • ChatGPT, Gemini, and Claude used as judges with internet search activated
  • First measurement on November 7 yielded 0 out of 9 points

More from Wednesday 11 November →