feat: i18n system, lang switch component, english subtitles, UI improvements, roadmap update

This commit is contained in:
2026-06-09 15:40:51 +08:00
parent 6b4114af43
commit 59aed77199
16 changed files with 410 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ref, watch, computed } from 'vue'
interface SubCue {
start: number
@@ -10,20 +10,25 @@ interface SubCue {
const props = defineProps<{
currentTime: number
subtitleUrl: string | null
subtitles?: Record<string, string> | null
lang?: string
}>()
const cues = ref<SubCue[]>([])
const currentText = ref('')
const loadedUrl = ref('')
watch(() => props.subtitleUrl, async (url) => {
const effectiveUrl = computed(() => {
if (props.lang && props.subtitles?.[props.lang]) return props.subtitles[props.lang]
return props.subtitleUrl
})
watch(effectiveUrl, async (url) => {
if (!url) {
cues.value = []
currentText.value = ''
loadedUrl.value = ''
return
}
if (url === loadedUrl.value) return
loadedUrl.value = url
try {
const resp = await fetch(url)