From 34acfa3ad32f249e9f7a9f87d42b9a922678af84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Lord=C3=AAlo?= Date: Sun, 22 Nov 2026 19:43:11 -0300 Subject: [PATCH 1/3] feat(task-manager): add independent FreeVideo task dashboard Add a native-style Tasks entry and full-screen dashboard for running, queued and historical generation and agent records. Reuse existing job sources and expose progress, stage, elapsed time and estimated remaining time. Monitor GPU, VRAM, temperature, CPU, RAM and disk through existing APIs and a lightweight read-only host endpoint. Keep bounded hardware history locally and poll only while the dashboard is visible. Support explicit targeted cancellation, native chain resume and workflow retry. Distinguish CLI and MCP clients when reported by the engine. Synchronize light and dark themes with FreeVideo, add a dedicated theme shortcut and correct the Settings glyph. Provide English, Simplified Chinese and Brazilian Portuguese translations with an accessible language menu. Document installation, compatibility limits and validation. Add ten JavaScript regression tests and one Python host metrics test. Keep upstream files and running generation lifecycle untouched. Developed with AI assistance. Refs: FlashML-org/FreeVideo#1054 --- extensions/FreeVideoTaskManager/.gitignore | 7 + extensions/FreeVideoTaskManager/README.md | 35 ++ extensions/FreeVideoTaskManager/__init__.py | 27 ++ .../FreeVideoTaskManager/tests/tasks.test.cjs | 110 ++++++ .../FreeVideoTaskManager/tests/test_host.py | 42 +++ extensions/FreeVideoTaskManager/web/i18n.js | 286 +++++++++++++++ extensions/FreeVideoTaskManager/web/tasks.css | 29 ++ extensions/FreeVideoTaskManager/web/tasks.js | 329 ++++++++++++++++++ 8 files changed, 865 insertions(+) create mode 100644 extensions/FreeVideoTaskManager/.gitignore create mode 100644 extensions/FreeVideoTaskManager/README.md create mode 100644 extensions/FreeVideoTaskManager/__init__.py create mode 100644 extensions/FreeVideoTaskManager/tests/tasks.test.cjs create mode 100644 extensions/FreeVideoTaskManager/tests/test_host.py create mode 100644 extensions/FreeVideoTaskManager/web/i18n.js create mode 100644 extensions/FreeVideoTaskManager/web/tasks.css create mode 100644 extensions/FreeVideoTaskManager/web/tasks.js diff --git a/extensions/FreeVideoTaskManager/.gitignore b/extensions/FreeVideoTaskManager/.gitignore new file mode 100644 index 00000000..03297ef3 --- /dev/null +++ b/extensions/FreeVideoTaskManager/.gitignore @@ -0,0 +1,7 @@ +__pycache__/ +*.py[cod] +.pytest_cache/ +node_modules/ +.env +.env.* +*.log diff --git a/extensions/FreeVideoTaskManager/README.md b/extensions/FreeVideoTaskManager/README.md new file mode 100644 index 00000000..ed1f99f0 --- /dev/null +++ b/extensions/FreeVideoTaskManager/README.md @@ -0,0 +1,35 @@ +# FreeVideo Task Manager — v0.1.0 (preview) +Independent ComfyUI frontend extension targeting FreeVideo 0.6.8. No changes to upstream files or engine lifecycle. + +## Installation +Place this folder in ComfyUI/custom_nodes/FreeVideoTaskManager. Restart ComfyUI **only when the queue and agent activity are idle**. Reload the browser; select Tasks in the main FreeVideo navigation. To remove, stop ComfyUI when idle, remove this folder, and start normally. Do not restart during a generation. + +## Design +- The sun/moon control follows the shared FreeVideo theme, via FreeVideoShell.setTheme and the native freevideo.theme preference. The dashboard no longer stores a separate theme. +- The extension also replaces the native Settings sun-like glyph with a cog and adds a separate theme toggle next to Settings. Existing Settings behavior is unchanged; no upstream files are edited. +- Local UI string catalog (web/i18n.js): Brazilian Portuguese, English and Simplified Chinese. The globe selector beside the theme icon changes the dashboard language immediately, saves the preference locally and preserves filters and task monitoring. With no saved selection, honors explicit freevideo_lang query parameter; otherwise detects browser locale and falls back to English. Native job names and unknown engine diagnostic strings remain unchanged. FreeVideo itself supports English and Chinese, not a global Portuguese translation. +- Uses the original task_store singleton and task_float sources (idempotent startup), agent_tasks adapter for agent activity, and studio_queue seededPrompt to clone an original video workflow for explicit retry. +- Full-screen independent view; native views remain mounted. No changes to the original navigation controller. +- GET FreeVideo monitor, jobs, chains, queue and progress; local read-only host route samples psutil non-blockingly, plus disk. GPU readings come from FreeVideo itself. History stores up to 240 samples (within 24 h) in browser storage, captured every five seconds while the dashboard and browser tab are visible (about 20 minutes of continuous samples). No persistent background daemon. +- Agent records are distinct from engine generation records, so totals count records, not unique underlying jobs. MCP is shown only if the server client identifies MCP; CLI stays CLI. +- Cancel uses native task/agent actions or the targeted native prompt/node endpoint with confirmation. Agent-controlled underlying workflow cancellation should use its agent activity row. Chain resume uses native endpoint; simple video retry requeues its frozen workflow if still in ComfyUI history (not checkpoint resume). No automatic retries. Image and agent retries are not yet implemented. +- Compatibility: internal FreeVideo JS exports and DOM selectors can change in future releases. Update-safe folder separation, not a promise of cross-version API compatibility. If exports change, opening safely errors without modifying the engine. +- No prompts are persisted by this extension. Hardware data only in localStorage. No external network or new Python dependency beyond ComfyUI's psutil. +## Validation before upstream PR +From the ComfyUI directory, offline checks (no generation is created or cancelled): + +```powershell +node --test custom_nodes/FreeVideoTaskManager/tests/tasks.test.cjs +.venv/Scripts/python.exe -B custom_nodes/FreeVideoTaskManager/tests/test_host.py +``` + +Verified on Windows 10 with an NVIDIA RTX 5060 Ti 16 GB and FreeVideo 0.6.8: the dashboard displayed live generation progress and hardware metrics, both themes rendered, and the user confirmed the language menu visually. Ten offline JavaScript tests and one Python host-metrics test passed. The offline checks do not replace the live-job acceptance tests below. + +Upstream discussion: https://github.com/FlashML-org/FreeVideo/issues/1054. The prototype was developed with AI assistance. Upstream main and other platforms still require validation. + +1. Idle restart and confirm Tasks appears in each native view; switch themes and back. +2. Generate a small video from UI and agent, verify progress, queue, ETA, origin and history. +3. Verify no interruptions when opening or closing Tasks. +4. Queue disposable jobs to verify confirmed targeted cancellation, chain resume, and video retry; never test on valuable jobs. +5. Compare hardware values to native monitor and Task Manager, and check browser console. +6. Assess upstream extension API, translations and cross-platform compatibility before proposing PR. diff --git a/extensions/FreeVideoTaskManager/__init__.py b/extensions/FreeVideoTaskManager/__init__.py new file mode 100644 index 00000000..2ca0d916 --- /dev/null +++ b/extensions/FreeVideoTaskManager/__init__.py @@ -0,0 +1,27 @@ +"""Independent FreeVideo Task Manager, no generation or model hooks.""" +from pathlib import Path +import shutil +import psutil +from aiohttp import web +from server import PromptServer + +NODE_CLASS_MAPPINGS = {} +NODE_DISPLAY_NAME_MAPPINGS = {} +WEB_DIRECTORY = "./web" + +# Prime the non-blocking counter. No sampling thread, no CUDA calls. +psutil.cpu_percent(interval=None) +ENGINE = Path(__file__).resolve().parents[2] / "FreeVideo-engine" + +@PromptServer.instance.routes.get("/freevideo-task-manager/host") +async def task_manager_host(request): + memory = psutil.virtual_memory() + # Same volume as the engine, not necessarily the system drive. + disk = shutil.disk_usage(ENGINE if ENGINE.exists() else ENGINE.parent) + return web.json_response({ + "cpu": psutil.cpu_percent(interval=None), + "ram_used": memory.total - memory.available, + "ram_total": memory.total, + "disk_used": disk.used, + "disk_total": disk.total, + }, headers={"Cache-Control": "no-store"}) diff --git a/extensions/FreeVideoTaskManager/tests/tasks.test.cjs b/extensions/FreeVideoTaskManager/tests/tasks.test.cjs new file mode 100644 index 00000000..1c915d55 --- /dev/null +++ b/extensions/FreeVideoTaskManager/tests/tasks.test.cjs @@ -0,0 +1,110 @@ +// Offline regression checks: no server calls and no model operations. +const {test}=require("node:test"); +const assert=require("node:assert/strict"); +const fs=require("node:fs"); +const vm=require("node:vm"); +const path=require("node:path"); +const js=fs.readFileSync(path.join(__dirname,"../web/tasks.js"),"utf8") + .replace(/^import .*;$/gm,"").replaceAll("import.meta.url","'http://localhost/extensions/FreeVideoTaskManager/tasks.js'"); +const i18n=fs.readFileSync(path.join(__dirname,"../web/i18n.js"),"utf8").replace(/^export /gm,""); +function context(){ + const c=vm.createContext({URL,URLSearchParams,Date,Math,JSON,Number,Map,Set,console,app:{registerExtension(){}},api:{},localStorage:{getItem(){return null},setItem(){}},document:{hidden:false}}); + vm.runInContext(i18n+"\n"+js,c); + vm.runInContext("sources={jobs:{list:()=>[],get:()=>null},queue:{}}",c); + return c; +} +const evaluate=(c,expr)=>vm.runInContext(expr,c); +test("language trigger toggles the menu and exposes all three languages",()=>{ + const c=context(); + evaluate(c,"globalThis.menu={hidden:true};globalThis.trigger={expanded:'false',setAttribute(k,v){this.expanded=v},focus(){this.focused=true}};globalThis.dashboard={querySelector(s){return s==='.language'?trigger:menu}}"); + evaluate(c,"setLanguageMenu(dashboard,true)"); + assert.equal(evaluate(c,"menu.hidden"),false); + assert.equal(evaluate(c,"trigger.expanded"),"true"); + evaluate(c,"setLanguageMenu(dashboard,false,true)"); + assert.equal(evaluate(c,"menu.hidden"),true); + assert.equal(evaluate(c,"trigger.expanded"),"false"); + assert.equal(evaluate(c,"trigger.focused"),true); + assert.equal(evaluate(c,"languageOptions.map(x=>x[0]).join(',')"),"pt-BR,en,zh"); +}); +test("native appearance selector tracks global theme without changing language controls",()=>{ + const c=context(); + evaluate(c,"document.documentElement={dataset:{theme:'light'}};globalThis.themeControl={options:[{value:'dark'},{value:'light'}],value:'dark'};globalThis.languageControl={options:[{value:'zh'},{value:'en'}],value:'en'};document.querySelectorAll=()=>[themeControl,languageControl]"); + evaluate(c,"syncNativeSettingsTheme()"); + assert.equal(evaluate(c,"themeControl.value"),"light"); + assert.equal(evaluate(c,"languageControl.value"),"en"); + evaluate(c,"document.documentElement.dataset.theme='dark';syncNativeSettingsTheme()"); + assert.equal(evaluate(c,"themeControl.value"),"dark"); +}); +test("settings cog and theme glyphs are distinct; theme toggle uses shared preference",()=>{ + const c=context(); + assert.notEqual(evaluate(c,"iconMask(cog)"),evaluate(c,"iconMask(icons.sun)")); + assert.notEqual(evaluate(c,"iconMask(icons.sun)"),evaluate(c,"iconMask(icons.moon)")); + evaluate(c,"document.documentElement={dataset:{theme:'dark'}};localStorage.setItem=(key,value)=>{globalThis.saved=[key,value]};globalThis.FreeVideoShell={setTheme(value){document.documentElement.dataset.theme=value}}"); + evaluate(c,"toggleTheme()"); + assert.equal(evaluate(c,"currentTheme()"),"light"); + assert.equal(evaluate(c,"saved.join(':')"),"freevideo.theme:light"); + evaluate(c,"toggleTheme()"); + assert.equal(evaluate(c,"currentTheme()"),"dark"); +}); +test("locale detection uses native explicit language then browser, with English fallback",()=>{ + const c=context(); + assert.equal(evaluate(c,"resolveLanguage('', 'pt-BR')"),"pt-BR"); + assert.equal(evaluate(c,"resolveLanguage('?freevideo_lang=en','pt-BR')"),"en"); + assert.equal(evaluate(c,"resolveLanguage('?freevideo_lang=zh','pt-BR')"),"zh"); + assert.equal(evaluate(c,"resolveLanguage('', 'fr-FR')"),"en"); + assert.equal(evaluate(c,"resolveLanguage('?freevideo_lang=en', 'en', 'pt-BR')"),"pt-BR"); + assert.equal(evaluate(c,"resolveLanguage('', 'pt-BR', 'zh')"),"zh"); + assert.equal(evaluate(c,"resolveLanguage('', 'pt-BR', 'invalid')"),"pt-BR"); + assert.equal(evaluate(c,"translate('Cancelar','en')"),"Cancel"); + assert.equal(evaluate(c,"translate('Cancelar','zh')"),"取消"); + assert.equal(evaluate(c,"translate('Cancelar','pt-BR')"),"Cancelar"); +}); +test("changing the selected language updates runtime status and group labels",()=>{ + const c=context(); + evaluate(c,"LANGUAGE='pt-BR'"); + assert.equal(evaluate(c,"t(states.running)"),"Em execução"); + evaluate(c,"LANGUAGE='en'"); + assert.equal(evaluate(c,"t(states.running)"),"Running"); + assert.equal(evaluate(c,"t(groups.all)"),"All"); + evaluate(c,"LANGUAGE='zh'"); + assert.equal(evaluate(c,"t(states.running)"),"运行中"); + assert.equal(evaluate(c,"t(groups.all)"),"全部"); +}); +test("timestamps, unknown estimates, fractions and units",()=>{ + const c=context(); + assert.equal(evaluate(c,"elapsed(3661)"),"01:01:01"); + assert.equal(evaluate(c,"elapsed(null)"),"—"); + assert.equal(evaluate(c,"fraction(1.5)"),1); + assert.equal(evaluate(c,"stamp(1795383596008)"),1795383596008); + assert.equal(evaluate(c,"stamp(1795383596)"),1795383596000); + assert.equal(evaluate(c,"gib(17179869184)"),"16.0 GB"); +}); +test("origin separates MCP, CLI and engine",()=>{ + const c=context(); + assert.equal(evaluate(c,"sourceLabel({kind:'agent',job:{client:'freevideo-mcp'}})"),"MCP"); + assert.equal(evaluate(c,"sourceLabel({kind:'agent',job:{client:'freevideo-cli'}})"),"CLI"); + assert.equal(evaluate(c,"sourceLabel({kind:'video'})"),"FreeVideo"); +}); +test("server queue and agent history are merged without duplicating an ID",()=>{ + const c=context(); + evaluate(c,`journal=[{id:'x',kind:'video',status:'running'}];queueRows=[{prompt_id:'x',node:'n',status:'running',client:'agent:j',percent:.42,eta_seconds:80}]; + agentRaw=[{id:'j',status:'running',client:'freevideo-mcp',progress:{fraction:.42}},{id:'f',status:'failed',client:'freevideo-cli'},{id:'d',status:'succeeded'}];`); + assert.equal(evaluate(c,"rows().length"),4); + assert.equal(evaluate(c,"rows().find(r=>r.id==='video:x').percent"),.42); + assert.equal(evaluate(c,"sourceLabel(rows().find(r=>r.id==='video:x'))"),"MCP"); + assert.equal(evaluate(c,"rows().find(r=>r.id==='video:x').externalCancel"),false); + assert.equal(evaluate(c,"rows().find(r=>r.id==='agent:d').status"),"done"); + assert.equal(evaluate(c,"rows().find(r=>r.id==='agent:f').status"),"failed"); +}); +test("only eligible terminal tasks expose resume or retry",()=>{ + const c=context(); + assert.equal(evaluate(c,"canResume({kind:'chain',status:'interrupted',chain:{id:'x'}})"),true); + assert.equal(evaluate(c,"canResume({kind:'chain',status:'running',chain:{id:'x'}})"),false); + assert.equal(evaluate(c,"canRetry({kind:'video',status:'failed',id:'video:x'})"),true); + assert.equal(evaluate(c,"canRetry({kind:'agent',status:'failed',id:'agent:x'})"),false); +}); +test("terminal store rows cannot be revived by a stale queue sample",()=>{ + const c=context(); + evaluate(c,"sources.jobs.list=()=>[{id:'video:x',kind:'video',status:'done'}];queueRows=[{prompt_id:'x',node:'n',status:'running'}]"); + assert.equal(evaluate(c,"rows()[0].status"),"done"); +}); diff --git a/extensions/FreeVideoTaskManager/tests/test_host.py b/extensions/FreeVideoTaskManager/tests/test_host.py new file mode 100644 index 00000000..1cab3e40 --- /dev/null +++ b/extensions/FreeVideoTaskManager/tests/test_host.py @@ -0,0 +1,42 @@ +"""Run offline; use the real psutil with a mocked Comfy route registry.""" +import asyncio +import importlib.util +import json +from pathlib import Path +import sys +import types +import unittest + +class HostTest(unittest.TestCase): + def test_read_only_metrics(self): + routes = {} + def register(path): + def decorate(fn): + routes[path] = fn + return fn + return decorate + server = types.ModuleType("server") + server.PromptServer = types.SimpleNamespace(instance=types.SimpleNamespace( + routes=types.SimpleNamespace(get=register))) + original = sys.modules.get("server") + sys.modules["server"] = server + try: + spec = importlib.util.spec_from_file_location("ftm_test", Path(__file__).resolve().parents[1] / "__init__.py") + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + self.assertEqual(set(routes), {"/freevideo-task-manager/host"}) + self.assertEqual(mod.NODE_CLASS_MAPPINGS, {}) + result = asyncio.run(routes["/freevideo-task-manager/host"](None)) + data = json.loads(result.body) + self.assertTrue(0 <= data["cpu"] <= 100) + self.assertTrue(0 <= data["ram_used"] <= data["ram_total"]) + self.assertTrue(0 <= data["disk_used"] <= data["disk_total"]) + self.assertEqual(result.headers["Cache-Control"], "no-store") + finally: + if original is None: + sys.modules.pop("server", None) + else: + sys.modules["server"] = original + +if __name__ == "__main__": + unittest.main() diff --git a/extensions/FreeVideoTaskManager/web/i18n.js b/extensions/FreeVideoTaskManager/web/i18n.js new file mode 100644 index 00000000..9769fd43 --- /dev/null +++ b/extensions/FreeVideoTaskManager/web/i18n.js @@ -0,0 +1,286 @@ +// UI strings only. Native task titles and unknown engine diagnostics are kept unchanged. +const dictionary = { + "Idioma": { + "en": "Language", + "zh": "语言" + }, + "Em execução": { + "en": "Running", + "zh": "运行中" + }, + "Cancelando": { + "en": "Cancelling", + "zh": "正在取消" + }, + "Na fila": { + "en": "Queued", + "zh": "排队中" + }, + "Iniciando": { + "en": "Starting", + "zh": "正在启动" + }, + "Concluída": { + "en": "Completed", + "zh": "已完成" + }, + "Falhou": { + "en": "Failed", + "zh": "失败" + }, + "Cancelada": { + "en": "Cancelled", + "zh": "已取消" + }, + "Interrompida": { + "en": "Interrupted", + "zh": "已中断" + }, + "Todas": { + "en": "All", + "zh": "全部" + }, + "Concluídas": { + "en": "Completed", + "zh": "已完成" + }, + "Falhas / canceladas": { + "en": "Failed / cancelled", + "zh": "失败 / 已取消" + }, + "Agente": { + "en": "Agent", + "zh": "代理" + }, + "Geração de vídeo": { + "en": "Video generation", + "zh": "视频生成" + }, + "Geração de imagem": { + "en": "Image generation", + "zh": "图像生成" + }, + "Vídeo em segmentos": { + "en": "Segmented video", + "zh": "分段视频" + }, + "Atividade do agente": { + "en": "Agent activity", + "zh": "代理活动" + }, + "Cancelar somente esta tarefa?": { + "en": "Cancel only this task?", + "zh": "仅取消此任务?" + }, + "Retomar esta cadeia do último ponto aceito pelo FreeVideo?": { + "en": "Resume this chain from the last point accepted by FreeVideo?", + "zh": "从 FreeVideo 上次接受的位置继续此任务链?" + }, + "Reenfileirar o workflow original? Uma nova execução será criada.": { + "en": "Requeue the original workflow? A new run will be created.", + "zh": "重新将原工作流加入队列?这将创建新的运行。" + }, + "Cancelamento indisponível": { + "en": "Cancellation unavailable", + "zh": "无法取消" + }, + "Cancelamento não confirmado": { + "en": "Cancellation not confirmed", + "zh": "未确认取消" + }, + "Workflow original indisponível ou ambíguo; nenhuma tarefa foi enviada.": { + "en": "Original workflow unavailable or ambiguous; no task was submitted.", + "zh": "原工作流不可用或不明确;未提交任务。" + }, + "Fila não confirmou a nova execução.": { + "en": "Queue did not confirm the new run.", + "zh": "队列未确认新运行。" + }, + "Posição": { + "en": "Position", + "zh": "位置" + }, + "Decorrido": { + "en": "Elapsed", + "zh": "已用时" + }, + "Restante": { + "en": "Remaining", + "zh": "剩余" + }, + "Cancelar": { + "en": "Cancel", + "zh": "取消" + }, + "Retomar": { + "en": "Resume", + "zh": "继续" + }, + "Reexecutar": { + "en": "Retry", + "zh": "重试" + }, + "Atualizado": { + "en": "Updated", + "zh": "更新于" + }, + "Aguardando dados": { + "en": "Waiting for data", + "zh": "等待数据" + }, + "Temperatura GPU": { + "en": "GPU temperature", + "zh": "GPU 温度" + }, + "Disco do engine": { + "en": "Engine disk", + "zh": "引擎磁盘" + }, + "livres": { + "en": "free", + "zh": "可用" + }, + "Dados parciais": { + "en": "Partial data", + "zh": "部分数据" + }, + "Online": { + "en": "Online", + "zh": "在线" + }, + "Conectando": { + "en": "Connecting", + "zh": "连接中" + }, + "Tema": { + "en": "Theme", + "zh": "主题" + }, + "Voltar": { + "en": "Back", + "zh": "返回" + }, + "Central de tarefas": { + "en": "Task center", + "zh": "任务中心" + }, + "Acompanhe a geração e os recursos do computador.": { + "en": "Track generation and computer resources.", + "zh": "跟踪生成进度和计算机资源。" + }, + "Recursos do sistema": { + "en": "System resources", + "zh": "系统资源" + }, + "Histórico local · até 240 amostras": { + "en": "Local history · up to 240 samples", + "zh": "本地历史 · 最多 240 个样本" + }, + "Atividade": { + "en": "Activity", + "zh": "活动" + }, + "Gerações e atividades do agente são registros distintos.": { + "en": "Generations and agent activities are separate records.", + "zh": "生成任务和代理活动是不同的记录。" + }, + "Origem": { + "en": "Source", + "zh": "来源" + }, + "Todas as origens": { + "en": "All sources", + "zh": "所有来源" + }, + "Gerações": { + "en": "Generations", + "zh": "生成任务" + }, + "Agente / MCP / CLI": { + "en": "Agent / MCP / CLI", + "zh": "代理 / MCP / CLI" + }, + "Buscar tarefa...": { + "en": "Search tasks...", + "zh": "搜索任务..." + }, + "Buscar tarefa": { + "en": "Search tasks", + "zh": "搜索任务" + }, + "Tarefa": { + "en": "Task", + "zh": "任务" + }, + "Status": { + "en": "Status", + "zh": "状态" + }, + "Progresso": { + "en": "Progress", + "zh": "进度" + }, + "Etapa": { + "en": "Stage", + "zh": "阶段" + }, + "Tempo": { + "en": "Time", + "zh": "时间" + }, + "Ações": { + "en": "Actions", + "zh": "操作" + }, + "Nenhuma tarefa neste filtro.": { + "en": "No tasks match this filter.", + "zh": "此筛选条件下没有任务。" + }, + "Task Manager indisponível:": { + "en": "Task Manager unavailable:", + "zh": "任务管理器不可用:" + }, + "Ativar tema escuro": { + "en": "Switch to dark theme", + "zh": "切换至深色主题" + }, + "Ativar tema claro": { + "en": "Switch to light theme", + "zh": "切换至浅色主题" + }, + "Tasks": { + "en": "Tasks", + "zh": "任务" + }, + "WORKSPACE / TASKS": { + "en": "WORKSPACE / TASKS", + "zh": "工作区 / 任务" + }, + "Hardware": { + "en": "Hardware", + "zh": "硬件" + }, + "Vídeo": { + "en": "Video", + "zh": "视频" + }, + "Imagem": { + "en": "Image", + "zh": "图像" + }, + "Cadeia": { + "en": "Chain", + "zh": "任务链" + }, + "Amostragem": { + "en": "Sampling", + "zh": "采样" + } +}; +export function resolveLanguage(search="", browserLanguage="en", savedLanguage=null) { + if (["pt-BR", "en", "zh"].includes(savedLanguage)) return savedLanguage; + const explicit = new URLSearchParams(search).get("freevideo_lang"); + const normalized = String(explicit||browserLanguage||"en").toLowerCase(); + return normalized.startsWith("pt") ? "pt-BR" : normalized.startsWith("zh") ? "zh" : "en"; +} +export function translate(key,language) { return dictionary[key]?.[language] || key; } diff --git a/extensions/FreeVideoTaskManager/web/tasks.css b/extensions/FreeVideoTaskManager/web/tasks.css new file mode 100644 index 00000000..abcc768c --- /dev/null +++ b/extensions/FreeVideoTaskManager/web/tasks.css @@ -0,0 +1,29 @@ +/* The main navigation tab intentionally inherits FreeVideo's own topbar CSS. */ +html body .fv-topbar.fv-topbar.fv-topbar .ftm-native-theme::before{display:block} +html body .fv-topbar.fv-topbar.fv-topbar .ftm-native-theme .fv-tb-lbl{display:none} +.ftm header .ftm-language{position:relative;display:inline-flex;align-items:center;color:var(--ft-text);flex:none} +.ftm header .ftm-language .language{display:inline-flex;align-items:center;gap:7px;height:var(--fv-ctl,36px);padding:0 8px;border:0;background:transparent;border-radius:var(--fv-rad-ctl,8px);color:inherit;font-size:13px;cursor:pointer} +.ftm header .ftm-language .language:hover,.ftm header .ftm-language .language[aria-expanded=true]{background:var(--ft-track)} +.ftm header .ftm-language .language svg{pointer-events:none;flex:none} +.ftm header .ftm-language .language-menu{position:absolute;z-index:10;top:calc(100% + 8px);right:0;min-width:190px;max-width:calc(100vw - 24px);padding:6px;border:1px solid var(--ft-line);border-radius:12px;background:var(--ft-card);box-shadow:0 10px 30px rgb(0 0 0 / .18)} +.ftm header .ftm-language .language-menu[hidden]{display:none} +.ftm header .ftm-language .language-choice{width:100%;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 12px;border:0;border-radius:7px;background:transparent;color:var(--ft-text);text-align:left;white-space:nowrap;font-size:13px;cursor:pointer} +.ftm header .ftm-language .language-choice:hover,.ftm header .ftm-language .language-choice[aria-pressed=true]{background:var(--ft-track)} +.ftm header .ftm-language .language-choice .check{color:var(--ft-accent);font-weight:600} +.ftm header .ftm-language button:focus-visible{outline:2px solid var(--ft-accent);outline-offset:2px} +.ftm header button.theme{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--fv-ctl,36px);height:var(--fv-ctl,36px);padding:0;border:0;border-radius:var(--fv-rad-ctl,8px);background:transparent;color:var(--ft-text);box-shadow:none;line-height:1} +.ftm header button.theme:hover{background:var(--ft-track);color:var(--ft-text)} +.ftm header button.theme:focus-visible{outline:2px solid var(--ft-accent);outline-offset:2px} +.ftm header button.theme svg{display:block;pointer-events:none} +/* Mirror the native glass navigation in the independent Tasks surface. */ +.ftm header nav{flex:0 1 auto;gap:0;margin-inline:auto;padding:4px;border:0;border-radius:999px;background:rgb(225 234 244 / .72);box-shadow:inset 0 0 0 1px rgb(100 124 153 / .14),0 3px 8px rgb(30 50 75 / .08);backdrop-filter:blur(12px) saturate(150%);align-items:center} +.ftm header nav button{display:inline-flex;align-items:center;justify-content:center;height:var(--fv-ctl,34px);padding:0 var(--fv-sp-16,16px);border:0;border-radius:999px;background:transparent;box-shadow:none;color:#303946;font-family:var(--fv-font,system-ui,sans-serif);font-size:var(--fv-fs-2,14px);font-weight:500;white-space:nowrap;line-height:1} +.ftm header nav button:hover{color:#15191f;background:transparent} +.ftm header nav button[aria-pressed=true]{background:#fff;color:#12161b;font-weight:600;box-shadow:inset 0 1px 0 rgb(255 255 255 / .8)} +.ftm[data-theme=dark] header nav{background:rgb(50 65 85 / .55);box-shadow:inset 0 0 0 1px rgb(153 173 201 / .16),0 3px 8px rgb(0 0 0 / .15)} +.ftm[data-theme=dark] header nav button{color:#aebdd0} +.ftm[data-theme=dark] header nav button:hover{color:#fff} +.ftm[data-theme=dark] header nav button[aria-pressed=true]{background:#344258;color:#f5f7fb;box-shadow:none} +.ftm{--ft-bg:#f3f6fb;--ft-card:#fff;--ft-text:#17243b;--ft-muted:#62718a;--ft-line:#dce4ef;--ft-accent:#316cf4;--ft-track:#e7edf6;box-sizing:border-box;position:fixed;inset:0;margin:0!important;width:100vw!important;height:100dvh!important;max-width:none!important;max-height:none!important;padding:0;border:0;background:var(--ft-bg);color:var(--ft-text);font:14px/1.45 system-ui,sans-serif;overflow:auto} +.ftm[data-theme=dark]{--ft-bg:#0b1220;--ft-card:#131e30;--ft-text:#e7edf9;--ft-muted:#9aacc5;--ft-line:#29384f;--ft-accent:#75a6ff;--ft-track:#26344a;color-scheme:dark} +.ftm *{box-sizing:border-box}.ftm::backdrop{background:var(--ft-bg)}.ftm header{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:12px;padding:14px 26px;background:var(--ft-card);border-bottom:1px solid var(--ft-line);flex-wrap:wrap}.ftm .brand{font-size:17px;font-weight:700;white-space:nowrap}.ftm .brand b{color:var(--ft-accent)}.ftm .brand small{font-size:10px}.ftm nav{display:flex;gap:4px;flex:1;flex-wrap:wrap;justify-content:center}.ftm button,.ftm input,.ftm select{font:inherit;color:var(--ft-text);background:var(--ft-card);border:1px solid var(--ft-line);border-radius:8px;padding:7px 12px}.ftm button{cursor:pointer}.ftm button:hover,.ftm button[aria-current=page],.ftm button[aria-pressed=true]{border-color:var(--ft-accent);color:var(--ft-accent)}.ftm button:disabled{opacity:.5;cursor:wait}.ftm main{max-width:1500px;margin:auto;padding:30px 28px 60px}.ftm h1,.ftm h2,.ftm p{margin:0}.ftm h1{font-size:32px;letter-spacing:-1.2px}.ftm h2{font-size:19px}.ftm small,.ftm .hero span,.ftm .hero p{color:var(--ft-muted)}.ftm small{display:block;font-size:12px}.ftm .hero,.ftm .section-head{display:flex;justify-content:space-between;align-items:center;gap:15px;flex-wrap:wrap}.ftm .hero p{font-size:11px;letter-spacing:1.2px;font-weight:700}.ftm .hero .health{color:#16a36b;font-weight:700}.ftm .counts{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:24px 0}.ftm .count{text-align:left;padding:17px 19px;box-shadow:0 2px 10px #00000007}.ftm .count span{display:block;color:var(--ft-muted);font-size:13px}.ftm .count strong{display:block;font-size:30px;margin-top:5px}.ftm .count.running strong{color:#418bfa}.ftm .count.queued strong{color:#d89b24}.ftm .count.done strong{color:#16a36b}.ftm .count.failed strong{color:#ed6265}.ftm .hardware,.ftm .tasks{background:var(--ft-card);border:1px solid var(--ft-line);border-radius:14px;padding:20px;margin-bottom:20px}.ftm .metrics{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-top:18px}.ftm .metric{padding:12px;border:1px solid var(--ft-line);border-radius:10px;min-width:0}.ftm .metric span{display:block;color:var(--ft-muted);font-size:12px}.ftm .metric strong{display:block;font-size:17px;margin:8px 0;overflow-wrap:anywhere}.ftm .track{height:6px;border-radius:8px;background:var(--ft-track);overflow:hidden;min-width:65px;margin-top:5px}.ftm .track i{display:block;background:var(--ft-accent);height:100%;border-radius:8px;transition:width .3s}.ftm canvas{display:block;width:100%;height:34px;margin-top:10px}.ftm .filters{display:flex;gap:8px;flex-wrap:wrap}.ftm .message{color:#ed6265;margin-top:8px;white-space:pre-wrap}.ftm .table-wrap{overflow:auto;margin-top:15px}.ftm table{width:100%;border-collapse:collapse;text-align:left;min-width:870px}.ftm th{font-size:12px;color:var(--ft-muted);font-weight:600;background:var(--ft-bg);padding:12px}.ftm td{padding:14px 12px;border-bottom:1px solid var(--ft-line);vertical-align:middle;max-width:250px;overflow-wrap:anywhere}.ftm td small{margin-top:4px}.ftm .badge,.ftm .origin{display:inline-block;border-radius:6px;padding:4px 8px;background:var(--ft-track);font-size:12px;white-space:nowrap}.ftm .badge.running{color:#418bfa}.ftm .badge.queued{color:#d89b24}.ftm .badge.done{color:#16a36b}.ftm .badge.failed,.ftm .failure,.ftm .danger{color:#ed6265}.ftm .actions button{padding:5px 9px;font-size:12px;margin:2px}.ftm .time{white-space:nowrap;font-size:12px}.ftm .empty{text-align:center;padding:35px;color:var(--ft-muted)}.ftm [hidden]{display:none!important}@media(max-width:1050px){.ftm .metrics{grid-template-columns:repeat(3,1fr)}.ftm .counts{grid-template-columns:repeat(3,1fr)}}@media(max-width:600px){.ftm main{padding:16px}.ftm header{padding:12px}.ftm .metrics,.ftm .counts{grid-template-columns:repeat(2,1fr)}.ftm .hardware,.ftm .tasks{padding:12px}.ftm h1{font-size:26px}} diff --git a/extensions/FreeVideoTaskManager/web/tasks.js b/extensions/FreeVideoTaskManager/web/tasks.js new file mode 100644 index 00000000..20402771 --- /dev/null +++ b/extensions/FreeVideoTaskManager/web/tasks.js @@ -0,0 +1,329 @@ +import { app } from "../../scripts/app.js"; +import { api } from "../../scripts/api.js"; +import { resolveLanguage, translate } from "./i18n.js"; +const LANG_KEY="freevideo-task-manager.language"; +let savedLanguage;try{savedLanguage=localStorage.getItem(LANG_KEY);}catch{} +let LANGUAGE=resolveLanguage(globalThis.location?.search,globalThis.navigator?.language,savedLanguage); +const t=key=>translate(key,LANGUAGE); + +const BASE = new URL("../FreeVideo/", import.meta.url); +const load = name => import(new URL(name + ".js", BASE).href); +const HISTORY = "freevideo-task-manager.history.v1"; +const LIMIT = 240; +const states = {running:"Em execução",cancelling:"Cancelando",queued:"Na fila",submitting:"Iniciando",done:"Concluída",failed:"Falhou",cancelled:"Cancelada",interrupted:"Interrompida"}; +const agentStates = {waiting:"queued",queued:"queued",running:"running",cancelling:"cancelling",succeeded:"done",done:"done",completed:"done",failed:"failed",cancelled:"cancelled",canceled:"cancelled",interrupted:"interrupted"}; +const groups = {all:"Todas",running:"Em execução",queued:"Na fila",done:"Concluídas",failed:"Falhas / canceladas"}; +const group = s => ["running","cancelling"].includes(s) ? "running" : ["queued","submitting"].includes(s) ? "queued" : s === "done" ? "done" : "failed"; +const number = n => typeof n === "number" && Number.isFinite(n); +const fraction = n => number(n) ? Math.max(0,Math.min(1,n)) : null; +const stamp = n => number(n) ? (n < 1e12 ? n*1000 : n) : Date.parse(n || "") || null; +const elapsed = n => !number(n) || n < 0 ? "—" : [Math.floor(n/3600),Math.floor(n/60)%60,Math.floor(n)%60].map(v=>String(v).padStart(2,"0")).join(":"); +const gib = n => number(n) ? (n/1073741824).toFixed(1)+" GB" : "—"; +const pct = (a,b) => number(a)&&number(b)&&b>0 ? 100*a/b : null; +const el = (tag, cls, txt) => {const x=document.createElement(tag); if(cls)x.className=cls; if(txt!=null)x.textContent=txt; return x;}; +const button = (txt,fn,cls="") => {const b=el("button",cls,txt);b.type="button";b.onclick=fn;return b;}; +let ui, sources, opening, observer, timer, tick, unsubscribe, agentUnsubscribe, agent, agentRaw=[], chains=[], journal=[], queueRows=[], hardware=null, samples=[], selected="all", scope="all", search="", error="", busy=new Set(), polling=false, pollEpoch=0, lastGood=0, nativeNav=null; +const rowElements=new Map(); +let lastChart=null, lastChartTheme=null, healthKey="Conectando"; +try { samples=JSON.parse(localStorage.getItem(HISTORY)||"[]").filter(s=>number(s.t)&&Date.now()-s.t<=86400000).slice(-LIMIT); } catch { samples=[]; } + +async function get(path,options={}) { + const r=await api.fetchApi(path,{cache:"no-store",signal:AbortSignal.timeout(6000),...options}); + if(!r.ok)throw new Error("HTTP "+r.status); + return r.json(); +} +const post = (path, body) => get(path,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)}); +const visible = () => Boolean(ui?.open); +function sourceLabel(row) { + if(row.kind!=="agent"&&!row.agentClient)return row.origin && row.origin!=="page" ? String(row.origin) : "FreeVideo"; + const name=String(row.agentClient||row.job?.client||""); + return /mcp/i.test(name) ? "MCP" : /cli/i.test(name) ? "CLI" : name || t("Agente"); +} +function rows() { + const map=new Map((sources?.jobs.list()||[]).map(r=>[r.id,{...r}])); + for(const r of journal) { + if(!r.id||!["video","chain","image"].includes(r.kind))continue; + const id=r.kind+":"+r.id; + if(!map.has(id)) map.set(id,{...r,id,kind:r.kind,status:r.status,created_at:stamp(r.created_at),started_at:stamp(r.started_at),finished_at:stamp(r.finished_at),cancellable:false}); + } + // The native queue adapter follows the current browser only. Cover other clients + // using the server queue, matching progress only to a unique running node. + for(const q of queueRows){ + const id="video:"+q.prompt_id, prev=map.get(id); + if(prev&&["done","failed","cancelled","interrupted"].includes(prev.status))continue; + const linked=agentRaw.find(j=>q.client==="agent:"+j.id); + const externalCancel=!q.client?.startsWith("agent:")&&!q.chainId; + map.set(id,{...prev,...q,id,kind:"video",agentClient:linked?.client||(q.client?.startsWith("agent:")?t("Agente"):null),externalCancel,cancellable:externalCancel||(prev?.cancellable===true&&Boolean(sources.jobs.get(id))),percent:q.percent??prev?.percent,phase:q.phase||prev?.phase,eta_seconds:q.eta_seconds??prev?.eta_seconds,started_at:q.started_at??prev?.started_at,created_at:q.created_at??prev?.created_at}); + } + for(const c of chains) { + if(!c.id)continue; + const id="chain:"+c.id; + const status=({pending:"queued",queued:"queued",running:"running",cancelling:"cancelling",done:"done",complete:"done",failed:"failed",cancelled:"cancelled",stopped:"cancelled",interrupted:"interrupted"})[c.state]; + if(!status)continue; + const prev=map.get(id); + map.set(id,{id,kind:"chain",created_at:stamp(c.created),percent:c.count?c.done/c.count:null,cancellable:["running","queued"].includes(status),...prev,status:c.output_state==="joining"?"running":status,chain:c}); + } + for(const r of agent?.rows()||[])map.set(r.id,{...r,phase:r.job?.progress?.phase,percent:fraction(r.job?.progress?.fraction),created_at:stamp(r.job?.created_at),started_at:stamp(r.job?.started_at)}); + for(const j of agentRaw) { + if(!j.id||!agentStates[j.status])continue; + const id="agent:"+j.id, prev=map.get(id); + map.set(id,{id,kind:"agent",agentId:j.id,status:agentStates[j.status],cancellable:false,job:j,phase:j.progress?.phase,percent:fraction(j.progress?.fraction),eta_seconds:j.progress?.remaining_seconds,created_at:stamp(j.created_at),started_at:stamp(j.started_at),finished_at:stamp(j.finished_at),...prev}); + } + return [...map.values()].filter(r=>states[r.status]).sort((a,b)=>["running","queued","done","failed"].indexOf(group(a.status))-["running","queued","done","failed"].indexOf(group(b.status)) || (stamp(b.finished_at||b.created_at)||0)-(stamp(a.finished_at||a.created_at)||0)); +} +function taskName(r) {return r.job?.label||r.model||({video:t("Geração de vídeo"),image:t("Geração de imagem"),chain:t("Vídeo em segmentos"),agent:t("Atividade do agente")})[r.kind]||r.kind;} +function phaseLabel(phase){if(!phase)return "";return String(phase).replace(/\bsampling\b/gi,t("Amostragem"));} +function canResume(r) {return r.kind==="chain"&&["failed","cancelled","interrupted"].includes(r.status)&&Boolean(r.chain);} +function canRetry(r) {return r.kind==="video"&&["failed","cancelled","interrupted"].includes(r.status)&&r.id.startsWith("video:");} +async function action(r,type) { + if(busy.has(r.id))return; + const question=type==="cancel"?t("Cancelar somente esta tarefa?"):type==="resume"?t("Retomar esta cadeia do último ponto aceito pelo FreeVideo?"):t("Reenfileirar o workflow original? Uma nova execução será criada."); + if(!window.confirm(question))return; + busy.add(r.id);error="";render(); + try { + if(type==="cancel"){ + if(r.kind==="agent")await agent.cancel(r.agentId); + else if(sources.jobs.get(r.id)?.cancellable===true){if(!await sources.jobs.cancel(r.id))throw Error(t("Cancelamento indisponível"));} + else if(r.kind==="chain"&&r.chain)await post("/freevideo/chain/"+encodeURIComponent(r.id.slice(6))+"/cancel",{}); + else if(r.externalCancel&&r.prompt_id&&r.node){const reply=await post("/freevideo/cancel",{prompt_id:r.prompt_id,node_id:String(r.node)});if(!["cancelled","cancelling","finished"].includes(reply.status))throw Error(t("Cancelamento não confirmado"));} + else throw Error(t("Cancelamento indisponível")); + } else if(type==="resume"){ + await post("/freevideo/chain/"+encodeURIComponent(r.id.slice(6))+"/resume",{client_id:api.clientId}); + } else { + const id=r.prompt_id||r.id.slice(6); + const history=await get("/history/"+encodeURIComponent(id)); + const p=history[id]?.prompt; + const nodes=Object.entries(p?.[2]||{}).filter(([,n])=>n.class_type==="FreeVideoGenerate"); + const node=nodes.find(([key])=>String(key)===String(r.node))|| (nodes.length===1?nodes[0]:null); + if(!node)throw Error(t("Workflow original indisponível ou ambíguo; nenhuma tarefa foi enviada.")); + // Native helper clones the frozen workflow; no new seed is applied. + const snapshot=sources.queue.seededPrompt({output:p[2],workflow:p[3]?.extra_pnginfo?.workflow||{}},node[0],-1,undefined); + const reply=await api.queuePrompt(0,snapshot); + if(!reply?.prompt_id)throw Error(t("Fila não confirmou a nova execução.")); + api.dispatchCustomEvent?.("promptQueued",{number:0,batchCount:1}); + } + if(visible())await poll(); + } catch(e){error=String(e.message||e);} finally {busy.delete(r.id);render();} +} +function taskRow(r) { + const tr=el("tr");const main=el("td"); + main.append(el("strong","",taskName(r)),el("small","",r.id.replace(/^[^:]+:/,"").slice(0,12)+" · "+({video:t("Vídeo"),image:t("Imagem"),chain:t("Cadeia"),agent:t("Agente")})[r.kind])); + const st=el("td");st.append(el("span","badge "+group(r.status),t(states[r.status]))); + const origin=el("td");origin.append(el("span","origin",sourceLabel(r))); + const progress=el("td");const f=r.status==="done"?1:fraction(r.percent);const bar=el("div","track");const fill=el("i");fill.style.width=(f===null?0:f*100)+"%";bar.append(fill);progress.append(el("strong","",f===null?"—":Math.round(f*100)+"%"),bar); + const phase=el("td","",phaseLabel(r.phase||r.job?.progress?.phase)|| (r.status==="queued"&&number(r.position)&&r.position>0?t("Posição")+" "+r.position:"—")); + const start=stamp(r.started_at||r.created_at), end=stamp(r.finished_at)||Date.now(); + const time=el("td","time");time.append(el("span","",t("Decorrido")+" "+(start?elapsed((end-start)/1000):"—")),el("small","",t("Restante")+" "+(group(r.status)==="running"&&number(r.eta_seconds)?"~"+elapsed(r.eta_seconds):"—"))); + const actions=el("td","actions"); + if(["running","queued","submitting"].includes(r.status)&&r.cancellable!==false&&(r.kind==="agent"||r.externalCancel||r.chain||sources.jobs.get(r.id)))actions.append(button(t("Cancelar"),()=>action(r,"cancel"),"danger")); + if(canResume(r))actions.append(button(t("Retomar"),()=>action(r,"resume"))); + else if(canRetry(r))actions.append(button(t("Reexecutar"),()=>action(r,"retry"))); + for(const b of actions.children)b.disabled=busy.has(r.id); + if(!actions.children.length)actions.textContent="—"; + if(r.failure?.code) main.append(el("small","failure",String(r.failure.code))); + tr.append(main,st,origin,progress,phase,time,actions);return tr; +} +function render() { + if(!visible()||!sources||document.hidden)return; + const all=rows(); + for(const [key,value] of Object.entries(groups)){ + const c=ui.querySelector('[data-count="'+key+'"]');if(c)c.textContent=String(key==="all"?all.length:all.filter(r=>group(r.status)===key).length); + } + const q=search.trim().toLowerCase(); + const filtered=all.filter(r=>(selected==="all"||group(r.status)===selected)&&(scope==="all"|| (scope==="agent"?r.kind==="agent":r.kind!=="agent"))&&(!q||[taskName(r),r.id,sourceLabel(r),r.phase].some(x=>String(x||"").toLowerCase().includes(q)))); + const body=ui.querySelector("tbody"), keep=new Set(filtered.map(r=>r.id)); + for(const [id,entry] of rowElements){if(!keep.has(id)){entry.node.remove();rowElements.delete(id);}} + filtered.forEach((r,index)=>{ + // The timer only updates the clock; it does not rebuild the table each second. + const key=JSON.stringify([taskName(r),r.kind,r.status,sourceLabel(r),r.percent,r.phase,r.position,r.eta_seconds,r.cancellable,r.failure?.code,canResume(r),canRetry(r),busy.has(r.id)]); + let entry=rowElements.get(r.id); + if(!entry||entry.key!==key){const node=taskRow(r); if(entry){const focused=document.activeElement;const label=entry.node.contains(focused)?focused.textContent:null;entry.node.replaceWith(node);if(label) [...node.querySelectorAll("button")].find(b=>b.textContent===label)?.focus({preventScroll:true});}entry={key,node};rowElements.set(r.id,entry);} + if(body.children[index]!==entry.node)body.insertBefore(entry.node,body.children[index]||null); + const start=stamp(r.started_at||r.created_at),end=stamp(r.finished_at)||Date.now(); + entry.node.querySelector(".time span").textContent=t("Decorrido")+" "+(start?elapsed((end-start)/1000):"—"); + }); + ui.querySelector(".empty").hidden=filtered.length!==0; + ui.querySelector(".message").textContent=error; + ui.querySelector(".connection").textContent=lastGood?t("Atualizado")+" "+new Date(lastGood).toLocaleTimeString(LANGUAGE):t("Aguardando dados"); + renderHardware(); +} +const metrics=[ + ["gpu","GPU",s=>number(s.gpu)?Math.round(s.gpu)+"%":"—",s=>s.gpu], + ["vram","VRAM",s=>gib(s.vram_used)+" / "+gib(s.vram_total),s=>pct(s.vram_used,s.vram_total)], + ["cpu","CPU",s=>number(s.cpu)?Math.round(s.cpu)+"%":"—",s=>s.cpu], + ["ram","RAM",s=>gib(s.ram_used)+" / "+gib(s.ram_total),s=>pct(s.ram_used,s.ram_total)], + ["temp","Temperatura GPU",s=>number(s.temp)?Math.round(s.temp)+" °C":"—",s=>s.temp], + ["disk","Disco do engine",s=>gib(s.disk_free)+" "+t("livres"),s=>pct(s.disk_used,s.disk_total)] +]; +function renderHardware(){ + if(lastChart===hardware&&lastChartTheme===ui.dataset.theme)return; + lastChart=hardware;lastChartTheme=ui.dataset.theme; + const h=hardware||{}; + ui.querySelector(".gpu-name").textContent=h.name||t("Hardware"); + for(const [id,label,format,measure] of metrics){ + const card=ui.querySelector('[data-metric="'+id+'"]');card.querySelector("strong").textContent=format(h); + const p=measure(h);card.querySelector("i").style.width=number(p)?Math.max(0,Math.min(100,p))+"%":"0%"; + const canvas=card.querySelector("canvas"), ctx=canvas.getContext("2d");ctx.clearRect(0,0,canvas.width,canvas.height); + const series=samples.map(measure);ctx.strokeStyle=getComputedStyle(card).getPropertyValue("--ft-accent").trim()||"#4285ff";ctx.lineWidth=2;ctx.beginPath();let begun=false; + series.forEach((v,i)=>{if(!number(v)){begun=false;return;}const x=i*canvas.width/Math.max(1,series.length-1),y=canvas.height-2-Math.max(0,Math.min(100,v))*(canvas.height-4)/100;if(!begun){ctx.moveTo(x,y);begun=true;}else ctx.lineTo(x,y);});ctx.stroke(); + } +} +async function poll(){ + if(!visible()||document.hidden||polling)return; + polling=true;const epoch=pollEpoch; + try { + const results=await Promise.allSettled([get("/freevideo/monitor"),get("/freevideo-task-manager/host"),get("/freevideo/jobs"),get("/freevideo/chains"),get("/queue"),get("/freevideo/progress")]); + if(!visible()||epoch!==pollEpoch)return; + const [gpu,host,j,c,q,p]=results.map(r=>r.status==="fulfilled"?r.value:null); + if(j)journal=Array.isArray(j.jobs)?j.jobs:[]; + if(c)chains=Array.isArray(c.chains)?c.chains:[]; + if(q){ + const active=(q.queue_running||[]).map(r=>[r,"running"]), pending=(q.queue_pending||[]).map(r=>[r,"queued"]); + const entries=[...active,...pending].flatMap(([r,status],position)=>{ + const nodes=Object.entries(r[2]||{}).filter(([,n])=>n.class_type==="FreeVideoGenerate"); + if(nodes.length!==1||!r[1])return []; + const node=nodes[0][0];return [{prompt_id:r[1],node,status,client:r[3]?.client_id,chainId:r[3]?.freevideo_chain?.id,created_at:stamp(r[3]?.create_time),position}]; + }); + queueRows=entries.map(r=>{ + const matched=r.status==="running"&&entries.filter(x=>x.node===r.node&&x.status==="running").length===1?(p?.progress||[]).filter(m=>String(m.node)===r.node&&(!m.prompt_id||m.prompt_id===r.prompt_id)&&m.overall?.status==="running"&&!m.result).sort((a,b)=>(a.age_seconds??Infinity)-(b.age_seconds??Infinity))[0]:null; + const o=matched?.overall; + return {...r,phase:matched?.label||matched?.phase,percent:fraction(o?.fraction),eta_seconds:o?.remaining_seconds,started_at:number(o?.elapsed_seconds)?Date.now()-o.elapsed_seconds*1000:null}; + }); + } else queueRows=[]; + if(gpu||host){ + hardware={t:Date.now(),name:gpu?.name||"",gpu:gpu?.utilization,vram_used:gpu?.memory_used,vram_total:gpu?.memory_total,temp:gpu?.temperature,disk_free:gpu?.disk_free,...(host||{})}; + if(!number(hardware.disk_free)&&number(host?.disk_total)&&number(host?.disk_used))hardware.disk_free=host.disk_total-host.disk_used; + samples.push(hardware);samples=samples.filter(s=>Date.now()-s.t<=86400000).slice(-LIMIT); + try{localStorage.setItem(HISTORY,JSON.stringify(samples));}catch{} + lastGood=Date.now(); + } else hardware=null; + healthKey=results.every(r=>r.status==="fulfilled")?"Online":"Dados parciais"; + ui.querySelector(".health").textContent=t(healthKey); + } finally {polling=false;render();} +} +const icons={sun:'',moon:''}; +// Keep native Settings behavior; replace its sun-like glyph with a toothed cog. +const cog=''; +const iconMask=path=>'url("data:image/svg+xml,'+encodeURIComponent(''+path+'')+'")'; +const currentTheme=()=>document.documentElement.dataset.theme==="light"?"light":"dark"; +const nextTheme=theme=>theme==="light"?"dark":"light"; +function syncNativeSettingsTheme(){ + // The native segmented control hooks the select value setter to repaint. + // Do not dispatch change: the global theme has already been applied. + for(const select of document.querySelectorAll(".st-seg > select")){ + const values=Array.from(select.options,o=>o.value); + if(values.length!==2||!values.includes("dark")||!values.includes("light"))continue; + if(select.value!==currentTheme())select.value=currentTheme(); + } +} +function toggleTheme(){ + const theme=nextTheme(currentTheme()); + if(globalThis.FreeVideoShell?.setTheme)globalThis.FreeVideoShell.setTheme(theme);else document.documentElement.dataset.theme=theme; + try{localStorage.setItem("freevideo.theme",theme);}catch{} +} +function syncNativeTheme(b){ + const dark=currentTheme()==="dark"; + const nativeLang=resolveLanguage(globalThis.location?.search,globalThis.navigator?.language)==="zh"?"zh":"en"; + const label=translate(dark?"Ativar tema claro":"Ativar tema escuro",nativeLang); + b.style.setProperty("--fv-tb-icon",iconMask(icons[dark?"sun":"moon"])); + b.setAttribute("aria-label",label);b.title=label; + const text=b.querySelector(".fv-tb-lbl");if(text.textContent!==label)text.textContent=label; +} +function attachNativeControls(){ + for(const settings of document.querySelectorAll(".fv-settings-entry")){ + if(!settings.closest(".fv-tb-links"))continue; + if(!settings.classList.contains("ftm-settings-cog")){ + settings.classList.add("ftm-settings-cog"); + settings.style.setProperty("--fv-tb-icon",iconMask(cog)); + } + const links=settings.parentElement; + if(links.querySelector(".ftm-native-theme"))continue; + const b=button("",toggleTheme,"fv-tb-link fv-tb-ico ftm-native-theme"); + b.append(el("span","fv-tb-lbl"));syncNativeTheme(b); + settings.before(b); + } +} +function syncTheme(d){ + d.dataset.theme=document.documentElement.dataset.theme==="light"?"light":"dark"; + const b=d.querySelector(".theme"), dark=d.dataset.theme==="dark"; + const label=t(dark?"Ativar tema claro":"Ativar tema escuro"); + b.title=label;b.setAttribute("aria-label",label); + b.innerHTML=''; + if(visible())renderHardware(); +} +function populate(d){ + rowElements.clear();lastChartTheme=null; + d.innerHTML=`
FreeVideo Task Manager v0.1

