Initial AI video editor prototype

This commit is contained in:
haixin.yang committed 2026-07-09 12:48:04 +08:00
commit d356816dda
22 files changed
+12866

No files matched your search

+760
View File
@@ -0,0 +1,760 @@
export const LANGUAGE_STORAGE_KEY = "ai-voiceover-ui-language";
export const APP_LANGUAGES = [
{ id: "zh", name: "中文", nativeName: "中文", hint: "简体中文" },
{ id: "en", name: "English", nativeName: "English", hint: "English" },
{ id: "ja", name: "Japanese", nativeName: "日本語", hint: "Japanese" },
{ id: "ko", name: "Korean", nativeName: "한국어", hint: "Korean" },
{ id: "es", name: "Spanish", nativeName: "Español", hint: "Spanish" },
{ id: "fr", name: "French", nativeName: "Français", hint: "French" },
{ id: "de", name: "German", nativeName: "Deutsch", hint: "German" },
{ id: "pt", name: "Portuguese", nativeName: "Português", hint: "Portuguese" },
{ id: "th", name: "Thai", nativeName: "ไทย", hint: "Thai" },
{ id: "vi", name: "Vietnamese", nativeName: "Tiếng Việt", hint: "Vietnamese" },
];
export const UI_COPY = {
zh: {
languageKicker: "AI Voice Studio",
languageTitle: "选择界面语言",
languageSubtitle: "设置一次后会自动保存,下次进入直接使用该语言。",
languageSaved: "之后可在设置里修改",
projectTitle: "AI 配音项目",
autosave: "已自动保存",
collapseSidebar: "折叠侧栏",
undo: "撤销",
redo: "重做",
preview: "预览",
pause: "暂停",
play: "播放",
exporting: "导出中",
exportMp4: "导出 MP4",
settings: "设置",
exportSettings: "导出设置",
exportCaptions: "导出字幕",
enableAudioTrack: "启用音频轨",
enableSourceTrack: "启用视频原声轨",
enableMusicTrack: "启用背景音乐轨",
checkModelCache: "检查模型缓存",
language: "语言",
toolbar: "工具栏",
media: "媒体",
text: "文本",
caption: "字幕",
audio: "音频",
transition: "转场",
effects: "效果",
stickers: "贴纸",
filters: "滤镜",
uploadTab: "本地上传",
libraryTab: "素材库",
mineTab: "我的素材",
uploadDropTitle: "点击上传或拖拽图片/视频/音频到此处",
uploadSupport: "支持 JPG、PNG、WebP、MP4、WebM、MOV、MP3、WAV、M4A",
emptyAssets: "上传图片或视频后,这里会显示你的本地素材。",
previewEmptyTitle: "上传图片或视频开始剪辑",
previewEmptySubtitle: "时间线默认保持为空",
currentMediaAlt: "当前上传素材预览",
fit: "适合",
cover: "填充",
fullscreenPreview: "全屏预览",
backTwoSeconds: "后退 2 秒",
forwardTwoSeconds: "前进 2 秒",
deleteTrack: "删除选中轨道",
duplicateTrack: "复制选中轨道",
cutSegment: "剪切当前片段",
cropCanvas: "裁剪画面",
addSegment: "片段",
removeSegment: "片段",
shortenSegment: "缩短当前片段",
lengthenSegment: "加长当前片段",
zoomOut: "缩小时间线",
fitTimeline: "缩放适配",
zoomIn: "放大时间线",
imageTrack: "图片",
sourceTrack: "视频原声",
voiceTrack: "配音音频",
musicTrack: "背景音乐",
visible: "可见性",
lock: "锁定",
dragPlayhead: "拖拽播放头",
dragImageDuration: "拖拽调整图片时长",
exportInProgress: "导出中",
exportProgress: "导出进度",
preparingExport: "准备导出",
aiVoice: "AI 语音",
voiceSynthesis: "语音合成",
myVoices: "我的声音",
history: "历史记录",
modelReady: "模型待命",
inputScript: "输入文案",
clear: "清空",
chooseVoice: "选择声音",
allVoices: "全部语音",
speed: "语速",
volume: "音量",
generateVoice: "生成语音",
regenerateVoice: "重新生成语音",
download: "下载",
use: "使用",
remove: "移除",
delete: "删除",
generating: "生成中",
generationProgress: "生成进度",
favoriteVoice: "收藏声音",
favorite: "收藏",
saved: "已收藏",
showCaptions: "显示字幕",
top: "顶部",
middle: "居中",
bottom: "底部",
fontSize: "字号",
currentCaption: "当前字幕",
showCurrentCaption: "显示当前字幕",
deleteCurrentCaption: "删除当前字幕",
noCaptionSegments: "当前没有字幕片段。",
openingHook: "开场强调",
productPoint: "产品卖点",
actionGuide: "行动引导",
templateSuffix: "请替换为你的文案。",
audioPanel: "音频",
aiVoiceEntryTitle: "AI 配音",
aiVoiceEntryDesc: "输入文案、选择声音并生成语音",
currentVoice: "当前声音",
voiceDuration: "配音时长",
sourceAudio: "视频原声",
sourceDuration: "原声时长",
bgm: "背景音乐",
musicDuration: "音乐时长",
notSeparated: "未分离",
notAdded: "未添加",
downloadCurrentWav: "下载当前 WAV",
downloadBgm: "下载背景音乐",
downloadSource: "下载视频原声",
deleteSource: "删除视频原声",
deleteBgm: "删除背景音乐",
transitionApplied: "转场已应用到导出预览状态",
effectApplied: "效果已应用到预览和导出",
stickerApplied: "贴纸已应用到预览和导出",
filterApplied: "画面风格已更新",
noMediaHistory: "生成配音后,历史记录会保存在当前浏览器会话里。",
noFavoriteVoices: "在语音合成里收藏声音后,会显示在这里。",
recordVoice: "录制声音",
startRecording: "开始录音",
stopRecording: "停止录音",
recording: "录音中",
recordedVoices: "我的录音",
noRecordings: "还没有录音。点击开始录音后,会自动写入配音音频轨。",
recordingReady: "录音已写入配音音频轨",
recordingUnsupported: "当前浏览器不支持麦克风录音",
recordingPermissionDenied: "无法访问麦克风,请检查浏览器权限",
assetAudio: "音频",
assetVideo: "视频",
assetImage: "图片",
deleteAsset: "删除素材",
imageHidden: "图片轨已隐藏",
dropVisualHere: "释放到图片轨",
dropVoiceHere: "释放到配音音频轨",
dropSourceHere: "释放后分离视频原声",
dropMusicHere: "释放到背景音乐轨",
},
en: {
languageKicker: "AI Voice Studio",
languageTitle: "Choose Interface Language",
languageSubtitle: "Saved once, then this editor opens in your language next time.",
languageSaved: "You can change it later in Settings",
projectTitle: "AI Voiceover Project",
autosave: "Autosaved",
collapseSidebar: "Collapse sidebar",
undo: "Undo",
redo: "Redo",
preview: "Preview",
pause: "Pause",
play: "Play",
exporting: "Exporting",
exportMp4: "Export MP4",
settings: "Settings",
exportSettings: "Export Settings",
exportCaptions: "Export captions",
enableAudioTrack: "Enable voice track",
enableSourceTrack: "Enable source audio",
enableMusicTrack: "Enable background music",
checkModelCache: "Check model cache",
language: "Language",
toolbar: "Toolbar",
media: "Media",
text: "Text",
caption: "Captions",
audio: "Audio",
transition: "Transitions",
effects: "Effects",
stickers: "Stickers",
filters: "Filters",
uploadTab: "Upload",
libraryTab: "Library",
mineTab: "My assets",
uploadDropTitle: "Click or drop image, video, or audio here",
uploadSupport: "Supports JPG, PNG, WebP, MP4, WebM, MOV, MP3, WAV, M4A",
emptyAssets: "Your local assets will appear here after upload.",
previewEmptyTitle: "Upload image or video to start editing",
previewEmptySubtitle: "Timeline starts empty by default",
currentMediaAlt: "Current uploaded media preview",
fit: "Fit",
cover: "Fill",
fullscreenPreview: "Fullscreen preview",
backTwoSeconds: "Back 2 seconds",
forwardTwoSeconds: "Forward 2 seconds",
deleteTrack: "Delete selected track",
duplicateTrack: "Duplicate selected track",
cutSegment: "Cut current segment",
cropCanvas: "Crop canvas",
addSegment: "Segment",
removeSegment: "Segment",
shortenSegment: "Shorten segment",
lengthenSegment: "Lengthen segment",
zoomOut: "Zoom out",
fitTimeline: "Fit timeline",
zoomIn: "Zoom in",
imageTrack: "Image",
sourceTrack: "Source audio",
voiceTrack: "Voiceover",
musicTrack: "Music",
visible: "visibility",
lock: "lock",
dragPlayhead: "Drag playhead",
dragImageDuration: "Drag to adjust visual duration",
exportInProgress: "Exporting",
exportProgress: "Export progress",
preparingExport: "Preparing export",
aiVoice: "AI Voice",
voiceSynthesis: "Voice synthesis",
myVoices: "My voices",
history: "History",
modelReady: "Model ready",
inputScript: "Script",
clear: "Clear",
chooseVoice: "Choose voice",
allVoices: "All voices",
speed: "Speed",
volume: "Volume",
generateVoice: "Generate voice",
regenerateVoice: "Regenerate voice",
download: "Download",
use: "Use",
remove: "Remove",
delete: "Delete",
generating: "Generating",
generationProgress: "Generation progress",
favoriteVoice: "Favorite voice",
favorite: "Favorite",
saved: "Saved",
showCaptions: "Show captions",
top: "Top",
middle: "Middle",
bottom: "Bottom",
fontSize: "Font size",
currentCaption: "Current caption",
showCurrentCaption: "Show current caption",
deleteCurrentCaption: "Delete current caption",
noCaptionSegments: "No caption segments.",
openingHook: "Opening hook",
productPoint: "Product point",
actionGuide: "Call to action",
templateSuffix: "Replace with your copy.",
audioPanel: "Audio",
aiVoiceEntryTitle: "AI Voiceover",
aiVoiceEntryDesc: "Write script, choose a voice, generate audio",
currentVoice: "Current voice",
voiceDuration: "Voice duration",
sourceAudio: "Source audio",
sourceDuration: "Source duration",
bgm: "Background music",
musicDuration: "Music duration",
notSeparated: "Not separated",
notAdded: "Not added",
downloadCurrentWav: "Download WAV",
downloadBgm: "Download music",
downloadSource: "Download source audio",
deleteSource: "Delete source audio",
deleteBgm: "Delete music",
transitionApplied: "Transition applied to export preview",
effectApplied: "Effect applied to preview and export",
stickerApplied: "Sticker applied to preview and export",
filterApplied: "Visual style updated",
noMediaHistory: "Generated voiceovers will be saved in this browser session.",
noFavoriteVoices: "Favorite voices in synthesis and they will appear here.",
recordVoice: "Record voice",
startRecording: "Start recording",
stopRecording: "Stop recording",
recording: "Recording",
recordedVoices: "My recordings",
noRecordings: "No recordings yet. Start recording and it will be added to the voiceover track.",
recordingReady: "Recording added to the voiceover track",
recordingUnsupported: "This browser does not support microphone recording",
recordingPermissionDenied: "Microphone access failed. Check browser permissions.",
assetAudio: "Audio",
assetVideo: "Video",
assetImage: "Image",
deleteAsset: "Delete asset",
imageHidden: "Image track hidden",
dropVisualHere: "Drop on visual track",
dropVoiceHere: "Drop on voiceover track",
dropSourceHere: "Drop to extract source audio",
dropMusicHere: "Drop on music track",
},
ja: {
languageTitle: "表示言語を選択",
languageSubtitle: "一度保存すると、次回からこの言語で開きます。",
languageSaved: "あとで設定から変更できます",
projectTitle: "AI ナレーションプロジェクト",
autosave: "自動保存済み",
undo: "元に戻す",
redo: "やり直し",
preview: "プレビュー",
pause: "一時停止",
play: "再生",
exporting: "書き出し中",
exportMp4: "MP4 書き出し",
settings: "設定",
media: "メディア",
text: "テキスト",
caption: "字幕",
audio: "音声",
transition: "トランジション",
effects: "エフェクト",
stickers: "ステッカー",
filters: "フィルター",
uploadTab: "アップロード",
libraryTab: "素材",
mineTab: "マイ素材",
uploadDropTitle: "画像・動画・音声をクリックまたはドラッグ",
previewEmptyTitle: "画像または動画をアップロードして開始",
aiVoice: "AI 音声",
voiceSynthesis: "音声合成",
myVoices: "マイ音声",
history: "履歴",
inputScript: "原稿入力",
chooseVoice: "声を選択",
generateVoice: "音声生成",
use: "使用",
remove: "削除",
delete: "削除",
generating: "生成中",
generationProgress: "生成進捗",
favoriteVoice: "声をお気に入り",
recordVoice: "録音",
startRecording: "録音開始",
stopRecording: "録音停止",
recording: "録音中",
recordedVoices: "マイ録音",
noRecordings: "録音はまだありません。録音するとナレーショントラックに追加されます。",
recordingReady: "録音をナレーショントラックに追加しました",
recordingUnsupported: "このブラウザは録音に対応していません",
recordingPermissionDenied: "マイクにアクセスできません。ブラウザ権限を確認してください。",
regenerateVoice: "音声を再生成",
imageTrack: "画像",
sourceTrack: "動画原音",
voiceTrack: "ナレーション",
musicTrack: "BGM",
dropVisualHere: "画像トラックにドロップ",
dropVoiceHere: "ナレーショントラックにドロップ",
dropSourceHere: "原音を分離",
dropMusicHere: "BGMトラックにドロップ",
},
};
Object.assign(UI_COPY, {
ko: {
...UI_COPY.en,
languageTitle: "인터페이스 언어 선택",
languageSubtitle: "한 번 저장하면 다음부터 이 언어로 열립니다.",
languageSaved: "나중에 설정에서 변경할 수 있습니다",
projectTitle: "AI 더빙 프로젝트",
autosave: "자동 저장됨",
undo: "실행 취소",
redo: "다시 실행",
preview: "미리보기",
pause: "일시정지",
play: "재생",
exporting: "내보내는 중",
exportMp4: "MP4 내보내기",
settings: "설정",
media: "미디어",
text: "텍스트",
caption: "자막",
audio: "오디오",
transition: "전환",
effects: "효과",
stickers: "스티커",
filters: "필터",
uploadTab: "업로드",
libraryTab: "라이브러리",
mineTab: "내 자료",
previewEmptyTitle: "이미지나 비디오를 업로드하여 시작",
previewEmptySubtitle: "타임라인은 기본적으로 비어 있습니다",
aiVoice: "AI 음성",
voiceSynthesis: "음성 합성",
myVoices: "내 음성",
history: "기록",
inputScript: "스크립트",
chooseVoice: "음성 선택",
generateVoice: "음성 생성",
regenerateVoice: "음성 다시 생성",
imageTrack: "이미지",
sourceTrack: "원본 오디오",
voiceTrack: "더빙 오디오",
musicTrack: "배경 음악",
},
es: {
...UI_COPY.en,
languageTitle: "Elige el idioma",
languageSubtitle: "Se guarda una vez y se abrirá así la próxima vez.",
languageSaved: "Puedes cambiarlo luego en Ajustes",
projectTitle: "Proyecto de voz con IA",
autosave: "Guardado automático",
undo: "Deshacer",
redo: "Rehacer",
preview: "Vista previa",
pause: "Pausar",
play: "Reproducir",
exporting: "Exportando",
exportMp4: "Exportar MP4",
settings: "Ajustes",
media: "Medios",
text: "Texto",
caption: "Subtítulos",
audio: "Audio",
transition: "Transiciones",
effects: "Efectos",
stickers: "Stickers",
filters: "Filtros",
uploadTab: "Subir",
libraryTab: "Biblioteca",
mineTab: "Mis recursos",
previewEmptyTitle: "Sube una imagen o video para empezar",
previewEmptySubtitle: "La línea de tiempo empieza vacía",
aiVoice: "Voz IA",
voiceSynthesis: "Síntesis de voz",
myVoices: "Mis voces",
history: "Historial",
inputScript: "Guion",
chooseVoice: "Elegir voz",
generateVoice: "Generar voz",
regenerateVoice: "Regenerar voz",
imageTrack: "Imagen",
sourceTrack: "Audio original",
voiceTrack: "Narración",
musicTrack: "Música",
},
fr: {
...UI_COPY.en,
languageTitle: "Choisir la langue",
languageSubtitle: "Enregistrée une fois, elle sera utilisée à la prochaine ouverture.",
languageSaved: "Modifiable plus tard dans les réglages",
projectTitle: "Projet voix IA",
autosave: "Enregistré automatiquement",
undo: "Annuler",
redo: "Rétablir",
preview: "Aperçu",
pause: "Pause",
play: "Lire",
exporting: "Exportation",
exportMp4: "Exporter MP4",
settings: "Réglages",
media: "Médias",
text: "Texte",
caption: "Sous-titres",
audio: "Audio",
transition: "Transitions",
effects: "Effets",
stickers: "Stickers",
filters: "Filtres",
uploadTab: "Importer",
libraryTab: "Bibliothèque",
mineTab: "Mes assets",
previewEmptyTitle: "Importez une image ou vidéo pour commencer",
previewEmptySubtitle: "La timeline démarre vide",
aiVoice: "Voix IA",
voiceSynthesis: "Synthèse vocale",
myVoices: "Mes voix",
history: "Historique",
inputScript: "Script",
chooseVoice: "Choisir une voix",
generateVoice: "Générer la voix",
regenerateVoice: "Regénérer la voix",
imageTrack: "Image",
sourceTrack: "Audio source",
voiceTrack: "Voix off",
musicTrack: "Musique",
},
de: {
...UI_COPY.en,
languageTitle: "Sprache wählen",
languageSubtitle: "Einmal gespeichert, startet der Editor künftig in dieser Sprache.",
languageSaved: "Später in den Einstellungen änderbar",
projectTitle: "AI-Voiceover-Projekt",
autosave: "Automatisch gespeichert",
undo: "Rückgängig",
redo: "Wiederholen",
preview: "Vorschau",
pause: "Pause",
play: "Abspielen",
exporting: "Export läuft",
exportMp4: "MP4 exportieren",
settings: "Einstellungen",
media: "Medien",
text: "Text",
caption: "Untertitel",
audio: "Audio",
transition: "Übergänge",
effects: "Effekte",
stickers: "Sticker",
filters: "Filter",
uploadTab: "Upload",
libraryTab: "Bibliothek",
mineTab: "Meine Medien",
previewEmptyTitle: "Bild oder Video hochladen und starten",
previewEmptySubtitle: "Die Timeline ist standardmäßig leer",
aiVoice: "AI-Stimme",
voiceSynthesis: "Sprachsynthese",
myVoices: "Meine Stimmen",
history: "Verlauf",
inputScript: "Skript",
chooseVoice: "Stimme wählen",
generateVoice: "Stimme erzeugen",
regenerateVoice: "Stimme neu erzeugen",
imageTrack: "Bild",
sourceTrack: "Originalton",
voiceTrack: "Voiceover",
musicTrack: "Musik",
},
pt: {
...UI_COPY.en,
languageTitle: "Escolha o idioma",
languageSubtitle: "Salvo uma vez, o editor abrirá nesse idioma depois.",
languageSaved: "Você pode alterar em Configurações",
projectTitle: "Projeto de voz IA",
autosave: "Salvo automaticamente",
undo: "Desfazer",
redo: "Refazer",
preview: "Prévia",
pause: "Pausar",
play: "Reproduzir",
exporting: "Exportando",
exportMp4: "Exportar MP4",
settings: "Configurações",
media: "Mídia",
text: "Texto",
caption: "Legendas",
audio: "Áudio",
transition: "Transições",
effects: "Efeitos",
stickers: "Stickers",
filters: "Filtros",
uploadTab: "Enviar",
libraryTab: "Biblioteca",
mineTab: "Meus assets",
previewEmptyTitle: "Envie imagem ou vídeo para começar",
previewEmptySubtitle: "A timeline começa vazia",
aiVoice: "Voz IA",
voiceSynthesis: "Síntese de voz",
myVoices: "Minhas vozes",
history: "Histórico",
inputScript: "Roteiro",
chooseVoice: "Escolher voz",
generateVoice: "Gerar voz",
regenerateVoice: "Gerar voz novamente",
imageTrack: "Imagem",
sourceTrack: "Áudio original",
voiceTrack: "Narração",
musicTrack: "Música",
},
th: {
...UI_COPY.en,
languageTitle: "เลือกภาษาอินเทอร์เฟซ",
languageSubtitle: "บันทึกครั้งเดียว ครั้งถัดไปจะเปิดด้วยภาษานี้",
languageSaved: "เปลี่ยนได้ภายหลังใน Settings",
projectTitle: "โปรเจกต์เสียง AI",
autosave: "บันทึกอัตโนมัติ",
undo: "ย้อนกลับ",
redo: "ทำซ้ำ",
preview: "พรีวิว",
pause: "หยุดชั่วคราว",
play: "เล่น",
exporting: "กำลังส่งออก",
exportMp4: "ส่งออก MP4",
settings: "ตั้งค่า",
media: "สื่อ",
text: "ข้อความ",
caption: "คำบรรยาย",
audio: "เสียง",
transition: "ทรานซิชัน",
effects: "เอฟเฟกต์",
stickers: "สติกเกอร์",
filters: "ฟิลเตอร์",
uploadTab: "อัปโหลด",
libraryTab: "คลัง",
mineTab: "สื่อของฉัน",
previewEmptyTitle: "อัปโหลดรูปหรือวิดีโอเพื่อเริ่ม",
previewEmptySubtitle: "ไทม์ไลน์เริ่มต้นว่าง",
aiVoice: "เสียง AI",
voiceSynthesis: "สังเคราะห์เสียง",
myVoices: "เสียงของฉัน",
history: "ประวัติ",
inputScript: "สคริปต์",
chooseVoice: "เลือกเสียง",
generateVoice: "สร้างเสียง",
regenerateVoice: "สร้างเสียงใหม่",
imageTrack: "รูปภาพ",
sourceTrack: "เสียงต้นฉบับ",
voiceTrack: "เสียงพากย์",
musicTrack: "เพลง",
},
vi: {
...UI_COPY.en,
languageTitle: "Chọn ngôn ngữ giao diện",
languageSubtitle: "Lưu một lần, lần sau sẽ mở bằng ngôn ngữ này.",
languageSaved: "Có thể đổi lại trong Cài đặt",
projectTitle: "Dự án lồng tiếng AI",
autosave: "Đã tự lưu",
undo: "Hoàn tác",
redo: "Làm lại",
preview: "Xem trước",
pause: "Tạm dừng",
play: "Phát",
exporting: "Đang xuất",
exportMp4: "Xuất MP4",
settings: "Cài đặt",
media: "Media",
text: "Văn bản",
caption: "Phụ đề",
audio: "Âm thanh",
transition: "Chuyển cảnh",
effects: "Hiệu ứng",
stickers: "Sticker",
filters: "Bộ lọc",
uploadTab: "Tải lên",
libraryTab: "Thư viện",
mineTab: "Tài nguyên của tôi",
previewEmptyTitle: "Tải ảnh hoặc video để bắt đầu",
previewEmptySubtitle: "Timeline mặc định đang trống",
aiVoice: "Giọng AI",
voiceSynthesis: "Tổng hợp giọng nói",
myVoices: "Giọng của tôi",
history: "Lịch sử",
inputScript: "Kịch bản",
chooseVoice: "Chọn giọng",
generateVoice: "Tạo giọng",
regenerateVoice: "Tạo lại giọng",
imageTrack: "Hình ảnh",
sourceTrack: "Âm thanh gốc",
voiceTrack: "Lồng tiếng",
musicTrack: "Nhạc nền",
},
});
export const OPTION_COPY = {
en: {
"原片": "Original",
"冷调清透": "Cool clean",
"胶片暗角": "Film vignette",
"轻亮人像": "Bright portrait",
"清晰增强": "Clarity",
"柔光": "Soft glow",
"电影感": "Cinematic",
"高饱和": "Vivid",
"夜景": "Night",
"暖调": "Warm",
"冷蓝": "Cool blue",
"黑白": "Mono",
"梦幻": "Dream",
"无转场": "None",
"淡入淡出": "Fade",
"轻推拉": "Subtle zoom",
"闪白切换": "Flash",
"左推入": "Push left",
"上推入": "Push up",
"模糊切": "Blur cut",
"双开门": "Split open",
"故障闪": "Glitch",
"无贴纸": "No sticker",
"新品感": "New",
"热点": "Hot",
"旁白": "Voiceover",
},
ja: {
"原片": "オリジナル",
"冷调清透": "クール",
"胶片暗角": "フィルム",
"轻亮人像": "明るい人物",
"清晰增强": "鮮明",
"柔光": "ソフト",
"电影感": "シネマ",
"高饱和": "ビビッド",
"夜景": "夜景",
"暖调": "ウォーム",
"冷蓝": "クールブルー",
"黑白": "モノクロ",
"梦幻": "ドリーム",
"无转场": "なし",
"淡入淡出": "フェード",
"轻推拉": "ズーム",
"闪白切换": "フラッシュ",
"左推入": "左プッシュ",
"上推入": "上プッシュ",
"模糊切": "ぼかし",
"双开门": "スプリット",
"故障闪": "グリッチ",
"无贴纸": "なし",
"新品感": "New",
"热点": "Hot",
"旁白": "Voiceover",
},
};
export const LANGUAGE_FALLBACKS = {
ko: "en",
es: "en",
fr: "en",
de: "en",
pt: "en",
th: "en",
vi: "en",
};
export function getStoredLanguage() {
if (typeof window === "undefined") {
return "";
}
try {
const stored = window.localStorage.getItem(LANGUAGE_STORAGE_KEY);
return APP_LANGUAGES.some((language) => language.id === stored) ? stored : "";
} catch {
return "";
}
}
export function getCopyLanguage(languageId) {
return UI_COPY[languageId] ? languageId : LANGUAGE_FALLBACKS[languageId] ?? "en";
}
export function createTranslator(languageId) {
const copyLanguage = getCopyLanguage(languageId);
const copy = UI_COPY[copyLanguage] ?? UI_COPY.en;
const fallback = UI_COPY.en;
return (key, fallbackText) => copy[key] ?? fallback[key] ?? UI_COPY.zh[key] ?? fallbackText ?? key;
}
export function translateOptionName(languageId, name) {
const copyLanguage = getCopyLanguage(languageId);
return OPTION_COPY[copyLanguage]?.[name] ?? OPTION_COPY.en?.[name] ?? name;
}
export function saveLanguagePreference(languageId) {
try {
window.localStorage.setItem(LANGUAGE_STORAGE_KEY, languageId);
} catch {
// localStorage may be unavailable in private browsing; keep the in-memory language.
}
}