From ce1decbed56a3d9f79d09d217cfb75c0b3284a62 Mon Sep 17 00:00:00 2001 From: Nice Try Date: Fri, 26 Jun 2026 13:34:50 +0000 Subject: [PATCH] docs: plan multilingual subtitle support --- docs/plans/multilang-subtitles.md | 644 ++++++++++++++++++++++++++++++ 1 file changed, 644 insertions(+) create mode 100644 docs/plans/multilang-subtitles.md diff --git a/docs/plans/multilang-subtitles.md b/docs/plans/multilang-subtitles.md new file mode 100644 index 0000000..1b9d271 --- /dev/null +++ b/docs/plans/multilang-subtitles.md @@ -0,0 +1,644 @@ +# Multi-Language Subtitles Implementation Plan + +> **For Hermes / future AI assistants:** Use `offlineacademy-dev`, `writing-plans`, and `test-driven-development` before implementing this plan. Implement task-by-task on branch `feature/multilang-subtitles`. Do not modify unrelated watch-page sidebar behavior, donation buttons, Docker docs, or quiz features while working on this branch. + +**Goal:** Add first-class multi-language subtitle support to OfflineAcademy so one video lesson can expose multiple selectable subtitle tracks such as English, Spanish, Japanese, Filipino, Chinese, etc. + +**Current State:** OfflineAcademy already detects one `.srt` or `.vtt` subtitle file whose base name exactly matches a video file, stores it in `Lesson.subtitlePath`, and renders one hardcoded English `` in `components/VideoPlayer.tsx`. + +**Target State:** OfflineAcademy detects multiple language-suffixed subtitle files per video, stores them as structured subtitle tracks, renders all tracks in the video player, and provides a clear subtitle selector in the existing player settings menu. + +**Tech Stack:** Next.js App Router, React client components, Prisma, SQLite, native HTML video `` elements, local course files served through `/api/files/[...path]`. + +--- + +## 1. User-Facing Behavior + +### Supported Folder Pattern + +Preferred pattern: + +```text +My_Courses/ +└── Course Name/ + └── Module Name/ + ├── 01 - Lesson.mp4 + ├── 01 - Lesson.en.vtt + ├── 01 - Lesson.es.vtt + ├── 01 - Lesson.ja.vtt + └── 01 - Lesson.fil.vtt +``` + +Also accept single-file legacy pattern: + +```text +01 - Lesson.mp4 +01 - Lesson.vtt +``` + +Legacy matching should continue to work and should be treated as English unless the implementation can confidently infer otherwise. + +### Supported Extensions + +- `.vtt` — preferred browser-native format. +- `.srt` — detected by scanner; should either be served as-is for compatibility or converted/proxied to VTT before being used in ``. + +### Language Naming Convention + +Use language suffixes immediately before the subtitle extension: + +```text +