Skip to content
 
 

Repository files navigation

DualSubs - Language Learning Subtitles

A Chrome extension for learning languages by watching Netflix, YouTube, Prime Video, and Disney+ with dual subtitles.

Features

  • Dual Subtitles: Display two language subtitles simultaneously
  • Word Hover Definitions: Hover over any word to see instant dictionary definitions
  • Offline Translation: Translate subtitles offline using Bergamot WASM
  • Language Packs: Download only the languages you need
  • Platform Support: Netflix, YouTube, Prime Video, Disney+

Tech Stack

  • TypeScript + React
  • Vite + @crxjs/vite-plugin (Chrome extension bundling)
  • AssemblyScript (Dictionary WASM)
  • Bergamot Translator (Offline translation WASM)
  • IndexedDB (Local storage)

Development Setup

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Install dependencies
npm install

# Build the extension
npm run build

# Development mode with hot reload
npm run dev

Building WASM

# Build AssemblyScript dictionary module
npm run build:wasm

Loading in Chrome

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable "Developer mode" (toggle in top right)
  3. Click "Load unpacked"
  4. Select the dist folder

Project Structure

src/
├── manifest.json           # Extension manifest (Manifest V3)
├── background/
│   └── service-worker.ts   # Background service worker
├── content/
│   ├── index.ts            # Content script entry
│   ├── adapters/           # Platform-specific subtitle extraction
│   │   ├── youtube.ts
│   │   ├── netflix.ts
│   │   └── ...
│   ├── subtitle-controller.ts
│   └── overlay/            # React subtitle overlay UI
├── popup/                  # Settings popup UI
├── wasm/
│   ├── dictionary/         # Dictionary lookup integration
│   └── bergamot/           # Translation integration
├── storage/                # IndexedDB wrapper
└── shared/                 # Shared types and utilities

assembly/                   # AssemblyScript source
public/
├── icons/
└── wasm/                   # Compiled WASM files

Platform Adapters

Each streaming platform requires a specific adapter to extract subtitles:

  • YouTube: Intercepts /youtubei/v1/player API for caption track URLs
  • Netflix: Intercepts /metadata requests for TTML subtitle URLs
  • Prime Video: Monitors network for WebVTT subtitle files
  • Disney+: Intercepts subtitle playlist requests

Language Packs

Language packs contain:

  • Dictionary data (~50-100MB per language)
  • Bergamot translation model (~15-32MB per language pair)

Packs are downloaded on-demand and stored in IndexedDB.

Monetization

Uses ExtensionPay for $5 one-time purchase:

  • Free tier: Limited to 1 language pair
  • Paid: All language pairs unlocked

Building for Production

# Full production build
npm run build

# The extension will be in the `dist` folder
# Zip for Chrome Web Store submission

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT

About

A chrome extension for displaying dual subtitles for popular streaming sites, for the intention of learning languages. Uses WASM and bergmot models to translate text tracks in real time. Includes vocab lists and customization features.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages