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: "字幕", smart: "智能", audio: "音频", transition: "转场", effects: "效果", stickers: "贴纸", filters: "滤镜", stickerCategories: "贴纸分类", loadMoreStickers: "加载更多贴纸", 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: "画面", stickerTrack: "贴纸", 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: "显示字幕", smartVisionTitle: "AI 智能画面", smartVisionKicker: "本地 ONNX 视觉", smartVisionReady: "分析完成", smartVisionIdle: "等待分析", smartVisionRunning: "模型运行中", smartVisionNoMedia: "先把图片或视频放到图片轨,再分析视觉素材。", smartVisionAnalyze: "识别并优化当前图片", smartVisionAnalyzeAgain: "重新分析当前图片", smartVisionAnalyzeVideo: "分析整段视频", smartVisionAnalyzeAgainVideo: "重新分析整段视频", smartVisionCancel: "取消视觉分析", smartVisionDetection: "主体识别框", smartVisionDetectionDesc: "显示 YOLOS tiny 检出的主体与常见物体", smartVisionMatting: "MODNet 智能抠图", smartVisionMattingDesc: "生成透明人像前景并用于预览与导出", smartVisionCaptionAvoidance: "字幕智能避让", smartVisionCaptionAvoidanceDesc: "自动选择与主体重叠最少的字幕位置", smartVisionCrop: "主体智能裁切", smartVisionCropDesc: "切换画幅时持续把主体保留在安全区", smartVisionSubject: "主主体", smartVisionObjects: "识别物体", smartVisionConfidence: "置信度", smartVisionImageOnly: "视频会先完成全片时序分析,再把 YOLOS 主体轨迹和 MODNet 遮罩用于每个播放与导出时刻。", smartVisionModels: "YOLOS tiny 定位 · MODNet 人像抠图", smartVisionVideoCoverage: "全视频已覆盖", smartVisionTemporalFrames: "个时序帧", smartVisionVideoCutoutExport: "遮罩随视频导出", smartVisionClear: "清除当前分析", smartVisionCutoutDownload: "下载透明 PNG", smartVisionNoSubject: "没有找到高置信度主体,可换一帧后重试。", avatarKicker: "Avatar lab · Browser ONNX", avatarTitle: "数字人(实验室)", avatarExperimental: "实验功能", avatarSupported: "浏览器已就绪", avatarDescription: "使用正脸照片与当前 AI 配音生成会说话的人像。首版采用浏览器端 ONNX 路径,模型将在首次生成时按需下载。", avatarPortrait: "正脸照片", avatarWebgpu: "全链路 WebGPU", avatarAudio: "当前配音", avatarCheck: "检查浏览器支持", avatarRecheck: "重新检查浏览器", avatarOfficial: "完整模型路线", avatarWebPort: "WebGPU 已跑通", avatarService: "官方推理服务", avatarServiceNeeded: "LivePortrait Web 移植中", avatarServiceHint: "JoyVASA 音频运动与 LivePortrait 神经渲染已完成全 WebGPU 端到端验收;5D GridSample 已等价改写为 WebGPU 支持的 4D 采样与深度插值。", avatarPortingStatus: "模型工程 · 阶段 3/3", avatarModelSource: "锁定模型", avatarStagePinned: "模型版本已锁定", avatarStageGrid: "5D 形变已改写验证", avatarStageAudio: "音频驱动 + WebGPU", avatarChecking: "正在检测浏览器…", avatarPreparing: "准备肖像", avatarGenerateAcceptance: "生成单帧并替换画面轨", avatarAcceptanceDone: "口型视频已生成并替换画面轨", avatarTrackReplaced: "LivePortrait 口型视频已替换到画面轨", avatarGenerationFailed: "数字人生成失败", avatarOpen: "打开数字人控制台", avatarLipSyncTitle: "字幕口型同步", avatarLipSyncDescription: "将字幕时间轴和当前 AI 配音映射为人物嘴型与表情节奏。", avatarCurrentPortrait: "当前图片将作为数字人头像", avatarNeedsPortrait: "请先在画面轨放入一张正脸图片", avatarNeedsAudio: "请先生成或添加配音", avatarLipSyncSource: "口型驱动", avatarCaptionSync: "按字幕时间轴同步", avatarNeedsCaptions: "请先生成或添加字幕", avatarSyncMode: "同步方式", avatarSyncModeCaption: "字幕 + 配音精确对齐", avatarGenerationNote: "模型已随项目按 50MB 分片托管并由服务工作线程缓存;首次运行需要下载,后续直接复用本地缓存。", avatarGenerate: "生成口型视频", avatarQuality: "生成质量", avatarQualityPreview: "快速预览", avatarQualityPreviewHint: "256px · FP16 · 自适应 1–2→8fps", avatarQualityFull: "高质量", avatarQualityFullHint: "512px · FP16 · 自适应 1–2→8fps", avatarGenerating: "正在生成数字人视频", avatarGenerationHint: "首次运行会下载模型;请保持此页面打开。", avatarProgressDownloadFile: "下载 {file}", avatarProgressDownloadModel: "下载 {model}", avatarProgressInitHubert: "初始化 JoyVASA HuBERT WebGPU", avatarProgressInitMotion: "初始化 JoyVASA 运动 WebGPU", avatarProgressInitModel: "初始化 {model}", avatarProgressMotionStep: "生成口型运动 {current}/{total}", avatarProgressPrepareAudio: "准备真实音频驱动", avatarProgressAudioReady: "音频特征完成", avatarProgressMotionReady: "真实音频运动生成完成", avatarProgressReuseMotion: "复用当前配音口型运动", avatarProgressPreparePortraitMotion: "准备肖像与真实口型运动", avatarProgressExtract3d: "提取人物 3D 特征", avatarProgressReuseGpuFeature: "复用人物 GPU 特征", avatarProgressKeyframe: "FP16 WebGPU 关键帧 {current}/{total} · {seconds}s", avatarProgressFrameEncoded: "完成帧 {current}/{total} · 编码 {seconds}s", avatarProgressRetryCorruptFrame: "检测到异常关键帧 {current}/{total},正在原位重推(第 {attempt} 次)", avatarProgressDroppedCorruptFrame: "异常关键帧 {current}/{total} 已丢弃并沿用上一正常帧", avatarProgressInterpolate: "关键帧生成完成,准备运动插帧", avatarProgressExtractFeature: "提取人物特征", avatarProgressWarp3d: "计算 3D 形变(可能需要约 1 分钟)", avatarProgressRenderPortrait: "渲染 512×512 人像", avatarProgressEncodeVideo: "编码数字人视频", fileMenu: "文件", projectMenuHeading: "工程", newProject: "新建工程", newProjectHint: "从空白时间线开始", importProject: "导入工程包", importProjectHint: "恢复时间线与全部媒体", exportProject: "导出工程包", exportProjectHint: "打包图片、视频和音频", ttsWarningChineseSymbolsCleaned: "已自动清理中文语音不支持的符号,避免本地 ONNX 运行失败。", ttsWarningEnglishCharactersCleaned: "已自动清理英文语音不支持的字符。", ttsErrorChineseVoiceEnglishText: "当前中文语音不适合大量英文文案,请切换 English 声音后再生成。", ttsErrorNoChineseContent: "当前中文语音没有可朗读的中文内容,请输入中文或切换英文声音。", ttsErrorEnglishVoiceChineseText: "当前英文语音不适合中文文案,请切换中文声音后再生成。", ttsErrorNoEnglishContent: "当前英文语音没有可朗读的英文内容,请输入英文或切换中文声音。", ttsErrorEmptyScript: "请输入要生成的文案。", ttsErrorVoiceMismatch: "当前文案不适合所选语音。", ttsStatusPreparingModel: "准备本地模型", ttsStatusLoadingChineseModel: "下载或读取中文 ONNX 模型", ttsStatusClearingCache: "模型缓存空间不足,正在清理后重试", ttsStatusLoadingKokoro: "加载 Kokoro 82M q8", ttsStatusGeneratingEnglish: "生成英文配音", ttsStatusDecodingWaveform: "解析音频波形", ttsNoticePiperCacheCleared: "浏览器模型缓存空间紧张,已清理 Piper 缓存后继续生成。", ttsGenerated: "已生成", ttsNoticeGenerated: "配音已生成并写入时间线", ttsErrorUnsupportedPiperSymbols: "当前中文语音模型不支持这段文案里的部分字符,请清理英文/特殊符号,或切换 English 声音。", ttsErrorStorageQuota: "浏览器模型缓存空间不足,请在设置里清理模型缓存后重试。", ttsErrorGenerationFailed: "生成失败,请重试", top: "顶部", middle: "居中", bottom: "底部", fontSize: "字号", captionStyle: "字幕样式", captionStyleHint: "预览和导出会保持一致", captionPresetClassic: "经典", captionPresetNeon: "霓虹", captionPresetBubble: "气泡", captionTextColor: "文字", captionBackground: "底色", captionBorderColor: "外框", captionOpacity: "底色透明度", captionBorderWidth: "外框大小", captionRadius: "圆角", captionPaddingX: "左右间距", captionPaddingY: "上下间距", captionShadow: "文字阴影", currentCaption: "当前字幕", captionScriptLabel: "字幕文案", captionList: "字幕列表", captionSegmentsUnit: "条字幕", captionEmptyHint: "选择时间线字幕片段后,这里会同步编辑。", showCurrentCaption: "显示当前字幕", hideCurrentCaption: "隐藏当前字幕", deleteCurrentCaption: "删除当前字幕", noCaptionSegments: "当前没有字幕片段。", openingHook: "开场强调", productPoint: "产品卖点", actionGuide: "行动引导", templateSuffix: "请替换为你的文案。", audioPanel: "音频", aiVoiceEntryTitle: "AI 配音", aiVoiceEntryDesc: "输入文案、选择声音并生成语音", autoCaptionsTitle: "从原声生成字幕", autoCaptionsDesc: "本地加载 Whisper small,识别后写入字幕轨", autoCaptionsNeedsSource: "先上传视频或把音频拖到原声轨", autoCaptionsRunning: "正在生成自动字幕", 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: "图片", assetSticker: "贴纸", deleteAsset: "删除素材", imageHidden: "图片轨已隐藏", dropVisualHere: "释放到图片轨", dropStickerHere: "释放到贴纸轨", 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", smart: "Smart", audio: "Audio", transition: "Transitions", effects: "Effects", stickers: "Stickers", filters: "Filters", stickerCategories: "Sticker categories", loadMoreStickers: "Load more stickers", 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: "Visuals", stickerTrack: "Stickers", 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", smartVisionTitle: "AI Smart Frame", smartVisionKicker: "Local ONNX vision", smartVisionReady: "Analysis ready", smartVisionIdle: "Waiting to analyze", smartVisionRunning: "Running models", smartVisionNoMedia: "Place an image or video on the visual track, then analyze the visual asset.", smartVisionAnalyze: "Detect and optimize image", smartVisionAnalyzeAgain: "Analyze image again", smartVisionAnalyzeVideo: "Analyze full video", smartVisionAnalyzeAgainVideo: "Analyze full video again", smartVisionCancel: "Cancel vision analysis", smartVisionDetection: "Subject detection boxes", smartVisionDetectionDesc: "Show subjects and common objects found by YOLOS tiny", smartVisionMatting: "MODNet background removal", smartVisionMattingDesc: "Create a transparent portrait foreground for preview and export", smartVisionCaptionAvoidance: "Smart caption avoidance", smartVisionCaptionAvoidanceDesc: "Choose the caption position with the least subject overlap", smartVisionCrop: "Subject-aware crop", smartVisionCropDesc: "Keep the subject inside the safe area across aspect ratios", smartVisionSubject: "Primary subject", smartVisionObjects: "Objects", smartVisionConfidence: "Confidence", smartVisionImageOnly: "Video is analyzed across its full duration, then YOLOS tracks and MODNet masks are resolved for every preview and export time.", smartVisionModels: "YOLOS tiny detection · MODNet portrait matting", smartVisionVideoCoverage: "Full video coverage", smartVisionTemporalFrames: "temporal frames", smartVisionVideoCutoutExport: "Mask exports with video", smartVisionClear: "Clear current analysis", smartVisionCutoutDownload: "Download transparent PNG", smartVisionNoSubject: "No high-confidence subject found. Seek to another frame and retry.", avatarKicker: "Avatar lab · Browser ONNX", avatarTitle: "Talking avatar (Lab)", avatarExperimental: "Experimental", avatarSupported: "Browser ready", avatarDescription: "Generate a talking portrait from a front-facing photo and the current AI voiceover. The browser ONNX model will download on first use.", avatarPortrait: "Front-facing photo", avatarWebgpu: "Full WebGPU pipeline", avatarAudio: "Current voiceover", avatarCheck: "Check browser support", avatarRecheck: "Recheck browser", avatarOfficial: "Full-model path", avatarWebPort: "WebGPU validated", avatarService: "Official inference service", avatarServiceNeeded: "LivePortrait Web port in progress", avatarServiceHint: "JoyVASA audio motion and LivePortrait neural rendering passed full WebGPU end-to-end acceptance. Native 5D GridSample was equivalently rewritten as supported 4D sampling plus depth interpolation.", avatarPortingStatus: "Model engineering · Stage 3/3", avatarModelSource: "Pinned model", avatarStagePinned: "Model revision pinned", avatarStageGrid: "5D warping rewrite validated", avatarStageAudio: "Audio driver + WebGPU", avatarChecking: "Checking browser…", avatarPreparing: "Preparing portrait", avatarGenerateAcceptance: "Generate frame and replace visual track", avatarAcceptanceDone: "Lip-sync video generated and placed on the visual track", avatarTrackReplaced: "LivePortrait lip-sync video replaced the visual track", avatarGenerationFailed: "Avatar generation failed", avatarOpen: "Open avatar controls", avatarLipSyncTitle: "Caption lip sync", avatarLipSyncDescription: "Map caption timing and the current voiceover into mouth and expression timing.", avatarCurrentPortrait: "Use the current image as the avatar portrait", avatarNeedsPortrait: "Put a front-facing photo on the visual track first", avatarNeedsAudio: "Generate or add voiceover first", avatarLipSyncSource: "Lip-sync driver", avatarCaptionSync: "caption timing sync", avatarNeedsCaptions: "Generate or add captions first", avatarSyncMode: "Sync method", avatarSyncModeCaption: "Captions + voiceover alignment", avatarGenerationNote: "Models ship with the project in 50 MB chunks and are cached by the service worker. First use downloads them; later runs reuse the local cache.", avatarGenerate: "Generate lip-sync video", avatarQuality: "Render quality", avatarQualityPreview: "Fast preview", avatarQualityPreviewHint: "256px · FP16 · adaptive 1–2→8fps", avatarQualityFull: "High quality", avatarQualityFullHint: "512px · FP16 · adaptive 1–2→8fps", avatarGenerating: "Generating avatar video", avatarGenerationHint: "First use downloads models. Keep this page open.", avatarProgressDownloadFile: "Downloading {file}", avatarProgressDownloadModel: "Downloading {model}", avatarProgressInitHubert: "Initializing JoyVASA HuBERT WebGPU", avatarProgressInitMotion: "Initializing JoyVASA motion WebGPU", avatarProgressInitModel: "Initializing {model}", avatarProgressMotionStep: "Generating lip motion {current}/{total}", avatarProgressPrepareAudio: "Preparing audio-driven motion", avatarProgressAudioReady: "Audio features ready", avatarProgressMotionReady: "Audio-driven motion ready", avatarProgressReuseMotion: "Reusing motion from the current voiceover", avatarProgressPreparePortraitMotion: "Preparing portrait and lip motion", avatarProgressExtract3d: "Extracting 3D portrait features", avatarProgressReuseGpuFeature: "Reusing portrait GPU features", avatarProgressKeyframe: "FP16 WebGPU keyframe {current}/{total} · {seconds}s", avatarProgressFrameEncoded: "Frame {current}/{total} complete · encoded in {seconds}s", avatarProgressRetryCorruptFrame: "Corrupt keyframe {current}/{total} detected; retrying in place (attempt {attempt})", avatarProgressDroppedCorruptFrame: "Corrupt keyframe {current}/{total} dropped; holding the previous valid frame", avatarProgressInterpolate: "Keyframes ready · preparing motion interpolation", avatarProgressExtractFeature: "Extracting portrait features", avatarProgressWarp3d: "Computing 3D warping (may take about 1 minute)", avatarProgressRenderPortrait: "Rendering 512×512 portrait", avatarProgressEncodeVideo: "Encoding talking-avatar video", fileMenu: "File", projectMenuHeading: "Project", newProject: "New project", newProjectHint: "Start with a blank timeline", importProject: "Import project package", importProjectHint: "Restore the timeline and all media", exportProject: "Export project package", exportProjectHint: "Bundle images, video, and audio", ttsWarningChineseSymbolsCleaned: "Unsupported symbols were cleaned automatically to prevent the local ONNX voice model from failing.", ttsWarningEnglishCharactersCleaned: "Unsupported characters were cleaned automatically for the English voice.", ttsErrorChineseVoiceEnglishText: "The selected Chinese voice is not suitable for mostly English text. Switch to an English voice and try again.", ttsErrorNoChineseContent: "No readable Chinese content remains. Enter Chinese text or switch to an English voice.", ttsErrorEnglishVoiceChineseText: "The selected English voice is not suitable for Chinese text. Switch to a Chinese voice and try again.", ttsErrorNoEnglishContent: "No readable English content remains. Enter English text or switch to a Chinese voice.", ttsErrorEmptyScript: "Enter a script to generate voiceover.", ttsErrorVoiceMismatch: "The script is not suitable for the selected voice.", ttsStatusPreparingModel: "Preparing local model", ttsStatusLoadingChineseModel: "Downloading or loading the Chinese ONNX model", ttsStatusClearingCache: "Model cache is full · clearing it before retrying", ttsStatusLoadingKokoro: "Loading Kokoro 82M q8", ttsStatusGeneratingEnglish: "Generating English voiceover", ttsStatusDecodingWaveform: "Analyzing audio waveform", ttsNoticePiperCacheCleared: "Browser model storage was low. The Piper cache was cleared and generation will continue.", ttsGenerated: "Generated", ttsNoticeGenerated: "Voiceover generated and added to the timeline.", ttsErrorUnsupportedPiperSymbols: "The Chinese voice model does not support some characters in this script. Remove English or special symbols, or switch to an English voice.", ttsErrorStorageQuota: "Browser model storage is full. Clear the model cache in Settings and try again.", ttsErrorGenerationFailed: "Generation failed. Try again.", top: "Top", middle: "Middle", bottom: "Bottom", fontSize: "Font size", captionStyle: "Caption style", captionStyleHint: "Matches preview and export", captionPresetClassic: "Classic", captionPresetNeon: "Neon", captionPresetBubble: "Bubble", captionTextColor: "Text", captionBackground: "Background", captionBorderColor: "Border", captionOpacity: "Background opacity", captionBorderWidth: "Border width", captionRadius: "Corner radius", captionPaddingX: "Horizontal padding", captionPaddingY: "Vertical padding", captionShadow: "Text shadow", currentCaption: "Current caption", captionScriptLabel: "Caption text", captionList: "Caption list", captionSegmentsUnit: "caption segment(s)", captionEmptyHint: "Select a caption segment on the timeline to edit it here.", showCurrentCaption: "Show current caption", hideCurrentCaption: "Hide 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", autoCaptionsTitle: "Generate captions from source", autoCaptionsDesc: "Loads Whisper small locally, then writes a caption track", autoCaptionsNeedsSource: "Upload video or drop audio on the source track first", autoCaptionsRunning: "Generating captions", 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", assetSticker: "Sticker", deleteAsset: "Delete asset", imageHidden: "Image track hidden", dropVisualHere: "Drop on visual track", dropStickerHere: "Drop on sticker 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: "Visual", 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: "Visuel", 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: "Bildmaterial", 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: "Visual", 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. } }