${t("WORKSPACE / TASKS")}

${t("Central de tarefas")}

${t("Acompanhe a geração e os recursos do computador.")}
${t(healthKey)}

${t("Recursos do sistema")}

${t("Histórico local · até 240 amostras")}

${t("Atividade")}

${t("Gerações e atividades do agente são registros distintos.")}
${t("Tarefa")}${t("Status")}${t("Origem")}${t("Progresso")}${t("Etapa")}${t("Tempo")}${t("Ações")}

${t("Nenhuma tarefa neste filtro.")}

`; + const counts=d.querySelector(".counts"); + for(const [id,label] of Object.entries(groups)){const b=button("",()=>{selected=id;for(const c of counts.children)c.setAttribute("aria-pressed",String(c===b));render();},"count "+id);b.setAttribute("aria-pressed",String(id===selected));const n=el("strong","","0");n.dataset.count=id;b.append(el("span","",t(label)),n);counts.append(b);} + for(const [id,label] of metrics){const c=el("article","metric");c.dataset.metric=id;c.append(el("span","",t(label)),el("strong","","—"));const tr=el("div","track");tr.append(el("i"));c.append(tr);const canvas=el("canvas");canvas.width=200;canvas.height=34;canvas.setAttribute("aria-hidden","true");c.append(canvas);d.querySelector(".metrics").append(c);} + d.querySelector(".back").onclick=()=>d.close(); + d.querySelector(".theme").onclick=()=>{toggleTheme();syncTheme(d);}; + d.querySelector("input").oninput=e=>{search=e.target.value;render();}; + const filter=d.querySelector(".filters select");filter.value=scope;filter.onchange=e=>{scope=e.target.value;render();}; + d.querySelector("input").value=search; + bindLanguageMenu(d); +} +const languageOptions=[["pt-BR","Português (Brasil)"],["en","English"],["zh","简体中文"]]; +function setLanguageMenu(d,open,restoreFocus=false){ + const trigger=d.querySelector(".language"), menu=d.querySelector(".language-menu"); + if(!trigger||!menu)return; + menu.hidden=!open;trigger.setAttribute("aria-expanded",String(open)); + if(restoreFocus)trigger.focus({preventScroll:true}); +} +function bindLanguageMenu(d){ + const trigger=d.querySelector(".language"),menu=d.querySelector(".language-menu"); + for(const [value,label] of languageOptions){ + const choice=button("",()=>{ + setLanguageMenu(d,false); + if(value!==LANGUAGE){LANGUAGE=value;try{localStorage.setItem(LANG_KEY,LANGUAGE);}catch{}populate(d);fillNav(d,nativeNav);syncTheme(d);render();} + d.querySelector(".language").focus({preventScroll:true}); + },"language-choice"); + choice.setAttribute("aria-pressed",String(value===LANGUAGE));choice.lang=value; + choice.append(el("span","",label),el("span","check",value===LANGUAGE?"✓":"")); + menu.append(choice); + } + trigger.onclick=()=>setLanguageMenu(d,menu.hidden); + trigger.onkeydown=e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault();setLanguageMenu(d,true);const items=menu.querySelectorAll("button");items[e.key==="ArrowDown"?0:items.length-1]?.focus();}; + menu.onkeydown=e=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault();const items=[...menu.querySelectorAll("button")], at=items.indexOf(document.activeElement);const index=e.key==="Home"?0:e.key==="End"?items.length-1:(at+(e.key==="ArrowDown"?1:-1)+items.length)%items.length;items[index]?.focus();}; +} +function build(){ + const d=el("dialog","ftm");d.setAttribute("aria-label","FreeVideo Task Manager");populate(d); + d.addEventListener("click",e=>{if(!e.target.closest(".ftm-language"))setLanguageMenu(d,false);}); + d.addEventListener("focusout",e=>{if(e.target.closest(".ftm-language")&&e.relatedTarget&&!e.relatedTarget.closest(".ftm-language"))setLanguageMenu(d,false);}); + d.addEventListener("keydown",e=>{if(e.key==="Escape"&&d.querySelector(".language")?.getAttribute("aria-expanded")==="true"){e.preventDefault();e.stopPropagation();setLanguageMenu(d,false,true);}},true); + d.addEventListener("close",()=>{setLanguageMenu(d,false);pollEpoch++;clearInterval(timer);clearInterval(tick);unsubscribe?.();agentUnsubscribe?.();agent?.watch(false);nativeNav?.focus({preventScroll:true});}); + document.body.append(d); + new MutationObserver(()=>syncTheme(d)).observe(document.documentElement,{attributes:true,attributeFilter:["data-theme"]}); + return d; +} +function fillNav(d,anchor){ + const nav=d.querySelector("nav");nav.replaceChildren(); + for(const tab of anchor?.parentElement?.querySelectorAll("[data-view]:not(.ftm-tab)")||[]){if(tab.hidden)continue;const b=button(tab.dataset.label||tab.textContent,()=>{d.close();tab.click();});b.setAttribute("aria-pressed","false");nav.append(b);} + const current=button(t("Tasks"),()=>{});current.setAttribute("aria-current","page");current.setAttribute("aria-pressed","true");nav.append(current); +} +async function open(anchor){ + if(opening||visible())return;opening=true;nativeNav=anchor; + try { + if(!sources){ + const [store,float,agentModule,queue]=await Promise.all([load("task_store"),load("task_float"),load("agent_tasks"),load("studio_queue")]); + float.startJobSources();sources={jobs:store.jobs,queue}; + // Reuse agent adapter; capture full history on its own reads, without additional activity polls. + agent=agentModule.createAgentTasks(new Proxy(api,{get(target,key){if(key==="fetchApi")return async (path,opts)=>{if(!visible()||document.hidden)return new Response("",{status:503});const r=await target.fetchApi(path,opts);if(path==="/freevideo/agent/activity"&&r.ok){try{agentRaw=(await r.clone().json()).jobs||[];}catch{}}return r;};const v=Reflect.get(target,key);return typeof v==="function"?v.bind(target):v;}})); + } + ui??=build(); + syncTheme(ui); + + fillNav(ui,anchor); + ui.showModal();pollEpoch++;unsubscribe=sources.jobs.subscribe(render);agentUnsubscribe=agent.subscribe(render);agent.watch(true);render();void poll();timer=setInterval(poll,5000);tick=setInterval(render,1000); + }catch(e){console.warn("FreeVideo Task Manager",e);window.alert(t("Task Manager indisponível:")+" "+String(e.message||e));}finally{opening=false;} +} +function install(){ + if(observer)return; + const css=el("link");css.rel="stylesheet";css.href=new URL("./tasks.css",import.meta.url).href;document.head.append(css); + const attach=()=>{for(const nav of document.querySelectorAll(".fv-view-switch")){if(nav.querySelector(".ftm-tab"))continue;const b=button("",()=>open(b),"ftm-tab fv-tb-tab");b.append(el("span","",t("Tasks")));b.dataset.view="tasks";b.dataset.label=t("Tasks");b.setAttribute("aria-pressed","false");b.setAttribute("aria-haspopup","dialog");b.title="FreeVideo Task Manager";nav.append(b);}attachNativeControls();syncNativeSettingsTheme();}; + let queued=false;observer=new MutationObserver(()=>{if(queued)return;queued=true;requestAnimationFrame(()=>{queued=false;attach();});}); + observer.observe(document.body,{childList:true,subtree:true});attach(); + new MutationObserver(()=>{for(const b of document.querySelectorAll(".ftm-native-theme"))syncNativeTheme(b);syncNativeSettingsTheme();}).observe(document.documentElement,{attributes:true,attributeFilter:["data-theme"]}); +} +app.registerExtension({name:"Lordelo.FreeVideoTaskManager",setup(){install();}}); From 45c087ce3c0aa9066dcff9c38fe3d1ff82dc02ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Lord=C3=AAlo?= Date: Sun, 22 Nov 2026 19:49:28 -0300 Subject: [PATCH 2/3] fix(task-manager): align language and creations navigation Share the language menu between native views and Tasks, using the existing FreeVideo locale switch for English and Chinese. Keep Portuguese scoped to the independent dashboard. Expose the native Creations library in the Tasks header without duplicating library logic. Add regression tests for locale routing and library delegation. --- extensions/FreeVideoTaskManager/README.md | 3 +- .../FreeVideoTaskManager/tests/tasks.test.cjs | 19 +++++ extensions/FreeVideoTaskManager/web/i18n.js | 8 +++ extensions/FreeVideoTaskManager/web/tasks.css | 17 +++++ extensions/FreeVideoTaskManager/web/tasks.js | 70 ++++++++++++++++--- 5 files changed, 105 insertions(+), 12 deletions(-) diff --git a/extensions/FreeVideoTaskManager/README.md b/extensions/FreeVideoTaskManager/README.md index ed1f99f0..4d24e683 100644 --- a/extensions/FreeVideoTaskManager/README.md +++ b/extensions/FreeVideoTaskManager/README.md @@ -5,6 +5,7 @@ Independent ComfyUI frontend extension targeting FreeVideo 0.6.8. No changes to Place this folder in ComfyUI/custom_nodes/FreeVideoTaskManager. Restart ComfyUI **only when the queue and agent activity are idle**. Reload the browser; select Tasks in the main FreeVideo navigation. To remove, stop ComfyUI when idle, remove this folder, and start normally. Do not restart during a generation. ## Design +- Native top bars expose the shared language selector. English and Simplified Chinese use FreeVideo's existing language switch; Portuguese remains available only for Tasks. The Tasks header includes Creations, which opens the original library after leaving the dashboard. - The sun/moon control follows the shared FreeVideo theme, via FreeVideoShell.setTheme and the native freevideo.theme preference. The dashboard no longer stores a separate theme. - The extension also replaces the native Settings sun-like glyph with a cog and adds a separate theme toggle next to Settings. Existing Settings behavior is unchanged; no upstream files are edited. - Local UI string catalog (web/i18n.js): Brazilian Portuguese, English and Simplified Chinese. The globe selector beside the theme icon changes the dashboard language immediately, saves the preference locally and preserves filters and task monitoring. With no saved selection, honors explicit freevideo_lang query parameter; otherwise detects browser locale and falls back to English. Native job names and unknown engine diagnostic strings remain unchanged. FreeVideo itself supports English and Chinese, not a global Portuguese translation. @@ -23,7 +24,7 @@ node --test custom_nodes/FreeVideoTaskManager/tests/tasks.test.cjs .venv/Scripts/python.exe -B custom_nodes/FreeVideoTaskManager/tests/test_host.py ``` -Verified on Windows 10 with an NVIDIA RTX 5060 Ti 16 GB and FreeVideo 0.6.8: the dashboard displayed live generation progress and hardware metrics, both themes rendered, and the user confirmed the language menu visually. Ten offline JavaScript tests and one Python host-metrics test passed. The offline checks do not replace the live-job acceptance tests below. +Verified on Windows 10 with an NVIDIA RTX 5060 Ti 16 GB and FreeVideo 0.6.8: the dashboard displayed live generation progress and hardware metrics, both themes rendered, and the user confirmed the dashboard language menu visually. Twelve offline JavaScript tests and one Python host-metrics test passed. The native language shortcut and Creations shortcut still need a visual acceptance check. The offline checks do not replace the live-job acceptance tests below. Upstream discussion: https://github.com/FlashML-org/FreeVideo/issues/1054. The prototype was developed with AI assistance. Upstream main and other platforms still require validation. diff --git a/extensions/FreeVideoTaskManager/tests/tasks.test.cjs b/extensions/FreeVideoTaskManager/tests/tasks.test.cjs index 1c915d55..c3f8d38f 100644 --- a/extensions/FreeVideoTaskManager/tests/tasks.test.cjs +++ b/extensions/FreeVideoTaskManager/tests/tasks.test.cjs @@ -14,6 +14,25 @@ function context(){ return c; } const evaluate=(c,expr)=>vm.runInContext(expr,c); +test("main navigation language changes native locale only for supported languages",()=>{ + const c=context(); + evaluate(c,"globalThis.location={search:'?freevideo_lang=en',href:'http://localhost/?freevideo_lang=en#workflow',assign(url){globalThis.reloaded=String(url)}};document.querySelectorAll=()=>[];localStorage.setItem=(k,v)=>{globalThis.saved=v}"); + evaluate(c,"selectLanguage('pt-BR',true)"); + assert.equal(evaluate(c,"LANGUAGE"),"pt-BR"); + assert.equal(evaluate(c,"typeof reloaded"),"undefined"); + evaluate(c,"selectLanguage('zh',false)"); + assert.equal(evaluate(c,"typeof reloaded"),"undefined"); + evaluate(c,"selectLanguage('zh',true)"); + assert.equal(evaluate(c,"reloaded"),"http://localhost/?freevideo_lang=zh#workflow"); + assert.equal(evaluate(c,"saved"),"zh"); +}); +test("Creations opens the original library after closing Tasks",()=>{ + const c=context(); + evaluate(c,"globalThis.clicked=false;globalThis.nativeWorks={isConnected:true,click(){clicked=true}};nativeNav={closest(){return {querySelector(){return nativeWorks}}}};globalThis.dashboard={addEventListener(name,fn){this.onClose=fn},close(){this.closed=true;this.onClose()}}"); + evaluate(c,"openNativeCreations(dashboard)"); + assert.equal(evaluate(c,"dashboard.closed"),true); + assert.equal(evaluate(c,"clicked"),true); +}); test("language trigger toggles the menu and exposes all three languages",()=>{ const c=context(); evaluate(c,"globalThis.menu={hidden:true};globalThis.trigger={expanded:'false',setAttribute(k,v){this.expanded=v},focus(){this.focused=true}};globalThis.dashboard={querySelector(s){return s==='.language'?trigger:menu}}"); diff --git a/extensions/FreeVideoTaskManager/web/i18n.js b/extensions/FreeVideoTaskManager/web/i18n.js index 9769fd43..8941b282 100644 --- a/extensions/FreeVideoTaskManager/web/i18n.js +++ b/extensions/FreeVideoTaskManager/web/i18n.js @@ -1,5 +1,13 @@ // UI strings only. Native task titles and unknown engine diagnostics are kept unchanged. const dictionary = { + "Criações": { + "en": "Creations", + "zh": "作品" + }, + "PT-BR apenas no Tasks; EN e 中文 também alteram o FreeVideo.": { + "en": "PT-BR applies to Tasks only. EN and 中文 also change FreeVideo.", + "zh": "PT-BR 仅适用于任务面板。EN 和中文也会更改 FreeVideo 的界面语言。" + }, "Idioma": { "en": "Language", "zh": "语言" diff --git a/extensions/FreeVideoTaskManager/web/tasks.css b/extensions/FreeVideoTaskManager/web/tasks.css index abcc768c..16737c7c 100644 --- a/extensions/FreeVideoTaskManager/web/tasks.css +++ b/extensions/FreeVideoTaskManager/web/tasks.css @@ -1,4 +1,21 @@ /* The main navigation tab intentionally inherits FreeVideo's own topbar CSS. */ +.ftm-native-language{--ft-text:var(--fv-fg,#263442);--ft-card:var(--fv-bg,#fff);--ft-line:var(--fv-line2,#cbd5e1);--ft-track:var(--fv-ctl-hover,#e5ebf2);--ft-accent:var(--fv-accent-ink,#326bda);position:relative;display:inline-flex;align-items:center;flex:none;color:var(--ft-text)} +.ftm-native-language .language{display:inline-flex;align-items:center;gap:4px;height:var(--fv-ctl,34px);padding:0 6px;border:0;border-radius:var(--fv-rad-ctl,8px);background:transparent;color:var(--fv-fg2,var(--ft-text));font:inherit;cursor:pointer} +.ftm-native-language .language:hover,.ftm-native-language .language[aria-expanded=true]{background:var(--ft-track);color:var(--ft-text)} +.ftm-native-language .language svg{width:16px;height:16px;pointer-events:none;flex:none} +.ftm-native-language .language svg:last-child{width:10px;height:10px} +.ftm-native-language .language-code{font-size:11px;white-space:nowrap} +.ftm-native-language .language-menu{position:absolute;z-index:100;top:calc(100% + 8px);right:0;width:224px;max-width:calc(100vw - 24px);padding:6px;border:1px solid var(--ft-line);border-radius:12px;background:var(--ft-card);color:var(--ft-text);box-shadow:0 10px 30px rgb(0 0 0 / .18)} +.ftm-native-language .language-menu[hidden]{display:none} +.ftm-native-language .language-choice{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;padding:10px 12px;border:0;border-radius:7px;background:transparent;color:inherit;text-align:left;font:inherit;cursor:pointer;white-space:nowrap} +.ftm-native-language .language-choice:hover,.ftm-native-language .language-choice[aria-pressed=true]{background:var(--ft-track)} +.ftm-native-language .language-choice .check{color:var(--ft-accent);font-weight:600} +.ftm-native-language .language-note{display:block;padding:8px 12px 4px;border-top:1px solid var(--ft-line);font-size:11px;line-height:1.4;color:var(--fv-fg2,var(--ft-text))} +.fv-tb-pop .ftm-native-language{display:flex;flex-direction:column;align-items:stretch} +.fv-tb-pop .ftm-native-language .language-menu{position:static;width:auto;box-shadow:none} +.ftm header button.creations{display:inline-flex;align-items:center;justify-content:center;gap:5px;height:var(--fv-ctl,36px);padding:0 7px;border:0;border-radius:var(--fv-rad-ctl,8px);background:transparent;color:var(--ft-text);box-shadow:none;white-space:nowrap} +.ftm header button.creations:hover{background:var(--ft-track);color:var(--ft-text)} +.ftm header button.creations svg{display:block;pointer-events:none;flex:none} html body .fv-topbar.fv-topbar.fv-topbar .ftm-native-theme::before{display:block} html body .fv-topbar.fv-topbar.fv-topbar .ftm-native-theme .fv-tb-lbl{display:none} .ftm header .ftm-language{position:relative;display:inline-flex;align-items:center;color:var(--ft-text);flex:none} diff --git a/extensions/FreeVideoTaskManager/web/tasks.js b/extensions/FreeVideoTaskManager/web/tasks.js index 20402771..5990488a 100644 --- a/extensions/FreeVideoTaskManager/web/tasks.js +++ b/extensions/FreeVideoTaskManager/web/tasks.js @@ -229,6 +229,19 @@ function syncNativeTheme(b){ b.setAttribute("aria-label",label);b.title=label; const text=b.querySelector(".fv-tb-lbl");if(text.textContent!==label)text.textContent=label; } +const globe=''; +const worksGlyph=''; +const svgIcon=path=>''; +const nativeLanguage=()=>resolveLanguage(globalThis.location?.search,globalThis.navigator?.language)==="zh"?"zh":"en"; +let languageMenuId=0; +function languageControl(native=false){ + const wrapper=el("div","ftm-language"+(native?" ftm-native-language":"")); + const trigger=button("",null,"language"); + const menu=el("div","language-menu");menu.id="ftm-language-menu-"+(++languageMenuId);menu.hidden=true;menu.setAttribute("role","group"); + trigger.setAttribute("aria-expanded","false");trigger.setAttribute("aria-controls",menu.id); + trigger.innerHTML=svgIcon(globe)+''; + wrapper.append(trigger,menu);bindLanguageMenu(wrapper,native);return wrapper; +} function attachNativeControls(){ for(const settings of document.querySelectorAll(".fv-settings-entry")){ if(!settings.closest(".fv-tb-links"))continue; @@ -237,10 +250,12 @@ function attachNativeControls(){ settings.style.setProperty("--fv-tb-icon",iconMask(cog)); } const links=settings.parentElement; - if(links.querySelector(".ftm-native-theme"))continue; - const b=button("",toggleTheme,"fv-tb-link fv-tb-ico ftm-native-theme"); - b.append(el("span","fv-tb-lbl"));syncNativeTheme(b); - settings.before(b); + if(!links.querySelector(".ftm-native-language"))settings.before(languageControl(true)); + if(!links.querySelector(".ftm-native-theme")){ + const b=button("",toggleTheme,"fv-tb-link fv-tb-ico ftm-native-theme"); + b.append(el("span","fv-tb-lbl"));syncNativeTheme(b); + settings.before(b); + } } } function syncTheme(d){ @@ -253,7 +268,7 @@ function syncTheme(d){ } function populate(d){ rowElements.clear();lastChartTheme=null; - d.innerHTML=`
FreeVideo Task Manager v0.1

${t("WORKSPACE / TASKS")}

${t("Central de tarefas")}

${t("Acompanhe a geração e os recursos do computador.")}
${t(healthKey)}

${t("Recursos do sistema")}

${t("Histórico local · até 240 amostras")}

${t("Atividade")}

${t("Gerações e atividades do agente são registros distintos.")}
${t("Tarefa")}${t("Status")}${t("Origem")}${t("Progresso")}${t("Etapa")}${t("Tempo")}${t("Ações")}

${t("Nenhuma tarefa neste filtro.")}

`; + d.innerHTML=`
FreeVideo Task Manager v0.1

${t("WORKSPACE / TASKS")}

${t("Central de tarefas")}

${t("Acompanhe a geração e os recursos do computador.")}
${t(healthKey)}

${t("Recursos do sistema")}

${t("Histórico local · até 240 amostras")}

${t("Atividade")}

${t("Gerações e atividades do agente são registros distintos.")}
${t("Tarefa")}${t("Status")}${t("Origem")}${t("Progresso")}${t("Etapa")}${t("Tempo")}${t("Ações")}

${t("Nenhuma tarefa neste filtro.")}

`; const counts=d.querySelector(".counts"); for(const [id,label] of Object.entries(groups)){const b=button("",()=>{selected=id;for(const c of counts.children)c.setAttribute("aria-pressed",String(c===b));render();},"count "+id);b.setAttribute("aria-pressed",String(id===selected));const n=el("strong","","0");n.dataset.count=id;b.append(el("span","",t(label)),n);counts.append(b);} for(const [id,label] of metrics){const c=el("article","metric");c.dataset.metric=id;c.append(el("span","",t(label)),el("strong","","—"));const tr=el("div","track");tr.append(el("i"));c.append(tr);const canvas=el("canvas");canvas.width=200;canvas.height=34;canvas.setAttribute("aria-hidden","true");c.append(canvas);d.querySelector(".metrics").append(c);} @@ -262,7 +277,9 @@ function populate(d){ d.querySelector("input").oninput=e=>{search=e.target.value;render();}; const filter=d.querySelector(".filters select");filter.value=scope;filter.onchange=e=>{scope=e.target.value;render();}; d.querySelector("input").value=search; - bindLanguageMenu(d); + const creations=d.querySelector(".creations");creations.innerHTML=svgIcon(worksGlyph)+""+t("Criações")+"";creations.title=t("Criações");creations.setAttribute("aria-label",t("Criações")); + creations.onclick=()=>openNativeCreations(d); + d.querySelector(".theme").before(languageControl()); } const languageOptions=[["pt-BR","Português (Brasil)"],["en","English"],["zh","简体中文"]]; function setLanguageMenu(d,open,restoreFocus=false){ @@ -271,22 +288,50 @@ function setLanguageMenu(d,open,restoreFocus=false){ menu.hidden=!open;trigger.setAttribute("aria-expanded",String(open)); if(restoreFocus)trigger.focus({preventScroll:true}); } -function bindLanguageMenu(d){ +function syncLanguageControl(d,native=false){ + const translateHere=key=>native?translate(key,nativeLanguage()):t(key); + const trigger=d.querySelector(".language"),menu=d.querySelector(".language-menu"); + trigger.setAttribute("aria-label",translateHere("Idioma"));trigger.title=translateHere("Idioma");menu.setAttribute("aria-label",translateHere("Idioma")); + trigger.querySelector(".language-code").textContent=LANGUAGE==="zh"?"中文":LANGUAGE==="en"?"EN":"PT-BR"; + for(const choice of menu.querySelectorAll(".language-choice")){ + const on=choice.dataset.language===LANGUAGE;choice.setAttribute("aria-pressed",String(on));choice.querySelector(".check").textContent=on?"✓":""; + } +} +function selectLanguage(value,native=false){ + if(!languageOptions.some(([id])=>id===value))return; + const changed=value!==LANGUAGE; + LANGUAGE=value;try{localStorage.setItem(LANG_KEY,LANGUAGE);}catch{} + for(const control of document.querySelectorAll(".ftm-native-language"))syncLanguageControl(control,true); + // The upstream UI only ships English and Chinese; use its own URL switch for those. + // Portuguese remains a Tasks-only preference. Dashboard selection never reloads. + if(native&&value!=="pt-BR"&&nativeLanguage()!==value){ + const url=new URL(location.href);url.searchParams.set("freevideo_lang",value);location.assign(url.href);return; + } + if(changed&&ui){populate(ui);fillNav(ui,nativeNav);syncTheme(ui);render();} +} +function bindLanguageMenu(d,native=false){ const trigger=d.querySelector(".language"),menu=d.querySelector(".language-menu"); for(const [value,label] of languageOptions){ const choice=button("",()=>{ setLanguageMenu(d,false); - if(value!==LANGUAGE){LANGUAGE=value;try{localStorage.setItem(LANG_KEY,LANGUAGE);}catch{}populate(d);fillNav(d,nativeNav);syncTheme(d);render();} - d.querySelector(".language").focus({preventScroll:true}); + selectLanguage(value,native); + (native?d:ui)?.querySelector(".language")?.focus({preventScroll:true}); },"language-choice"); - choice.setAttribute("aria-pressed",String(value===LANGUAGE));choice.lang=value; + choice.dataset.language=value;choice.setAttribute("aria-pressed",String(value===LANGUAGE));choice.lang=value; choice.append(el("span","",label),el("span","check",value===LANGUAGE?"✓":"")); menu.append(choice); } - trigger.onclick=()=>setLanguageMenu(d,menu.hidden); + if(native)menu.append(el("small","language-note",translate("PT-BR apenas no Tasks; EN e 中文 também alteram o FreeVideo.",nativeLanguage()))); + syncLanguageControl(d,native); + trigger.onclick=()=>{const open=menu.hidden;for(const other of document.querySelectorAll(".ftm-native-language"))if(other!==d)setLanguageMenu(other,false);setLanguageMenu(d,open);}; trigger.onkeydown=e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault();setLanguageMenu(d,true);const items=menu.querySelectorAll("button");items[e.key==="ArrowDown"?0:items.length-1]?.focus();}; menu.onkeydown=e=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault();const items=[...menu.querySelectorAll("button")], at=items.indexOf(document.activeElement);const index=e.key==="Home"?0:e.key==="End"?items.length-1:(at+(e.key==="ArrowDown"?1:-1)+items.length)%items.length;items[index]?.focus();}; } +function openNativeCreations(d){ + const native=nativeNav?.closest(".fv-topbar")?.querySelector(".fv-tb-works"); + d.addEventListener("close",()=>{if(native?.isConnected)native.click();else void load("palette").then(m=>m.openCreations()).catch(e=>console.warn("FreeVideo Task Manager",e));},{once:true}); + d.close(); +} function build(){ const d=el("dialog","ftm");d.setAttribute("aria-label","FreeVideo Task Manager");populate(d); d.addEventListener("click",e=>{if(!e.target.closest(".ftm-language"))setLanguageMenu(d,false);}); @@ -324,6 +369,9 @@ function install(){ const attach=()=>{for(const nav of document.querySelectorAll(".fv-view-switch")){if(nav.querySelector(".ftm-tab"))continue;const b=button("",()=>open(b),"ftm-tab fv-tb-tab");b.append(el("span","",t("Tasks")));b.dataset.view="tasks";b.dataset.label=t("Tasks");b.setAttribute("aria-pressed","false");b.setAttribute("aria-haspopup","dialog");b.title="FreeVideo Task Manager";nav.append(b);}attachNativeControls();syncNativeSettingsTheme();}; let queued=false;observer=new MutationObserver(()=>{if(queued)return;queued=true;requestAnimationFrame(()=>{queued=false;attach();});}); observer.observe(document.body,{childList:true,subtree:true});attach(); + document.addEventListener("pointerdown",e=>{for(const control of document.querySelectorAll(".ftm-native-language"))if(!control.contains(e.target))setLanguageMenu(control,false);},true); + document.addEventListener("keydown",e=>{if(e.key!=="Escape")return;const control=[...document.querySelectorAll(".ftm-native-language")].find(c=>c.querySelector(".language")?.getAttribute("aria-expanded")==="true");if(control){e.preventDefault();e.stopPropagation();setLanguageMenu(control,false,true);}},true); + globalThis.addEventListener?.("freevideo-view",()=>{for(const control of document.querySelectorAll(".ftm-native-language"))setLanguageMenu(control,false);}); new MutationObserver(()=>{for(const b of document.querySelectorAll(".ftm-native-theme"))syncNativeTheme(b);syncNativeSettingsTheme();}).observe(document.documentElement,{attributes:true,attributeFilter:["data-theme"]}); } app.registerExtension({name:"Lordelo.FreeVideoTaskManager",setup(){install();}}); From 2aeeb5d578e565eebd844dbb223b898b90c000cd Mon Sep 17 00:00:00 2001 From: "DESKTOP-5P6LRD2\\MLL" Date: Sun, 22 Nov 2026 20:43:59 -0300 Subject: [PATCH 3/3] feat(i18n): enable reactive language switching and first-launch locale detection Localize known native FreeVideo controls through a reversible catalog adapter. Keep the engine startup locale and original sources intact while sharing selection across navigation, Appearance settings and Tasks without page reloads. Detect browser locale on fresh launches, fall back to English for unsupported languages and keep manual selection scoped to the current tab. Preserve prompts, workflows, video elements and task monitoring. Document the generated compatibility catalog, incomplete translation coverage and native palette limitation. Add regression tests and an optional Chromium smoke test verified with pt-BR, en-US and zh-CN. Validation: 17 JavaScript tests, one Python host test and three first-launch browser checks passed in the installed extension. Developed with AI assistance. Refs: FlashML-org/FreeVideo#1054 --- extensions/FreeVideoTaskManager/README.md | 29 ++- .../scripts/build_native_locales.mjs | 29 +++ .../tests/browser_locale_smoke.cjs | 38 ++++ .../FreeVideoTaskManager/tests/tasks.test.cjs | 80 ++++++- extensions/FreeVideoTaskManager/web/i18n.js | 19 +- .../web/native_locales.js | 3 + .../FreeVideoTaskManager/web/native_pt.js | 197 ++++++++++++++++++ extensions/FreeVideoTaskManager/web/tasks.js | 52 +++-- 8 files changed, 419 insertions(+), 28 deletions(-) create mode 100644 extensions/FreeVideoTaskManager/scripts/build_native_locales.mjs create mode 100644 extensions/FreeVideoTaskManager/tests/browser_locale_smoke.cjs create mode 100644 extensions/FreeVideoTaskManager/web/native_locales.js create mode 100644 extensions/FreeVideoTaskManager/web/native_pt.js diff --git a/extensions/FreeVideoTaskManager/README.md b/extensions/FreeVideoTaskManager/README.md index 4d24e683..8e97fc07 100644 --- a/extensions/FreeVideoTaskManager/README.md +++ b/extensions/FreeVideoTaskManager/README.md @@ -5,10 +5,10 @@ Independent ComfyUI frontend extension targeting FreeVideo 0.6.8. No changes to Place this folder in ComfyUI/custom_nodes/FreeVideoTaskManager. Restart ComfyUI **only when the queue and agent activity are idle**. Reload the browser; select Tasks in the main FreeVideo navigation. To remove, stop ComfyUI when idle, remove this folder, and start normally. Do not restart during a generation. ## Design -- Native top bars expose the shared language selector. English and Simplified Chinese use FreeVideo's existing language switch; Portuguese remains available only for Tasks. The Tasks header includes Creations, which opens the original library after leaving the dashboard. +- Native top bars, Appearance settings and Tasks expose a shared reactive language selector. All three languages switch without reloading through a reversible, scoped UI adapter (web/native_pt.js) and the generated compatibility catalog (web/native_locales.js). The original startup locale is preserved internally, so native lazy-loaded modules remain consistent. Known navigation, Create controls and common settings labels are translated; specialized messages and views are not fully covered. Native palette language commands outside the shared selector still use the original reload behavior. No original source files, prompts or workflow data are changed. The Tasks header includes Creations, which opens the original library after leaving the dashboard. - The sun/moon control follows the shared FreeVideo theme, via FreeVideoShell.setTheme and the native freevideo.theme preference. The dashboard no longer stores a separate theme. - The extension also replaces the native Settings sun-like glyph with a cog and adds a separate theme toggle next to Settings. Existing Settings behavior is unchanged; no upstream files are edited. -- Local UI string catalog (web/i18n.js): Brazilian Portuguese, English and Simplified Chinese. The globe selector beside the theme icon changes the dashboard language immediately, saves the preference locally and preserves filters and task monitoring. With no saved selection, honors explicit freevideo_lang query parameter; otherwise detects browser locale and falls back to English. Native job names and unknown engine diagnostic strings remain unchanged. FreeVideo itself supports English and Chinese, not a global Portuguese translation. +- Local UI string catalog (web/i18n.js): Brazilian Portuguese, English and Simplified Chinese. The globe selector beside the theme icon changes the shared language immediately, saves the preference in the current tab's sessionStorage and preserves filters and task monitoring. A fresh launch (freevideo=launch) or new independent tab honors an explicit freevideo_lang parameter; otherwise detects browser locale and falls back to English. Refreshing the current tab retains its selection. Old global language preferences are ignored. Native job names and unknown engine diagnostic strings remain unchanged. The native application itself still supports only English and Chinese; the reactive adapter is a compatibility layer, not a complete upstream localization. - Uses the original task_store singleton and task_float sources (idempotent startup), agent_tasks adapter for agent activity, and studio_queue seededPrompt to clone an original video workflow for explicit retry. - Full-screen independent view; native views remain mounted. No changes to the original navigation controller. - GET FreeVideo monitor, jobs, chains, queue and progress; local read-only host route samples psutil non-blockingly, plus disk. GPU readings come from FreeVideo itself. History stores up to 240 samples (within 24 h) in browser storage, captured every five seconds while the dashboard and browser tab are visible (about 20 minutes of continuous samples). No persistent background daemon. @@ -24,10 +24,33 @@ node --test custom_nodes/FreeVideoTaskManager/tests/tasks.test.cjs .venv/Scripts/python.exe -B custom_nodes/FreeVideoTaskManager/tests/test_host.py ``` -Verified on Windows 10 with an NVIDIA RTX 5060 Ti 16 GB and FreeVideo 0.6.8: the dashboard displayed live generation progress and hardware metrics, both themes rendered, and the user confirmed the dashboard language menu visually. Twelve offline JavaScript tests and one Python host-metrics test passed. The native language shortcut and Creations shortcut still need a visual acceptance check. The offline checks do not replace the live-job acceptance tests below. +Verified on Windows 10 with an NVIDIA RTX 5060 Ti 16 GB and FreeVideo 0.6.8: the dashboard displayed live generation progress and hardware metrics, both themes rendered, and the user confirmed the dashboard language menu visually. The native Portuguese overlay and Creations shortcut still need a visual acceptance check. The offline checks do not replace the live-job acceptance tests below. Upstream discussion: https://github.com/FlashML-org/FreeVideo/issues/1054. The prototype was developed with AI assistance. Upstream main and other platforms still require validation. +### Locale validation + +The compatibility catalog is derived from FreeVideo's Apache-2.0 licensed UI +strings and the initial locale catalogs on the separate `feat/native-i18n` branch. +To regenerate it from matching source trees, run from the extension directory: + +```sh +node scripts/build_native_locales.mjs +``` + +The optional Windows Chromium smoke test uses disposable profiles and the +running local server (port 8188), without submitting generation requests: + +```powershell +node tests/browser_locale_smoke.cjs pt-BR en-US zh-CN +``` + +Verified first-launch navigation, locale badge and generation-button rendering +in fresh Chrome profiles for these three locales. Seventeen JavaScript +regression tests and one Python host test also passed. Full live switching +coverage across specialized views and destructive task-action acceptance +remain outstanding. + 1. Idle restart and confirm Tasks appears in each native view; switch themes and back. 2. Generate a small video from UI and agent, verify progress, queue, ETA, origin and history. 3. Verify no interruptions when opening or closing Tasks. diff --git a/extensions/FreeVideoTaskManager/scripts/build_native_locales.mjs b/extensions/FreeVideoTaskManager/scripts/build_native_locales.mjs new file mode 100644 index 00000000..b3b76d66 --- /dev/null +++ b/extensions/FreeVideoTaskManager/scripts/build_native_locales.mjs @@ -0,0 +1,29 @@ +// Regenerate the compatibility catalog from a matching FreeVideo source tree. +// Only literal UI pairs are collected; no prompts, workflows or user data. +import fs from 'node:fs'; +import path from 'node:path'; +const source=process.argv[2]; +const upstreamCatalog=process.argv[3]; +if(!source||!upstreamCatalog)throw Error('Usage: node scripts/build_native_locales.mjs '); +const en=JSON.parse(fs.readFileSync(path.join(upstreamCatalog,'en.json'),'utf8')); +const zh=JSON.parse(fs.readFileSync(path.join(upstreamCatalog,'zh.json'),'utf8')); +const pt=JSON.parse(fs.readFileSync(path.join(upstreamCatalog,'pt-BR.json'),'utf8')); +const files=['view_navigation','topbar_state','topbar','studio','studio_console','result_actions','sampling_effort','settings_room','settings_words','settings_kit','library','context_menu','image_view','image_view_ui','editor','palette','task_float','tooltip_copy','monitor_panel','generation_progress']; +const literal=String.raw`(?:'(?:\\.|[^'\\\r\n])*'|"(?:\\.|[^"\\\r\n])*")`; +const pair=new RegExp(String.raw`(?:\b(?:t|text|t0|tt)\(\s*|\[\s*)(${literal})\s*,\s*(${literal})\s*(?:\)|\])`,'g'); +const pairs=new Map(); +function add(a,b){if(typeof a!=='string'||typeof b!=='string'||!a.trim()||!b.trim()||a.length>500||b.length>500||!/[\u3400-\u9fff]/.test(b))return;const key=JSON.stringify([a,b]);pairs.set(key,[a,b]);} +for(const file of files){const src=fs.readFileSync(path.join(source,file+'.js'),'utf8');for(const match of src.matchAll(pair)){ + try{add(Function('return '+match[1])(),Function('return '+match[2])());}catch{} +}} +const translated={}; +for(const key of Object.keys(en))if(!key.startsWith('progress.')&&!key.startsWith('theme.')&&!key.startsWith('quality.')){translated[en[key]]=pt[key];add(en[key],zh[key]);} +const overrides=[ + ['Create','创作面板'],['Images','图像视图'],['Nodes','节点视图'],['Edit','剪辑视图'],['Autopilot','AI 全自动'], + ['Creations','作品库'],['Ready','就绪'],['Light','轻量'],['Light','浅色'],['Dark','深色'],['Enhance','增强'], + ['Media','素材'],['Generate video','生成视频'],['Generate preview','生成预览'],['Extend','接着生成'], + ['Share','分享'],['Reuse settings','复用设置'],['Download video','下载视频'],['Settings','设置'] +];overrides.forEach(([a,b])=>add(a,b)); +const output='// Generated compatibility catalog for FreeVideo 0.6.8. See scripts/build_native_locales.mjs.\nexport const nativePairs = '+JSON.stringify([...pairs.values()].sort((a,b)=>a[0].localeCompare(b[0],'en')||a[1].localeCompare(b[1],'zh'))) + ';\nexport const nativePortugueseLabels = '+JSON.stringify(translated)+';\n'; +fs.writeFileSync('web/native_locales.js',output); +console.log('Pairs:',pairs.size,'Portuguese labels:',Object.keys(translated).length); diff --git a/extensions/FreeVideoTaskManager/tests/browser_locale_smoke.cjs b/extensions/FreeVideoTaskManager/tests/browser_locale_smoke.cjs new file mode 100644 index 00000000..03081417 --- /dev/null +++ b/extensions/FreeVideoTaskManager/tests/browser_locale_smoke.cjs @@ -0,0 +1,38 @@ +// Optional browser smoke test: disposable Chromium profile, no generation. +const fs=require('node:fs'),os=require('node:os'),path=require('node:path'); +const {spawn}=require('node:child_process'); +const chrome=process.env.CHROME_PATH || 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'; +const delay=ms=>new Promise(r=>setTimeout(r,ms)); +async function run(locale){ + const dir=fs.mkdtempSync(path.join(os.tmpdir(),'fv-locale-test-')); + fs.mkdirSync(path.join(dir,'Default')); + fs.writeFileSync(path.join(dir,'Default','Preferences'),JSON.stringify({intl:{accept_languages:locale}})); + const proc=spawn(chrome,['--headless=new','--disable-gpu','--no-first-run','--no-default-browser-check','--remote-debugging-port=0','--user-data-dir='+dir,'--lang='+locale,'about:blank'],{stdio:'ignore'}); + let ws; + try{ + const endpoint=path.join(dir,'DevToolsActivePort'); + for(let i=0;i<100&&!fs.existsSync(endpoint);i++)await delay(100); + const port=fs.readFileSync(endpoint,'utf8').split(/\r?\n/)[0]; + const tabs=await (await fetch('http://127.0.0.1:'+port+'/json/list')).json(); + ws=new WebSocket(tabs.find(x=>x.type==='page').webSocketDebuggerUrl); + await new Promise((r,j)=>{ws.onopen=r;ws.onerror=j}); + let seq=0;const calls=new Map(); + ws.onmessage=e=>{const obj=JSON.parse(e.data);if(obj.id&&calls.has(obj.id)){const [r,j]=calls.get(obj.id);calls.delete(obj.id);obj.error?j(Error(JSON.stringify(obj.error))):r(obj.result);}}; + const call=(method,params={})=>new Promise((r,j)=>{let id=++seq;calls.set(id,[r,j]);ws.send(JSON.stringify({id,method,params}));}); + await call('Page.enable'); + await call('Runtime.enable'); + await call('Page.navigate',{url:'http://127.0.0.1:8188/?freevideo=launch'}); + let state; + for(let i=0;i<100;i++){ + await delay(300); + const r=await call('Runtime.evaluate',{expression:`JSON.stringify({browser:navigator.language, languages:navigator.languages, tabs:[...document.querySelectorAll('.fv-view-switch [data-view=studio]')].map(b=>b.textContent.trim()), code:document.querySelector('.ftm-native-language .language-code')?.textContent, saved:sessionStorage.getItem('freevideo-task-manager.tab-language'), generate:[...document.querySelectorAll('.fvs-key-label')].map(e=>e.textContent.trim())})`,returnByValue:true}); + if(!r.result.value)continue; + state=JSON.parse(r.result.value); + if(state.code&&state.tabs.length&&state.generate.length)break; + } + console.log(JSON.stringify({requested:locale,...state})); + const expected=locale.startsWith('pt')?'PT-BR':locale.startsWith('zh')?'中文':'EN'; + if(state?.code!==expected||!state.tabs.includes(expected==='PT-BR'?'Criar':expected==='EN'?'Create':'创作面板'))throw Error('First-visit check failed '+JSON.stringify(state)); + } finally {ws?.close();proc.kill();await delay(500);try{fs.rmSync(dir,{recursive:true,force:true,maxRetries:2})}catch{}} +} +(async()=>{for(const lang of process.argv.slice(2))await run(lang)})().catch(e=>{console.error(e);process.exitCode=1}); diff --git a/extensions/FreeVideoTaskManager/tests/tasks.test.cjs b/extensions/FreeVideoTaskManager/tests/tasks.test.cjs index c3f8d38f..0e482ddd 100644 --- a/extensions/FreeVideoTaskManager/tests/tasks.test.cjs +++ b/extensions/FreeVideoTaskManager/tests/tasks.test.cjs @@ -7,25 +7,84 @@ const path=require("node:path"); const js=fs.readFileSync(path.join(__dirname,"../web/tasks.js"),"utf8") .replace(/^import .*;$/gm,"").replaceAll("import.meta.url","'http://localhost/extensions/FreeVideoTaskManager/tasks.js'"); const i18n=fs.readFileSync(path.join(__dirname,"../web/i18n.js"),"utf8").replace(/^export /gm,""); +const nativeCatalog=fs.readFileSync(path.join(__dirname,"../web/native_locales.js"),"utf8").replace(/^export /gm,""); +const nativePt=fs.readFileSync(path.join(__dirname,"../web/native_pt.js"),"utf8").replace(/^import .*;$/gm,"").replace(/^export /gm,""); function context(){ - const c=vm.createContext({URL,URLSearchParams,Date,Math,JSON,Number,Map,Set,console,app:{registerExtension(){}},api:{},localStorage:{getItem(){return null},setItem(){}},document:{hidden:false}}); - vm.runInContext(i18n+"\n"+js,c); + const c=vm.createContext({URL,URLSearchParams,Date,Math,JSON,Number,Map,Set,console,app:{registerExtension(){}},api:{},localStorage:{getItem(){return null},setItem(){}},sessionStorage:{getItem(){return null},setItem(){}},document:{hidden:false}}); + vm.runInContext(i18n+"\n"+nativeCatalog+"\n"+nativePt+"\n"+js,c); vm.runInContext("sources={jobs:{list:()=>[],get:()=>null},queue:{}}",c); return c; } const evaluate=(c,expr)=>vm.runInContext(expr,c); -test("main navigation language changes native locale only for supported languages",()=>{ +test("native translate=no guard does not block the explicit Portuguese catalog",()=>{ const c=context(); - evaluate(c,"globalThis.location={search:'?freevideo_lang=en',href:'http://localhost/?freevideo_lang=en#workflow',assign(url){globalThis.reloaded=String(url)}};document.querySelectorAll=()=>[];localStorage.setItem=(k,v)=>{globalThis.saved=v}"); + evaluate(c,`globalThis.MutationObserver=class{observe(){}}; + globalThis.label={nodeValue:"Generate video"}; + globalThis.guardedButton={isConnected:true,closest(selector){return selector.includes("[translate=no]")?this:null},getAttribute(){return null}}; + label.parentElement=guardedButton; + document.body={};document.querySelectorAll=()=>[guardedButton]; + document.createTreeWalker=()=>{let done=false;return{nextNode(){if(done)return null;done=true;return label}}}; + nativePortuguese=createNativePortuguese(document);nativePortuguese.setEnabled(true);`); + assert.equal(evaluate(c,"label.nodeValue"),"Gerar vídeo"); + evaluate(c,"nativePortuguese.setEnabled(false)"); + assert.equal(evaluate(c,"label.nodeValue"),"Generate video"); +}); +test("Portuguese overlay translates known native controls and dynamic estimates",()=>{ + const c=context(); + assert.equal(evaluate(c,"ptLabel('Generate video')"),"Gerar vídeo"); + assert.equal(evaluate(c,"ptLabel('About 18 min')"),"Cerca de 18 min"); + assert.equal(evaluate(c,"ptLabel('Generating 42%')"),"Gerando 42%"); + assert.equal(evaluate(c,"ptLabel('Light', true)"),"Claro"); + assert.equal(evaluate(c,"ptLabel('Light')"),"Leve"); + assert.equal(evaluate(c,"ptLabel('A fox walks through a sunlit forest.')"),"A fox walks through a sunlit forest."); +}); +test("all native language switches update labels without reloading",()=>{ + const c=context(); + evaluate(c,"globalThis.location={search:'?freevideo_lang=en',href:'http://localhost/?freevideo_lang=en',assign(url){globalThis.reloaded=String(url)}};document.querySelectorAll=()=>[];nativePortuguese={setLanguage(v){globalThis.overlay=v}}"); + evaluate(c,"selectLanguage('pt-BR',true)"); + assert.equal(evaluate(c,"overlay"),"pt-BR"); + assert.equal(evaluate(c,"typeof reloaded"),"undefined"); + evaluate(c,"selectLanguage('en',true)"); + assert.equal(evaluate(c,"overlay"),"en"); + evaluate(c,"location.search='?freevideo_lang=zh';selectLanguage('pt-BR',true)"); + assert.equal(evaluate(c,"overlay"),"pt-BR"); + evaluate(c,"selectLanguage('zh',true)"); + assert.equal(evaluate(c,"overlay"),"zh"); + assert.equal(evaluate(c,"typeof reloaded"),"undefined"); +}); +test("main navigation and dashboard share the locale without reloading or changing workflow URL",()=>{ + const c=context(); + evaluate(c,"globalThis.location={search:'?freevideo_lang=en',href:'http://localhost/?freevideo_lang=en#workflow',assign(url){globalThis.reloaded=String(url)}};document.querySelectorAll=()=>[];sessionStorage.setItem=(k,v)=>{globalThis.saved=v}"); evaluate(c,"selectLanguage('pt-BR',true)"); assert.equal(evaluate(c,"LANGUAGE"),"pt-BR"); assert.equal(evaluate(c,"typeof reloaded"),"undefined"); evaluate(c,"selectLanguage('zh',false)"); assert.equal(evaluate(c,"typeof reloaded"),"undefined"); evaluate(c,"selectLanguage('zh',true)"); - assert.equal(evaluate(c,"reloaded"),"http://localhost/?freevideo_lang=zh#workflow"); + assert.equal(evaluate(c,"typeof reloaded"),"undefined"); + assert.equal(evaluate(c,"location.href"),"http://localhost/?freevideo_lang=en#workflow"); assert.equal(evaluate(c,"saved"),"zh"); }); +test("English and Chinese native labels can round-trip through Portuguese",()=>{ + const c=context(); + assert.equal(evaluate(c,"nativeLabel('Create','zh')"),"创作面板"); + assert.equal(evaluate(c,"nativeLabel('创作面板','pt-BR',false,'zh')"),"Criar"); + assert.equal(evaluate(c,"nativeLabel('生成视频','en',false,'zh')"),"Generate video"); + assert.equal(evaluate(c,"nativeLabel('Generate video','zh')"),"生成视频"); + assert.equal(evaluate(c,"nativeLabel('约 18 分钟','pt-BR',false,'zh')"),"Cerca de 18 min"); + evaluate(c,`globalThis.MutationObserver=class{observe(){}}; + globalThis.label={nodeValue:"生成视频"}; + globalThis.nativeButton={isConnected:true,closest(){return null},getAttribute(){return null}}; + label.parentElement=nativeButton; + document.body={};document.querySelectorAll=()=>[nativeButton]; + document.createTreeWalker=()=>{let done=false;return{nextNode(){if(done)return null;done=true;return label}}}; + nativePortuguese=createNativePortuguese(document,"zh");nativePortuguese.setLanguage("pt-BR");`); + assert.equal(evaluate(c,"label.nodeValue"),"Gerar vídeo"); + evaluate(c,"nativePortuguese.setLanguage('en')"); + assert.equal(evaluate(c,"label.nodeValue"),"Generate video"); + evaluate(c,"nativePortuguese.setLanguage('zh')"); + assert.equal(evaluate(c,"label.nodeValue"),"生成视频"); +}); test("Creations opens the original library after closing Tasks",()=>{ const c=context(); evaluate(c,"globalThis.clicked=false;globalThis.nativeWorks={isConnected:true,click(){clicked=true}};nativeNav={closest(){return {querySelector(){return nativeWorks}}}};globalThis.dashboard={addEventListener(name,fn){this.onClose=fn},close(){this.closed=true;this.onClose()}}"); @@ -78,6 +137,17 @@ test("locale detection uses native explicit language then browser, with English assert.equal(evaluate(c,"translate('Cancelar','zh')"),"取消"); assert.equal(evaluate(c,"translate('Cancelar','pt-BR')"),"Cancelar"); }); +test("fresh launches auto-detect browser locale instead of a previous tab's Chinese choice",()=>{ + const c=context(); + evaluate(c,"globalThis.priorTab={getItem(){return 'zh'}};globalThis.newTab={getItem(){return null}}"); + assert.equal(evaluate(c,"initialLanguage('?freevideo=launch','pt-BR',priorTab)"),"pt-BR"); + assert.equal(evaluate(c,"initialLanguage('?freevideo=launch','en-US',priorTab)"),"en"); + assert.equal(evaluate(c,"initialLanguage('?freevideo=launch','fr-FR',priorTab)"),"en"); + assert.equal(evaluate(c,"initialLanguage('?freevideo=launch','zh-CN',priorTab)"),"zh"); + assert.equal(evaluate(c,"initialLanguage('?freevideo=launch&freevideo_lang=zh','pt-BR',priorTab)"),"zh"); + assert.equal(evaluate(c,"initialLanguage('','pt-BR',newTab)"),"pt-BR"); + assert.equal(evaluate(c,"initialLanguage('','pt-BR',priorTab)"),"zh"); +}); test("changing the selected language updates runtime status and group labels",()=>{ const c=context(); evaluate(c,"LANGUAGE='pt-BR'"); diff --git a/extensions/FreeVideoTaskManager/web/i18n.js b/extensions/FreeVideoTaskManager/web/i18n.js index 8941b282..c273c385 100644 --- a/extensions/FreeVideoTaskManager/web/i18n.js +++ b/extensions/FreeVideoTaskManager/web/i18n.js @@ -4,9 +4,9 @@ const dictionary = { "en": "Creations", "zh": "作品" }, - "PT-BR apenas no Tasks; EN e 中文 também alteram o FreeVideo.": { - "en": "PT-BR applies to Tasks only. EN and 中文 also change FreeVideo.", - "zh": "PT-BR 仅适用于任务面板。EN 和中文也会更改 FreeVideo 的界面语言。" + "Troca instantânea · tradução da interface em evolução.": { + "en": "Instant switching · interface translation in progress.", + "zh": "即时切换 · 界面翻译持续完善中。" }, "Idioma": { "en": "Language", @@ -291,4 +291,17 @@ export function resolveLanguage(search="", browserLanguage="en", savedLanguage=n const normalized = String(explicit||browserLanguage||"en").toLowerCase(); return normalized.startsWith("pt") ? "pt-BR" : normalized.startsWith("zh") ? "zh" : "en"; } +// A fresh launch is a new language session, not a continuation of a previous +// tab's temporary language experiment. Explicit links still select a locale. +export function initialLanguage(search="", browserLanguage="en", tabStorage=null) { + const query=new URLSearchParams(search); + let selected=null; + if(query.get("freevideo")!=="launch"){ + try{selected=tabStorage?.getItem("freevideo-task-manager.tab-language");}catch{} + } + return resolveLanguage(search,browserLanguage,selected); +} +export function rememberLanguage(language,tabStorage=null){ + try{tabStorage?.setItem("freevideo-task-manager.tab-language",language);}catch{} +} export function translate(key,language) { return dictionary[key]?.[language] || key; } diff --git a/extensions/FreeVideoTaskManager/web/native_locales.js b/extensions/FreeVideoTaskManager/web/native_locales.js new file mode 100644 index 00000000..01e59b6f --- /dev/null +++ b/extensions/FreeVideoTaskManager/web/native_locales.js @@ -0,0 +1,3 @@ +// Generated compatibility catalog for FreeVideo 0.6.8. See scripts/build_native_locales.mjs. +export const nativePairs = [[" (single pass; two-pass acceleration needs 8 first-pass steps)","(只采样一遍;二采加速需一采 8 步)"],[" + prompt"," + 提示词准备"],[" Click the edit name at the top to open another edit.","点击顶部的剪⁠辑⁠名可打开其他剪辑。"],[" Existing files are reused.","已有文件会继续使用。"],[" In Settings, under Models, select \"Check installation\", then \"Install\" to restore the tested file; the current file is kept.","可在设置的“模型”页先点“检查安装”,再点“安装”恢复已验证的文件,原文件会保留。"],[" Select \"Repair\" in the launcher under Settings > Environment to restore the tested file; the current file is kept.","可在启动器“设置 → 环境”中点“修复”恢复已验证的文件,原文件会保留。"],[" You can also use Download report below and submit it in a GitHub issue; we will look into it.","也可以点下方“下载报告”提交到 GitHub issue,我们会专门排查。"],["\"Use as is\" is not available while continuing a video. Remove \"Continues this video\" first.","接在视频之后时不能“原样使用”,请先移除“接在这条视频后面”。"],["(references are cut to the generated length, up to 15 s)","(参考素材只取与生成视频等长的部分,最长 15 秒)"],["~","约 "],["0.98 MP · Recommended","0.98 MP · 推荐"],["A browser extension is interfering with FreeVideo. See the details on the picture.","浏览器扩展干扰了 FreeVideo,详见画面上的说明。"],["A continuation uses the Light level.","接着生成使用轻量档。"],["A continuation uses the Medium level.","接着生成使用标准档。"],["A continued video keeps its size","接着生成时沿用原视频尺寸"],["A first-pass preview: finish it first","这是一采预览,先继续二采"],["A loop is running. Stop it to start again.","正在循环生成,停止后可重新开始"],["A mirror of the international source","国际源的镜像站点"],["A picture named in the prompt was removed; choose it again with @","描述里引用的参考图已移除,请用 @ 重新选择"],["A reshoot counts as long from","耗时较长的标准"],["A source file cannot be read. Import it again from the library.","有素材读不出来,请在素材库重新导入。"],["A source file is missing. Import it again from the library.","有素材的原文件找不到了,请在素材库重新导入。"],["A token is set for this session. Clearing it falls back to credentials already on this computer.","已设置本次令牌;清除后仍可使用本机已有的凭据。"],["A video is being made. Try the example when it finishes.","正在生成,完成后再试示例"],["about","约"],["About 16 MP, more detail, slower","约 1600 万像素,更细更慢"],["About 30 minutes each; nothing can be generated meanwhile","每轮约 30 分钟,期间不能生成"],["About 4 MP, quicker","约 400 万像素,更快"],["About 76 MiB","约 76 MiB"],["About enhancement","关于提示词增强"],["About this picture","图片信息"],["Access token","访问令牌"],["Actions","操作"],["Add","添加"],["Add a picture first","先添加一张图片"],["Add a picture in Media first","先在素材里添加图片"],["Add a reference picture","添加参考图"],["Add a style or character add-on","加入风格或人物的附加模型"],["Add a style or character model","叠加风格或人物模型"],["Add a style or character model from models/loras","从 models/loras 文件夹加一个风格或人物模型"],["Add a subtitle at the playhead","在播放头处添加字幕"],["Add an image in Media to follow its aspect ratio.","请先在素材中添加图片,再跟随输入比例。"],["Add from works, the library or this computer; or drop or paste","从作品、素材库或电脑添加;也可拖入或粘贴"],["Add it to the reference pictures","加入参考图"],["Add LoRA","添加 LoRA"],["Add LoRAs in the create panel. FreeVideo models are already accelerated, so no speed LoRA is needed.","在创作面板里添加 LoRA。FreeVideo 的模型已经加速,不需要加速 LoRA。"],["Add model","添加模型"],["Add or remove tags on the selection","给选中的作品加上或去掉标签"],["Add reference","添加参考图"],["Add reference pictures, video and sound","加参考图、视频和声音"],["Add settings","补上设置"],["Add settings to earlier videos","为之前的视频补上生成设置"],["Add sound track","添加声音轨"],["Add the selected creations to Favorites","把选中的作品加入收藏"],["Add to favorites","收藏"],["Add to queue","加入队列"],["Add videos","添加视频"],["Add-on models","附加模型"],["Added to Favorites.","已加入收藏。"],["Added to the queue. It starts when the current video finishes.","已加入队列,当前视频完成后自动开始。"],["Adding the settings…","正在补写生成设置…"],["Adding to the queue. One moment.","正在加入队列,请稍候"],["Adding…","正在添加…"],["Adds a 10-bit video beside it, for color grading","另存一份 10 位视频,适合调色"],["Adjust","调整"],["Adjust the selection","调整选中的片段"],["Adjustments","调整分组"],["Advanced","高级"],["Advanced","高级选项"],["Advanced: access token","高级:访问令牌"],["Advanced: installation and model folders","高级:安装位置与模型文件夹"],["After generation","生成后"],["After the previous part","接上一段"],["After the video","接原视频"],["Agree","同意"],["All","全部"],["All creations","全部作品"],["All creations as a grid, to sort and select","以网格查看全部作品,便于整理和多选"],["All quality levels","全部质量档位"],["Already at the closest view","已经放到最大"],["Already at the widest view","已经缩到最小"],["Already here","已有模型"],["Also downloaded the first time they are used","第一次用到时也会自动下载"],["Also running","同时进行"],["Also save a high color depth copy","同时保存高色深版本"],["Also save pictures to the output folder","同时将图片保存到 output 文件夹"],["Always download through the proxy","始终通过代理下载"],["Amount to keep free","预留数值"],["An example file is missing from this installation. Select \"Repair\" under Settings > Environment, then try again.","示例素材不在本机安装里,在“设置 → 环境”里点“修复”后重试"],["Animate this image in Create","在创作面板里让它动起来"],["Another image is generating. This one starts when it finishes.","前面有 1 张在生成,完成后自动开始。"],["Another look, up to about 4 MP","另一种画风,最大约 4 MP"],["Another track for music or voice","多一条轨放配乐或人声"],["Another video is generating. Try again when it finishes.","正在生成别的视频,完成后再试。"],["Another view was opened, so the example was not filled in. Go back to the creation panel and try again.","已切到别的视图,示例没有填入,回到创作面板再试"],["Any","全部"],["Any time","任何时间"],["App","应用"],["Appearance","外观"],["Appearance, language, settings","外观、语言和设置"],["Applies at once to every view","立即应用到所有视图"],["Applies at once to the preview on screen, also on the phone page.","立即应用到屏幕上的预览,手机页面也一样。"],["Apply","应用"],["Apply this crop","应用这次裁剪"],["Ask before","先询问"],["Ask phones for a password first","手机访问前需要输入密码"],["Assistant","助手"],["Assistant activity","助手动态"],["Audio","声音"],["Auto","自动"],["Automatic","自动选择"],["Automatic optimization","自动优化"],["Autopilot","AI 全自动"],["Back","返回"],["Back","上一步"],["Back / forward ten frames","后退 / 前进 10 帧"],["Back to create","返回创作"],["Back to it","回到生成"],["Back to one creation","回到单个作品"],["Back to Settings; the plan stays","回到设置,计划保留"],["Back to the library","回到作品库"],["Back to the list","回到列表"],["Back to the running generation","回到进行中的生成"],["Back to the shelf","回到作品列表"],["Back to this view's start","回到当前视图的首屏"],["Back to where you were","回到打开设置前的画面"],["Balanced speed and detail","速度和细节均衡"],["Batch","批量"],["Batch and loop use the seed in this panel. Disconnect the seed link in node view.","批量和循环要用面板里的种子,请在节点视图断开种子的连线。"],["Biggest file first","文件最大"],["Both at once, next to each other","两个并排显示"],["Both audio tracks are full here. Move an audio clip first.","这里两条声音轨都满了,请先挪开一段声音。"],["Both videos from the same moment","两段视频从同一时刻播放"],["Bring a picture or character into the prompt","在描述里引用素材或角色"],["Bring back deleted creations","找回删掉的作品"],["Bring back its prompt, size and length","带回这条的描述、尺寸和时长"],["Bring back the edit just undone","恢复刚撤销的改动"],["Bring back what was just deleted","恢复刚删除的作品"],["Bring back what you undid","恢复刚撤销的改动"],["Bring the clip back","把删掉的内容恢复"],["Bring the deleted creations back","恢复刚删除的作品"],["Bring your own videos, pictures or sound","导入自己的视频、图片或声音"],["Browse every video you have made","浏览你生成过的所有视频"],["Build a longer video shot by shot","在剪辑视图里分段做长视频"],["Cancel","取消"],["Cancel current","取消当前"],["Cancel export","取消导出"],["Cancel this picture; asks first","取消这一张,会先确认"],["Cancel update","取消更新"],["Cancelled","已取消"],["Cancelling…","正在取消…"],["Cannot be used","不能使用"],["Cannot be used: ","不能使用:"],["Cast","角色"],["Change the order of the shelf","改变作品的排列顺序"],["Change this in Settings","到设置里调整这一项"],["Changes are not saved yet. Staying here keeps retrying.","改动尚未保存,留在此页将继续重试。"],["Changes save by themselves as you edit","改动会自动保存"],["Changing steps may lower quality. Default: 8 + 3 steps.","改步数可能降低质量。默认 8 + 3 步。"],["Changing the language reloads the page; generations keep running.","切换语言会重新载入页面,正在进行的生成不受影响。"],["Character","角色"],["Characters show here once created.","创建的角色会出现在这里。"],["Characters, scenes and props","角色、场景和道具"],["Characters, scenes and props to reuse","可反复使用的角色、场景和道具"],["Check again","重新检查"],["Check again after fixing the problems","处理问题后重新检查"],["Check and install","检查并安装"],["Check first: models already on this computer are used as they are.","先检查一遍,电脑上已有的模型会直接使用。"],["Check installation","检查安装"],["Check models and fix what is missing","检查模型并修复缺少的部分"],["Check now","立即检查"],["Check this computer and list what would be installed","检查本机,列出要安装或修复的内容"],["Checking","检查中"],["Checking configuration and local models…","正在检查配置和本地模型…"],["Checking each file…","正在逐个检查…"],["Checking the installation","正在检查安装"],["Checking video…","正在检查视频…"],["Checking…","正在检查…"],["China source","国内源"],["Chinese interface","切换到中文界面"],["Choose a creation to see it here","选一个作品,在这里查看"],["Choose a FreeVideo installation folder first.","请先选择 FreeVideo 安装位置。"],["Choose a part first","先选中一段"],["Choose a separate folder for FreeVideo, not the program folder or the folder that contains it.","请给 FreeVideo 单独选一个文件夹,不要用程序所在的文件夹或它的上一级。"],["Choose an empty spot on the timeline.","请在时间线上选一段空白。"],["Choose another settings page","切换到其他设置页"],["Choose Batch to use it","选“批量”后可用"],["Choose one of the five views","在五个视图之间切换"],["Choose the voice for the narration","选择旁白用的声音"],["Choose which image model draws it","选择用哪个模型生成"],["Clarity","清晰度"],["Clear","清除本次令牌"],["Clear","清空"],["Clear filters","清除筛选"],["Clear its unread dot","去掉未读标记"],["Clear the selection","清空已选"],["Clear up","清理"],["Click","点击"],["Click Check installation again, then Install.","请重新点“检查安装”,再点“安装”。"],["Click Check installation, then Install.","请先点“检查安装”,再点“安装”。"],["Click to retry","点此重试"],["Click to save the changes again","点一下重新保存改动"],["Click to type an exact length","点一下输入精确时长"],["Clips in time order; drag to arrange","按时间排列的片段,可拖动"],["Clips stick to edges and the playhead","拖动时贴齐片段边缘和播放头"],["Close","关闭"],["Close now; remind me later","先关闭,稍后再提醒"],["Close settings","关闭设置"],["Close the library and go back","关闭作品库,回到之前的视图"],["Close the open panel or tray","关闭打开的面板或托盘"],["Close the plan without installing","关闭计划,不安装"],["Close the top layer","关闭最上层"],["Close the tour; it stays in Tutorial","关闭介绍,教程里可以再看"],["Close this and keep generating","不停止,接着生成"],["Close this and let the step go on","不停止,让这一步接着做"],["Close this panel","关闭这个面板"],["Close without changing the password","不改密码,关闭这一栏"],["Closing Settings does not stop it.","关闭设置不会中断。"],["Combine generation steps freely with nodes","用节点自由组合生成步骤"],["Comfortable","舒适"],["Command palette","命令面板"],["Compact","紧凑"],["Compare","对比"],["Compare as","对比方式"],["Compare it with another one","和另一个并排或滑块对比"],["Compare with another video","和另一条视频对比"],["Compatibility","兼容性"],["Compatibility settings are enabled, so generation will take longer.","已开启兼容性设置,生成会较慢。"],["Compatibility view","兼容界面"],["Confirm","确认删除"],["Confirm and close","确认并关闭"],["Confirm delete","确认删除"],["Confirm every page file loads","确认页面的每个文件都能载入"],["Confirm installation","确认安装"],["Confirm this choice","确认这个选择"],["Connect a FreeVideo Media panel in node view to upload here.","在节点视图连接 FreeVideo 素材面板,可在这里上传。"],["Connected; speed not measured yet","已连通,速度还没测出"],["Connecting…","正在连接…"],["Connection","连接"],["Connection","连接方式"],["Connection","连接状态"],["Continue","继续"],["Continue","继续安装"],["Continue","接着生成"],["Continue download","继续下载"],["Continue from here","从这段继续"],["Continue from this preview to the full-resolution video.","从这个预览继续生成全分辨率视频。"],["Continue generating","继续生成"],["Continue it into a longer video","接着生成更长的视频"],["Continue this video","接着生成"],["Continue video","延长视频"],["Controlled by connected nodes.","由连接的节点控制。"],["Copied","已复制"],["Copy","复制"],["Copy details","复制详情"],["Copy it to the clipboard","复制到剪贴板"],["Copy its prompt to paste elsewhere","复制提示词,可粘贴到别处"],["Copy link","复制链接"],["Copy path","复制路径"],["Copy prompt","复制提示词"],["Copy reused models instead of linking them","复用模型时复制一份,而不是链接"],["Copy the address to open on a phone","复制地址,在手机上打开"],["Copy the error to send to us","复制出错信息,便于反馈"],["Copy the log for a report","复制日志,用于提交问题"],["Copy the path, and other actions","复制路径等其他操作"],["Copy the words this picture was made from","复制这张图的提示词"],["Copy the words this was made from","复制生成它所用的提示词"],["Copy this sentence for your AI assistant","复制这句话,发给你的 AI 助手"],["Copy where the file is saved","复制视频文件所在位置"],["Copy where the file is saved","复制文件保存的位置"],["Copy where the video file is stored","复制视频文件的位置"],["Copy, reveal or delete this image","复制、定位或删除这张图"],["Could not add the character's pictures","无法加入角色的图片"],["Could not add to the queue. Check the settings in node view.","没能加入队列,请在节点视图检查设置。"],["Could not cancel. Refresh the page and try again.","没有取消成功,请刷新页面后再试。"],["Could not cancel. Try again.","没有取消成功,请重试。"],["Could not change the resolution. Try again.","没能更改清晰度,请重试。"],["Could not complete. Try again.","没有完成,请重试"],["Could not continue. Refresh the page and try again.","没有继续生成,请刷新页面后再试。"],["Could not copy","复制失败"],["Could not copy.","没能复制。"],["Could not delete this creation.","无法删除这条作品。"],["Could not delete. Try again.","没能删除,请重试。"],["Could not fill in the settings. Try again.","没能填入设置,请重试。"],["Could not join the parts. See the details on the picture.","未能接合各段,原因见画面上的说明。"],["Could not move it. Try again.","没有移动成功,请重试。"],["Could not open the creative panel. Try again.","没能打开创作面板,请重试。"],["Could not open the editor. Try again.","无法打开剪辑,请重试。"],["Could not open the folder.","没能打开文件夹。"],["Could not open the folder. Open it on the computer that runs FreeVideo.","没能打开文件夹。请在运行 FreeVideo 的电脑上打开。"],["Could not prepare this run. Try again.","没能准备这次生成,请重试。"],["Could not read the creations. Try again.","没能读取作品,请重试。"],["Could not read the image dimensions. Choose another image.","无法读取图片尺寸,请换一张图片。"],["Could not read the LoRA list. Try again.","无法读取 LoRA 列表,请重试。"],["Could not read the queue. The loop has stopped; videos already added stay queued.","暂时读不到队列,循环已停止;已加入的视频还在队列中。"],["Could not read the result. Choose \"Generate\" again.","没能读取结果,请再点“生成”。"],["Could not read the trigger words. Try again.","没能读取触发词,请重试。"],["Could not read trigger words.","无法读取触发词。"],["Could not remove the favorite. Try again.","无法取消收藏,请重试。"],["Could not save the favorite. Try again.","无法保存收藏,请重试。"],["Could not save the model folders. Try again.","没能保存模型文件夹,请重试。"],["Could not save. Try again.","没能保存,请重试。"],["Could not save. Try again.","没有保存,请再试一次。"],["Could not search the creations","暂时无法搜索作品"],["Could not start the download. Try again.","无法开始下载,请重试。"],["Could not start the measurement. Try again.","没能开始测量,请重试。"],["Could not start the second pass: ","无法继续二采:"],["Could not start the second pass. Try again.","没能开始二采,请重试。"],["Could not start. See the details on the picture.","没能开始,原因见画面上的说明。"],["Could not start. See the details on the picture.","没能开始生成,原因见画面上的说明。"],["Could not start. Try again.","没能开始,请重试。"],["Could not stop. Try again; if it keeps failing, report the problem.","没有停止成功。请重试;仍然失败时,请提交问题。"],["Could not undo. Try again.","没能撤销,请重试。"],["Create","创作面板"],["Create","生成"],["Created an editing project for you.","已新建一个剪辑工程"],["Creation","作品"],["Creations","作品"],["Creations","作品库"],["Creations marked with the heart","点过爱心的作品"],["Crop","裁剪"],["Crop edge","裁剪"],["Crop, retouch or add text","裁剪、修图或加文字"],["Current connection","当前连接"],["Custom","自定"],["Custom","自定义"],["Custom size","自定义"],["Custom steps","自定义步数"],["Cut","剪开"],["Cut","剪切"],["Cut clips, add sound and captions","剪片段,配声音和字幕"],["Cut the clip in two at the playhead","在播放头处把片段分成两段"],["Cut to the clipboard.","已剪切到剪贴板。"],["Cut, extend and add sound on a timeline","在时间线上剪辑、续写、配声音"],["Cut, join and add sound","剪辑、拼接和配声音"],["Dark","深色"],["Dark appearance","深色外观"],["Dark panels, best for pictures","深色界面,适合看画面"],["Decoder","解码器"],["Decrement","递减"],["Default for the image view; clear lettering in pictures","图像视图默认模型,图中文字清晰"],["Delete","删除"],["Delete (to recently deleted)","删除(移到最近删除)"],["Delete creation","删除作品"],["Delete it for good; asks first","永久删除,会先确认"],["Delete it; undo for 10 seconds","删除这个作品,10 秒内可撤销"],["Delete it; undo for 10 seconds","删除这张图片,10 秒内可撤销"],["Delete on a selected gap","选中空隙后按 Delete"],["Delete or restore creations","删除或恢复作品"],["Delete tag","删除标签"],["Delete temporary files of finished videos","删除已完成视频的临时文件"],["Delete the selection","删除选中的内容"],["Delete the selection; undo for 10 seconds","删除选中的作品,10 秒内可撤销"],["Delete the tag? Press again","删除这个标签?再点一次"],["Delete this creation?","删除这个作品?"],["Delete this empty sound track","删掉这条空的声音轨"],["Delete; undo for 10 seconds","删除,10 秒内可撤销"],["Deleted creations can be brought back for 10 seconds.","删除的作品 10 秒内可以撤销。"],["Deleted creations can be brought back for 10 seconds.","删除的作品在 10 秒内可以恢复。"],["Deleted.","已删除。"],["Deleting…","正在删除…"],["Describe a scene below to start","在下方写一句描述,开始生成"],["Describe it; the assistant films it","说想法,助手分镜并拍完"],["Describe the people, their clothes and the place, for example: a young woman in a beige trench coat on a pier at dusk","写下人物、衣着和地点,例如:穿米色风衣的年轻女性,站在黄昏的海边栈桥上"],["Describe the picture","描述画面"],["Describe the picture first","先写一句描述"],["Describe the scene… Type @ to reference media","描述画面… 输入 @ 引用素材"],["Describe your scene","描述画面"],["Deselect day","取消这一天"],["Deselect every LoRA; the files stay","取消选中所有 LoRA,文件不删"],["Details","详情"],["Details and logs","详细信息与日志"],["Device","显卡总量"],["Diagnostic report","诊断报告"],["Diagnostic report: hardware, settings and timings","诊断报告:硬件、设置和耗时"],["Direct","直连"],["Direct only","仅直连"],["Disk free","磁盘可用"],["Dismiss","关闭"],["Dismiss","收起"],["Dismiss this notice","关掉这条提示"],["Divider","分界线"],["Do not show this again","以后不再显示"],["Don't ask again","不再提示"],["Done","完成"],["Done","已完成"],["Download","下载"],["Download again; the part downloaded is kept","重新下载,已下载的部分会保留"],["Download and fix what the plan lists","按计划下载并修复缺少的部分"],["Download and turn on","下载并启用"],["Download picture","下载图片"],["Download prompt model","下载提示词模型"],["Download report","“下载报告”"],["Download report","下载报告"],["Download source","下载源"],["Download the Replace person model again","重新下载替换人物模型"],["Download the Replace person model now","现在下载替换人物模型"],["Download the replacement model again","重新下载替换人物用的模型"],["Download the rewriting model, then use it","下载改写模型后自动启用"],["Download the video model before generating","下载视频模型后才能生成视频"],["Download this model to use it here","下载这个模型后即可使用"],["Download this picture model","下载这个图像模型"],["Download video","下载视频"],["Download with your account this session","本次运行用账号额度下载"],["Downloaded when Replace person is first used","打开“替换人物”时自动下载"],["Downloading","下载中"],["Downloading files for generation","正在下载生成所需文件"],["Downloading model files","下载模型文件"],["Downloading…","正在下载…"],["Downloads","下载"],["Draft small, then refine: usually faster","先小后精,通常更快"],["Drag","拖动"],["Drag a range on the timeline first","先在时间线上拖出一段"],["Drag for more or fewer pixels; marks are the usual sizes","拖动调像素数,刻度是常用尺寸"],["Drag on the timeline to choose a part first.","先在时间线上拖出一段。"],["Drag onto the timeline, or press + to add","拖到时间线,或按加号加入"],["Drag to move through the edit","拖动来移动播放位置"],["Drag to move through the video","拖动跳到视频的任意位置"],["Drag to reorder","拖动调整顺序"],["Drag to scale the picture","拖动来缩放画面"],["Drag to set the length, one second a step","拖动设定时长,每格 1 秒"],["Drag to set what stays in frame","拖动来调整保留的范围"],["Drag to show more or less time","拖动调整时间线的疏密"],["Drag, or use the arrow keys","拖动或用方向键移动"],["Draw a sketch","画草图"],["Draw the layout on a blank canvas of this frame; it becomes Image 1","在当前画幅的空白画布上画出构图,作为图 1"],["Drawing lines from the reference video","正在把参考视频转成线稿"],["Drop pictures or videos here, or click Add","把图片或视频拖到这里,或点“添加”"],["Drop them back onto FreeVideo to bring back the settings they were made with. Each original is kept as a backup.","把它们拖回 FreeVideo 即可还原生成时的设置。每个原视频都另存了一份备份。"],["Duration","时长"],["Duration · seconds","时长 · 秒"],["Duration in seconds","时长(秒)"],["Each kind of file downloads from its fastest source","每类文件会从最快的源下载"],["Each line is one video, sent as written without enhancement","每行生成一个视频,按原文发送,不做描述增强"],["Each line of the description is one video","描述的每一行生成一个视频"],["Each line of the description is one video, sent as written without enhancement.","描述的每一行生成一个视频,按原文发送,不做描述增强。"],["Each line of the description is one video.","描述的每一行生成一个视频。"],["Each original video is kept as a backup.","每个原视频都会另存一份备份。"],["Each side is set on its own","两边各自设定"],["Earlier","更早"],["Earlier descriptions","用过的描述"],["Earliest images at the top","按时间从旧到新排列"],["Edit","编辑"],["Edit","剪辑"],["Edit","剪辑任务"],["Edit","剪辑生成"],["Edit","剪辑视图"],["Edit description","修改说明"],["Edit image","改这张"],["Edit name","剪辑名称"],["Edit name","修改名字"],["Edit the description in a large box","在大文本框里编辑描述"],["Editing","编辑"],["Editor","编辑器"],["Elapsed","已用时"],["Empty: new each time; a number repeats a picture","留空每次不同;填数字可复现同一张"],["Enable LoRA","启用 LoRA"],["Engine offline","引擎已断开"],["English interface","切换到英文界面"],["Enhance","增强"],["Enlarge or shrink this clip’s picture","放大或缩小这一段的画面"],["Enter a number in range","请输入范围内的数"],["Enter a value.","请输入数值。"],["Enter a whole number, or leave it empty","请输入整数,或留空"],["Estimating remaining time…","正在估算剩余时间…"],["Estimating time…","正在估算用时…"],["Every file was checked.","已检查全部文件。"],["Every key this page answers to","这个页面的全部快捷键"],["Every keyboard shortcut in this view","查看这个视图的全部快捷键"],["Every picture made here","在这里生成的所有图片"],["Every shortcut of every view","所有视图的快捷键"],["Every video and picture","所有视频和图片"],["Every video and picture made here","生成过的全部视频和图片"],["Everything at once","一次看全部"],["Example","示例"],["Example part","示例片段"],["Existing installation connected. Ready to generate.","已连接现有安装,可以生成。"],["Exit full screen","退出全屏"],["Expand","放大"],["Export","导出"],["Export a video or picture to send","导出可发送的视频或图片"],["Export cancelled. No unfinished file is kept.","已取消导出,没有留下不完整的文件。"],["Export failed: a source file cannot be read. Import it again from the library.","导出时出错:有素材读不出来,请在素材库重新导入。"],["Export failed: the disk is full. Free some space, then export again.","导出时出错:磁盘空间不够,空出空间后再导出。"],["Export failed: the graphics card did not have enough free memory for 48/60 fps. Export again after the current generation finishes, or set the frame rate to 24.","导出时出错:显卡空闲显存不足,无法导出 48/60 帧率。请等当前生成结束后重新导出,或把帧率改为 24。"],["Export failed: the model needed for 48/60 fps could not be downloaded. Check the connection and export again, or set the frame rate to 24.","导出时出错:48/60 帧率需要的模型没能下载。请检查网络后重新导出,或把帧率改为 24。"],["Export failed: the output folder cannot be written to. Check that the folder can be written to, then retry.","导出时出错:输出目录不可写。请检查这个文件夹的写入权限后重试。"],["Export failed. Try again.","导出时出错,请再试一次。"],["Export the edit","导出剪辑"],["Exporting","正在导出"],["Exporting; it goes to the library when done","正在导出,完成后进入作品库"],["Exporting. You can export again when it finishes.","正在导出,完成后可以再导出一次。"],["Extend","接着生成"],["Extend","拉长"],["Extra disk space","额外占用磁盘"],["Extra memory to keep for the system and other apps. Applies from the next generation.","额外保留给系统和其他程序的内存,下次生成起生效。"],["Extra VRAM to keep free. Applies from the next generation.","额外保留的空闲显存,下次生成起生效。"],["Extracting depth from the reference video","正在提取参考视频的深度"],["Failed","失败"],["Fastest, for trying ideas","最快,适合试效果"],["Fastest, with less detail","最快,细节较少"],["Favorite","收藏"],["Favorite","已收藏"],["Favorite, share, copy the prompt, delete and more","收藏、分享、复制提示词、删除等"],["Favorites","收藏"],["Favourite","收藏"],["Favourite images at the top","收藏的图片排在前面"],["Favourites first","收藏在前"],["Feedback","反馈"],["File time left","本文件预计剩余"],["files","个文件"],["Files","文件"],["Files in the installation folder changed after you confirmed, so installation stopped. Click Check installation, then Install.","确认之后安装位置里的文件有变化,已停止。请先点“检查安装”,再点“安装”。"],["Files in the LoRA folder","LoRA 文件夹中的文件"],["Fill in a random seed","填入一个随机种子"],["Fill in its prompt and settings","填入它的提示词和设置"],["Fill in the duration.","请填写时长。"],["Fill in the first-pass steps.","请填写一采步数。"],["Fill in the height.","请填写高度。"],["Fill in the second-pass steps.","请填写二采步数。"],["Fill in the seed.","请填写种子。"],["Fill in the width.","请填写宽度。"],["Fill in this example prompt","把这条示例填进提示词"],["Fill the creation panel with these settings","把这次的设置填回创作面板"],["Fill the panel with this video’s settings","把这条视频的设置填回面板"],["Filled in","已填入"],["Filter","筛选"],["Find a setting by its name","按名称查找设置"],["Find by prompt or file name","按提示词或文件名查找"],["Find creations by prompt or name","按提示词或名称查找作品"],["Fine","精细"],["Finer levels take longer","越细用时越长"],["Finish the full-resolution video","从预览继续生成全分辨率视频"],["Finish this one, then start no more","做完这一个就不再继续"],["Finished","已完成"],["Finished videos and pictures","成片与图片"],["Finished videos and pictures appear here.","生成完成的视频和图片会保存在这里。"],["Finished, failed and installing","完成、失败和安装进度"],["first pass","一采"],["First-frame reference","首帧参考"],["First-pass preview","一采预览"],["First-pass previews","一采预览"],["First-pass steps","一采步数"],["Fit all","看全部"],["Fit the whole edit in view","让整个剪辑显示在一屏内"],["Fit the whole edit in view","整条剪辑放进当前宽度"],["Fix the problems listed above, then check again.","请先处理上面列出的问题,再重新检查。"],["Fix these before installing","安装前需要先处理"],["Fix this in Settings","到设置里修复这个问题"],["Flip horizontally","水平翻转"],["Flip vertically","垂直翻转"],["Fold this group away","收起这一组"],["Folder, copy prompt, delete","打开文件夹、复制提示词、删除"],["Folders found automatically","自动发现的文件夹"],["Folders with models to reuse","可复用模型所在的文件夹"],["Folders, downloads, language and more","文件夹、下载、语言等设置"],["Folders, language and engine options","文件夹、语言和引擎选项"],["For everyday use","日常使用"],["For older computers","适合较旧的电脑"],["Frame & size","画幅与尺寸"],["Frame sheet","多帧拼图"],["frames","帧"],["Free disk","硬盘剩余"],["FreeVideo creative workspace","FreeVideo 创作面板"],["FreeVideo did not report a reason for this video. Try again, and report the problem if it keeps failing.","FreeVideo 没有给出这段视频失败的原因。请重试,仍然失败请提交问题。"],["FreeVideo keeps","FreeVideo 占用"],["FreeVideo needs no acceleration LoRA.","FreeVideo 无需添加加速 LoRA"],["FreeVideo picks the amount for each generation","每次生成由 FreeVideo 选择数值"],["FreeVideo restarted and the export stopped. Export again.","FreeVideo 已重启,导出已中断。请重新导出。"],["FreeVideo restarted while this was being made, so it did not finish. Finished parts are in your works.","FreeVideo 在生成过程中重新启动,这次没有完成。已经完成的部分在作品里。"],["FreeVideo settings","FreeVideo 设置"],["FreeVideo stopped answering while this was being made. Start FreeVideo again, then generate again.","生成过程中 FreeVideo 停止了响应。重新启动 FreeVideo 后再生成一次。"],["FreeVideo view","FreeVideo 视图"],["FreeVideo workspace","FreeVideo 工作区"],["From works, the library or this computer","从作品、素材库或电脑选择"],["From works, the library or this computer; or drop or paste","从作品、素材库或电脑选择;也可拖入或粘贴"],["Full","已满"],["Full resolution","继续二采"],["Full screen","全屏"],["Generate","生成"],["Generate (in the description)","生成(在描述框里)"],["Generate and edit still images","生成和修改图片"],["Generate image","生成图片"],["Generate in this view","在当前视图开始生成"],["Generate music in this style","按这种风格生成配乐"],["Generate picture","AI 生成"],["Generate preview","生成预览"],["Generate the chosen part","生成选中的这一段"],["Generate video","生成视频"],["Generate when installed","安装完再生成"],["Generate without this picture","不再参考这张图"],["Generated videos and pictures","生成的视频和图片"],["Generates at a lower resolution, then upscales. Faster.","先用低分辨率生成,再放大成片,更快。"],["Generates when installed","安装完自动生成"],["Generating","生成中"],["Generating","正在生成"],["Generating is not available here right now. Restart FreeVideo to try again.","这台电脑现在不能生成。重新启动 FreeVideo 后再试。"],["Generating; you can leave this view","正在生成,可以离开这个视图"],["Generation","生成"],["Generation","生成用时"],["Generation could not start. Choose \"Generate\" again.","生成没能开始,请再点“生成”。"],["Generation has slowed automatically and will gradually speed up as it stabilizes.","生成已自动放慢,稳定后会逐步加快。"],["Generation in progress","进行中的生成"],["Generation is not ready. Restart FreeVideo.","生成功能没有就绪,请重新启动 FreeVideo。"],["Generation is slowed automatically for stability; you can change this in Settings.","为了稳定,生成已自动放慢;可在设置里调整。"],["Generation mode","生成方式"],["Generation progress","生成进度"],["Generation statistics","生成统计"],["Generation stopped","生成已停止"],["Generation stopped.","生成已停止。"],["Generations are running or queued. Install after they finish, or cancel them first.","仍有生成正在进行或排队。请等待完成或先取消,再安装。"],["Generations are running or queued. Start measuring after they finish, or cancel them first.","仍有生成正在进行或排队。请等待完成或先取消,再开始性能测量。"],["Get a read token","获取只读令牌"],["Get another rewrite of the description","换一种写法再改写一次"],["Getting started","上手"],["Getting started","新手指引"],["Give it another name","换一个名字"],["Give the tag another name","给标签换个名字"],["Go back one step","回到上一步"],["Go back to its picture","回到它的生成画面"],["Go back to this setting","回到这项设置"],["Go on to the next step","继续下一步"],["Go on; the latest changes are lost","离开这里,最近的改动会丢失"],["Go to the latest generation","跳到最近生成"],["Go to this page of the tour","跳到介绍的这一页"],["Go to where it was started","回到发起这次生成的视图"],["Got it","知道了"],["GPU runtime","显卡运行环境"],["Graphics card","显卡"],["Graphics card load","显卡占用"],["Graphics memory and temperature in the top bar","在顶栏显示显存和温度"],["Grid","网格"],["Group it with a tag","给作品加上标签,方便查找"],["Group it with a tag","用标签给它分组"],["Guide the result with your own picture","用你的图片引导生成结果"],["Guide this clip with a picture","用一张图引导这一段"],["Hardware, settings and timings, to send us","硬件、设置和耗时,可发给我们"],["Hear only this track","只听这一条轨的声音"],["Hear the replaced voice","听替换后的新声音"],["Hear the voice before replacing","听替换前的原声"],["Height","高度"],["Help","帮助"],["Hide info","收起信息"],["Hide settings","收起设置栏"],["Hide the card and show the picture","收起这张卡片,显示画面"],["Hide the status panel","收起运行状态"],["Hide this hint","收起这条提示"],["Hide this message","收起这条提示"],["Hide this offer for good","以后不再显示这条提示"],["Hide this panel","收起这个面板"],["Hide this; the result stays in your works","收起提示,成品仍在作品里"],["Hide works","收起作品栏"],["High","高"],["High","高清"],["High color depth copy","高色深版本"],["Higher is sharper and takes longer","越高越清楚,生成越慢"],["Higher takes longer, shows more detail","越高越清楚,用时越长"],["Hints","提示"],["History and presets","提示词与预设"],["Hold","按住"],["How descriptions are rewritten","了解描述是怎样被改写的"],["How the seed changes after each video","每次生成后种子怎么变"],["How to describe a scene well","怎样写出效果更好的描述"],["How to write a prompt","描述写法"],["I accept this installation plan and the model and toolkit licenses","我同意当前展示的安装计划和模型/工具包许可证"],["If FreeVideo does not open completely, a card with the cause and the next step appears on its own.","如果 FreeVideo 没有完整打开,会自动出现一张说明原因和下一步的卡片。"],["Image","生成图像"],["Image","图片"],["Image","图像视图"],["Images","图像视图"],["Import","导入"],["Import files","导入文件"],["In the FreeVideo launcher, open Settings and click Repair.","请在 FreeVideo 启动器的设置里点“修复”。"],["Include every quality level in the next installation","下次安装时一并准备全部质量档位"],["Includes first-time setup","含首次准备"],["Increment","递增"],["Info","信息"],["Insert clip","放入素材"],["Install","安装"],["Install and generate","安装并生成"],["Install this model, or retry its download","安装这个模型,或重试下载"],["Installation cannot start until these are fixed.","处理完这些问题后才能开始安装。"],["Installation folder","安装位置"],["Installation is still running. Try again after it finishes.","安装仍在进行,请在完成后重试。"],["Installation settings could not be read","无法读取安装设置"],["Installed · about 76 MiB","已安装 · 约 76 MiB"],["Installing","正在安装"],["Interface language","界面语言"],["International mirror","国际镜像"],["International source","国际源"],["Interrupted","已中断"],["It has not started; it will not be made.","这项还没有开始,取消后不会生成。"],["It has not started; it will not run.","这一步还没有开始,取消后不会进行。"],["It will not be made","这项不会再生成"],["Jobs","任务列表"],["Joining the parts…","正在接合各段…"],["Jump to text the font cannot show","跳到字体显示不了的文字"],["Keep fixed","保持固定"],["Keep generating new takes until you stop","一直生成新版本,直到停止"],["Keep going","继续"],["Keep going","继续生成"],["Keep it at the top of Creations","在作品里置顶保留"],["Keep it in Favorites","加入或移出收藏"],["Keep it in favourites","加入收藏"],["Keep it under Favorites","加入收藏,方便再找"],["Keep running","继续运行"],["Keep source sound","保留源视频声音"],["Keep the changes made here","保存这里的修改"],["Keep the clips on this track from changing","锁住这条轨上的片段不被改动"],["Keep these creations","不删除,保留这些作品"],["Keep this amount of VRAM free","按这个数值预留显存"],["Keep this image easy to find","收藏这张,方便以后找到"],["Keep this version for now","暂不更新,继续用当前版本"],["Keeping the original file: ","正在保留原文件:"],["Kept for reporting a problem","提交问题时可附上"],["Kept for this session only","只在本次运行中有效"],["Keyboard shortcuts","快捷键"],["Keyboard shortcuts","快捷键速查"],["Landscape 16:9","横屏 16:9"],["Language","语言"],["Large","大图"],["Larger tiles and rows","缩略图和行更大"],["Largest size first","尺寸最大"],["Last 30 days","最近 30 天"],["Last 7 days","最近 7 天"],["Last prompt not loaded","上次的描述没能读取"],["Last prompt not loaded. Click to retry","上次的描述没能读取,点此重试"],["Later","稍后"],["Latest images at the top","按时间从新到旧排列"],["layers","层"],["Layout","布局"],["Learn each feature step by step","一步步学会每个功能"],["Learn FreeVideo step by step","一步步学会 FreeVideo"],["Leave the picture as it was","放弃这次裁剪"],["Leave without changing anything","不做改动,退出这一步"],["Leave without saving","放弃改动并离开"],["Left by finished videos; your videos are not touched","已完成视频留下的中间文件,不会删除作品"],["Less memory is available, so this generation will take longer.","可用内存较少,这次生成会较慢。"],["Less than a minute left","预计还需不到 1 分钟"],["Let an AI assistant make the video for you","让 AI 助手替你做完整个视频"],["Let phones on this network open FreeVideo","允许同一网络的手机访问"],["Let the assistant make a film","让助手做一部片子"],["Let the assistant make a longer video","让助手分段生成更长的视频"],["Library","资料库"],["License","许可协议"],["Light","光线"],["Light","浅色"],["Light","轻量"],["Light appearance","浅色外观"],["Light panels","浅色界面"],["Load the models early when a generation looks near","判断快要生成时提前加载模型"],["Load the page again; generations keep running","重新载入页面,生成不受影响"],["Load the page again; usually recovers","重新载入页面,通常能恢复"],["Loading progress","正在读取进度"],["Loading the model","加载模型"],["Loading the prompt model","正在加载提示词模型"],["Loading the video model","正在载入视频模型"],["Loading…","正在读取…"],["Lock","锁定"],["Long video","长视频"],["Longer","加长"],["Longest first","时长最长"],["Look","外观"],["Look for models in these folders","按这些文件夹查找模型"],["Look for this computer’s address again","重新查找这台电脑的地址"],["Loop","循环"],["Loop","循环播放"],["Loop playback","循环播放"],["Looping","循环中"],["LoRA model","LoRA 模型"],["LoRA strength","LoRA 强度"],["Lost the connection to FreeVideo, so the export progress cannot be read. Export again once it is back.","与 FreeVideo 的连接已断开,无法读取导出进度。恢复后请重新导出。"],["Lower-resolution preview; finish it if you like it","先出低分辨率预览,满意再继续"],["Made by the assistant","助手生成"],["Maintenance","维护"],["Make a card or link to send","做成可发送的卡片或链接"],["Make a copy next to it","在旁边复制一份"],["Make a longer video from its end","从结尾继续生成更长的视频"],["Make a new tag for it","新建一个标签"],["Make a new version: it becomes Image 1","以这张为图 1,描述要改的地方"],["Make a picture","生成图片"],["Make a picture or clip to share","生成可分享的图片或短片"],["Make a reference picture from words","用一句话生成一张参考图"],["Make a tag to group creations","新建一个标签来归类作品"],["Make a video","做成视频"],["Make a video from one sentence","写一句话,生成一段视频"],["Make a video from the description and settings","按描述和设置生成视频"],["Make an image from the prompt","按提示词生成图片"],["Make and edit pictures","生成和编辑图片"],["Make and edit pictures","生成和修改图片"],["Make it the next to start","让它下一个开始"],["Make one to mention with @ later","新建后可在描述里用 @ 引用"],["Make separate copies when reusing models","复用模型时创建独立副本"],["Make the full size in one go","一次生成全分辨率"],["Make the full-size video from this preview","从这个预览生成全尺寸视频"],["Make the next part from its last frame","从最后一帧接着生成下一段"],["Make the next shot from its last frame","从最后一帧接着生成下一段"],["Make the selected stretch from its description","按描述生成选中的这一段"],["Make the whole length at once, no parts","不分段,一次生成整段"],["Make this clip again from its description","按这段描述重新生成这一段"],["Make videos from a description","用描述生成视频"],["Making the video","合成视频"],["Mark this moment to find it later","在这一刻做标记,方便回找"],["Marker","标记"],["Match image","跟随图片"],["Match the picture","跟随图片"],["Measure each download source again","重新测量各下载源的速度"],["Measure this computer; about 30 min per pass","测量本机性能,每轮约 30 分钟"],["Measures this computer and writes a report; no setting changes.","测量本机性能并生成报告,不改变任何设置。"],["Measuring performance","正在测量性能"],["Media","素材"],["Media group","素材分组"],["Medium","中"],["Memory is low; closing memory-heavy applications will speed this up.","可用内存较少,关闭占用内存较多的程序可以更快。"],["Mention","提及"],["Mention","引用"],["Menu","菜单"],["min","分钟"],["Minutes","分钟"],["Minutes, 0 to 1440","分钟,0 到 1440"],["Mirror the picture left to right","画面左右镜像"],["Missing characters","缺字"],["Model","模型"],["Model loading","模型加载"],["Model package","模型包"],["Model version","模型版本"],["Model, prompt, size and more","模型、描述、尺寸等"],["Models","模型"],["Models & downloads","模型与下载"],["Models, downloads, storage, look","模型、下载、存储和外观"],["Models, storage, language and notifications","模型、存储位置、语言和通知"],["Models, storage, network and more","模型、存储、网络等设置"],["More","更多"],["More detail, slower","细节更多,较慢"],["More detail, takes longer","细节更多,用时更长"],["More options","更多选项"],["More room for the picture","给画面腾出空间"],["More steps look finer and take longer","步数越多越细,用时越长"],["More than one Replace person model was found. Add the one to use under \"LoRA\".","找到多个替换人物模型,请在“LoRA”一栏添加要使用的那个。"],["More tools","更多工具"],["Most detail, takes longest","细节最多,用时最长"],["Move","选择"],["Move it to Recently deleted","移到最近删除,可恢复"],["Move this video to Recently deleted","把视频移到最近删除"],["Move to front","排到最前"],["Move to recently deleted; can be undone","移到最近删除,可以撤销"],["Moved right after the previous part.","已接在上一段后面。"],["Moved to front","已排到最前"],["Moved to the next empty spot.","已挪到后面的空位。"],["Music style","配乐风格"],["Mute","静音"],["Mute the sound","关闭声音"],["Needs 8 first-pass steps","一采需 8 步"],["Needs a second video in the history","历史里还要有另一条视频"],["Never use the proxy","不使用代理"],["New","新建"],["New each run","每次随机"],["New each run, kept, or stepped","每次随机、保持或按次递增"],["New edit","新建剪辑"],["New tag","新建标签"],["New tag…","新建标签…"],["New voice","新声"],["Newest first","最新在前"],["Next","下一步"],["Next","下一个"],["Next","下一页"],["Next","下一张"],["Next page; the last one closes the tour","看下一页,最后一页结束介绍"],["Next picture","下一张"],["No conversion on this computer","无需本地转换"],["No creation has this tag yet. Select creations and press Tag.","还没有作品带这个标签。选中作品后点“标签”。"],["No details","没有更多信息"],["No estimate is available for these settings.","当前设置暂无预计用时。"],["No favorite creations. Click the heart in a creation's details to add one.","暂无收藏的作品。点作品详情中的爱心图标收藏。"],["No graphics card readings.","读不到显卡信息。"],["No LoRA files yet","还没有 LoRA 文件"],["No model folders found; add one above.","没有发现模型文件夹,可在上方添加。"],["No room left when continuing","接续段位置已满"],["No setting matches","没有找到相关设置"],["No source can be reached. Check the network or the connection mode.","下载源均无法连接,请检查网络或切换连接方式。"],["No token for this session. Credentials already on this computer still apply.","未填写本次令牌;仍可使用本机已有的凭据。"],["No video was changed","没有视频被改动"],["Nodes","节点视图"],["Not available on this computer","这台电脑不支持"],["Not available right now","现在不能用"],["Not available right now","暂时无法读取"],["Not checked","未能检查"],["Not checked yet","尚未检查"],["Not deleted: a video continuing from it is running or queued. Try again after it finishes.","未删除:接在这条视频后面的生成正在运行或排队,请等它完成后再试。"],["Not deleted: its second pass is running, or the video is still open. Try again in a moment.","未删除:正在用它跑二采,或视频仍被占用,请稍后再试。"],["Not deleted: saved edits could not be checked. Try again in a moment.","未删除:暂时无法检查已保存的剪辑,请稍后再试。"],["Not deleted: the folder also holds files FreeVideo did not write: ","未删除:文件夹里还有不是 FreeVideo 生成的文件:"],["Not deleted: these edits use it: ","未删除:这些剪辑正在使用它:"],["Not finished","未完成"],["Not measured yet. Test again to compare the sources.","还没有测速,点“重新测速”比较各下载源。"],["Not now","暂不安装"],["Not now","暂不启用"],["Not saved","未保存"],["Nothing here yet","这里还没有内容"],["Nothing is running.","没有进行中的任务。"],["Nothing matches these filters.","没有符合筛选条件的作品。"],["Nothing matches this search.","没有符合搜索的作品。"],["Nothing to bring back.","没有可以恢复的作品。"],["Nothing to clear up","没有可清理的文件"],["Nothing to clear up now","现在没有可清理的文件"],["Nothing to redo","没有可以重做的改动"],["Nothing to redo.","没有可以重做的改动。"],["Nothing to undo yet","还没有可以撤销的改动"],["Nothing to undo.","没有可以撤销的改动。"],["Notice","提示"],["Notices","通知"],["Notices are here","通知在这里"],["Notifications","通知"],["Number of videos","生成数量"],["Off","关闭"],["Off keeps it listed but unused","关闭后保留在列表里但不使用"],["Off. Click to turn on","已停用,点击启用"],["OK","确定"],["Oldest first","最早在前"],["On","开启"],["Once, a batch, or a loop","单次、批量或循环生成"],["Once, a batch, or keep going until stopped","单次、批量或一直生成"],["One creation large, thumbnails beside it","大图查看,旁边是缩略图"],["One over the other, drag to reveal","叠在一起,拖动分界线查看"],["One piece","强制单次生成"],["One prompt per line","每行一条描述"],["One second longer","加长 1 秒"],["One second longer","时长增加 1 秒"],["One second shorter","时长减少 1 秒"],["One second shorter","缩短 1 秒"],["One video per press","每按一次生成一个"],["Only","只看"],["Only the creation, over the whole screen","全屏只看作品"],["Only the generated pictures","只看生成的图片"],["Only the generated videos","只看生成的视频"],["Only things to do","只看可执行的操作"],["Open","打开"],["Open","去看看"],["Open a FreeVideo workflow first.","请先打开 FreeVideo 工作流。"],["Open a prefilled report; the file itself is not sent","打开预填好的问题报告,不会发送文件本身"],["Open Creations","打开作品库"],["Open folder","打开文件夹"],["Open for the reason","点开查看原因"],["Open FreeVideo on a phone on this network","在同一网络的手机上打开"],["Open in Images","在图像视图打开"],["Open it","打开它"],["Open it over the whole window","铺满窗口查看"],["Open on a phone on this network","在同一网络的手机上打开"],["Open settings","打开设置"],["Open Settings","打开设置"],["Open the create view first, then run the second pass","请先打开创作页,再继续二采"],["Open the exported video in the library","在作品库里打开导出的视频"],["Open the feedback form with this error filled in","打开反馈表,已填好这条错误"],["Open the generation in progress","打开正在进行的生成画面"],["Open the guide to writing a good prompt","打开描述写法指南,写得更准"],["Open the library to place clips","打开素材库,把素材放进时间线"],["Open the settings at this group","展开设置栏并跳到这一组"],["Open the source","打开来源"],["Open these results where they were made","打开这组结果,回到它的画面"],["Open where this feature lives","打开这个功能所在的位置"],["Open your works to sort and manage them","打开作品库,筛选和管理"],["Opening the edit…","正在打开…"],["Opens the account page in the browser","在浏览器中打开账号页面"],["Optional · kept for this session only","可选 · 只在本次运行中有效"],["Order","排序"],["Original","原声"],["Original","原文"],["original kept","原声已保留"],["Other","其他"],["Other edits came after it; use Undo in the tool row.","之后又有改动,请用工具行的撤销。"],["Other model folders","其他模型文件夹"],["Other model folders (optional, one per line)","其他模型文件夹(可选,每行一个)"],["Out of GPU memory","显存不足"],["Out of RAM","内存不足"],["Outside usual range","超出常用范围"],["Overall","整体进度"],["Page check","页面检查"],["Page files","页面文件"],["Partly applied","部分生效"],["parts","段"],["Parts are generating. Wait, or cancel them in the queue.","分段视频生成中,完成或在队列里取消后可再生成"],["Passes","轮数"],["Paste","粘贴"],["Paste a read token","粘贴只读令牌"],["Pause","暂停"],["Pause both","一起暂停"],["Pause the video","暂停视频"],["Pause; downloaded files are kept","暂停安装,已下载的文件会保留"],["Peak RAM","最高内存"],["Peak VRAM","最高显存"],["Performance measurement","性能测量"],["Phone","手机"],["Phone access","手机连接"],["Phones will need this password","保存后手机要输入这个密码"],["Pick a picture to see its facts","选一张图片查看信息"],["Pick a style add-on to use","选一个附加模型加入生成"],["Pick several creations to act on","选中多个作品一起操作"],["Pick several images to delete together","多选图片一起删除"],["Pick several works to compare","多选作品即可对比"],["Pick something you said before","选一句最近说过的话"],["Pick the frame and the size","选画幅和尺寸"],["Pick up the long video where it stopped","从停下的位置接着生成长视频"],["Picture","图片"],["Picture","图片任务"],["Picture facts","图片信息"],["Picture folder","图片文件夹"],["Picture models","图像模型"],["Picture, sound and speed of the selection","调整选中片段的画面、声音和速度"],["Pictures","素材"],["Pictures","图片"],["Pictures and sound","素材"],["Pictures could not be read just now.","图片暂时无法读取。"],["Pictures from","图片来源"],["Pictures from a text prompt, up to about 4 MP","根据文字提示出图,最大约 4 MP"],["Pictures made in the image view appear here.","在图像视图里生成的图片会保存在这里。"],["Planning segments…","正在规划分段…"],["Plans each part of a long video","下载后自动规划长视频各段"],["Play","播放"],["Play both","一起播放"],["Play only the selected range","只播放选中的那一段"],["Play or pause from the playhead","从播放头开始播放或暂停"],["Play or pause the example video","播放或暂停示例视频"],["Play selection","播放选中范围"],["Play the range over and over","反复播放选中的范围"],["Play the tour of this version","播放这一版的新功能介绍"],["Play the video","播放视频"],["Play the video in progress as a loop","把进行中的视频循环播放"],["Play this part of the example","播放示例里的这一段"],["Playback","播放"],["Playhead","播放位置"],["Portrait 9:16","竖屏 9:16"],["Position","播放位置"],["Preload ahead","积极预加载"],["Prepare all quality levels","提前下载全部质量档位"],["Prepared ahead, so switching levels needs no download; applies at the next check","提前准备,切换档位不用再等下载;下次检查安装时生效"],["Preparing","正在准备"],["Preparing","准备生成"],["Preparing installation…","正在准备安装…"],["Preparing report…","正在整理报告…"],["Preparing the prompt model","正在准备提示词模型"],["Preparing video output","正在准备输出视频"],["Preparing your video","正在准备视频"],["Preparing…","正在整理…"],["Preparing…","正在准备…"],["preset","预设"],["Presets","参数预设"],["Press Enter to start.","按回车开始生成。"],["Press to generate as soon as it is installed","按下后,安装完成即自动生成"],["Press to not generate after it","再按一次取消自动生成"],["preview","预览"],["Preview","预览"],["Preview during generation","生成中的预览"],["Preview first was turned off for \"Use as is\".","已为“原样使用”关闭“先出预览”。"],["Preview saved","预览已保存"],["Previous","上一个"],["Previous","上一张"],["Previous / next picture","上一张 / 下一张"],["Previous attempt did not finish","上一次尝试没有完成"],["Previous version","上一版"],["Previous version of this part","这一段换回上一版"],["Problem","问题"],["Process peak RAM","进程最高内存"],["Processing reference images and videos","正在处理参考图片和视频"],["Processing the prompt","正在处理提示词"],["Processing the prompt and references","正在处理提示词和参考素材"],["Progress has not updated recently; generation is still running.","进度暂未更新,仍在生成中。"],["Prompt","描述"],["Prompt","提示词"],["Prompt and run details","提示词和运行详情"],["Prompt copied.","已复制提示词。"],["Prompt enhancement","提示词增强"],["Prompt history","提示词历史"],["Prompt model","提示词模型"],["Prompt model not installed. The description is split across the parts by sentence.","未安装提示词模型,描述按句子顺序分到各段"],["Prompt not saved","描述没能保存"],["Prompt not saved. Click to retry","描述没能保存,点此重试"],["Prompt templates","提示词模板"],["Prompt, model, size and time","提示词、模型、尺寸和用时"],["Prompt, model, size and time of the shown picture","当前图片的提示词、模型、尺寸和用时"],["Prompts","提示词"],["Prompts are not kept in this browser; one shows while the page that made the picture is open.","提示词不保存在浏览器里,只在生成它的页面打开期间显示。"],["Prompts show here once used.","用过的描述会出现在这里。"],["Prompts used before","用过的描述"],["Proxy only","仅代理"],["Pull the clips together over empty space","把片段之间的空白收拢"],["Put .safetensors files in models/loras, then check again","把 .safetensors 文件放进 models/loras 文件夹,再点“重新检查”"],["Put a clip on the timeline first","先在时间线上放一个片段"],["Put back the picture as it was before editing","换回编辑前的原图"],["Put it back where it was","放回原来的位置"],["Put it on the stage","在中间显示"],["Put its prompt back in the box","把它的提示词填回描述框"],["Put its prompt in the box of the image view","把它的提示词填回图像视图的描述框"],["Put LoRA files (.safetensors) in the models/loras folder, then choose \"Add LoRA\".","把 LoRA 文件(.safetensors)放进 models/loras 文件夹,再点“添加 LoRA”。"],["Put the other one first","交换两边的位置"],["Put the person from your picture in the video","把视频里的人换成你图里的人"],["Put the playhead inside a clip first","先把播放头放到片段中间"],["Put the playhead on a clip first","先把播放头放到片段上"],["Put these creations back on the shelf","把这些作品放回作品库"],["Put these settings back to default","把这些设置恢复为默认值"],["Puts it in the Create prompt","填进创作面板的描述框"],["Puts it in the Images prompt","填进图像视图的描述框"],["Quality","质量"],["Quality and two-pass settings for this clip","这一段的质量和二采"],["Quality level","质量档位"],["Queue","队列"],["Queued","排队中"],["Queued","已加入队列"],["Queued. It appears in \"Creations\" when done.","已加入队列,完成后在“作品”里。"],["Queued. It starts after the part now generating.","已排队,正在生成的那段完成后自动开始。"],["Queued. It starts after the previous part finishes.","已排队,上一段完成后自动开始。"],["Queued. It starts once generation is ready.","已排队,准备好后自动开始。"],["Queued…","排队中…"],["Random seed","随机种子"],["Read the creations again","重新读取作品"],["Read the LoRA folder and check every file again","重新读取 LoRA 文件夹并逐个检查"],["Read the next creations again","重新读取后面的作品"],["Read the terms of the rewriting model","查看改写模型的使用条款"],["Reading all creations…","正在读取全部作品…"],["Reading installation settings…","正在读取安装设置…"],["Reading the LoRA folder…","正在读取 LoRA 文件夹…"],["Reading the prompt","读取提示词"],["Reading the prompt model","正在读取提示词模型"],["Reading the references","读取参考图"],["Reading…","正在读取…"],["Ready","就绪"],["Ready to generate","已就绪,可以开始生成"],["Ready to generate.","已就绪,可以开始生成。"],["Ready to generate.","准备就绪,可以开始生成。"],["Reason, what to do, and the report","原因、可做的事和诊断报告"],["Recent","最近说过"],["Recent creations","最近作品"],["Recent results","最近作品"],["Recently deleted","最近删除"],["Recently used","最近使用"],["Recommended · picks the fastest measured source","推荐 · 按测速选择最快的源"],["Record","录音"],["Record from the microphone","用麦克风开始录制"],["Record from the microphone","用麦克风录音"],["Record from the microphone at the playhead","用麦克风从播放头处录一段"],["Record your voice onto the timeline","录一段声音放到时间线上"],["Redo","重做"],["Redo from here","从这段重新生成"],["Redub","重新配音"],["Refer to a picture or character in the text","在描述里引用图片或人物"],["Reference","参考图"],["Reference audio","参考音频"],["Reference media (@)","引用素材(@)"],["Reference picture","参考图"],["Reference pictures","参考图"],["Reference pictures, first and last frame, sound","参考图、首尾帧和参考音频"],["Reference video","参考视频"],["Reference, first frame or last frame","作参考图、首帧或尾帧"],["References","参考图"],["Refresh","刷新"],["Regenerate","重新生成"],["Release notes","更新说明"],["Reload now","立即重新载入"],["Reload page","刷新页面"],["Reload the page in the chosen language","以所选语言重新载入页面"],["Reload the page in the other language? Generations keep running.","重新载入页面并切换语言?正在进行的生成不受影响。"],["Reloads the page; generations keep running","会重新载入页面,生成不受影响"],["Remove","取消排队"],["Remove","移除"],["Remove from favorites","取消收藏"],["Remove from queue","取消排队"],["Remove from the queue?","取消排队?"],["Remove gaps","移除空隙"],["Remove LoRA","移除 LoRA"],["Remove picture","移除人物图"],["Remove reference","移除参考图"],["Remove sound track","移除声音轨"],["Remove star","取消收藏"],["Remove tag","去掉标签"],["Remove the selected clips","删除选中的片段"],["Remove the selection and leave its gap","删掉选中的内容,留下空隙"],["Remove the tag; the creations stay","只删除标签,作品保留"],["Removed from Favorites.","已移出收藏。"],["Rename","改名"],["Rename or open another edit","改名或打开其他剪辑"],["Rename this edit","给这个剪辑项目改名"],["Rendering the audio","正在输出音频"],["Rendering the video","正在输出视频"],["Replace person","替换人物"],["Replace person model","替换人物模型"],["Report","提交问题"],["Report a mistake","报告误判"],["Report a problem","提交问题"],["Report unavailable · retry","报告暂不可用 · 重试"],["Required before installing","安装前需要同意"],["Reserved unified memory","预留统一内存"],["Reserved VRAM","预留显存"],["Reset","恢复原样"],["Reshoots this long ask first","重拍达到这个时长时先询问"],["Resize","缩放"],["Resolution","清晰度"],["Resolution in megapixels","清晰度(百万像素)"],["Restart FreeVideo after updating to open the creations.","更新后重启 FreeVideo,可打开作品。"],["Restart FreeVideo to generate.","请重新启动 FreeVideo 后再生成。"],["Restore","恢复"],["Restore","恢复原样"],["Restore creations","恢复作品"],["Restore defaults","恢复默认"],["Restore draft","恢复草稿"],["Restore original","恢复原图"],["Restored.","已恢复。"],["Results","结果"],["Results for each file","各文件的测速结果"],["Resume","继续"],["Resume queue","继续队列"],["retry","重试"],["Retry","重试"],["Retry at Standard","改用标准并重试"],["Return to the generation; nothing restarts","展开回生成画面,进度不中断"],["Return to this generation","回到这项生成"],["Reuse settings","复用设置"],["Reused from this computer","复用本地模型"],["Reused previous result","已复用上次结果"],["Review plan","查看计划"],["Review the plan, then install.","请确认计划后安装。"],["Rewrite again","重新改写"],["Rewrite the description in more detail","把描述自动改写得更详细"],["Rewritten","改写"],["Ripple delete","波纹删除"],["Rotate left 90°","左转 90°"],["Rotate right 90°","右转 90°"],["Run details","运行详情"],["Run mode, seed, steps and parts","生成方式、种子、步数和分段"],["Run second pass","继续二采"],["Run status","运行状态"],["Running the first step (it takes longer the first time a size is used or after an update)","正在进行第一步(首次使用这个尺寸或更新后,第一步要多花一些时间)"],["Running; progress is under Models. Closing Settings keeps it running.","正在运行,进度见“模型”。关闭设置不会中断。"],["Runtime packages","运行环境"],["s","秒"],["Same model. Higher effort uses more sampling steps; results vary by scene.","使用同一模型,提高档位会增加采样步数;效果因场景而异。"],["Same settings, a new seed each time. Stops when this page closes.","用当前设置,每次换一个种子;关闭网页后停止。"],["Same settings, a new seed for each video.","用当前设置,每个视频换一个种子。"],["Same settings, a new take","同样的设置,再生成一版"],["Sampling","采样"],["Save","保存"],["Save again","重新保存"],["Save details that help us fix problems","保存帮助我们排查问题的信息"],["Save failed: ","保存失败:"],["Save folders","保存文件夹"],["Save frame","保存当前帧"],["Save the current frame as a picture","把当前帧存成图片"],["Save the diagnostic report of this run","保存这次生成的诊断报告"],["Save the diagnostic report to send us","保存诊断报告,可发给我们"],["Save the file to this computer","把文件存到这台电脑"],["Save the finished video as an MP4","把成片导出为 MP4 文件"],["Save the full-size picture","保存原尺寸图片"],["Save the image to this computer","把图片保存到这台电脑"],["Save the latest changes once more","再保存一次最近的改动"],["Save the MP4 to this computer","把 MP4 保存到这台电脑"],["Save the MP4 to this computer","把视频文件保存到电脑"],["Save the picked works as a zip file","将所选作品保存为压缩包"],["Save the picture at the playhead","把播放头处的画面存成图片"],["Save the picture to this computer","把图片保存到电脑"],["Save the video to this computer","把视频保存到本机"],["Save the whole edit as one video","把整条剪辑存成一个视频"],["Save the whole edit as one video in the library","把整条剪辑存成一个视频,放进作品库"],["Saved","已保存"],["Saved · applies to the next generation","已保存 · 下次生成生效"],["Saved creations","已保存的作品"],["Saved picture","已保存的图片"],["Saved the current frame to Edit image > Generate with AI > Works.","已保存当前帧,位于“编辑图片 > AI 生成 > 作品库”。"],["Saved to your works","已存入作品"],["Saved video","已保存的视频"],["Saved.","已保存。"],["Saved. This folder was not found:","已保存。找不到这个文件夹:"],["Saving changes failed because of an unexpected error. Your changes stay in this page and are saved again automatically.","保存改动时出现意外错误。改动仍在这个页面里,会自动再次保存。"],["Saving changes failed: the disk is full. Free some space, then export again.","保存改动时出错:磁盘空间不够,空出空间后再导出。"],["Saving changes failed. Please export again.","保存改动时出错,请再导出一次。"],["Saving changes…","正在保存改动…"],["Saving the changes, then switching…","正在保存改动,保存后切换…"],["Saving the video","正在保存视频"],["Saving…","正在保存…"],["Scope","切换范围"],["Search","搜索"],["Search actions, creations, prompts and cast","搜索操作、作品、提示词和角色"],["Search and commands","搜索与命令"],["Search creations","搜索作品"],["Search creations, images and cast","搜索作品、图像和角色"],["Search prompts and names","搜索提示词和名称"],["Search settings","搜索设置"],["Search works","搜索作品"],["Search works and run any action","搜索作品、提示词并执行操作"],["Search works, prompts and actions","搜索作品、提示词和操作"],["Search, phone, version, tutorials, feedback, settings","搜索、手机、版本、教程、反馈和设置"],["Searching","正在搜索"],["second pass","二采"],["Second pass","二采"],["Second pass · upscaling","二采 · 放大"],["Second pass did not start · retry","二采没有开始 · 重试"],["Second pass did not start. Try again","二采没有开始,请重试"],["Second-pass steps","二采步数"],["See and change the full workflow","查看和修改完整的节点流程"],["See more of the timeline at once","时间线显示更长一段"],["See problems","查看问题"],["See running tasks and notices","看进行中的任务和通知"],["See the description as you wrote it","查看你写的原始描述"],["See the enhanced description","查看增强后的描述"],["See the timeline in more detail","时间线显示得更细"],["See this version and install updates","查看当前版本,安装更新"],["See two creations side by side or with a slider","并排或用滑块对比两个作品"],["See updates and what is new","查看更新和新功能"],["See what this update changes","查看这次更新改了什么"],["See what was made","查看这次生成的成品"],["See what will be installed and agree","查看要安装的内容并确认"],["See why","查看原因"],["See, reorder or remove waiting videos","查看、调整或移除排队的视频"],["Seed","种子"],["Seed and fine settings","种子和细节设置"],["Seed and length details","种子、分段等细节设置"],["Select","选择"],["Select a clip first","先选中一个片段"],["Select a clip with sound first","先选中一段有声音的片段"],["Select a range first","先选出一段范围"],["Select a stretch on the timeline first","先在时间线上选出一段"],["Select a video clip first","先选中一个视频片段"],["Select all","全选"],["Select all while selecting","多选时全选"],["Select creations first","先选择作品"],["Select creations on the shelf","点作品来选择"],["Select day","选择这一天"],["Select every creation of this day","选中这一天的全部作品"],["Select every creation shown","选中当前显示的全部作品"],["Select exactly two creations","正好选中两个作品时可用"],["Select exactly two creations first","先正好选中两个作品"],["Select none","全不选"],["Select only one part","只选一段"],["Send the problem and diagnostics to us","把问题和诊断信息发给我们"],["Send the problem with its diagnostics","附上诊断信息提交问题"],["Sending the generation first, then switching…","正在发送生成请求,发送后切换…"],["Separate copies","独立副本"],["Separate tracks","分离音轨"],["Set","已设置"],["Set by connected nodes","由连接的节点决定"],["Set by the number of lines","按描述的行数生成"],["Set password","设置密码"],["Settings","设置"],["Settings / installation","设置/安装"],["Settings changed","设置已更改"],["Settings changed. Click Check installation again.","设置已更改,请重新点“检查安装”。"],["Settings pages","设置页面"],["Several videos in a row, each a new take","连续生成多个不同版本"],["Shape","比例"],["Shape free","比例不限"],["Shape kept","保持比例"],["Share","分享"],["Shortcuts","快捷键"],["Shorter","缩短"],["Show","显示"],["Show all","看全部"],["Show creations with this tag; right-click to rename or delete","显示带这个标签的作品;右键可改名或删除"],["Show every job in progress","展开全部进行中的任务"],["Show everything again","恢复显示全部"],["Show how this picture is used","查看这张图的用法"],["Show in folder","在文件夹中显示"],["Show its progress","查看进度"],["Show more of the timeline","时间线显示得更长"],["Show only creations that match","只显示符合条件的作品"],["Show or hide the strip of recent videos","显示或收起最近作品栏"],["Show or hide what you typed","显示或隐藏输入的密码"],["Show password","显示密码"],["Show settings","展开设置栏"],["Show several frames of the video in progress","同时显示进行中视频的多帧"],["Show the clips and pictures you can add","显示可加入的素材"],["Show the creation after","查看后一个作品"],["Show the creation before","查看前一个作品"],["Show the file in its folder","在文件夹里找到这个文件"],["Show the image after this one","查看后一张图片"],["Show the image before this one","查看前一张图片"],["Show the interface in Chinese","界面显示为中文"],["Show the interface in English","界面显示为英文"],["Show the other actions","显示其余操作"],["Show the pictures in the file manager","在文件管理器里打开图片所在文件夹"],["Show the pictures on this computer","在电脑上打开保存图片的文件夹"],["Show the timeline in more detail","时间线看得更细"],["Show the videos in the file manager","在文件管理器里打开视频所在文件夹"],["Show the work this picture was made from","显示这张图的来源作品"],["Show these clips and pictures","切换到这一组素材"],["Show these settings for the selection","切换到这一组调整"],["Show this computer","显示本机数据"],["Show this computer in the status","在运行状态中显示本机数据"],["Show this group","展开这一组"],["Show this image large","大图查看这张图片"],["Show this page","打开这一页"],["Show what was made last","打开最近一次生成的结果"],["Show why it cannot be used","查看不能使用的原因"],["Show works","展开作品栏"],["Showing the last completed part.","正在显示最后完成的一段。"],["Side by side","并排"],["Side by side or with a divider, with another video","和另一条视频并排或滑动对比"],["Silence this track for now","让这条轨暂时没有声音"],["Single","单次"],["Size","尺寸"],["Size from connected nodes","尺寸来自已连接节点"],["Sizes and lengths this computer can make","这台电脑能生成的尺寸和时长"],["Sketch","草图"],["Sketch","画草图"],["Slide clips together to close empty space","把片段前移,填掉中间的空白"],["Slider","滑块"],["Slim FP8","精简 FP8 版"],["Slim int8","精简 int8 版"],["Smaller tiles, more at once","缩略图更小,一屏更多"],["Snap to this usual size","回到这个常用尺寸"],["Snapping","吸附"],["Solid panels, fewer animations, no autoplay","实体背景,减少动画,视频不自动播放"],["Solo","独奏"],["Some layers apply on this model version","在当前模型版本上部分层生效"],["Some of the model files are missing or damaged. ","部分模型文件缺失或已损坏。"],["Some of the selection have it; choose to add to all","选中的部分作品带着它,点一下全部加上"],["Some settings this example needs are connected to other nodes, so it cannot fill them in. Disconnect those links in the node view, then try again.","示例要改的设置已连到别的节点,无法填入;在节点视图断开这些连线后再试"],["Sort","排序"],["Sound","声音"],["Sound off","已静音"],["Sound on","有声音"],["Source","来源"],["Source · route","来源 · 连接"],["Speed","速度"],["Speeds are a guide; actual downloads may differ.","测速只作参考,实际下载速度可能不同。"],["Split","剪开"],["Split at the playhead","在播放头处剪开"],["Split the clip at the playhead","在播放头处把片段剪成两段"],["Split voice and background into two tracks","把人声和背景声分成两条轨"],["Square 1:1","方形 1:1"],["Square frame for feeds and avatars","适合信息流和头像"],["Stage","大图"],["stages complete","阶段已完成"],["Standard","标准"],["Star","收藏"],["Star or unstar","收藏 / 取消收藏"],["Start a new image from this one","以这张为参考再生成"],["Start from a ready-made request","从常用说法里选一句"],["Start loop","开始循环"],["Start measuring","开始测量"],["Start recording","开始录音"],["Start selecting with this one","从这一个开始多选"],["Start the waiting tasks again","让排队的任务继续开始"],["Start this view's generation","开始这个视图的生成"],["Starting","正在开始"],["Starting generation","正在启动生成"],["Starting…","正在开始…"],["Starting…","正在启动…"],["Starts after the one before it","等前一项完成后开始"],["Starts when the current video finishes","当前视频完成后自动开始"],["step","步"],["Step back to an earlier take of this clip","换回这一段更早的版本"],["Step-by-step guides with examples","带示例的分步教程"],["steps","步"],["Stop","停止"],["Stop after this video","完成当前后停止"],["Stop downloading this update","停止下载这次更新"],["Stop generating?","停止生成?"],["Stop it now; nothing is kept","立即停止,不保留结果"],["Stop selecting","退出多选"],["Stop setup","停止安装"],["Stop setup to change the token, then continue; downloaded files are kept.","先停止安装,再修改令牌并继续;已下载文件会保留。"],["Stop the current loop before starting another.","请先停止当前循环。"],["Stop the current video? What is being made is not kept.","停止当前视频?正在生成的不会保留。"],["Stop the download; the part downloaded is kept","停止下载,已下载的部分会保留"],["Stop the video being made now","停止正在生成的视频"],["Stop this export; no partial file is kept","停止导出,不留下不完整的文件"],["Stop this generation (asks first)","停止这次生成(会先确认)"],["Stop this one; asks first","停止这一项,会先确认"],["Stop this rewrite","停止这次改写"],["Stop this step now; what it made so far is not kept","立即停止这一步,做到一半的不保留"],["Stop this step?","停止这一步?"],["Stop this video; the queue goes on","停止这一条,排队的照常进行"],["Stop using the token entered","不再使用填写的令牌"],["Stop using this person picture","不再使用这张人物图"],["Stop what runs and pause the queue; asks first","停止正在生成的并暂停队列,会先确认"],["Stopped","已停止"],["Stopped; downloaded files are kept","已停止,已下载的文件保留"],["Stopped. Files retained for resuming.","已停止,文件保留,可继续安装。"],["Stopped. The next queued video is starting.","已停止,队列中的下一条开始生成。"],["Stopped. The queue is paused.","已停止,队列已暂停。"],["Stopping","正在停止"],["Stopping generation…","正在停止生成…"],["Stops at a lower-resolution preview. Choose \"Run second pass\" in the result when it looks right; the video matches a direct run.","先出低分辨率预览,满意后在结果里点“继续二采”,成片与直接生成一致。"],["Storage","存储"],["Strength","强度"],["Studio","创作面板"],["Subtitle","字幕"],["Swap","左右互换"],["Swap this part back to its earlier take","把这一段换回之前生成的版本"],["Switch between light and dark","在浅色和深色之间切换"],["Switch every view's colours","切换所有视图的颜色"],["Switch view","切换视图"],["Switching sources; downloaded parts are kept where possible.","正在切换下载源,能续传的部分会保留。"],["Tag","标签"],["Tag name","标签名称"],["Tags","标签"],["Take back the last change","撤回上一步改动"],["Take back the last edit","退回上一步改动"],["Take it off the list; the file stays","从列表移除,文件不删"],["Take it off this list","从列表里移除"],["Take it out of favourites","移出收藏"],["Take it out of the queue","从队列里拿掉这一项"],["Take me there","带我去"],["Take this picture out","去掉这张参考图"],["Taking longer than expected","比预计久,仍在生成"],["Tall frame for phones and short videos","适合手机和短视频"],["Task","任务"],["Tasks","任务"],["Technical details","技术详情"],["Tell us a problem or an idea","把问题或想法告诉我们"],["Tell us what to improve","告诉我们哪里需要改进"],["Tell us what went wrong or could be better","告诉我们问题或建议"],["Temperature","温度"],["Templates","模板"],["Temporary files","临时文件"],["Temporary files from generating","生成过程中的临时文件"],["Test again","重新测速"],["Testing sources… ","正在测速… "],["Testing…","正在测速…"],["Text understanding","文本理解"],["That picture could not be read.","这张图读不了。"],["That spot is taken. Use an empty spot.","这里已经有片段了,请放到空白处。"],["The assistant makes films in the Autopilot view.","助手在“AI 全自动”视图中拍片。"],["The assistant waits for an answer first","助手先等确认再继续"],["The check did not answer; check again later","检查没有回应,请稍后重新检查"],["The chosen font is missing some characters. Choose another font.","所选字体缺少部分字符,请换一种字体。"],["The creations could not be loaded.","作品暂时无法读取。"],["The current model cannot use this example's settings.","当前模型用不了这个示例的设置"],["The description is split across the parts by sentence.","描述按句子顺序分到各段"],["The description is too long. Shorten it to %d characters or fewer.","描述过长,请缩短到 %d 字以内。"],["The disk is full. Free some space, then save the frame again.","磁盘空间不足,请清理出空间后再保存。"],["The download did not start: ","下载没有开始:"],["The download did not start: FreeVideo could not be reached. Start FreeVideo again, then try again.","下载没有开始:连不上 FreeVideo。请重新启动 FreeVideo 后再试。"],["The download did not start: the disk is full. Free some space, then download again.","下载没有开始:磁盘空间不够。空出空间后再下载。"],["The download did not start. Try again; if it keeps failing, report the problem.","下载没有开始。请重试;仍然失败请提交问题。"],["The edited picture could not be saved. Try again; if it keeps failing, report the problem.","编辑后的图片没能保存。请重试;仍然失败时,请提交问题。"],["The editor did not open, so the start clip was not placed. Open the editor, then select the example again.","剪辑视图没有打开,起始片段没有放上去;打开剪辑视图后再点一次示例"],["The engine restarted","引擎已重启"],["The engine stopped","引擎停止了"],["The engine was closed","引擎已关闭"],["The exact error, for troubleshooting","查看出错的具体信息"],["The example files could not be added to this panel's media list. Try again.","示例素材没能加入这个面板的素材列表,请再试一次"],["The example files could not be read from FreeVideo. Check that FreeVideo is still running, then try again.","没能从 FreeVideo 读取示例素材,确认 FreeVideo 仍在运行后再试"],["The example was not filled in.","示例没有填入"],["the file below","下面这个文件"],["The first 200 files are listed.","只列出前 200 个文件。"],["The folder could not be opened automatically. Open it in a file manager.","无法自动打开该文件夹,请在文件管理器中手动打开"],["The FreeVideo node was off in Nodes view. It has been turned back on.","FreeVideo 节点在节点视图里是关闭的,已自动打开。"],["The image editor did not load. Reload the page and try again.","图片编辑器没有加载出来。请刷新页面后再试。"],["the installation","安装"],["the installation check","安装检查"],["The installation in this folder is not finished. ","该文件夹中的安装尚未完成。"],["The installation plan is ready","安装计划已就绪"],["The last edit could not be found, so a blank edit is open.","找不到上次的剪辑,已打开空白剪辑。"],["The last step did not finish","上一步没有完成"],["The last video did not finish. The loop has stopped.","上一个视频没有生成完,循环已停止。"],["The LoRA folder could not be read. Check again.","无法读取 LoRA 文件夹,请重新检查。"],["The LoRA list cannot be read. Add the LoRAs again.","LoRA 列表无法读取,请重新添加 LoRA。"],["The media this part uses is missing. Import it again from the library.","找不到这一段用到的素材,请在素材库重新导入。"],["The model is not fully installed. ","模型没有装全。"],["The most detail, slowest","细节最多,最慢"],["The new video keeps the original sound","新视频沿用原视频的声音"],["The other side follows the chosen shape","改一边,另一边按比例跟着变"],["The output folder cannot be accessed.","无法访问输出文件夹"],["The output folder cannot be written to, so the video was not saved. Check that the folder can be written to, then retry.","输出目录不可写,视频没能保存。请检查这个文件夹的写入权限后重试。"],["The part before did not finish, so this one did not start.","上一段没有完成,这一段没有开始。"],["the performance measurement","性能测量"],["The picture did not finish.","这张图没有完成。"],["The picture didn't finish","这张图没有完成"],["The picture folder cannot be written to. Check that the folder can be written to, then save the frame again.","图片文件夹不可写。请检查这个文件夹的写入权限后再保存。"],["The picture was not made","这张没有生成出来"],["The preview can be set to loop in Settings.","预览可在设置中改为循环播放。"],["The prompt has only picture references and no words. Describe the picture you want, then try again.","提示词里只有图片引用,没有文字。请写上要生成的画面后重试。"],["The prompt model file differs from the tested one, so results and speed may differ.","提示词模型文件和测试过的版本不同,效果和速度可能不一样。"],["The recommended size","推荐尺寸"],["The reference slots are full; remove one","参考图已满,先移除一张"],["The saved setting was damaged, so Automatic optimization is in use. The original file was renamed and kept.","保存的设置已损坏,现按“自动优化”运行,原文件已改名保留。"],["The setting could not be saved. Check that the installation folder can be written to.","设置未能保存,请检查安装位置是否可以写入。"],["The settings, GPU or free disk space changed after you confirmed, so installation stopped. Click Check installation, then Install.","确认之后设置、显卡或磁盘空间有变化,已停止。请先点“检查安装”,再点“安装”。"],["the setup task","安装任务"],["The sketch canvas cannot open right now.","草图画布暂时打不开。"],["The source is no longer in the works","来源作品已不在作品里"],["The source video sound could not be kept. The video uses generated sound.","未能保留源视频声音,成片使用生成的声音。"],["The speed test did not finish. Click \"Test again\".","测速没有完成,请点“重新测速”。"],["The timeline is empty","时间线是空的"],["The timeline is empty; add a clip first","时间线是空的,先放入素材"],["The timeline is empty. Add a clip first.","时间线是空的,请先放入素材。"],["The undo time has passed.","已过了撤销时间。"],["The video and its files will be deleted.","视频和相关文件都会删除。"],["The video didn't finish","这段视频没有完成"],["The video file cannot be found. If you moved the file, refresh the page.","找不到这条视频的文件。如果移动过文件,请刷新页面。"],["The video file cannot be found. It may have been moved or deleted. Import it again.","视频文件找不到了,可能已被移动或删除。请重新导入。"],["The video starts from this picture","视频从这张图开始"],["The workflow behind the views","各视图背后的工作流"],["Theme","主题"],["then generates","完成后生成"],["There is no gap that can close","没有可以收拢的空隙"],["There is no picture at this position. Move the playhead onto a clip.","这个位置没有画面,请把播放头移到片段上。"],["These files are downloaded or reused. Closing Settings does not stop the installation.","将下载或复用以下文件。关闭设置不会中断安装。"],["These works cannot be downloaded.","这些作品无法下载。"],["These works cannot be read.","无法读取这些作品。"],["They can be brought back for 10 seconds.","10 秒内可以撤销。"],["This aspect ratio and resolution are out of range. Use a custom width and height.","这个比例和清晰度超出范围,请改用自定义宽高。"],["This clip cannot be played.","这段素材无法播放。"],["This clip has no earlier version","这一段还没有更早的版本"],["This clip has no sound. Please choose one with sound.","这个素材没有声音,请选一段有声音的。"],["This computer","本机"],["This example is not available yet.","这个示例暂时不能用"],["this file","这个文件"],["This folder has no finished FreeVideo installation. ","该文件夹中没有已安装的 FreeVideo。"],["This installation has not checked the GPU yet. ","该安装尚未检查显卡。"],["This installation is missing its runtime. ","该安装缺少运行环境。"],["This installation was moved from another folder. ","该安装是从其他文件夹移动过来的。"],["This is the first image","已经是第一张"],["This is the last image","已经是最后一张"],["This model needs an account with access. Add an access token under Downloads.","这个模型需要有访问权限的账号,请在“下载”里填写访问令牌。"],["This node is disabled or no longer in the workflow.","该节点已禁用或已从工作流移除。"],["This page","本页面"],["This part has no earlier take","这一段没有更早的版本"],["This part is already generating. Your edit was not saved.","这一段已在生成,改动没有保存"],["This part is generating","这一段正在生成"],["This part is generating.","这一段正在生成。"],["This part is generating. Redo once it finishes.","这一段正在生成,完成后再重做。"],["This part is generating. Undo once it finishes.","这一段正在生成,完成后再撤销。"],["This part is longer than the maximum length. Shorten it and try again.","这一段超过了最长时长,请缩短后再试。"],["This part is still being generated. Save the frame when it is done.","这一段还在生成,完成后再保存。"],["This picture can no longer be read. It may have been moved or deleted.","这张图片已无法读取,可能已被移动或删除。"],["This picture could not be read. Choose another picture.","这张图无法读取。请重新选择一张。"],["This picture kept no prompt","这张图片没有保存提示词"],["This picture kept no prompt.","这张图片没有保存提示词。"],["This picture will not be kept.","这张图不会保留。"],["This run used the low-memory mode, so it was slower. A lower resolution or a shorter video is faster.","这次用了省显存方式,所以较慢。降低分辨率或缩短时长会更快。"],["This step did not finish. Try again; if it keeps failing, report the problem.","这一步没有完成。请重试;仍然失败时,请提交问题。"],["This track is locked; unlock it first","这条轨道已锁定,先解锁"],["This track is locked.","这条轨道已锁定。"],["This video cannot be continued","这条视频不能接着生成"],["This video kept no prompt","这条视频没有保存提示词"],["This video kept no prompt to reuse.","这条视频没有保存可复用的提示词。"],["This video's size and length do not fit in GPU memory, so some data is kept in RAM. It will take longer than usual, but it will finish.","可用显存放不下这次的尺寸和时长,部分数据改放在内存中,生成会比平时慢,但能完成。"],["This view has nothing to generate yet.","这个视图里还没有可生成的内容。"],["Tick the agreement to enable Install.","勾选同意后,可点击“安装”。"],["Time","用时"],["Time and memory this generation used","这次生成的用时和内存"],["Time left","预计剩余"],["Timed lines cannot be split into separate videos. Turn off One prompt per line.","带时间的台词不能拆成多个视频,请关闭“每行一条描述”。"],["Timeline","剪辑轨道"],["Timeline zoom","轨道缩放"],["To download","需要下载"],["Today","今天"],["Tools","安装工具"],["Tools that do not fit in the bar","显示工具栏放不下的工具"],["Top bar","顶栏"],["Total time","总用时"],["Tour page","介绍页"],["Track tools","轨道工具"],["Track zoom","轨道缩放"],["Trade speed for detail","在速度和画面细节之间取舍"],["Trigger words","触发词"],["Trim the edges of the picture","裁掉画面边缘不要的部分"],["Try again in a moment.","请稍后再试。"],["Try another word, or use it as a prompt.","换个词,或直接用它作为描述生成。"],["Try another word.","换个词试试。"],["Try saving the changes now","现在再试一次保存改动"],["Try this prompt","试试这条描述"],["Try to read your last description again","再次读取上次的描述"],["Try what failed once more","再试一次刚才失败的操作"],["Turn off compatibility view","关闭兼容界面"],["Turn on compatibility view","开启兼容界面"],["Turn on the assistant interface in Settings","先在设置里打开助手接口"],["Turn on two-pass acceleration to use this setting.","开启二采加速后生效。"],["Turn the picture anticlockwise","画面逆时针转 90°"],["Turn the picture clockwise","画面顺时针转 90°"],["Turn the picture upside down","画面上下颠倒"],["Turn the preview clip into full size","把预览片段做成全分辨率"],["Turn the sound on","打开声音"],["Turn this preview into the final video","把预览做成全分辨率成片"],["Turn this preview part into the full-resolution video, in place","把这段预览原地做成全分辨率成片"],["Tutorial","教程"],["Tutorials","教程"],["Two-pass","二采"],["Two-pass acceleration","二采加速"],["Type a message to the assistant","在对话框里告诉助手要做什么"],["Type a number or use − and +","输入数值,或用 − 和 + 调整"],["Ultimate","极致"],["Unavailable","未连通"],["Under 1 min left","不到 1 分钟"],["Undo","撤销"],["Undo rotation, flip and crop on this clip","撤掉这段的旋转、翻转和裁剪"],["Unified memory","统一内存总量"],["Untitled","未命名作品"],["Untitled edit","未命名剪辑"],["Up to 2 props","最多 2 个道具"],["Up to 3 characters","最多 3 个角色"],["Up to 32 references","参考素材最多 32 个"],["Update","有更新"],["Upscaling the video","正在放大画面"],["Usable","可用"],["Use","使用"],["Use 3 second-pass steps, or fewer than the first-pass steps.","二采步数须为 3,或少于一采步数。"],["Use as reference","当作参考图"],["Use as reference","用作参考图"],["Use at most 32 LoRAs","最多使用 32 个 LoRA"],["Use existing","使用已有安装"],["Use it as a reference or make more like it there","在那里用作参考图,或接着生成"],["Use it as a reference picture","作为参考图放进当前视图"],["Use models already on this computer","直接用本机上已有的模型"],["Use new pictures as","新图片用途"],["Use prompt","使用提示词"],["Use Run in the node view","节点视图里请用运行按钮"],["Use the shape of the added picture","用添加的图片的比例"],["Use this LoRA","使用这个 LoRA"],["Use token","应用令牌"],["Use your account’s download quota on the international source instead of the anonymous limit.","在国际源上使用账号的下载额度,避开匿名限流。"],["Used the description of the part before.","沿用了上一段的描述。"],["Used the latest description.","沿用了最近一次的描述。"],["Uses extra disk space","额外占用磁盘空间"],["Usually faster on networks in China","国内网络通常更快"],["Version","版本"],["Version & updates","版本与更新"],["Video","生成视频"],["Video","视频"],["Video","视频任务"],["Video folder","视频文件夹"],["video memory","显存"],["Video memory","显存"],["Video model","视频模型"],["Video models","视频模型"],["Video models are not installed yet","视频模型还没有安装"],["Video preview","视频预览"],["Video saved","视频已保存"],["Videos","视频"],["Videos and pictures made here","生成过的视频和图片"],["Videos and pictures show here once made.","生成的视频和图片会出现在这里。"],["Videos made by the assistant","由助手生成的视频"],["Videos made in parts cannot use batch or loop.","分段视频不能批量或循环生成。"],["Videos that could not be checked safely were left as they were.","无法安全确认的视频都保持原样。"],["Videos that still need a second pass","还没有继续二采的视频"],["View","查看"],["View it large","打开大图查看"],["View large","查看大图"],["Viewer","查看大图"],["Views","视图"],["Voice","音色"],["Volume, speed, picture and text","声音、速度、画面和文字"],["Volume, speed, picture and text of the selection","调整选中片段的声音、速度、画面和文字"],["VRAM","显存"],["VRAM budget","可用显存预算"],["Wait for the current generation to finish","等当前生成完成"],["Wait for the current setup task to finish","请等待当前安装任务完成"],["Wait for the current task to finish","请等待当前任务完成"],["Waiting","等待开始"],["Waiting","排队"],["Waiting","排队中"],["Waiting in queue","正在排队"],["Watch the preview filling the screen","全屏查看预览"],["What fits","可生成范围"],["What happened","发生了什么"],["What has been made so far is not kept. Queued jobs go on.","已生成的部分不会保留,排队的任务照常进行。"],["What is generating in every view","各个视图正在生成和排队的任务"],["What the connected AI assistant is doing","已连接的 AI 助手正在做什么"],["What this step has made so far is not kept. Finished works stay.","这一步做到一半的不会保留,已经完成的作品不受影响。"],["What to generate","生成什么"],["What to make or change","要画什么或要改什么"],["What's new","新功能"],["What’s new","更新内容"],["Wheel","滚轮"],["When","时间"],["When off, nothing takes VRAM before a generation; models already used stay loaded for the next one.","关闭后不会在生成前主动占用显存;用过的模型仍会保留,改提示词继续生成不受影响。"],["When the loop is off, a frame sheet is shown.","关闭循环时显示多帧拼图。"],["Where FreeVideo keeps its models","FreeVideo 存放模型的位置"],["Where the models are first published","模型的原始发布站点"],["Whether an AI assistant is connected","查看 AI 助手是否已连接"],["While the audio is set to \"Use as is\", the duration matches it.","音频选“原样使用”时,时长与音频相同。"],["Wide frame for screens and video sites","适合电脑和视频网站"],["Width","宽度"],["Width to height of the image","图片的宽高比例"],["With a proxy, the faster route is chosen","有代理时自动选择更快的一种"],["with prompt","含描述"],["with prompt","含提示词"],["Working","运行中"],["Works","作品"],["Works with the video model","可用于视频模型"],["Write a description first.","先写一句描述。"],["Write a description or add a picture first","先写描述或添加图片"],["Write a description, or wait for the run to end","先写描述,或等当前生成结束"],["Write a long prompt in a large box","在大文本框里写长描述"],["Write a prompt or add a picture first","先写提示词或添加图片"],["Write a scene and generate a video","写一段描述,生成视频"],["Write each video's settings into it, keeping a backup","给每个视频写入生成设置,并保留备份"],["Write one prompt per line, then add them.","每行写一条描述后再添加。"],["Write what the sketch shows, for example: a person raising both hands","写下草图画的是什么,例如:一个人举起双手"],["Write without enhancement; turn on later","先不下载,之后可再开启"],["Writing guide","描述写法"],["Writing part descriptions","正在写各段描述"],["Yesterday","昨天"],["Your edit was not saved.","改动没有保存"],["Your pictures, newest first","你的图片,最新在前"],["zh","中文"],["Zoom","缩放"],["Zoom in","放大"],["Zoom out","缩小"]]; +export const nativePortugueseLabels = {"Create":"Criar","Images":"Imagens","Nodes":"Nós","Edit":"Editar","Autopilot":"Autopilot","Tasks":"Tarefas","Creations":"Criações","Settings":"Configurações","Ready":"Pronto","Generating":"Gerando","Queued":"Na fila","Waiting":"Aguardando","Cancel":"Cancelar","Media":"Mídia","Light":"Luz","Medium":"Médio","High":"Alto","Enhance":"Aprimorar","Generate video":"Gerar vídeo","Generate preview":"Gerar prévia","Download video":"Baixar vídeo","Download picture":"Baixar imagem","Download":"Baixar","Reuse settings":"Reutilizar configurações","Filled in":"Preenchido","Undo":"Desfazer","Extend":"Estender","Share":"Compartilhar","Regenerate":"Gerar novamente","Preview":"Prévia","Search":"Pesquisar","Models":"Modelos","Downloads":"Downloads","Generation":"Geração","Appearance":"Aparência","Assistant":"Assistente","Storage":"Armazenamento","Page check":"Verificação da página","Advanced":"Avançado","Version & updates":"Versão e atualizações","Getting started":"Primeiros passos","Look":"Aparência","Theme":"Tema","Dark":"Escuro","Dark panels, best for pictures":"Painéis escuros, ideais para imagens","Light panels":"Painéis claros","Applies at once to every view":"Aplica-se imediatamente a todas as telas","Compatibility view":"Modo de compatibilidade","Solid panels, fewer animations, no autoplay":"Painéis sólidos, menos animações, sem reprodução automática","Top bar":"Barra superior","Show this computer in the status":"Mostrar este computador no status","Graphics memory and temperature in the top bar":"Memória de vídeo e temperatura na barra superior","Language":"Idioma","Interface language":"Idioma da interface","Changing the language reloads the page; generations keep running.":"Mudar o idioma recarrega a página; as gerações continuam.","Reload now":"Recarregar agora","This computer":"Este computador","Temperature":"Temperatura","Disk free":"Espaço livre","Temporary files":"Arquivos temporários","FreeVideo keeps":"FreeVideo mantém","Search settings":"Pesquisar configurações","No setting matches":"Nenhuma configuração encontrada","FreeVideo view":"Tela do FreeVideo","FreeVideo settings":"Configurações do FreeVideo","Settings pages":"Páginas de configurações","FreeVideo creative workspace":"Área de criação do FreeVideo","Search works, prompts and actions":"Pesquisar criações, prompts e ações","Reference media (@)":"Referenciar mídia (@)","Add reference pictures, video and sound":"Adicionar imagens, vídeos e áudio de referência","Save the MP4 to this computer":"Salvar o MP4 neste computador","Fill the creation panel with these settings":"Preencher o painel de criação com estas configurações","Tutorial":"Tutorial","Feedback":"Feedback","Version":"Versão","Close":"Fechar","Back":"Voltar","More":"Mais","Menu":"Menu","Run status":"Status das tarefas","See running tasks and notices":"Ver tarefas em execução e avisos","Search and commands":"Pesquisa e comandos","Search works and run any action":"Pesquisar criações e executar ações","Open your works to sort and manage them":"Abrir suas criações para organizar e gerenciar","Phone":"Celular","Open on a phone on this network":"Abrir em um celular nesta rede","See updates and what is new":"Ver atualizações e novidades","Tutorials":"Tutoriais","Learn each feature step by step":"Aprenda cada recurso passo a passo","Tell us a problem or an idea":"Conte-nos um problema ou uma ideia","Models, downloads, storage, look":"Modelos, downloads, armazenamento e aparência","Find a setting by its name":"Encontrar uma configuração pelo nome","Reload the page in the chosen language":"Recarregar a página no idioma escolhido","Show the interface in Chinese":"Mostrar a interface em chinês","Show the interface in English":"Mostrar a interface em inglês","Save":"Salvar","Delete":"Excluir","Rename":"Renomear","Copy":"Copiar","Paste":"Colar","Select all":"Selecionar tudo","Clear":"Limpar","Reset":"Redefinir","Retry":"Tentar novamente","Stop":"Parar","Continue":"Continuar","Confirm":"Confirmar","Apply":"Aplicar","Import":"Importar","Export":"Exportar","Open":"Abrir","Loading…":"Carregando…","Done":"Concluído","Failed":"Falhou","Image":"Imagem","Video":"Vídeo","Audio":"Áudio","Prompt":"Prompt","Duration":"Duração","Resolution":"Resolução","Quality":"Qualidade","Seed":"Semente","Width":"Largura","Height":"Altura","Size":"Tamanho","Generate":"Gerar","New":"Novo","More options":"Mais opções","Recently deleted":"Excluídos recentemente","Keyboard shortcuts":"Atalhos de teclado","Notifications":"Notificações","Check installation":"Verificar instalação","Install":"Instalar","Check again":"Verificar novamente","Use existing":"Usar existentes","Stop setup":"Interromper configuração","Performance measurement":"Medição de desempenho","FreeVideo":"FreeVideo","Português (Brasil)":"Português (Brasil)"}; diff --git a/extensions/FreeVideoTaskManager/web/native_pt.js b/extensions/FreeVideoTaskManager/web/native_pt.js new file mode 100644 index 00000000..f9448fca --- /dev/null +++ b/extensions/FreeVideoTaskManager/web/native_pt.js @@ -0,0 +1,197 @@ +// Scoped, reversible compatibility localization for FreeVideo 0.6.8. +// Never modify prompts, user-generated content, or workflow data. +import { nativePairs, nativePortugueseLabels } from "./native_locales.js"; +const labels = { + "Create": "Criar", + "Images": "Imagens", + "Nodes": "Nós", + "Edit": "Editar", + "Autopilot": "Autopilot", + "Tasks": "Tarefas", + "Creations": "Criações", + "Settings": "Configurações", + "Ready": "Pronto", + "Generating": "Gerando", + "Queued": "Na fila", + "Waiting": "Aguardando", + "Cancel": "Cancelar", + "Cancelling": "Cancelando", + "Media": "Mídia", + "Light": "Leve", + "Medium": "Médio", + "High": "Alto", + "Enhance": "Aprimorar", + "Generate video": "Gerar vídeo", + "Generate preview": "Gerar prévia", + "Download video": "Baixar vídeo", + "Download picture": "Baixar imagem", + "Download": "Baixar", + "Reuse settings": "Reutilizar configurações", + "Filled in": "Preenchido", + "Undo": "Desfazer", + "Extend": "Estender", + "Share": "Compartilhar", + "Regenerate": "Gerar novamente", + "Finish": "Finalizar", + "Preview": "Prévia", + "Search": "Pesquisar", + "Models": "Modelos", + "Downloads": "Downloads", + "Models & downloads": "Modelos e downloads", + "Use": "Uso", + "Generation": "Geração", + "Appearance": "Aparência", + "Assistant": "Assistente", + "Storage": "Armazenamento", + "Maintenance": "Manutenção", + "Page check": "Verificação da página", + "Advanced": "Avançado", + "Version & updates": "Versão e atualizações", + "Getting started": "Primeiros passos", + "Look": "Aparência", + "Theme": "Tema", + "Dark": "Escuro", + "Dark panels, best for pictures": "Painéis escuros, ideais para imagens", + "Light panels": "Painéis claros", + "Applies at once to every view": "Aplica-se imediatamente a todas as telas", + "Compatibility view": "Modo de compatibilidade", + "Solid panels, fewer animations, no autoplay": "Painéis sólidos, menos animações, sem reprodução automática", + "Top bar": "Barra superior", + "Show this computer in the status": "Mostrar este computador no status", + "Graphics memory and temperature in the top bar": "Memória de vídeo e temperatura na barra superior", + "Language": "Idioma", + "Interface language": "Idioma da interface", + "Changing the language reloads the page; generations keep running.": "Mudar o idioma recarrega a página; as gerações continuam.", + "Reload now": "Recarregar agora", + "This computer": "Este computador", + "Temperature": "Temperatura", + "Disk free": "Espaço livre", + "Temporary files": "Arquivos temporários", + "FreeVideo keeps": "FreeVideo mantém", + "Search settings": "Pesquisar configurações", + "No setting matches": "Nenhuma configuração encontrada", + "FreeVideo view": "Tela do FreeVideo", + "FreeVideo settings": "Configurações do FreeVideo", + "Settings pages": "Páginas de configurações", + "FreeVideo creative workspace": "Área de criação do FreeVideo", + "Search works, prompts and actions": "Pesquisar criações, prompts e ações", + "Reference media (@)": "Referenciar mídia (@)", + "Add reference pictures, video and sound": "Adicionar imagens, vídeos e áudio de referência", + "Save the MP4 to this computer": "Salvar o MP4 neste computador", + "Fill the creation panel with these settings": "Preencher o painel de criação com estas configurações", + "Tutorial": "Tutorial", + "Feedback": "Feedback", + "Version": "Versão", + "Version and updates": "Versão e atualizações", + "Close": "Fechar", + "Back": "Voltar", + "More": "Mais", + "Menu": "Menu" +}; +const portuguese={...nativePortugueseLabels,...labels}; +const englishToChinese=new Map(), chineseToEnglish=new Map(); +function addCandidate(map,key,value){if(!map.has(key))map.set(key,new Set());map.get(key).add(value);} +for(const [en,zh] of nativePairs){addCandidate(englishToChinese,en,zh);addCandidate(chineseToEnglish,zh,en);} +const preferred=new Map([ + ["Create","创作面板"],["Images","图像视图"],["Nodes","节点视图"],["Edit","剪辑视图"],["Autopilot","AI 全自动"],["Creations","作品库"], + ["Ready","就绪"],["Generating","正在生成"],["Media","素材"],["Light","轻量"],["Dark","深色"],["Enhance","增强"],["Generate video","生成视频"], + ["Generate preview","生成预览"],["Download video","下载视频"],["Reuse settings","复用设置"],["Extend","接着生成"],["Share","分享"],["Settings","设置"] +]); +const reversePreferred=new Map([...preferred].map(([en,zh])=>[zh,en])); +const unique=(map,key)=>{const values=map.get(key);return values?.size===1?[...values][0]:null;}; +const scopes = [ + ".fv-topbar .fv-view-switch > button:not(.ftm-tab)", + ".fv-topbar .fv-tb-cap-txt", + ".fv-topbar .fv-tb-link:not(.ftm-native-theme)", + ".fv-topbar .fv-tb-search", + ".fv-topbar .fv-tb-menu", + ".fv-studio .fvs-chip-label", + ".fv-studio .fvs-key-label", + ".fv-studio .fvs-key-eta", + ".fv-studio .fvs-tray-title", + ".fv-studio .fv-action", + ".fv-set .st-nav button", + ".fv-set .st-ng", + ".fv-set .st-nav-empty", + ".fv-set .st-ph h1", + ".fv-set .st-gh", + ".fv-set .st-rt", + ".fv-set .st-seg button", + ".fv-set .st-foot", + ".fv-set .st-gn", + ".fv-set .st-rh", + ".fv-set .st-meter .l", + ".fv-set input[type=search]", + ".fv-library-tabs button", ".fv-library .fv-action", + ".fv-image .fvs-chip-label", ".fv-image .fvs-key-label", ".fv-image .fvs-key-eta", + ".fv-image .fv-action" +].join(","); +const attrs = ["aria-label","title","placeholder","data-label","data-fv-tip-name","data-fv-tip-use"]; +// FreeVideo marks its own dialogs translate="no" to block *browser* translation. +// This is an explicit, local catalog, so that inherited flag must not exclude +// the native UI we intend to translate. The scoped selectors and editable-field +// exclusions below keep user content outside the translation pass. +const skip = ".ftm, .ftm-native-language, [contenteditable], textarea"; +export function nativeLabel(value,target,theme=false,base="en"){ + if(typeof value!=="string"||target===base)return value; + const raw=value.trim(); + const eta=/^About (\d+) min$/.exec(raw)||/^约\s*(\d+)\s*分钟$/.exec(raw); + const generation=/^Generating (\d+)%$/.exec(raw)||/^(?:正在生成|生成中)\s*(\d+)%$/.exec(raw); + let translated=null; + if(eta)translated=target==="zh"?"约 "+eta[1]+" 分钟":target==="pt-BR"?"Cerca de "+eta[1]+" min":"About "+eta[1]+" min"; + else if(generation)translated=target==="zh"?"正在生成 "+generation[1]+"%":target==="pt-BR"?"Gerando "+generation[1]+"%":"Generating "+generation[1]+"%"; + else { + const english=base==="zh"?(raw==="浅色"||raw==="轻量"?"Light":reversePreferred.get(raw)||unique(chineseToEnglish,raw)):raw; + if(english){ + if(target==="en")translated=english; + else if(target==="zh")translated=theme&&english==="Light"?"浅色":preferred.get(english)||unique(englishToChinese,english); + else if(target==="pt-BR")translated=theme&&english==="Light"?"Claro":Object.hasOwn(portuguese,english)?portuguese[english]:english; + } + } + return translated?value.replace(raw,translated):value; +} +export function ptLabel(value,theme=false){return nativeLabel(value,"pt-BR",theme,"en");} +export function createNativePortuguese(doc=document,base="en"){ + let language=base, scheduled=false; + const records=new WeakMap(), pending=new Set(); + function patchValue(owner,key,read,write,theme){ + let state=records.get(owner); + const now=read();if(now==null)return; + const previous=state?.get(key); + const original=previous&&now===previous.applied?previous.original:now; + const next=nativeLabel(original,language,theme,base); + if(next!==now)write(next); + if(language!==base&&next!==original){if(!state){state=new Map();records.set(owner,state);}state.set(key,{original,applied:next});} + else state?.delete(key); + } + function scan(element){ + if(!element?.isConnected||element.closest(skip))return; + const theme=Boolean(element.closest(".fv-set")); + const walker=doc.createTreeWalker(element,4); + let node;while((node=walker.nextNode())){ + if(node.parentElement?.closest(skip))continue; + patchValue(node,"text",()=>node.nodeValue,v=>{node.nodeValue=v;},theme); + } + for(const a of attrs)patchValue(element,a,()=>element.getAttribute(a),v=>element.setAttribute(a,v),theme); + } + function collect(element){ + if(!element||element.nodeType!==1||element.closest(skip))return; + const owner=element.closest(scopes);if(owner)pending.add(owner); + if(element.matches(scopes))pending.add(element); + for(const child of element.querySelectorAll(scopes))pending.add(child); + } + function flush(){scheduled=false;for(const element of pending)scan(element);pending.clear();} + function schedule(){if(!scheduled){scheduled=true;requestAnimationFrame(flush);}} + const observer=new MutationObserver(changes=>{ + if(language===base)return; + for(const change of changes){ + if(change.type==="characterData"){const owner=change.target.parentElement?.closest(scopes);if(owner)pending.add(owner);} + else if(change.type==="attributes"){const owner=change.target.closest(scopes);if(owner)pending.add(owner);} + else {const owner=change.target.closest?.(scopes);if(owner)pending.add(owner);for(const node of change.addedNodes)if(node.nodeType===1)collect(node);} + } + if(pending.size)schedule(); + }); + observer.observe(doc.body,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:attrs}); + function setLanguage(value){if(!["en","zh","pt-BR"].includes(value))return;language=value;for(const element of doc.querySelectorAll(scopes))scan(element);} + return {setLanguage,setEnabled(value){setLanguage(value?"pt-BR":base);},dispose(){observer.disconnect();setLanguage(base);}}; +} diff --git a/extensions/FreeVideoTaskManager/web/tasks.js b/extensions/FreeVideoTaskManager/web/tasks.js index 5990488a..45875513 100644 --- a/extensions/FreeVideoTaskManager/web/tasks.js +++ b/extensions/FreeVideoTaskManager/web/tasks.js @@ -1,10 +1,12 @@ import { app } from "../../scripts/app.js"; import { api } from "../../scripts/api.js"; -import { resolveLanguage, translate } from "./i18n.js"; -const LANG_KEY="freevideo-task-manager.language"; -let savedLanguage;try{savedLanguage=localStorage.getItem(LANG_KEY);}catch{} -let LANGUAGE=resolveLanguage(globalThis.location?.search,globalThis.navigator?.language,savedLanguage); +import { initialLanguage, rememberLanguage, translate } from "./i18n.js"; +import { createNativePortuguese, nativeLabel } from "./native_pt.js"; +let tabLanguageStorage;try{tabLanguageStorage=globalThis.sessionStorage;}catch{} +let LANGUAGE=initialLanguage(globalThis.location?.search,globalThis.navigator?.language,tabLanguageStorage); +rememberLanguage(LANGUAGE,tabLanguageStorage); const t=key=>translate(key,LANGUAGE); +let nativePortuguese; const BASE = new URL("../FreeVideo/", import.meta.url); const load = name => import(new URL(name + ".js", BASE).href); @@ -223,8 +225,7 @@ function toggleTheme(){ } function syncNativeTheme(b){ const dark=currentTheme()==="dark"; - const nativeLang=resolveLanguage(globalThis.location?.search,globalThis.navigator?.language)==="zh"?"zh":"en"; - const label=translate(dark?"Ativar tema claro":"Ativar tema escuro",nativeLang); + const label=t(dark?"Ativar tema claro":"Ativar tema escuro"); b.style.setProperty("--fv-tb-icon",iconMask(icons[dark?"sun":"moon"])); b.setAttribute("aria-label",label);b.title=label; const text=b.querySelector(".fv-tb-lbl");if(text.textContent!==label)text.textContent=label; @@ -232,7 +233,6 @@ function syncNativeTheme(b){ const globe=''; const worksGlyph=''; const svgIcon=path=>''; -const nativeLanguage=()=>resolveLanguage(globalThis.location?.search,globalThis.navigator?.language)==="zh"?"zh":"en"; let languageMenuId=0; function languageControl(native=false){ const wrapper=el("div","ftm-language"+(native?" ftm-native-language":"")); @@ -257,6 +257,17 @@ function attachNativeControls(){ settings.before(b); } } + // Keep the Appearance setting on the same reactive selector as the top bar. + for(const select of document.querySelectorAll(".fv-set .st-seg > select")){ + const values=Array.from(select.options,o=>o.value); + if(!values.includes("zh")||!values.includes("en"))continue; + const group=select.parentElement; + if(group.dataset.ftmLanguage)continue; + group.dataset.ftmLanguage="true";group.style.display="none"; + group.after(languageControl(true)); + const footer=group.closest(".st-card")?.querySelector(".st-foot"); + if(footer)footer.style.display="none"; + } } function syncTheme(d){ d.dataset.theme=document.documentElement.dataset.theme==="light"?"light":"dark"; @@ -289,10 +300,11 @@ function setLanguageMenu(d,open,restoreFocus=false){ if(restoreFocus)trigger.focus({preventScroll:true}); } function syncLanguageControl(d,native=false){ - const translateHere=key=>native?translate(key,nativeLanguage()):t(key); + const translateHere=t; const trigger=d.querySelector(".language"),menu=d.querySelector(".language-menu"); trigger.setAttribute("aria-label",translateHere("Idioma"));trigger.title=translateHere("Idioma");menu.setAttribute("aria-label",translateHere("Idioma")); trigger.querySelector(".language-code").textContent=LANGUAGE==="zh"?"中文":LANGUAGE==="en"?"EN":"PT-BR"; + const note=menu.querySelector(".language-note");if(note)note.textContent=translateHere("Troca instantânea · tradução da interface em evolução."); for(const choice of menu.querySelectorAll(".language-choice")){ const on=choice.dataset.language===LANGUAGE;choice.setAttribute("aria-pressed",String(on));choice.querySelector(".check").textContent=on?"✓":""; } @@ -300,13 +312,13 @@ function syncLanguageControl(d,native=false){ function selectLanguage(value,native=false){ if(!languageOptions.some(([id])=>id===value))return; const changed=value!==LANGUAGE; - LANGUAGE=value;try{localStorage.setItem(LANG_KEY,LANGUAGE);}catch{} + LANGUAGE=value;rememberLanguage(LANGUAGE,tabLanguageStorage); for(const control of document.querySelectorAll(".ftm-native-language"))syncLanguageControl(control,true); - // The upstream UI only ships English and Chinese; use its own URL switch for those. - // Portuguese remains a Tasks-only preference. Dashboard selection never reloads. - if(native&&value!=="pt-BR"&&nativeLanguage()!==value){ - const url=new URL(location.href);url.searchParams.set("freevideo_lang",value);location.assign(url.href);return; - } + // Keep the startup locale unchanged: lazy native modules still read it. + // Only translate their UI labels, never recreate the current view or reload. + nativePortuguese?.setLanguage(value); + for(const b of document.querySelectorAll(".ftm-native-theme"))syncNativeTheme(b); + for(const tab of document.querySelectorAll(".ftm-tab")){const span=tab.querySelector("span");if(span)span.textContent=t("Tasks");tab.dataset.label=t("Tasks");} if(changed&&ui){populate(ui);fillNav(ui,nativeNav);syncTheme(ui);render();} } function bindLanguageMenu(d,native=false){ @@ -321,7 +333,7 @@ function bindLanguageMenu(d,native=false){ choice.append(el("span","",label),el("span","check",value===LANGUAGE?"✓":"")); menu.append(choice); } - if(native)menu.append(el("small","language-note",translate("PT-BR apenas no Tasks; EN e 中文 também alteram o FreeVideo.",nativeLanguage()))); + if(native)menu.append(el("small","language-note",t("Troca instantânea · tradução da interface em evolução."))); syncLanguageControl(d,native); trigger.onclick=()=>{const open=menu.hidden;for(const other of document.querySelectorAll(".ftm-native-language"))if(other!==d)setLanguageMenu(other,false);setLanguageMenu(d,open);}; trigger.onkeydown=e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault();setLanguageMenu(d,true);const items=menu.querySelectorAll("button");items[e.key==="ArrowDown"?0:items.length-1]?.focus();}; @@ -344,7 +356,8 @@ function build(){ } function fillNav(d,anchor){ const nav=d.querySelector("nav");nav.replaceChildren(); - for(const tab of anchor?.parentElement?.querySelectorAll("[data-view]:not(.ftm-tab)")||[]){if(tab.hidden)continue;const b=button(tab.dataset.label||tab.textContent,()=>{d.close();tab.click();});b.setAttribute("aria-pressed","false");nav.append(b);} + const names={studio:"Create",image:"Images",nodes:"Nodes",editor:"Edit",autopilot:"Autopilot"}; + for(const tab of anchor?.parentElement?.querySelectorAll("[data-view]:not(.ftm-tab)")||[]){if(tab.hidden)continue;const label=names[tab.dataset.view]?nativeLabel(names[tab.dataset.view],LANGUAGE):tab.dataset.label||tab.textContent;const b=button(label,()=>{d.close();tab.click();});b.setAttribute("aria-pressed","false");nav.append(b);} const current=button(t("Tasks"),()=>{});current.setAttribute("aria-current","page");current.setAttribute("aria-pressed","true");nav.append(current); } async function open(anchor){ @@ -366,7 +379,12 @@ async function open(anchor){ function install(){ if(observer)return; const css=el("link");css.rel="stylesheet";css.href=new URL("./tasks.css",import.meta.url).href;document.head.append(css); - const attach=()=>{for(const nav of document.querySelectorAll(".fv-view-switch")){if(nav.querySelector(".ftm-tab"))continue;const b=button("",()=>open(b),"ftm-tab fv-tb-tab");b.append(el("span","",t("Tasks")));b.dataset.view="tasks";b.dataset.label=t("Tasks");b.setAttribute("aria-pressed","false");b.setAttribute("aria-haspopup","dialog");b.title="FreeVideo Task Manager";nav.append(b);}attachNativeControls();syncNativeSettingsTheme();}; + const attach=()=>{for(const nav of document.querySelectorAll(".fv-view-switch")){if(nav.querySelector(".ftm-tab"))continue;const b=button("",()=>open(b),"ftm-tab fv-tb-tab");b.append(el("span","",t("Tasks")));b.dataset.view="tasks";b.dataset.label=t("Tasks");b.setAttribute("aria-pressed","false");b.setAttribute("aria-haspopup","dialog");b.title="FreeVideo Task Manager";nav.append(b);}attachNativeControls();syncNativeSettingsTheme(); + if(!nativePortuguese){ + const original=document.querySelector(".fv-view-switch [data-view=studio]"); + if(original){const base=/[\u3400-\u9fff]/.test(original.dataset.label||original.textContent)?"zh":"en";nativePortuguese=createNativePortuguese(document,base);nativePortuguese.setLanguage(LANGUAGE);} + } + }; let queued=false;observer=new MutationObserver(()=>{if(queued)return;queued=true;requestAnimationFrame(()=>{queued=false;attach();});}); observer.observe(document.body,{childList:true,subtree:true});attach(); document.addEventListener("pointerdown",e=>{for(const control of document.querySelectorAll(".ftm-native-language"))if(!control.contains(e.target))setLanguageMenu(control,false);},true);