feat(transcript): add Chinese script choices

This commit is contained in:
yiling
2026-12-05 11:43:32 +08:00
parent 6c74413375
commit 70e4c63323
19 changed files with 242 additions and 29 deletions
@@ -5,6 +5,7 @@ import { NativeSelect, NativeSelectOption } from '@/ui/components/ui/native-sele
import { ScrollArea } from '@/ui/components/ui/scroll-area'
import type { MediaController } from '@/ui/components/viewers/types'
import { savedTranscriptKey } from '@/ui/hooks/use-video-transcript'
import { getChineseTranscriptLanguageName } from '@/ui/lib/transcript'
import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import { getLocale } from '@/ui/paraglide/runtime.js'
@@ -69,7 +70,10 @@ export const TranscriptPanel = memo(function TranscriptPanel({
const options = useMemo(() => {
const names = new Intl.DisplayNames(locale, { type: 'language' })
return languages
.map((code) => ({ code, name: names.of(code) ?? code }))
.map((code) => ({
code,
name: getChineseTranscriptLanguageName(code) ?? names.of(code) ?? code,
}))
.sort((a, b) => a.name.localeCompare(b.name, locale))
}, [languages, locale])
const [preferredLanguage, setPreferredLanguage] = useState<string>(locale)