fix(stt): offer every whisper.cpp language in the regenerate picker (cherry-pick to 1.10.0.rc2) - #475
Conversation
The "Regenerate as" selector only listed 11 hand-picked languages while the shipped whisper small model transcribes ~100. TRANSCRIPT_LANGUAGE_CODES in schema/index.ts is now the single source of truth (mirrors whisper.cpp's own g_lang table) for both the zod schema and the picker, which sorts by name localized via Intl.DisplayNames (falling back to whisper's English name) instead of a hardcoded list of bare codes.
A subagent review caught that the first commit only widened SourceTranscriptModal, which NewEditorShell never mounts (LeftPanel is always rendered with active="chat"). The picker a real user opens is MediaStage.tsx's own, separate <select>, still hardcoded to auto/en/fr/es. - Extract language-label resolution into lib/ai-edition/transcription/languageLabels.ts (languageLabel, sortedLanguageOptions) so both pickers share one implementation instead of drifting the way the original hand-duplicated lists did. - Wire MediaStage.tsx's picker onto it. - Fix the "detected language" pill in both components to show a localized name instead of the raw whisper code. - Guard Intl.Collator the same way Intl.DisplayNames already was, and cache a failed Intl.DisplayNames construction instead of retrying it on every language in the list. - Move TRANSCRIPT_LANGUAGE_NAMES out of the schema module (bundled into the Electron main process) into the new UI-facing module, and collapse three copies of `Exclude<TranscriptLanguageCode, "auto">` into one exported WhisperLanguageCode type.
CodeRabbit review: AxcutTranscript.language is an unvalidated z.string().min(1), so a stored transcript holding a code outside the ~100 known ones would leave the select unmatched and submit a code Whisper can't resolve. Parse it through transcriptLanguageSchema and fall back to "auto" in both the init and the open-sync effect.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Cherry-pick of #468 onto
release/v1.10.0for1.10.0.rc2, per request. Clean cherry-pick, no conflicts:62d6809ffix(stt): offer every whisper.cpp language in the regenerate picker05eb06b4fix(stt): wire the language list into the picker that's actually live8d7e4ddafix(stt): validate regenLang against the known code listSee #468 for the full description, the subagent code review that caught the second commit's fix, and the CodeRabbit review (0 actionable comments remaining).
Test plan
npx tsc— cleannpx biome checkon the changed/new files — cleannode scripts/check-docs.mjs— cleanvitest runonschema/index.test.ts,transcriptionStore.test.ts,transcription/status.test.ts,TranscriptionStatus.test.tsx,TranscriptPane.gating.test.tsx,MediaStage.test.ts— all passing🤖 Generated with Claude Code