diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 93fba186..5f591f69 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -15,9 +15,12 @@ FreeVideo code uses [Apache-2.0](LICENSE). Its dependencies and models retain th | [ComfyUI](https://github.com/Comfy-Org/ComfyUI), including the H3 text encoder code | GPL-3.0 | | [VDN-H3](https://github.com/OpenVDN/vdn-minimax-h3), [Diffusers](https://github.com/huggingface/diffusers), [SageAttention](https://github.com/thu-ml/SageAttention) | Apache-2.0 | | [VDN-H3 and H3 model weights](https://huggingface.co/OpenVDN/vdn-minimax-h3-edge/blob/main/LICENSE) | MiniMax H3 Community License | +| [LakonLab](https://github.com/Lakonik/LakonLab/tree/2ee2b334374ec91b7cee371a85a524bf4ba644d3), © 2026 Hansheng Chen. The structure of the fastest mode's pixel head (`freevideo_engine/dwd_head.py`: window attention with register tokens and the pixel projection) follows its reference implementation of the pi-H3 no-decode head; the code is FreeVideo's own. | [Apache-2.0](freevideo_engine/licenses/LakonLab-Apache-2.0.txt) | +| [pi-H3](https://huggingface.co/Lakonik/pi-H3) two-step no-decode adapter (INT8 ConvRot file), a derivative of MiniMax H3 (optional download for the fastest mode, pinned at `4a864589b0fac3d14768f932c930c4dcf1a17b56`) | [MiniMax H3 Community License](freevideo_engine/licenses/MiniMax-H3-Community-License-Agreement.txt) | | Sampling preview decoder weights (a derivative of the H3 video decoder) | [MiniMax H3 Community License](freevideo_engine/licenses/MiniMax-H3-Community-License-Agreement.txt) | | [MiniMax H3 Image](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image) prompt expansion instructions, © MiniMax (text kept as published in the ComfyUI H3 Image template and, for prompts with reference pictures, in [MiniMax-H3-Image-PE](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image-PE); FreeVideo appends one instruction) | [MiniMax H3 Image Community License](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/main/LICENSE) | | [Qwen-Image](https://github.com/QwenLM/Qwen-Image) prompt rewriting instructions (text kept as published; FreeVideo appends one instruction) | [Apache-2.0](freevideo_engine/licenses/Qwen-Image-Apache-2.0.txt) | +| [OpenCC](https://github.com/BYVoid/OpenCC) 1.4.2, © Carbo Kuo (BYVoid) and contributors: the Traditional Chinese interface text (web/locales/zh-Hant.json) is converted from the Simplified Chinese with it (Taiwan wording, then FreeVideo's own corrections), and scripts/i18n_hans_chars.txt is taken from its character table (data/dictionary/STCharacters.txt, as copied in opencc-python-reimplemented 0.1.7). OpenCC itself is not shipped; it ships no NOTICE file | [Apache-2.0](LICENSE) | | [MiniMax H3 latent upscaler](https://huggingface.co/LBH-123-AI/Minimax_h3_latent_Upscaler) | [MIT](freevideo_engine/licenses/latent-upscaler-MIT.txt) | | [FreeToken](https://github.com/FlashML-org/FreeToken) prompt VLM operators, [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) optional weights | [Apache-2.0](freevideo_engine/licenses/FreeToken-Apache-2.0.txt) | | [Qwen-Image-2.1](https://huggingface.co/Comfy-Org/Qwen-Image-2.1) Turbo image generation models, including Qwen3-VL-8B and VAE (optional download; [notice](freevideo_engine/image_gen/licenses/NOTICE.txt) installed with the models), © 2026 Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved. | [Qwen RESEARCH LICENSE AGREEMENT](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/LICENSE) | diff --git a/__init__.py b/__init__.py index 0662a8b0..cdb0437b 100644 --- a/__init__.py +++ b/__init__.py @@ -81,6 +81,8 @@ async def comfy_entrypoint(): share_routes() from .freevideo_engine.swap_lora import register as swap_lora_routes swap_lora_routes() + from .freevideo_engine.fast_pack import register as fast_pack_routes + fast_pack_routes() from .freevideo_engine.comfy_metadata import register as workflow_backfill workflow_backfill() try: diff --git a/freevideo_engine/adaptive.py b/freevideo_engine/adaptive.py index 77120834..2b8c8cd9 100644 --- a/freevideo_engine/adaptive.py +++ b/freevideo_engine/adaptive.py @@ -729,6 +729,8 @@ def execute_attempts(history, identity, profile, canvas, launch, *, if prepare is not None: prepare(current) evidence['request_artifacts'] = report.get('artifacts') + if report.get('fast_tier'): + evidence['fast_tier'] = report['fast_tier']['mode'] if report.get('resource_prediction') is not None: evidence['prediction'] = copy.deepcopy(report['resource_prediction']) geometry = attempt_geometry(canvas, current['engine']) diff --git a/freevideo_engine/agent/errors.py b/freevideo_engine/agent/errors.py index 33b025cd..59309d34 100644 --- a/freevideo_engine/agent/errors.py +++ b/freevideo_engine/agent/errors.py @@ -104,7 +104,7 @@ 'stale_revision': (409, False, 'The card changed since you read it.', 'Apply your change to error.card and send its revision.'), 'changed_by_user': (409, False, 'The user changed this part of the card.', "Keep the user's change; do not change it back. Ask the user if it must change."), 'card_in_use': (409, False, 'An unfinished film uses this card.', 'Ask the user before deleting this card.'), - 'already_generating': (409, False, 'Reference pictures for this card are already being made.', 'Wait for error.job to end, then get the card.'), + 'already_generating': (409, False, 'Reference images for this card are already being made.', 'Wait for error.job to end, then get the card.'), 'project_changed': (409, False, 'The project changed since you read it.', 'Apply your operations to error.project and send its revision.'), 'clip_busy': (409, True, 'A part in this operation is still generating.', 'Wait for its job to end, get the project, then send the operations again.'), 'clip_locked': (409, False, 'A part in this operation is on a track the user locked.', 'Leave the locked track unchanged; ask the user to unlock it if it must change.'), @@ -147,28 +147,30 @@ # Static bilingual image reasons; backend exception strings never enter the API. IMAGE_REASONS = { - 'small_memory': ('This Mac has less than 16 GB of memory and cannot generate pictures.', + 'small_memory': ('This Mac has less than 16 GB of memory and cannot generate images.', '这台 Mac 的内存不足 16 GB,无法生成图片。'), 'no_memory': ('Not enough GPU memory, even at the smallest size. Close other apps using the GPU, then try again.', '显存不足,最小尺寸也无法生成。请关闭其他占用显卡的程序后重试。'), 'busy_video': ('A video is generating. Try again when it finishes.', '视频正在生成,完成后再试。'), 'pack_missing': ('Download "Image generation models" in the launcher first.', '请先在启动器里下载“图像生成模型”。'), - 'model_unavailable': ('This computer does not support the chosen picture model. Use Qwen-Image 2.1.', + 'model_unavailable': ('This computer does not support the chosen image model. Use Qwen-Image 2.1.', '这台电脑不支持所选的图片模型。请改用 Qwen-Image 2.1。'), 'model_unreadable': ('The image generation model files could not be read. Repair them in the launcher and try again.', '图像生成模型的文件读不出来。在启动器里修复后再试。'), 'device_unavailable': ('The graphics card is not available right now. Try again later.', '显卡暂时用不了,稍后再试。'), + 'gpu_kernels_failed': ("The graphics card's computation check did not pass. Update the graphics card driver, then restart FreeVideo. If the check still does not pass, download the report and report the problem.", + '显卡的计算检查未通过。请更新显卡驱动后重新启动 FreeVideo;如仍未通过,请下载报告并提交问题。'), 'worker_exit': ('Image generation stopped unexpectedly. Try again.', '图像生成意外停止了,请再试一次。'), 'timeout': ('This image took too long and was stopped. Try again.', '这一张用时太长,已停止。请再试一次。'), 'disk_full': ('Saving the image failed: the disk is full. Free some space, then generate again.', '保存图片时出错:磁盘空间不够,空出空间后再生成。'), 'generation_failed': ('Image generation ran into an error. Try again.', '图像生成出错了,请再试一次。'), - 'invalid_media': ('The reference image could not be read. Choose another one.', - '参考图读不出来,请换一张。'), + 'invalid_media': ('This image cannot be read or is larger than 4096×4096 pixels. Choose another image.', + '这张图片读不出来,或超过 4096×4096 像素。请换一张图片。'), 'invalid_request': ('The image settings are invalid. Adjust them and try again.', '图片设置有误,请调整后重试。'), - 'invalid_prompt': ('The prompt is empty, or longer than 2,000 characters once the picture references are counted. Shorten it and try again.', + 'invalid_prompt': ('The prompt is empty, or longer than 2,000 characters once the image references are counted. Shorten it and try again.', '提示词为空,或加上图片引用后超过 2000 字。请缩短提示词后重试。'), 'invalid_dimensions': ('The image size is outside what the chosen model supports. Change the size and try again.', '图片尺寸超出所选模型支持的范围。请调整尺寸后重试。'), @@ -176,10 +178,11 @@ '随机种子无效。请清空种子或改用较小的整数后重试。'), 'too_many_images': ('There are more reference images than the chosen model supports. Remove some and try again.', '参考图超过所选模型支持的数量。请减少参考图后重试。'), - 'output_unwritable': ('The folder that keeps the pictures cannot be written (freevideo-image in the ComfyUI input folder). Check that it exists, is writable and has no file of the same name, then try again.', + 'output_unwritable': ('The folder that keeps the images cannot be written (freevideo-image in the ComfyUI input folder). Check that it exists, is writable and has no file of the same name, then try again.', '无法写入保存图片的文件夹(ComfyUI 的 input 目录下的 freevideo-image)。请确认该目录存在、可写,且没有同名文件,然后重试。'), - 'busy': ('Another picture is being generated. Try again when it finishes.', '已有一张图在生成,完成后再试。'), - 'cancelled': ('The picture was cancelled.', '已取消这张图片。'), + 'busy': ('The image queue is full. Wait for the earlier images to finish, then try again.', + '等待生成的图片已满,请等前面的图片完成后再试。'), + 'cancelled': ('The image was cancelled.', '已取消这张图片。'), } @@ -214,11 +217,12 @@ def image_failure(code, report_id=None): 'no_memory': 'There is not enough GPU or system memory for this picture.', 'model_unreadable': IMAGE_REASONS['model_unreadable'][0], 'device_unavailable': IMAGE_REASONS['device_unavailable'][0], + 'gpu_kernels_failed': IMAGE_REASONS['gpu_kernels_failed'][0], 'timeout': IMAGE_REASONS['timeout'][0], 'generation_failed': IMAGE_REASONS['generation_failed'][0], 'worker_exit': 'The image worker stopped before finishing this picture.', 'disk_full': IMAGE_REASONS['disk_full'][0], - 'output_unwritable': 'The folder that keeps the pictures cannot be written; tell the user to check that the freevideo-image folder in the input directory exists, is writable and has no file of the same name, then submit again with a new ref.', + 'output_unwritable': 'The folder that keeps the images cannot be written; tell the user to check that the freevideo-image folder in the input directory exists, is writable and has no file of the same name, then submit again with a new ref.', 'cancelled': 'The picture job was cancelled.', } IMAGE_REASONS.update({code: (LORA_MESSAGE_EN[code], LORA_MESSAGE_ZH[code]) for code in LORA_ERRORS}) @@ -308,7 +312,7 @@ def safe_details(value): # Picture-only codes: the people-facing sentence is the picture card's own (IMAGE_REASONS), word for word. -IMAGE_ONLY = ('small_memory', 'busy_video', 'model_unreadable', 'device_unavailable') +IMAGE_ONLY = ('small_memory', 'busy_video', 'model_unreadable', 'device_unavailable', 'gpu_kernels_failed') # Program-facing codes: only an Agent or a command-line client meets them, never a person as a task's failure. PROTOCOL_ONLY = ('forbidden', 'redirect_forbidden', 'method_not_allowed', 'unauthorized', 'no_token', 'invalid_json', 'unsupported_media_type', 'idempotency_conflict', 'invalid_range', 'invalid_wait', 'invalid_resume', @@ -317,439 +321,445 @@ def safe_details(value): # One public sentence shared by conversation cards, HTTP and MCP. Backend text # is classified, never echoed: it can contain prompts, filenames or credentials. -FAILURE_REASONS_ZH = { - **LORA_MESSAGE_ZH, - 'too_large': '这条消息太长,请缩短或分成两条发送', - 'lan_unavailable': '手机连接需要用启动器安装的 FreeVideo', - 'capabilities_computing': '正在计算这台电脑的生成能力,稍后再试', - 'out_of_memory': '生成时显存或内存不足', - 'insufficient_memory': '可用显存或内存不足,无法生成这段内容', - 'no_memory': '可用显存或内存不足,无法生成这张图片', - 'ram_space': '加载模型时系统内存不足', - 'model_missing': '需要的模型还没有安装好', - 'pack_missing': '图片模型还没有安装好', - 'model_unavailable': '这台电脑不支持所选的图片模型', - 'not_ready': '生成所需的环境还没有安装好', - 'cancelled': '生成已被停止', - 'stopped_by_user': '生成已被停止', - 'interrupted': '生成中途被打断', - 'worker_exit': '图片生成中途被打断', - 'closed': '图片生成服务已经关闭', - 'image_unavailable': '图片生成服务还没有启动', - 'vlm_unavailable': '读取画面的模型服务还没有启动', - 'vlm_failed': '没能读出画面', - 'vlm_invalid_json': '回复读不出来', - 'context_length': '描述和参考图太长', - 'dependency_failed': '前面依赖的任务没有完成', - 'lost': '生成服务没有保留这次任务的结果', - 'unknown_job': '图片生成服务找不到这次任务', - 'not_found': '找不到这次任务或素材', - 'source_missing': '接续所需的上一段视频已经不在', - 'chain_missing': '接续所需的生成记录已经不在', - 'not_resumable': '此任务无法继续生成', - 'chain_unavailable': '分段生成服务还没有启动', - 'continuation_unavailable': '当前生成方式不支持接续视频', - 'join_failed': '片段已生成,但拼接成片时出错', - 'invalid_output': '生成的结果无法读取或保存', - 'storage_unavailable': '任务记录或素材无法写入磁盘', - 'disk_full': '磁盘空间不够,图片没能保存', - 'output_unwritable': '保存图片的文件夹无法写入', - 'submit_interrupted': '提交生成时服务中断,尚未确认任务是否开始', - 'timeout': '生成等了太久没有结果', - 'invalid_media': '参考素材无法读取', - 'clip_unreadable': '生成的角色参考视频无法读取', - 'invalid_request': '生成参数不符合支持的范围', - 'invalid_drama': '短剧设置有误', - 'reshoot_limit': '这个镜头已达到可生成的次数上限', - 'production_limit': '这部短剧已达到可生成的任务数量上限', - 'export_failed': '导出成片时出错', - 'invalid_prompt': '图片描述为空或超过了支持的长度', - 'invalid_dimensions': '图片尺寸超出了支持的范围', - 'too_many_images': '参考图片数量超过了支持的范围', - 'chain_too_long': '接续后的视频超过了支持的段数', - 'chain_short_parts': '有短于 10 秒的段时,接续后的视频超过了支持的段数', - 'chain_rejected': '生成服务无法使用这组参数', - 'generation_failed': '生成过程中出现了意外错误', - 'internal_error': '处理过程中出现了意外错误', - 'unreachable': 'FreeVideo 服务没有响应', - 'session_full': '这个对话的消息已达到上限', - 'page_session_required': '页面会话已失效', - 'origin_forbidden': '这次操作来自其他网址,已被拒绝', - 'local_only': '这项操作只能在运行 FreeVideo 的电脑上进行', - 'page_required': '这项操作需要在浏览器中打开 FreeVideo 页面', - 'unsupported_comfyui': '已安装的生成组件版本不受支持', - 'busy': '另一项任务正在占用所需的资源', - 'conflict': '这项操作与任务的当前状态冲突', - 'no_video': '来源任务还没有生成完成的视频', - 'invalid_edit': '图片编辑的设置有误', - 'invalid_screenplay': '剧本中有不符合要求的内容', - 'invalid_seed': '图片的随机种子超出了支持的范围', - 'image_size': '图片超过了 5000 万像素的上限', - 'unsupported_media': '读取画面的模型只能读取图片', - 'unknown_shot': '找不到这个镜头', - 'unknown_take': '这个镜头中找不到指定的那一条', - 'take_not_ready': '这一条已过期或没有生成成功', - 'chosen_by_user': '这个镜头已手动选定,不会自动更改', - 'nothing_to_cancel': '没有可以取消的未完成任务', - 'not_allowed': '这部短剧只能在页面上手动停止或继续', - 'already_ended': '这部短剧已经结束', - 'needs_confirmation': '这项操作需要先确认', - 'declined_by_user': '这项操作已被拒绝', - 'turn_abandoned': '这次请求已被放弃', - 'managed_by_production': '这一条属于一部短剧,不能单独继续生成', - 'stale_revision': '卡片在读取后已有改动', - 'changed_by_user': '这部分内容已被手动修改', - 'card_in_use': '有未完成的短剧正在使用这张卡片', - 'already_generating': '这张卡片的参考图正在生成', - 'project_changed': '项目在读取后已有改动', - 'image_changed': '图片在读取后已有改动', - 'clip_busy': '这次操作涉及的片段还在生成', - 'clip_locked': '这次操作涉及的片段在已锁定的轨道上', - 'layer_locked': '这次操作要修改已锁定的图层', - 'audio_full': '这里没有空闲的声音轨', - 'overlap': '这次操作会与不能移动的片段重叠', - 'missing_glyphs': '项目中的文字含有内置字体无法显示的字符', - 'clip_source_unusable': '有片段的源文件缺失,或在片段使用的范围内无法读取', - 'shorten_unavailable': '这里暂时不能自动缩短台词', - 'no_speech_model': '这台电脑上没有安装语音识别模型', - 'speech_language': '语音识别模型不支持这段声音的语言', - 'listen_failed': '识别台词时中途出错', - 'music_download_failed': '配乐模型未能下载', - 'music_failed': '生成配乐时中途出错', - 'stems_download_failed': '声音分离模型未能下载', - 'stems_failed': '分离声音时中途出错', - 'sound_failed': '处理成片声音时中途出错', - 'voice_failed': '更换人声时中途出错', - 'voice_model_missing': '配音模型还没有安装好', - 'no_speech': '所选范围内没有找到说话声', +FAILURE_REASONS = { + **{code: (LORA_MESSAGE_EN[code], LORA_MESSAGE_ZH[code]) for code in LORA_MESSAGE_ZH}, + 'too_large': ('This message is too long; shorten it or send it in two parts', + '这条消息太长,请缩短或分成两条发送'), + 'lan_unavailable': ('Phone access requires FreeVideo installed with the launcher', + '手机连接需要用启动器安装的 FreeVideo'), + 'capabilities_computing': ('Working out what this computer can generate; try again shortly', + '正在计算这台电脑的生成能力,稍后再试'), + 'out_of_memory': ('Graphics or system memory ran out during generation', + '生成时显存或内存不足'), + 'insufficient_memory': ('There is not enough free graphics or system memory for this generation', + '可用显存或内存不足,无法生成这段内容'), + 'no_memory': ('There is not enough free graphics or system memory for this image', + '可用显存或内存不足,无法生成这张图片'), + 'ram_space': ('System memory ran out while loading the model', + '加载模型时系统内存不足'), + 'model_missing': ('A required model is not installed yet', + '需要的模型还没有安装好'), + 'pack_missing': ('The image model is not installed yet', + '图片模型还没有安装好'), + 'model_unavailable': ('This computer does not support the chosen image model', + '这台电脑不支持所选的图片模型'), + 'not_ready': ('The generation environment is not installed yet', + '生成所需的环境还没有安装好'), + 'cancelled': ('Generation was stopped', + '生成已被停止'), + 'stopped_by_user': ('Generation was stopped', + '生成已被停止'), + 'interrupted': ('Generation was interrupted', + '生成中途被打断'), + 'worker_exit': ('Image generation was interrupted', + '图片生成中途被打断'), + 'closed': ('The image generation service has closed', + '图片生成服务已经关闭'), + 'image_unavailable': ('The image generation service has not started yet', + '图片生成服务还没有启动'), + 'vlm_unavailable': ('The model that reads pictures has not started yet', + '读取画面的模型服务还没有启动'), + 'vlm_failed': ('The picture could not be read', + '没能读出画面'), + 'vlm_invalid_json': ('The reply could not be read', + '回复读不出来'), + 'context_length': ('The prompt and reference images are too long', + '提示词和参考图太长'), + 'dependency_failed': ('A task this one depends on did not finish', + '前面依赖的任务没有完成'), + 'lost': ('The generation service no longer has the result of this task', + '生成服务没有保留这次任务的结果'), + 'unknown_job': ('The image generation service cannot find this task', + '图片生成服务找不到这次任务'), + 'not_found': ('This task or media file cannot be found', + '找不到这次任务或素材'), + 'source_missing': ('The previous video needed to extend it is no longer available', + '接续所需的上一段视频已经不在'), + 'chain_missing': ('The generation record needed to extend the video is no longer available', + '接续所需的生成记录已经不在'), + 'not_resumable': ('This task cannot be continued', + '此任务无法继续生成'), + 'chain_unavailable': ('The part-by-part generation service has not started yet', + '分段生成服务还没有启动'), + 'continuation_unavailable': ('The current generation mode cannot extend a video', + '当前生成方式不支持接续视频'), + 'join_failed': ('The parts were generated, but joining them into one video failed', + '片段已生成,但拼接成片时出错'), + 'invalid_output': ('The result could not be read or saved', + '生成的结果无法读取或保存'), + 'storage_unavailable': ('The task record or media could not be written to disk', + '任务记录或素材无法写入磁盘'), + 'disk_full': ('Saving the image failed: the disk is full', + '磁盘空间不够,图片没能保存'), + 'output_unwritable': ('The folder that keeps the images cannot be written', + '保存图片的文件夹无法写入'), + 'submit_interrupted': ('The service stopped during submission, so it is not confirmed whether the task started', + '提交生成时服务中断,尚未确认任务是否开始'), + 'timeout': ('Generation took too long without a result', + '生成等了太久没有结果'), + 'invalid_media': ('The reference media could not be read', + '参考素材无法读取'), + 'clip_unreadable': ('The generated character reference video could not be read', + '生成的角色参考视频无法读取'), + 'invalid_request': ('The generation settings are outside the supported range', + '生成参数不符合支持的范围'), + 'invalid_drama': ('The short film settings are invalid', + '短剧设置有误'), + 'reshoot_limit': ('This shot has reached its generation limit', + '这个镜头已达到可生成的次数上限'), + 'production_limit': ('This short film has reached its task limit', + '这部短剧已达到可生成的任务数量上限'), + 'export_failed': ('Exporting the video failed', + '导出成片时出错'), + 'invalid_prompt': ('The image prompt is empty or too long', + '图片提示词为空或超过了支持的长度'), + 'invalid_dimensions': ('The image size is outside the supported range', + '图片尺寸超出了支持的范围'), + 'too_many_images': ('There are more reference images than supported', + '参考图片数量超过了支持的范围'), + 'chain_too_long': ('The extended video has more parts than supported', + '接续后的视频超过了支持的段数'), + 'chain_short_parts': ('With a part shorter than 10 seconds, the extended video has more parts than supported', + '有短于 10 秒的段时,接续后的视频超过了支持的段数'), + 'chain_rejected': ('The generation service cannot use these settings', + '生成服务无法使用这组参数'), + 'generation_failed': ('An unexpected error stopped generation', + '生成过程中出现了意外错误'), + 'internal_error': ('An unexpected error stopped this task', + '处理过程中出现了意外错误'), + 'unreachable': ('The FreeVideo service did not respond', + 'FreeVideo 服务没有响应'), + 'session_full': ('This chat has reached its message limit', + '这个对话的消息已达到上限'), + 'page_session_required': ('The page session is no longer valid', + '页面会话已失效'), + 'origin_forbidden': ('This action came from a different web address and was refused', + '这次操作来自其他网址,已被拒绝'), + 'local_only': ('This action is available only on the computer running FreeVideo', + '这项操作只能在运行 FreeVideo 的电脑上进行'), + 'page_required': ('This action needs the FreeVideo page open in a browser', + '这项操作需要在浏览器中打开 FreeVideo 页面'), + 'unsupported_comfyui': ('The installed generation component version is not supported', + '已安装的生成组件版本不受支持'), + 'busy': ('Another task is using the resources this one needs', + '另一项任务正在占用所需的资源'), + 'conflict': ('This action conflicts with the current state of the task', + '这项操作与任务的当前状态冲突'), + 'no_video': ('The source task has no finished video yet', + '来源任务还没有生成完成的视频'), + 'invalid_edit': ('The image edit settings are invalid', + '图片编辑的设置有误'), + 'invalid_screenplay': ('The screenplay contains invalid content', + '剧本中有不符合要求的内容'), + 'invalid_seed': ('The image seed is outside the supported range', + '图片的随机种子超出了支持的范围'), + 'image_size': ('The image exceeds the 50-megapixel limit', + '图片超过了 5000 万像素的上限'), + 'unsupported_media': ('The model that reads pictures can read only images', + '读取画面的模型只能读取图片'), + 'unknown_shot': ('This shot cannot be found', + '找不到这个镜头'), + 'unknown_take': ('The chosen take cannot be found in this shot', + '这个镜头中找不到指定的那一条'), + 'take_not_ready': ('This take is out of date or did not succeed', + '这一条已过期或没有生成成功'), + 'chosen_by_user': ('This shot was chosen by hand and is not changed automatically', + '这个镜头已手动选定,不会自动更改'), + 'nothing_to_cancel': ('There is no unfinished task to cancel', + '没有可以取消的未完成任务'), + 'not_allowed': ('This short film can be stopped or continued only by hand on the page', + '这部短剧只能在页面上手动停止或继续'), + 'already_ended': ('This short film has already ended', + '这部短剧已经结束'), + 'needs_confirmation': ('This action needs approval first', + '这项操作需要先确认'), + 'declined_by_user': ('This action was declined', + '这项操作已被拒绝'), + 'turn_abandoned': ('This request was abandoned', + '这次请求已被放弃'), + 'managed_by_production': ('This take belongs to a short film and cannot be continued on its own', + '这一条属于一部短剧,不能单独继续生成'), + 'stale_revision': ('The card has changed since it was read', + '卡片在读取后已有改动'), + 'changed_by_user': ('This part was changed by hand', + '这部分内容已被手动修改'), + 'card_in_use': ('An unfinished short film uses this card', + '有未完成的短剧正在使用这张卡片'), + 'already_generating': ('Reference images for this card are already being made', + '这张卡片的参考图正在生成'), + 'project_changed': ('The project has changed since it was read', + '项目在读取后已有改动'), + 'image_changed': ('The image has changed since it was read', + '图片在读取后已有改动'), + 'clip_busy': ('A clip in this action is still generating', + '这次操作涉及的片段还在生成'), + 'clip_locked': ('A clip in this action is on a locked track', + '这次操作涉及的片段在已锁定的轨道上'), + 'layer_locked': ('This action changes a locked layer', + '这次操作要修改已锁定的图层'), + 'audio_full': ('There is no free sound track here', + '这里没有空闲的声音轨'), + 'overlap': ('This action would overlap clips that cannot move', + '这次操作会与不能移动的片段重叠'), + 'missing_glyphs': ('Text in the project contains characters the built-in fonts cannot display', + '项目中的文字含有内置字体无法显示的字符'), + 'clip_source_unusable': ('A clip\'s source file is missing, or cannot be read over the part the clip uses', + '有片段的源文件缺失,或在片段使用的范围内无法读取'), + 'shorten_unavailable': ('Lines cannot be shortened automatically here yet', + '这里暂时不能自动缩短台词'), + 'no_speech_model': ('No speech recognition model is installed on this computer', + '这台电脑上没有安装语音识别模型'), + 'speech_language': ('The speech recognition model does not support the language of this sound', + '语音识别模型不支持这段声音的语言'), + 'listen_failed': ('An error stopped recognizing the lines', + '识别台词时中途出错'), + 'music_download_failed': ('The music model could not be downloaded', + '配乐模型未能下载'), + 'music_failed': ('An error stopped composing the music', + '生成配乐时中途出错'), + 'stems_download_failed': ('The sound separation model could not be downloaded', + '声音分离模型未能下载'), + 'stems_failed': ('An error stopped separating the sound', + '分离声音时中途出错'), + 'sound_failed': ('An error stopped finishing the sound of the cut', + '处理成片声音时中途出错'), + 'voice_failed': ('An error stopped changing the voice', + '更换人声时中途出错'), + 'voice_model_missing': ('The dubbing model is not installed yet', + '配音模型还没有安装好'), + 'no_speech': ('No speech was found in the selection', + '所选范围内没有找到说话声'), # Image-only codes keep the sentences the picture card already shows. - **{code: IMAGE_REASONS[code][1] for code in IMAGE_ONLY}, -} -FAILURE_REASONS_EN = { - **LORA_MESSAGE_EN, - 'too_large': 'This message is too long; shorten it or send it in two parts', - 'lan_unavailable': 'Phone access requires FreeVideo installed with the launcher', - 'capabilities_computing': 'Working out what this computer can generate; try again shortly', - 'out_of_memory': 'Graphics or system memory ran out during generation', - 'insufficient_memory': 'There is not enough free graphics or system memory for this generation', - 'no_memory': 'There is not enough free graphics or system memory for this picture', - 'ram_space': 'System memory ran out while loading the model', - 'model_missing': 'A required model is not installed yet', - 'pack_missing': 'The image model is not installed yet', - 'model_unavailable': 'This computer does not support the chosen picture model', - 'not_ready': 'The generation environment is not installed yet', - 'cancelled': 'Generation was stopped', - 'stopped_by_user': 'Generation was stopped', - 'interrupted': 'Generation was interrupted', - 'worker_exit': 'Picture generation was interrupted', - 'closed': 'The picture generation service has closed', - 'image_unavailable': 'The picture generation service has not started yet', - 'vlm_unavailable': 'The model that reads pictures has not started yet', - 'vlm_failed': 'The picture could not be read', - 'vlm_invalid_json': 'The reply could not be read', - 'context_length': 'The description and reference pictures are too long', - 'dependency_failed': 'A task this one depends on did not finish', - 'lost': 'The generation service no longer has the result of this task', - 'unknown_job': 'The picture generation service cannot find this task', - 'not_found': 'This task or media file cannot be found', - 'source_missing': 'The previous video needed to continue is no longer available', - 'chain_missing': 'The generation record needed to continue is no longer available', - 'not_resumable': 'This task cannot be continued', - 'chain_unavailable': 'The part-by-part generation service has not started yet', - 'continuation_unavailable': 'The current generation mode cannot continue a video', - 'join_failed': 'The parts were generated, but joining them into one video failed', - 'invalid_output': 'The result could not be read or saved', - 'storage_unavailable': 'The task record or media could not be written to disk', - 'disk_full': 'Saving the image failed: the disk is full', - 'output_unwritable': 'The folder that keeps the pictures cannot be written', - 'submit_interrupted': 'The service stopped during submission, so it is not confirmed whether the task started', - 'timeout': 'Generation took too long without a result', - 'invalid_media': 'The reference media could not be read', - 'clip_unreadable': 'The generated character reference video could not be read', - 'invalid_request': 'The generation settings are outside the supported range', - 'invalid_drama': 'The short film settings are invalid', - 'reshoot_limit': 'This shot has reached its generation limit', - 'production_limit': 'This short film has reached its task limit', - 'export_failed': 'Exporting the video failed', - 'invalid_prompt': 'The picture description is empty or too long', - 'invalid_dimensions': 'The picture size is outside the supported range', - 'too_many_images': 'There are more reference pictures than supported', - 'chain_too_long': 'The continued video has more parts than supported', - 'chain_short_parts': 'With a part shorter than 10 seconds, the continued video has more parts than supported', - 'chain_rejected': 'The generation service cannot use these settings', - 'generation_failed': 'An unexpected error stopped generation', - 'internal_error': 'An unexpected error stopped this task', - 'unreachable': 'The FreeVideo service did not respond', - 'session_full': 'This chat has reached its message limit', - 'page_session_required': 'The page session is no longer valid', - 'origin_forbidden': 'This action came from a different web address and was refused', - 'local_only': 'This action is available only on the computer running FreeVideo', - 'page_required': 'This action needs the FreeVideo page open in a browser', - 'unsupported_comfyui': 'The installed generation component version is not supported', - 'busy': 'Another task is using the resources this one needs', - 'conflict': 'This action conflicts with the current state of the task', - 'no_video': 'The source task has no finished video yet', - 'invalid_edit': 'The image edit settings are invalid', - 'invalid_screenplay': 'The screenplay contains invalid content', - 'invalid_seed': 'The picture seed is outside the supported range', - 'image_size': 'The image exceeds the 50-megapixel limit', - 'unsupported_media': 'The model that reads pictures can read only images', - 'unknown_shot': 'This shot cannot be found', - 'unknown_take': 'The chosen take cannot be found in this shot', - 'take_not_ready': 'This take is out of date or did not succeed', - 'chosen_by_user': 'This shot was chosen by hand and is not changed automatically', - 'nothing_to_cancel': 'There is no unfinished task to cancel', - 'not_allowed': 'This short film can be stopped or continued only by hand on the page', - 'already_ended': 'This short film has already ended', - 'needs_confirmation': 'This action needs approval first', - 'declined_by_user': 'This action was declined', - 'turn_abandoned': 'This request was abandoned', - 'managed_by_production': 'This take belongs to a short film and cannot be continued on its own', - 'stale_revision': 'The card has changed since it was read', - 'changed_by_user': 'This part was changed by hand', - 'card_in_use': 'An unfinished short film uses this card', - 'already_generating': 'Reference pictures for this card are already being made', - 'project_changed': 'The project has changed since it was read', - 'image_changed': 'The image has changed since it was read', - 'clip_busy': 'A clip in this action is still generating', - 'clip_locked': 'A clip in this action is on a locked track', - 'layer_locked': 'This action changes a locked layer', - 'audio_full': 'There is no free sound track here', - 'overlap': 'This action would overlap clips that cannot move', - 'missing_glyphs': 'Text in the project contains characters the built-in fonts cannot display', - 'clip_source_unusable': 'A clip\'s source file is missing, or cannot be read over the part the clip uses', - 'shorten_unavailable': 'Lines cannot be shortened automatically here yet', - 'no_speech_model': 'No speech recognition model is installed on this computer', - 'speech_language': 'The speech recognition model does not support the language of this sound', - 'listen_failed': 'An error stopped recognizing the lines', - 'music_download_failed': 'The music model could not be downloaded', - 'music_failed': 'An error stopped composing the music', - 'stems_download_failed': 'The sound separation model could not be downloaded', - 'stems_failed': 'An error stopped separating the sound', - 'sound_failed': 'An error stopped finishing the sound of the cut', - 'voice_failed': 'An error stopped changing the voice', - 'voice_model_missing': 'The dubbing model is not installed yet', - 'no_speech': 'No speech was found in the selection', - **{code: IMAGE_REASONS[code][0] for code in IMAGE_ONLY}, + **{code: IMAGE_REASONS[code] for code in IMAGE_ONLY}, } +FAILURE_REASONS_EN = {code: pair[0] for code, pair in FAILURE_REASONS.items()} +FAILURE_REASONS_ZH = {code: pair[1] for code, pair in FAILURE_REASONS.items()} # What a person can do next, for the reasons above whose remedy is not just running the task again. Shown after the # reason only while the reason itself is the code's sentence (a more specific message keeps its own meaning). -FAILURE_NEXT_ZH = { - 'generation_failed': '再次出现时,请点击“提交问题”', - 'internal_error': '再次出现时,请点击“提交问题”', - 'unreachable': '确认 FreeVideo 已经启动后再试', - 'session_full': '点击“新对话”后继续', - 'page_session_required': '刷新页面后再操作一次', - 'origin_forbidden': '在 FreeVideo 提供的页面中操作', - 'unsupported_comfyui': '在启动器或设置中修复安装', - 'busy': '等该任务完成后再试', - 'no_video': '等来源视频生成完成后再试', - 'image_size': '缩小图片后再试', - 'managed_by_production': '重拍这个镜头,或继续这部短剧', - 'already_generating': '等参考图生成完成后再试', - 'clip_busy': '等片段生成完成后再试', - 'clip_locked': '解锁该轨道后再试', - 'layer_locked': '解锁该图层后再试', - 'audio_full': '先挪开或删除这里的一段声音', - 'overlap': '换一个位置,或先挪开挡住的片段', - 'missing_glyphs': '修改这些文字后再导出', - 'clip_source_unusable': '找回或替换源文件后再导出', - 'shorten_unavailable': '手动改写较短的台词', - 'no_speech_model': '请手动填写字幕', - 'music_download_failed': '配乐模型需要约 20 GB 磁盘空间和网络连接,确认后再试', - 'stems_download_failed': '检查网络连接后再试', - 'voice_model_missing': '先安装配音模型', - 'no_speech': '选择有人说话的一段声音', - 'invalid_prompt': '缩短图片描述后再试', - 'invalid_dimensions': '调整图片尺寸后再试', - 'invalid_seed': '清空种子或改用较小的整数后再试', - 'too_many_images': '减少参考图后再试', - 'output_unwritable': '确认输入目录下的 freevideo-image 文件夹存在、可写且没有同名文件后再试', - 'invalid_lora_strength': '把强度调到 -2 到 2 之间后再试', - 'lan_unavailable': '先用启动器安装 FreeVideo,再打开“手机连接”', - 'turn_abandoned': '需要时重新提交', - 'insufficient_memory': '关闭其他占用显卡的程序,或缩小尺寸、缩短时长后再试', - 'no_memory': '关闭其他占用显卡的程序,或缩小图片尺寸后再试', - 'ram_space': '关闭其他占用内存的程序后再试', - 'model_missing': '在启动器或设置中安装所需模型后再试', - 'pack_missing': '在启动器或设置中安装图片模型后再试', - 'model_unavailable': '换一个图片模型后再试', - 'not_ready': '在启动器或设置中完成安装或修复后再试', - 'cancelled': '需要时重新提交', - 'stopped_by_user': '需要时重新提交', - 'interrupted': '再试一次', - 'worker_exit': '再试一次;再次出现时,请点击“提交问题”', - 'closed': '在启动器里重新启动 FreeVideo 后再试', - 'image_unavailable': '稍等片刻后再试;仍不行时,在启动器里重新启动 FreeVideo', - 'vlm_unavailable': '稍等片刻后再试;仍不行时,在启动器里重新启动 FreeVideo', - 'vlm_failed': '换一张更清晰的图片,或再试一次', - 'vlm_invalid_json': '再试一次', - 'context_length': '缩短描述或减少参考图后再试', - 'dependency_failed': '先处理前面失败的任务,再重新提交', - 'lost': '重新提交一次', - 'unknown_job': '刷新页面后查看任务列表,必要时重新提交', - 'not_found': '刷新页面后确认它还在,再重试', - 'source_missing': '找回或重新生成上一段视频后再接续', - 'chain_missing': '改为从完整视频重新接续', - 'not_resumable': '重新提交一个新任务', - 'chain_unavailable': '在启动器里重新启动 FreeVideo 后再试', - 'continuation_unavailable': '换一种生成方式,或重新生成整段视频', - 'join_failed': '检查磁盘空间后重新导出成片', - 'invalid_output': '检查磁盘空间后再试', - 'storage_unavailable': '检查磁盘空间和文件夹写入权限后再试', - 'disk_full': '清理磁盘空间后再试', - 'submit_interrupted': '查看任务列表确认是否已开始,没有再重新提交', - 'timeout': '再试一次;再次出现时,请缩短时长或降低尺寸', - 'invalid_media': '换一个能正常播放的文件后再试', - 'clip_unreadable': '重新生成这个角色参考视频后再试', - 'invalid_request': '把设置改到可用范围内后再试', - 'invalid_drama': '检查短剧设置后再试', - 'reshoot_limit': '改为选用已有的镜头,或新建一个镜头', - 'production_limit': '继续前,先完成或删除不需要的任务', - 'export_failed': '检查磁盘空间后重新导出', - 'chain_too_long': '缩短接续的内容,或减少段数后再试', - 'chain_short_parts': '把短于 10 秒的段合并或重新生成后再试', - 'chain_rejected': '更换尺寸或时长后再试', - 'local_only': '在运行 FreeVideo 的电脑上操作', - 'page_required': '在浏览器中打开 FreeVideo 页面后再操作', - 'conflict': '等当前任务结束,或刷新页面后再试', - 'invalid_edit': '检查编辑设置后再试', - 'invalid_screenplay': '按提示修改剧本后再试', - 'unsupported_media': '换一张图片后再试', - 'unknown_shot': '刷新页面后选择现有的镜头', - 'unknown_take': '刷新页面后选择这个镜头里现有的一条', - 'take_not_ready': '重新生成这一条,或选另一条', - 'chosen_by_user': '要更换时,请在页面上手动改选', - 'nothing_to_cancel': '无需操作,需要时再提交新任务', - 'not_allowed': '在页面上手动停止或继续这部短剧', - 'already_ended': '需要时新建一部短剧', - 'needs_confirmation': '确认后再执行这项操作', - 'declined_by_user': '需要时重新提出这项操作', - 'stale_revision': '刷新页面查看最新内容后再改', - 'changed_by_user': '按手动修改后的内容继续,或刷新页面后重新操作', - 'card_in_use': '等短剧结束,或先停止它后再改这张卡片', - 'project_changed': '刷新页面查看最新内容后再改', - 'image_changed': '刷新页面查看最新内容后再改', - 'speech_language': '换一段受支持语言的声音,或手动填写字幕', - 'listen_failed': '再试一次,或手动填写字幕', - 'music_failed': '再试一次', - 'stems_failed': '再试一次', - 'sound_failed': '再试一次', - 'voice_failed': '再试一次', - 'small_memory': '在内存 16 GB 及以上的 Mac 上使用图片生成', -} -FAILURE_NEXT_EN = { - 'generation_failed': 'If it happens again, use "Report a problem"', - 'internal_error': 'If it happens again, use "Report a problem"', - 'unreachable': 'Make sure FreeVideo is running, then try again', - 'session_full': 'Click "New chat" to continue', - 'page_session_required': 'Reload the page and repeat the action', - 'origin_forbidden': 'Use the page served by FreeVideo', - 'unsupported_comfyui': 'Repair the installation in the launcher or in Settings', - 'busy': 'Try again when that task finishes', - 'no_video': 'Try again after the source video finishes', - 'image_size': 'Make the image smaller, then try again', - 'managed_by_production': 'Reshoot this shot, or continue the short film', - 'already_generating': 'Try again when the reference pictures are finished', - 'clip_busy': 'Try again when the clip finishes generating', - 'clip_locked': 'Unlock the track, then try again', - 'layer_locked': 'Unlock the layer, then try again', - 'audio_full': 'Move or remove a sound clip here first', - 'overlap': 'Choose another position, or move the clips in the way first', - 'missing_glyphs': 'Change that text, then export again', - 'clip_source_unusable': 'Restore or replace the source file, then export again', - 'shorten_unavailable': 'Write a shorter line by hand', - 'no_speech_model': 'Write the subtitles by hand', - 'music_download_failed': 'The music model needs about 20 GB of free disk space and a network connection; check both, then try again', - 'stems_download_failed': 'Check the network connection, then try again', - 'voice_model_missing': 'Install the dubbing model first', - 'no_speech': 'Choose a stretch of sound with someone speaking', - 'invalid_prompt': 'Shorten the description, then try again', - 'invalid_dimensions': 'Change the picture size, then try again', - 'invalid_seed': 'Clear the seed or use a smaller whole number, then try again', - 'too_many_images': 'Remove some reference pictures, then try again', - 'output_unwritable': 'Check that the freevideo-image folder in the input directory exists, is writable and has no file of the same name, then try again', - 'invalid_lora_strength': 'Set the strength between -2 and 2, then try again', - 'lan_unavailable': 'Install FreeVideo with the launcher first, then turn on Phone access', - 'turn_abandoned': 'Submit it again when needed', - 'insufficient_memory': 'Close other programs that use the graphics card, or use a smaller size or a shorter length, then try again', - 'no_memory': 'Close other programs that use the graphics card, or use a smaller picture size, then try again', - 'ram_space': 'Close other programs that use memory, then try again', - 'model_missing': 'Install the required model in the launcher or in Settings, then try again', - 'pack_missing': 'Install the picture model in the launcher or in Settings, then try again', - 'model_unavailable': 'Choose another picture model, then try again', - 'not_ready': 'Finish the installation or repair in the launcher or in Settings, then try again', - 'cancelled': 'Submit it again when needed', - 'stopped_by_user': 'Submit it again when needed', - 'interrupted': 'Try again', - 'worker_exit': 'Try again; if it happens again, use "Report a problem"', - 'closed': 'Restart FreeVideo from the launcher, then try again', - 'image_unavailable': 'Wait a moment and try again; if it still fails, restart FreeVideo from the launcher', - 'vlm_unavailable': 'Wait a moment and try again; if it still fails, restart FreeVideo from the launcher', - 'vlm_failed': 'Try a clearer picture, or try again', - 'vlm_invalid_json': 'Try again', - 'context_length': 'Shorten the description or use fewer reference pictures, then try again', - 'dependency_failed': 'Fix the earlier task that failed, then submit this one again', - 'lost': 'Submit it again', - 'unknown_job': 'Reload the page and check the task list; submit again if needed', - 'not_found': 'Reload the page and make sure it still exists, then try again', - 'source_missing': 'Restore or regenerate the previous video, then continue it', - 'chain_missing': 'Continue again from the finished video instead', - 'not_resumable': 'Submit a new task', - 'chain_unavailable': 'Restart FreeVideo from the launcher, then try again', - 'continuation_unavailable': 'Choose another way of generating, or generate the whole video again', - 'join_failed': 'Check the free disk space, then export the film again', - 'invalid_output': 'Check the free disk space, then try again', - 'storage_unavailable': 'Check the free disk space and the write access to the folder, then try again', - 'disk_full': 'Free up disk space, then try again', - 'submit_interrupted': 'Check the task list to see whether it started; submit again if it did not', - 'timeout': 'Try again; if it happens again, use a shorter length or a smaller size', - 'invalid_media': 'Use a file that plays normally, then try again', - 'clip_unreadable': 'Generate the character reference video again, then try again', - 'invalid_request': 'Change the settings to a supported range, then try again', - 'invalid_drama': 'Check the drama settings, then try again', - 'reshoot_limit': 'Choose one of the existing takes, or add a new shot', - 'production_limit': 'Finish or delete tasks you no longer need before continuing', - 'export_failed': 'Check the free disk space, then export again', - 'chain_too_long': 'Shorten what you continue, or use fewer parts, then try again', - 'chain_short_parts': 'Merge or regenerate the parts shorter than 10 seconds, then try again', - 'chain_rejected': 'Change the size or the length, then try again', - 'local_only': 'Do this on the computer that runs FreeVideo', - 'page_required': 'Open the FreeVideo page in the browser, then do this there', - 'conflict': 'Wait for the current task to end, or reload the page, then try again', - 'invalid_edit': 'Check the edit settings, then try again', - 'invalid_screenplay': 'Change the screenplay as indicated, then try again', - 'unsupported_media': 'Use a picture instead, then try again', - 'unknown_shot': 'Reload the page and choose an existing shot', - 'unknown_take': 'Reload the page and choose a take that this shot has', - 'take_not_ready': 'Generate this take again, or choose another one', - 'chosen_by_user': 'To change it, choose another take on the page', - 'nothing_to_cancel': 'Nothing to do; submit a new task when needed', - 'not_allowed': 'Stop or continue this drama on the page', - 'already_ended': 'Start a new drama when needed', - 'needs_confirmation': 'Confirm first, then run this action', - 'declined_by_user': 'Ask for this action again when needed', - 'stale_revision': 'Reload the page to see the latest content, then change it again', - 'changed_by_user': 'Continue from the content you edited by hand, or reload the page and try again', - 'card_in_use': 'Wait for the drama to end, or stop it first, then change this card', - 'project_changed': 'Reload the page to see the latest content, then change it again', - 'image_changed': 'Reload the page to see the latest content, then change it again', - 'speech_language': 'Use a sound in a supported language, or write the subtitles by hand', - 'listen_failed': 'Try again, or write the subtitles by hand', - 'music_failed': 'Try again', - 'stems_failed': 'Try again', - 'sound_failed': 'Try again', - 'voice_failed': 'Try again', - 'small_memory': 'Use picture generation on a Mac with 16 GB of memory or more', -} -FAILURE_MESSAGES_ZH = { - 'The previous video is too short to continue; it needs to be at least 1.7 s long.': '接续的上一段视频太短,至少需要 1.7 秒', - 'The previous video has no usable continuation data. Generate it again with this version of FreeVideo.': '上一段视频缺少可用的接续数据', - 'The previous video cannot be read.': '接续的上一段视频无法读取', - "The previous video's frame rate is too low to continue; it needs at least 10 frames per second.": '接续的上一段视频帧率太低,每秒至少需要 10 帧', - 'Use the same aspect ratio as the previous video.': '接续的画面比例与上一段视频不同', - 'The reference video is too short; it needs to be at least about 1 s long.': '参考视频太短,至少需要约 1 秒', +FAILURE_NEXT = { + 'generation_failed': ('If it happens again, use "Report a problem"', + '再次出现时,请点击“提交问题”'), + 'internal_error': ('If it happens again, use "Report a problem"', + '再次出现时,请点击“提交问题”'), + 'unreachable': ('Make sure FreeVideo is running, then try again', + '确认 FreeVideo 已经启动后再试'), + 'session_full': ('Click "New chat" to continue', + '点击“新对话”后继续'), + 'page_session_required': ('Reload the page and repeat the action', + '刷新页面后再操作一次'), + 'origin_forbidden': ('Use the page served by FreeVideo', + '在 FreeVideo 提供的页面中操作'), + 'unsupported_comfyui': ('Repair the installation in the launcher or in Settings', + '在启动器或设置中修复安装'), + 'busy': ('Try again when that task finishes', + '等该任务完成后再试'), + 'no_video': ('Try again after the source video finishes', + '等来源视频生成完成后再试'), + 'image_size': ('Make the image smaller, then try again', + '缩小图片后再试'), + 'managed_by_production': ('Reshoot this shot, or continue the short film', + '重拍这个镜头,或继续这部短剧'), + 'already_generating': ('Try again when the reference images are finished', + '等参考图生成完成后再试'), + 'clip_busy': ('Try again when the clip finishes generating', + '等片段生成完成后再试'), + 'clip_locked': ('Unlock the track, then try again', + '解锁该轨道后再试'), + 'layer_locked': ('Unlock the layer, then try again', + '解锁该图层后再试'), + 'audio_full': ('Move or remove a sound clip here first', + '先挪开或删除这里的一段声音'), + 'overlap': ('Choose another position, or move the clips in the way first', + '换一个位置,或先挪开挡住的片段'), + 'missing_glyphs': ('Change that text, then export again', + '修改这些文字后再导出'), + 'clip_source_unusable': ('Restore or replace the source file, then export again', + '找回或替换源文件后再导出'), + 'shorten_unavailable': ('Write a shorter line by hand', + '手动改写较短的台词'), + 'no_speech_model': ('Write the subtitles by hand', + '请手动填写字幕'), + 'music_download_failed': ('The music model needs about 20 GB of free disk space and a network connection; check both, then try again', + '配乐模型需要约 20 GB 磁盘空间和网络连接,确认后再试'), + 'stems_download_failed': ('Check the network connection, then try again', + '检查网络连接后再试'), + 'voice_model_missing': ('Install the dubbing model first', + '先安装配音模型'), + 'no_speech': ('Choose a section of sound with someone speaking', + '选择有人说话的一段声音'), + 'invalid_prompt': ('Shorten the prompt, then try again', + '缩短图片提示词后再试'), + 'invalid_dimensions': ('Change the image size, then try again', + '调整图片尺寸后再试'), + 'invalid_seed': ('Clear the seed or use a smaller whole number, then try again', + '清空种子或改用较小的整数后再试'), + 'too_many_images': ('Remove some reference images, then try again', + '减少参考图后再试'), + 'output_unwritable': ('Check that the freevideo-image folder in the input directory exists, is writable and has no file of the same name, then try again', + '确认输入目录下的 freevideo-image 文件夹存在、可写且没有同名文件后再试'), + 'invalid_lora_strength': ('Set the strength between -2 and 2, then try again', + '把强度调到 -2 到 2 之间后再试'), + 'lan_unavailable': ('Install FreeVideo with the launcher first, then turn on Phone access', + '先用启动器安装 FreeVideo,再打开“手机连接”'), + 'turn_abandoned': ('Submit it again when needed', + '需要时重新提交'), + 'insufficient_memory': ('Close other programs that use the graphics card, or use a smaller size or a shorter length, then try again', + '关闭其他占用显卡的程序,或缩小尺寸、缩短时长后再试'), + 'no_memory': ('Close other programs that use the graphics card, or use a smaller image size, then try again', + '关闭其他占用显卡的程序,或缩小图片尺寸后再试'), + 'ram_space': ('Close other programs that use memory, then try again', + '关闭其他占用内存的程序后再试'), + 'model_missing': ('Install the required model in the launcher or in Settings, then try again', + '在启动器或设置中安装所需模型后再试'), + 'pack_missing': ('Install the image model in the launcher or in Settings, then try again', + '在启动器或设置中安装图片模型后再试'), + 'model_unavailable': ('Choose another image model, then try again', + '换一个图片模型后再试'), + 'not_ready': ('Finish the installation or repair in the launcher or in Settings, then try again', + '在启动器或设置中完成安装或修复后再试'), + 'cancelled': ('Submit it again when needed', + '需要时重新提交'), + 'stopped_by_user': ('Submit it again when needed', + '需要时重新提交'), + 'interrupted': ('Try again', + '再试一次'), + 'worker_exit': ('Try again; if it happens again, use "Report a problem"', + '再试一次;再次出现时,请点击“提交问题”'), + 'closed': ('Restart FreeVideo from the launcher, then try again', + '在启动器里重新启动 FreeVideo 后再试'), + 'image_unavailable': ('Wait a moment and try again; if it still fails, restart FreeVideo from the launcher', + '稍等片刻后再试;仍不行时,在启动器里重新启动 FreeVideo'), + 'vlm_unavailable': ('Wait a moment and try again; if it still fails, restart FreeVideo from the launcher', + '稍等片刻后再试;仍不行时,在启动器里重新启动 FreeVideo'), + 'vlm_failed': ('Try a clearer image, or try again', + '换一张更清晰的图片,或再试一次'), + 'vlm_invalid_json': ('Try again', + '再试一次'), + 'context_length': ('Shorten the prompt or use fewer reference images, then try again', + '缩短提示词或减少参考图后再试'), + 'dependency_failed': ('Fix the earlier task that failed, then submit this one again', + '先处理前面失败的任务,再重新提交'), + 'lost': ('Submit it again', + '重新提交一次'), + 'unknown_job': ('Reload the page and check the task list; submit again if needed', + '刷新页面后查看任务列表,必要时重新提交'), + 'not_found': ('Reload the page and make sure it still exists, then try again', + '刷新页面后确认它还在,再重试'), + 'source_missing': ('Restore or regenerate the previous video, then extend it', + '找回或重新生成上一段视频后再接续'), + 'chain_missing': ('Extend from the finished video instead', + '改为从完整视频重新接续'), + 'not_resumable': ('Submit a new task', + '重新提交一个新任务'), + 'chain_unavailable': ('Restart FreeVideo from the launcher, then try again', + '在启动器里重新启动 FreeVideo 后再试'), + 'continuation_unavailable': ('Choose another way of generating, or generate the whole video again', + '换一种生成方式,或重新生成整段视频'), + 'join_failed': ('Check the free disk space, then export the film again', + '检查磁盘空间后重新导出成片'), + 'invalid_output': ('Check the free disk space, then try again', + '检查磁盘空间后再试'), + 'storage_unavailable': ('Check the free disk space and the write access to the folder, then try again', + '检查磁盘空间和文件夹写入权限后再试'), + 'disk_full': ('Free up disk space, then try again', + '清理磁盘空间后再试'), + 'submit_interrupted': ('Check the task list to see whether it started; submit again if it did not', + '查看任务列表确认是否已开始,没有再重新提交'), + 'timeout': ('Try again; if it happens again, use a shorter length or a smaller size', + '再试一次;再次出现时,请缩短时长或降低尺寸'), + 'invalid_media': ('Use a file that plays normally, then try again', + '换一个能正常播放的文件后再试'), + 'clip_unreadable': ('Generate the character reference video again, then try again', + '重新生成这个角色参考视频后再试'), + 'invalid_request': ('Change the settings to a supported range, then try again', + '把设置改到可用范围内后再试'), + 'invalid_drama': ('Check the drama settings, then try again', + '检查短剧设置后再试'), + 'reshoot_limit': ('Choose one of the existing takes, or add a new shot', + '改为选用已有的镜头,或新建一个镜头'), + 'production_limit': ('Finish or delete tasks you no longer need before continuing', + '继续前,先完成或删除不需要的任务'), + 'export_failed': ('Check the free disk space, then export again', + '检查磁盘空间后重新导出'), + 'chain_too_long': ('Shorten what you extend, or use fewer parts, then try again', + '缩短接续的内容,或减少段数后再试'), + 'chain_short_parts': ('Merge or regenerate the parts shorter than 10 seconds, then try again', + '把短于 10 秒的段合并或重新生成后再试'), + 'chain_rejected': ('Change the size or the length, then try again', + '更换尺寸或时长后再试'), + 'local_only': ('Do this on the computer that runs FreeVideo', + '在运行 FreeVideo 的电脑上操作'), + 'page_required': ('Open the FreeVideo page in the browser, then do this there', + '在浏览器中打开 FreeVideo 页面后再操作'), + 'conflict': ('Wait for the current task to end, or reload the page, then try again', + '等当前任务结束,或刷新页面后再试'), + 'invalid_edit': ('Check the edit settings, then try again', + '检查编辑设置后再试'), + 'invalid_screenplay': ('Change the screenplay as indicated, then try again', + '按提示修改剧本后再试'), + 'unsupported_media': ('Use an image instead, then try again', + '换一张图片后再试'), + 'unknown_shot': ('Reload the page and choose an existing shot', + '刷新页面后选择现有的镜头'), + 'unknown_take': ('Reload the page and choose a take that this shot has', + '刷新页面后选择这个镜头里现有的一条'), + 'take_not_ready': ('Generate this take again, or choose another one', + '重新生成这一条,或选另一条'), + 'chosen_by_user': ('To change it, choose another take on the page', + '要更换时,请在页面上手动改选'), + 'nothing_to_cancel': ('Nothing to do; submit a new task when needed', + '无需操作,需要时再提交新任务'), + 'not_allowed': ('Stop or continue this drama on the page', + '在页面上手动停止或继续这部短剧'), + 'already_ended': ('Start a new drama when needed', + '需要时新建一部短剧'), + 'needs_confirmation': ('Confirm first, then run this action', + '确认后再执行这项操作'), + 'declined_by_user': ('Ask for this action again when needed', + '需要时重新提出这项操作'), + 'stale_revision': ('Reload the page to see the latest content, then change it again', + '刷新页面查看最新内容后再改'), + 'changed_by_user': ('Continue from the content you edited by hand, or reload the page and try again', + '按手动修改后的内容继续,或刷新页面后重新操作'), + 'card_in_use': ('Wait for the drama to end, or stop it first, then change this card', + '等短剧结束,或先停止它后再改这张卡片'), + 'project_changed': ('Reload the page to see the latest content, then change it again', + '刷新页面查看最新内容后再改'), + 'image_changed': ('Reload the page to see the latest content, then change it again', + '刷新页面查看最新内容后再改'), + 'speech_language': ('Use a sound in a supported language, or write the subtitles by hand', + '换一段受支持语言的声音,或手动填写字幕'), + 'listen_failed': ('Try again, or write the subtitles by hand', + '再试一次,或手动填写字幕'), + 'music_failed': ('Try again', + '再试一次'), + 'stems_failed': ('Try again', + '再试一次'), + 'sound_failed': ('Try again', + '再试一次'), + 'voice_failed': ('Try again', + '再试一次'), + 'small_memory': ('Use image generation on a Mac with 16 GB of memory or more', + '在内存 16 GB 及以上的 Mac 上使用图片生成'), } +FAILURE_NEXT_EN = {code: pair[0] for code, pair in FAILURE_NEXT.items()} +FAILURE_NEXT_ZH = {code: pair[1] for code, pair in FAILURE_NEXT.items()} +# The sentences an engine error may carry, with what the cards show for them. +FAILURE_MESSAGES = ( + ('The previous video is too short to extend; it needs to be at least 1.7 s long.', + '接续的上一段视频太短,至少需要 1.7 秒'), + ('The previous video lacks the data needed to extend it. Generate it again with this version of FreeVideo.', + '上一段视频缺少可用的接续数据'), + ('The previous video cannot be read.', + '接续的上一段视频无法读取'), + ("The previous video's frame rate is too low to extend; it needs at least 10 frames per second.", + '接续的上一段视频帧率太低,每秒至少需要 10 帧'), + ('Use the same aspect ratio as the previous video.', + '接续的画面比例与上一段视频不同'), + ('The reference video is too short; it needs to be at least about 1 s long.', + '参考视频太短,至少需要约 1 秒'), +) +FAILURE_MESSAGES_ZH = dict(FAILURE_MESSAGES) def _failure_line(error): @@ -784,8 +794,10 @@ def failure_reason_en(error): return FAILURE_REASONS_EN.get(error.get('code'), 'Did not finish') -# The people-facing fields reasons() writes; next_zh/next_en only when the reason has a next step. -REASON_KEYS = ('error_zh', 'error_en', 'next_zh', 'next_en') +# The people-facing fields reasons() writes; next_zh/next_en only when the reason has a next step, reason_zh/reason_en +# (the reason without the note on other programs' memory) only when that note was added, so a page in another language +# looks the reason up whole and writes the note from its own template. +REASON_KEYS = ('error_zh', 'error_en', 'next_zh', 'next_en', 'reason_zh', 'reason_en') def reasons(error): @@ -793,10 +805,13 @@ def reasons(error): result = dict(error_zh=failure_reason(error), error_en=failure_reason_en(error)) code = error.get('code') step = code in FAILURE_NEXT_ZH and result['error_zh'] == FAILURE_REASONS_ZH.get(code) + plain = dict(reason_zh=result['error_zh'], reason_en=result['error_en']) for key, zh in (('error_zh', True), ('error_en', False)): suffix = fact(error.get('other_usage'), zh=zh) if suffix and suffix not in result[key]: result[key] = join(result[key], suffix, zh=zh) + if all(result[key] != plain['reason_' + key[-2:]] for key in ('error_zh', 'error_en')): + result.update(plain) if step: result.update(next_zh=FAILURE_NEXT_ZH[code], next_en=FAILURE_NEXT_EN[code]) return result diff --git a/freevideo_engine/agent/production.py b/freevideo_engine/agent/production.py index 0c19c235..041c1520 100644 --- a/freevideo_engine/agent/production.py +++ b/freevideo_engine/agent/production.py @@ -791,7 +791,9 @@ def _public(value): from ..diagnostics import ABSOLUTE_PATH # Keep prose slashes, URLs and bare roots. Once a path starts, use # the shared matcher, which includes spaces through the full filename. - starts = re.compile(r'''(?|])|\\\\[^\\/\s"'<>]+[\\/])''' + # A file URL (file:///home/..., file://localhost/C:/...) starts one too; the shared matcher reads it whole. + starts = re.compile(r'''(?]*)?(?:/+|(?=[A-Za-z]:[\\/]))''' + r'''|(?|])|\\\\[^\\/\s"'<>]+[\\/])''' r'''|(?;|\r\n]+/(?![/\s])''') parts, cursor = [], 0 for start in starts.finditer(value): diff --git a/freevideo_engine/agent/routes.py b/freevideo_engine/agent/routes.py index f7a1c129..9cce76d7 100644 --- a/freevideo_engine/agent/routes.py +++ b/freevideo_engine/agent/routes.py @@ -817,7 +817,8 @@ def agent_path(path): return path == '/freevideo/agent' or path.startswith('/freevideo/agent/') async def no_cross_site_headers(request, response): - if agent_path(request.path) or request.path in ('/freevideo/lan', '/api/freevideo/lan'): + if agent_path(request.path) or request.path in ('/freevideo/lan', '/api/freevideo/lan', '/freevideo/language', + '/api/freevideo/language'): for key in list(response.headers): if key.lower().startswith('access-control-'): del response.headers[key] @@ -909,6 +910,38 @@ async def lan_settings(request): finally: errors.REQUEST_ID.reset(identity) + # The interface language, shared with the launcher: read anywhere on this computer, changed only by the page. + @routes.get('/freevideo/language') + @routes.post('/freevideo/language') + async def language_setting(request): + from .. import language_page + from ..comfy_bridge import installation_root + identity = errors.REQUEST_ID.set('r-' + uuid.uuid4().hex) + try: + access.check(request, local=True) + root = installation_root() + if request.method == 'POST': + if not valid_page_session(request): + raise JobError('page_session_required', 'Page session required') + value = await read_body(request, contract.MAX_BODY_BYTES) + return reply(await asyncio.to_thread(language_page.apply, root, value)) + return reply(await asyncio.to_thread(language_page.read, root)) + except language_page.InvalidRequest as error: + field = error.field if error.field in ('language', '') else '' + return reply({'error': errors.validation([contract.diagnostic('/' + field, error.allowed, error.got)])}, 422) + except JobError as error: + return reply({'error': error.view()}, errors.ERRORS[error.code][0]) + except (json.JSONDecodeError, UnicodeDecodeError, RecursionError): + return problem('invalid_json') + except web.HTTPException as error: + return problem('too_large' if error.status == 413 else 'invalid_request') + except OSError: + return problem('storage_unavailable') + except Exception: + return problem('internal_error') + finally: + errors.REQUEST_ID.reset(identity) + def activity_item(row, *, card=False): view = jobs.view(row, detail=False) value = {k: view.get(k) for k in ('id', 'kind', 'status', 'label', 'project', 'client', 'take', diff --git a/freevideo_engine/capabilities.py b/freevideo_engine/capabilities.py index 3e087737..5304f9a5 100644 --- a/freevideo_engine/capabilities.py +++ b/freevideo_engine/capabilities.py @@ -26,6 +26,26 @@ TIERS = {name: (tier['steps'], tier['two_pass']) for name, tier in quality_tiers.TIERS.items()} PLAN_NAMES = {'-1': 'refused', '0': 'normal', '1': 'slower_streaming', '2': 'admitted_tight_memory'} +# The fastest mode (fast_mode 'fast2'): one pass of two steps, decoded by the adapter's pixel head. It is not one of the +# quality levels (`tiers`), so every reader of those keeps its four levels; `fast_mode` carries its own rows. +FAST2_STEPS = 2 + + +def _fast_mode_listing(machine): + """Whether this machine is offered the fastest mode at all, and why not: the adapter replaces int8 layers and runs + on NVIDIA's CUDA build only.""" + if machine['mac']: + return dict(listed=False, unlisted_reason='mac') + # Setup's vendor first, then the torch build (a ROCm build passes the capability check but saves no CUDA version); + # a record without either is told by the card's name. Older NVIDIA drivers name a card without the vendor + # ("GeForce RTX 3090"), so the name rules out AMD's words rather than asking for NVIDIA's. + name = str(machine['name']).casefold() + if (machine['cap'] is None or machine.get('vendor') not in (None, 'nvidia') or machine.get('cuda_missing') + or any(word in name for word in ('amd', 'radeon', 'instinct'))): + return dict(listed=False, unlisted_reason='gpu') + if machine['precision'] != 'int8': + return dict(listed=False, unlisted_reason='engine') + return dict(listed=True, unlisted_reason=None) # WholeVideoProgress.for_request starts an ordinary new-prompt request with # these flags. Unobserved encoder/model residency stays cold; compilation is # unknown (the prior's half-cold default), even later in the same session. @@ -260,14 +280,20 @@ def _machine(machine, in_use=None): ram_available=max(0, int(ram) - idle['ram']), idle_in_use=idle, cap=tuple(cap) if not mac else None, precision=precision, metal=int(metal) if metal is not None else None, - compile_owed=machine.get('compile_owed') is True and not mac) + compile_owed=machine.get('compile_owed') is True and not mac, + # Setup's vendor, and whether the saved torch build is a CUDA one: a ROCm build saves no CUDA version. + # A record from before either was saved has neither, and is judged by the card's name as before. + vendor=str(machine['gpu_vendor']).casefold() if machine.get('gpu_vendor') else None, + cuda_missing='cuda_version' in observed and not observed['cuda_version']) def _request(width, height, frames, steps, two_pass, task='t2va', refine=3, - references=None, reference_rows=None, upscale=2): + references=None, reference_rows=None, upscale=2, fast_mode=None): """Scalar request shared by admission and offline, recorded-row reviews.""" from .two_pass import render_canvas canvas = dict(render_canvas(geometry(width, height, frames=frames))[0], task=task, steps=steps) + if fast_mode == 'fast2': + canvas['fast_mode'] = fast_mode if reference_rows is not None: if not valid_reference_rows(reference_rows): raise ValueError('Invalid recorded reference rows.') @@ -289,14 +315,14 @@ def _request(width, height, frames, steps, two_pass, task='t2va', refine=3, def _admit(machine, width, height, frames, steps, two_pass, task='t2va', refine=3, - references=None, reference_rows=None, step_cache=None, upscale=2): + references=None, reference_rows=None, step_cache=None, upscale=2, fast_mode=None): """Admission of one request; `step_cache` asks the planner for a first-pass cache. The request carries the cache the planner keeps (on Mac only the audio-video EasyCache), so its estimate and history follow what the engine will actually run. """ canvas, sampling, request = _request(width, height, frames, steps, two_pass, task, refine, - references, reference_rows, upscale) + references, reference_rows, upscale, fast_mode) rows = dict(video=canvas.get('reference_video_tokens', 0), audio=canvas.get('reference_audio_tokens', 0)) try: if machine['mac']: @@ -341,7 +367,10 @@ def _admit(machine, width, height, frames, steps, two_pass, task='t2va', refine= return request, int(disk_risk or transfers), 'memory' if disk_risk else 'gpu_memory' if transfers else None except ResourceBudgetError as error: # One field cannot encode both failures: prefer the system RAM limit. - return None, -1, 'memory' if 'ram' in error.details['insufficient'] else 'gpu_memory' + if 'ram' in error.details['insufficient']: + return None, -1, 'memory' + # The fast mode's sampling fits and its pixel head does not: the ways out differ from a sampling shortfall. + return None, -1, 'decode_gpu_memory' if error.details.get('gpu_requirement') == 'fast_mode_decode' else 'gpu_memory' except MemoryError: return None, -1, 'memory' @@ -468,13 +497,11 @@ def estimate(request): if matches else {}) return local.get('seconds', prior['total']['seconds'] * ratio) - tiers = {} - for name, tier in quality_tiers.table(machine['mac']).items(): - steps, two_pass, step_cache, upscale = tier['steps'], tier['two_pass'], tier['step_cache'], tier['upscale'] + def rows(steps, two_pass, step_cache, upscale, fast_mode=None): times, codes, slow_by, maxima, frame_maxima, limits = [], [], [], [], [], [] for size_row in sizes: admitted = {f: _admit(machine, size_row['width'], size_row['height'], f, steps, two_pass, task, - references=references, step_cache=step_cache, upscale=upscale) + references=references, step_cache=step_cache, upscale=upscale, fast_mode=fast_mode) for f in range(39, lengths[-1]['frames'] + 1, 17)} estimates = {} for f, (request, _, _) in admitted.items(): @@ -503,14 +530,24 @@ def estimate(request): times.append(row_times) codes.append(row_codes) slow_by.append(row_slow) - tiers[name] = dict(steps=steps, two_pass=two_pass, step_cache=step_cache, upscale=upscale, estimate_seconds=times, - max_seconds=maxima, max_frames=frame_maxima, limit=limits, plan=codes, slow_by=slow_by) + return dict(steps=steps, two_pass=two_pass, step_cache=step_cache, upscale=upscale, estimate_seconds=times, + max_seconds=maxima, max_frames=frame_maxima, limit=limits, plan=codes, slow_by=slow_by) + + tiers = {name: rows(tier['steps'], tier['two_pass'], tier['step_cache'], tier['upscale']) + for name, tier in quality_tiers.table(machine['mac']).items()} + fast = _fast_mode_listing(machine) + if fast['listed']: + fast.update(rows(FAST2_STEPS, False, None, 2, fast_mode='fast2')) + # Where a length does not fit: the light level instead, or the longest length that fits at this size (never + # shortened without being asked). The page shows the light level only where it fits that size and length. + fast['shorten_seconds'] = list(fast['max_seconds']) + fast['actions'] = [['use_light', 'shorten'] if longest is not None else ['use_light'] for longest in fast['max_seconds']] default = next((i for i, s in enumerate(sizes) if s['pixels'] == .98), 0) result = dict(version=1, status='ready', machine=dict(gpu_name=machine['name'], vram_gib=machine['vram'] / GiB, ram_gib=machine['ram'] / GiB, system=machine['system'], compile_owed=machine['compile_owed']), - aspect=aspect, sizes=sizes, lengths=lengths, tiers=tiers, + aspect=aspect, sizes=sizes, lengths=lengths, tiers=tiers, fast_mode=fast, summary=dict(width=sizes[default]['width'], height=sizes[default]['height'], tier='light', max_seconds=tiers['light']['max_seconds'][default], max_frames=tiers['light']['max_frames'][default]), diff --git a/freevideo_engine/chain_plan.py b/freevideo_engine/chain_plan.py index 03d5be87..06d0424d 100644 --- a/freevideo_engine/chain_plan.py +++ b/freevideo_engine/chain_plan.py @@ -9,7 +9,7 @@ import math from pathlib import Path -from .geometry import geometry +from .geometry import SHORTEST_SECONDS, geometry FPS, UNIT, OVERLAP = 24, 17, 22 SINGLE_SECONDS, BLOCK_SECONDS, SHORTEST_BLOCK = 30, 15, 5 @@ -64,9 +64,11 @@ def parts_limit(short, first_frame=False, max_parts=MAX_PARTS): class PlanError(ValueError): - def __init__(self, code, message): + """`details`: fields the page reads besides the code, such as the shortest length for `too_short`.""" + def __init__(self, code, message, **details): super().__init__(message) self.code = code + self.details = details def _number(value, name, whole=False): @@ -138,7 +140,7 @@ def plan(seconds, single=False, max_frames=None, single_limit_seconds=None, bloc except PlanError: raise except ValueError as error: - raise PlanError('too_short', str(error)) from None + raise PlanError('too_short', str(error), min_seconds=SHORTEST_SECONDS) from None if seconds > MAX_SECONDS: raise PlanError('too_long', 'A video is at most 2 hours long') # The longest whole-second block this device can start a video with, and continue one with. diff --git a/freevideo_engine/cli.py b/freevideo_engine/cli.py index 8c7ac7b5..9bdbc34c 100644 --- a/freevideo_engine/cli.py +++ b/freevideo_engine/cli.py @@ -136,6 +136,8 @@ def main(): help='Sample a smaller canvas, upscale latents and refine (default: on; 8 + 3 steps)') generate.add_argument('--step-cache', choices=('easycache-av', 'fbcache'), help='Approximate reuse between sampling steps (disabled by default)') + generate.add_argument('--fast-mode', choices=('fast2',), + help='Fastest mode: two steps with an additional adapter, pixels without the video VAE') generate.add_argument('--base-steps', type=int, choices=range(1, 33), metavar='1..32', help='First-pass steps (default: 8, or explicit profile). Changes may reduce quality.') generate.add_argument('--refine-steps', type=int, choices=range(1, 32), default=3, metavar='1..31', @@ -189,6 +191,9 @@ def main(): validate_route(task=args.task or ('ref2va' if args.continue_anchor else 't2va'), anchor=args.continue_anchor is not None, two_pass=args.two_pass, preview=args.preview, refine_from=args.refine_from) + if sys.platform == 'darwin' and args.command == 'generate' and args.fast_mode is not None: + # The Mac route below has its own engine, which would otherwise run the default steps. + raise ValueError('The fastest mode is not available on Mac') if sys.platform == 'darwin' and args.command == 'generate' and args.upscale_from is not None: raise ValueError('Upscaling a finished video is not available on Mac yet') if sys.platform == 'darwin' and args.command in ('plan', 'generate', 'encode', 'doctor'): diff --git a/freevideo_engine/comfy_bridge.py b/freevideo_engine/comfy_bridge.py index 9ded062a..7b6aa5f1 100644 --- a/freevideo_engine/comfy_bridge.py +++ b/freevideo_engine/comfy_bridge.py @@ -1394,7 +1394,8 @@ def generate(prompt, width, height, seconds, seed, output_directory, *, force_regenerate=False, base_steps=8, refine_steps=3, comfy_metadata=None, prompt_rewrite_report=None, preview=False, refine_from=None, report_extra=None, continue_from=None, frames=None, first_frame_reference=False, voice_reference=False, hide_tail=False, - step_cache=None, upscale_factor=2, allow_empty_prompt=False, upscale_from=None, upscale_to=None): + step_cache=None, upscale_factor=2, allow_empty_prompt=False, upscale_from=None, upscale_to=None, + fast_mode=None): from .comfy_environment import control_process if control_process(environ): raise RuntimeError('Generation requires a dispatched executor') @@ -1475,6 +1476,10 @@ def generate(prompt, width, height, seconds, seed, output_directory, *, staged = bool(preview or upscale or work) from .refine_schedule import UPSCALE schedule = UPSCALE if work else None + if fast_mode is not None: + from . import fast_tier + two_pass, base_steps, refine_steps = fast_tier.bridge_steps(fast_mode, preview=preview, refine_from=refine_from, + continue_from=continue_from, upscale_from=upscale_from, step_cache=step_cache, upscale_factor=upscale_factor) from .preview import validate_flags validate_flags(preview, upscale, two_pass, base_steps) from .two_pass import validate_steps @@ -1483,6 +1488,8 @@ def generate(prompt, width, height, seconds, seed, output_directory, *, allow_empty_prompt=allow_empty_prompt) source = Path(source or source_root()).resolve() root, machine = installation(source, environ) + if fast_mode is not None and machine.get('device_backend') == 'mps': + raise ValueError('The fastest mode is not available on Mac') continuation = None def check_ending(): @@ -1553,6 +1560,10 @@ def check_ending(): command.append('--allow-empty-prompt') if step_cache is not None: command += ['--step-cache', step_cache] + if fast_mode is not None: + # The folder the engine process resolves (paths.installed_model_root). Before queueing, so a missing file is named at once. + fast_tier.files(environment.get('FREEVIDEO_MODEL_ROOT') or machine['model_root']) + command += ['--fast-mode', fast_mode] if two_pass and upscale_factor != 2: command += ['--upscale-factor', '%g' % upscale_factor] if frames is not None: @@ -1771,6 +1782,9 @@ def release_depth_models(): if step_cache is not None: # A cache changes the arithmetic; without one the identity stays that of earlier versions. keyed = dict(keyed, step_cache=step_cache) + if fast_mode is not None: + # The same step count without the adapter is another video. + keyed = dict(keyed, fast_mode=fast_mode, fast_adapter=fast_tier.FILES[fast_tier.ADAPTER][1]) if hide_tail_frames: keyed = dict(keyed, hide_tail_frames=hide_tail_frames) identify = lambda check: request_key(prompt, seed, canvas, keyed, extra, machine, @@ -1807,8 +1821,9 @@ def asset_progress(message): if continue_from is not None and original_audio is None else engine_task(extra.get('media', {}), media_base)) # Tables follow the step count; the cache is carried for exact level recognition. - preparation = prepare_sampling_assets(root, machine, dict(planned, step_cache=step_cache) if step_cache else planned, - asset_task, + # The fastest mode computes its modulation from the adapter and reads no table. + preparation = dict(status='not_needed', seconds=0.) if fast_mode is not None else prepare_sampling_assets( + root, machine, dict(planned, step_cache=step_cache) if step_cache else planned, asset_task, progress=asset_progress, interrupted=interrupted, environ=environment) except BaseException: elapsed = time.monotonic() - preparation_started diff --git a/freevideo_engine/comfy_chain.py b/freevideo_engine/comfy_chain.py index cd57dc65..1a09a0e3 100644 --- a/freevideo_engine/comfy_chain.py +++ b/freevideo_engine/comfy_chain.py @@ -448,7 +448,7 @@ async def plan(request): raise chain_plan.PlanError('device_limit', 'This device cannot generate this length at this size') return response({'plan': result}) except chain_plan.PlanError as failure: - return response({'error': str(failure), 'code': failure.code}, 400) + return response({**failure.details, 'error': str(failure), 'code': failure.code}, 400) except ValueError as failure: return response({'error': str(failure), 'code': 'invalid'}, 400) @@ -472,7 +472,7 @@ def refused(failure, invalid_status=400): return response({'error': str(failure), 'error_zh': failure.message_zh, 'code': failure.code, 'min_seconds': failure.limit}, 400) if isinstance(failure, chain_plan.PlanError): - return response({'error': str(failure), 'code': failure.code}, 400) + return response({**failure.details, 'error': str(failure), 'code': failure.code}, 400) if hasattr(failure, 'as_dict'): value = failure.as_dict() if isinstance(value.get('message_zh'), str): diff --git a/freevideo_engine/comfy_continuation.py b/freevideo_engine/comfy_continuation.py index 4d7172eb..1dc66e9e 100644 --- a/freevideo_engine/comfy_continuation.py +++ b/freevideo_engine/comfy_continuation.py @@ -52,7 +52,7 @@ def part_steps(base_steps, refine_steps, step_cache): if base_steps == TWO_PASS_BASE_STEPS: return base_steps, refine_steps, step_cache, None return (TWO_PASS_BASE_STEPS, 3, 'none', - 'Parts of a long video and continued parts use %d + 3 steps with "Two-pass acceleration". ' + 'Parts of a long video and extended parts use %d + 3 steps with "Faster second pass". ' '%d first-pass steps apply only to a single video.' % (TWO_PASS_BASE_STEPS, base_steps)) diff --git a/freevideo_engine/comfy_host.py b/freevideo_engine/comfy_host.py index ecee1ac4..0a3b94c7 100644 --- a/freevideo_engine/comfy_host.py +++ b/freevideo_engine/comfy_host.py @@ -14,7 +14,7 @@ from .comfy_bridge import installation from .comfy_environment import isolated_environment from .comfy_requirements import managed_requirements -from .environments import uv_build_environment, uv_file_arguments, uv_folder +from .environments import uv_build_environment, uv_file_arguments, uv_folder, windows_arm64 from .locking import runtime_lock from .monitoring import save from .package_progress import PackageOutput @@ -24,7 +24,13 @@ # do not name what only they use (the editor rules engine for project and image edits), # and accept a range of PyAV: the version our media code was measured on is held here, # because a newer one reads and writes different audio (it matches the engine's constraints). -NODE_PACKAGES = ('quickjs==1.19.4', 'av==18.1.0') +def node_packages(arm64): + """The QuickJS binding publishes no win_arm64 wheel and would have to be compiled on the computer: + on Windows on Arm the editing tools say they are not available (editor_runtime.available) instead.""" + return ('av==18.1.0',) if arm64 else ('quickjs==1.19.4', 'av==18.1.0') + + +NODE_PACKAGES = node_packages(windows_arm64()) def prepare(root, comfy, run=None, download=False, repair=False): diff --git a/freevideo_engine/comfy_launcher_runtime.py b/freevideo_engine/comfy_launcher_runtime.py index 863070b9..f333d001 100644 --- a/freevideo_engine/comfy_launcher_runtime.py +++ b/freevideo_engine/comfy_launcher_runtime.py @@ -938,7 +938,7 @@ def check_server_exit(self): from . import engine_exit if not engine or engine_exit.by_the_user(code): return None - value = engine_exit.record(engine, code, log) + value = engine_exit.record(engine, code, log, oom_before=getattr(self, 'server_oom_kills', None)) self.state = dict(self.state, status='restart-required', engine_exit=engine_exit.public(value)) return value @@ -1621,6 +1621,9 @@ def _connect_comfy(self): server = processes.popen(started, cwd=selected['root'], env=env, stdin=subprocess.DEVNULL, stdout=log, stderr=subprocess.STDOUT, start_new_session=True, supervise=True) self.server = server + from .engine_exit import oom_baseline + # The kernel's out-of-memory counts when this ComfyUI started: its own cgroup's, and the whole computer's. + self.server_oom_kills = oom_baseline(server.pid) self.server_url = url self.server_address = selected['url'] save(directory / 'launch.json', dict(command=command, pid=server.pid, root=selected['root'], url=url, **context)) diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.py index ab99ae52..33c8012a 100644 --- a/freevideo_engine/comfy_nodes.py +++ b/freevideo_engine/comfy_nodes.py @@ -82,6 +82,12 @@ def step_cache_option(value): return {'step_cache': value} if value in STEP_CACHE_OPTIONS and value != 'none' else {} +FAST_MODE_OPTIONS = ('none', 'fast2') +def fast_mode_option(value): + """Bridge keyword for the Fastest mode widget; a workflow without it or with 'none' adds nothing.""" + return {'fast_mode': value} if value in FAST_MODE_OPTIONS and value != 'none' else {} + + UPSCALE_OPTIONS = ('2', '1.5', '1.2') # two_pass.SCALES as the widget shows them @@ -94,12 +100,16 @@ def upscale_option(value): return {'upscale_factor': float(text)} if text in UPSCALE_OPTIONS and text != '2' else {} +# The three input labels before they followed the interface wording (0.6.12); a search for the old name still finds the node. +LEGACY_INPUT_NAMES = ('Continue from video', 'Two-pass acceleration', 'Two-pass: preview first pass') + + class FreeVideoGenerate(io.ComfyNode): @classmethod def define_schema(cls): return io.Schema( node_id='FreeVideoGenerate', display_name='FreeVideo · Video + Audio', - category='FreeVideo', search_aliases=['VDN', 'H3', 'i2v', 'fl2v', 'ref2v'], + category='FreeVideo', search_aliases=['VDN', 'H3', 'i2v', 'fl2v', 'ref2v', *LEGACY_INPUT_NAMES], description='Generate a video with audio using your FreeVideo installation. Memory placement, ' 'caches and validated optimizations are automatic. Outputs and diagnostics are retained.', inputs=[ @@ -123,23 +133,23 @@ def define_schema(cls): 'When it is connected, the prompt and media inputs are not used. ' 'Conditioning from generic CLIP nodes is rejected.'), Media.Input('media', optional=True, tooltip='Unified Media panel: keyframes or ordered references.'), - io.Boolean.Input('two_pass', display_name='Two-pass acceleration', default=True, optional=True, + io.Boolean.Input('two_pass', display_name='Faster second pass', default=True, optional=True, tooltip='Usually faster: generate at a lower resolution, then upscale and finish sampling at the target size.'), io.Int.Input('base_steps', display_name='First-pass steps', default=8, min=1, max=32, optional=True, - tooltip='Default: 8. Two-pass acceleration runs only with 8 first-pass steps; any other count ' + tooltip='Default: 8. The faster second pass runs only with 8 first-pass steps; any other count ' 'generates in one pass of that many steps. Changing sampling steps may reduce generation quality.'), io.Int.Input('refine_steps', display_name='Second-pass steps', default=3, min=1, max=31, optional=True, tooltip='Default: 3. Three steps use the independent refinement schedule. Changing sampling steps may reduce generation quality.'), io.Boolean.Input('force_regenerate', display_name='Force regeneration', default=False, optional=True, tooltip='Generate again even when an identical completed video is saved locally.'), - io.Boolean.Input('preview', display_name='Two-pass: preview first pass', default=False, optional=True, - tooltip='Part of two-pass acceleration: pause after the half-resolution first pass and save it as a preview. ' + io.Boolean.Input('preview', display_name='Preview first', default=False, optional=True, + tooltip='Part of the faster second pass: pause after the half-resolution first pass and save it as a preview. ' 'Run the second pass from the result when it looks right; it continues from the same latents.'), io.String.Input('refine_from', display_name='Second pass of preview', default='', optional=True, advanced=True, socketless=True, tooltip='Set by the Run second pass button: the preview video to continue. ' "The second pass uses the preview's own prompt, seed, size and inputs."), - io.String.Input('continue_from', display_name='Continue from video', default='', optional=True, advanced=True, - tooltip='For long videos generated in segments: continue after this MP4. Use its ComfyUI output ' + io.String.Input('continue_from', display_name='Extend from video', default='', optional=True, advanced=True, + tooltip='For long videos generated in segments: extend after this MP4. Use its ComfyUI output ' 'subfolder/filename or an absolute path inside ComfyUI output or input.'), io.Int.Input('frames', display_name='Total frames', default=0, min=0, max=2**31-1, optional=True, advanced=True, tooltip='For long videos generated in segments: 0 uses Duration; otherwise use 5 + 17n, at least 39. ' @@ -147,7 +157,7 @@ def define_schema(cls): io.Boolean.Input('first_frame_reference', display_name='First-frame reference', default=False, optional=True, advanced=True, tooltip='Reduces drift.'), io.Boolean.Input('voice_reference', display_name='Voice reference', default=False, - optional=True, advanced=True, tooltip='Keeps the opening voice consistent in continued dialogue.'), + optional=True, advanced=True, tooltip='Keeps the opening voice consistent in extended dialogue.'), io.Boolean.Input('hide_tail', display_name='Hide dialogue tail', default=False, optional=True, advanced=True, tooltip='Generates and discards 17 extra frames to keep dialogue moving between parts.'), # Last, so the widget values of saved workflows keep their positions. @@ -156,7 +166,7 @@ def define_schema(cls): tooltip='Reuses work between similar sampling steps to finish sooner, with a small change to the result.'), io.Combo.Input('upscale_factor', display_name='Upscale factor', options=list(UPSCALE_OPTIONS), default='2', optional=True, advanced=True, - tooltip='Two-pass only: a smaller factor starts from a larger first pass, for more detail and a longer run.'), + tooltip='Second pass only: a smaller factor starts from a larger first pass, for more detail and a longer run.'), io.Boolean.Input('allow_empty_prompt', display_name='Allow empty prompt', default=False, optional=True, advanced=True, tooltip='Generates from an empty prompt instead of asking for one.'), io.String.Input('upscale_from', display_name='Upscale video', default='', optional=True, advanced=True, @@ -165,6 +175,9 @@ def define_schema(cls): io.String.Input('upscale_to', display_name='Upscale size', default='', optional=True, advanced=True, socketless=True, tooltip='Set by Upscale in Creations: empty for one 1.5x step, 4k for the 4K size ' 'made frame by frame by a small upscale model.'), + io.Combo.Input('fast_mode', display_name='Fastest mode', options=list(FAST_MODE_OPTIONS), default='none', + optional=True, advanced=True, + tooltip='Uses an additional two-step model and skips the video decoder.'), ], outputs=[io.Video.Output('video'), io.String.Output('report', display_name='Report JSON')], hidden=[io.Hidden.unique_id, io.Hidden.prompt, io.Hidden.extra_pnginfo], @@ -174,7 +187,7 @@ def define_schema(cls): @classmethod def validate_inputs(cls, text, width, height, seconds, seed, continue_from='', frames=0, two_pass=True, preview=False, refine_from='', base_steps=8, refine_steps=3, step_cache='none', - upscale_factor='2', allow_empty_prompt=False, upscale_from='', upscale_to=''): + upscale_factor='2', allow_empty_prompt=False, upscale_from='', upscale_to='', fast_mode='none'): # ComfyUI marks every input named here when a check fails, so only the checked widgets are # listed. Linked pictures, media and conditioning have no value before the run anyway. # step_cache and upscale_factor are named so ComfyUI skips their option lists: an older saved @@ -185,6 +198,13 @@ def validate_inputs(cls, text, width, height, seconds, seed, continue_from='', f return True if optional_text(upscale_to) in (None, '', '4k') else 'Upscale size must be empty or 4k' try: options = request_options(continue_from, node_frames(frames)) + if fast_mode_option(fast_mode): + from .fast_tier import bridge_steps + two_pass, base_steps, refine_steps = bridge_steps(fast_mode, preview=preview is True, + refine_from=refine_from, continue_from=options.get('continue_from'), + step_cache=step_cache_option(step_cache).get('step_cache'), + upscale_factor=upscale_option(upscale_factor).get('upscale_factor', 2)) + preview = False if options.get('continue_from'): # A continued part turns on two passes and takes keyframes as pictures; only NVIDIA keeps its preview (execute). from .continuation import previews_supported @@ -198,7 +218,7 @@ def validate_inputs(cls, text, width, height, seconds, seed, continue_from='', f from .two_pass import validate_steps validate_steps(base_steps, refine_steps, two_pass) if preview and not two_pass: - return 'Preview first needs two-pass acceleration.' + return 'Preview first needs the faster second pass.' comfy_bridge.installation() except (OSError, ValueError, KeyError) as error: from .continuation import UNSUPPORTED @@ -221,7 +241,8 @@ def execute(cls, text, width, height, seconds, seed, first=None, last=None, references=None, loras=None, conditioning=None, media=None, two_pass=True, force_regenerate=False, base_steps=8, refine_steps=3, preview=False, refine_from='', continue_from='', frames=0, first_frame_reference=False, voice_reference=False, hide_tail=False, - step_cache='none', upscale_factor='2', allow_empty_prompt=False, upscale_from='', upscale_to=''): + step_cache='none', upscale_factor='2', allow_empty_prompt=False, upscale_from='', upscale_to='', + fast_mode='none'): from .comfy_environment import control_process from .gpu_pool import pool_enabled if control_process() and pool_enabled(): @@ -242,6 +263,14 @@ def execute(cls, text, width, height, seconds, seed, first=None, last=None, chain = block_context(PromptServer.instance, node_id) options = request_options(continue_from, node_frames(frames)) notes = [] + if fast_mode_option(fast_mode): + # Refused here, before any model is stopped or loaded. + from .fast_tier import bridge_steps + two_pass, base_steps, refine_steps = bridge_steps(fast_mode, preview=preview is True, refine_from=refine_from, + continue_from=options.get('continue_from'), upscale_from=upscale_from, + step_cache=step_cache_option(step_cache).get('step_cache'), + upscale_factor=upscale_option(upscale_factor).get('upscale_factor', 2), + parts=chain.get('count', 1) if chain is not None else 1) if options.get('continue_from') or chain is not None and chain.get('count', 1) > 1: base_steps, refine_steps, step_cache, note = part_steps(base_steps, refine_steps, step_cache) if note: @@ -249,12 +278,12 @@ def execute(cls, text, width, height, seconds, seed, first=None, last=None, notes.append(note) if options.get('continue_from') and not two_pass: two_pass = True - notes.append('Continuing a video needs "Two-pass acceleration", so it is on for this part.') + notes.append('Extending a video needs "Faster second pass", so it is on for this part.') if options.get('continue_from') and preview: from .continuation import previews_supported if not previews_supported(): preview = False - notes.append('A continued part is made in full, without stopping at the preview.') + notes.append('An extended part is made in full, without stopping at the preview.') from .two_pass import validate_steps if not refine_from and not upscale_from: validate_steps(base_steps, refine_steps, two_pass) @@ -418,6 +447,7 @@ def kept(exported): **({'upscale_to': '4k'} if frames_upscale else {}), **step_cache_option(step_cache), **upscale_option(upscale_factor), + **fast_mode_option(fast_mode), **({'report_extra': {'chain': report_fields(chain)}} if chain is not None else {})) relative = output.relative_to(output_root) report = output.with_suffix('.request.json').read_text(encoding='utf-8') diff --git a/freevideo_engine/compatibility.py b/freevideo_engine/compatibility.py index 8afbde06..965f19fe 100644 --- a/freevideo_engine/compatibility.py +++ b/freevideo_engine/compatibility.py @@ -89,6 +89,13 @@ def current_settings(value): return value +def fast_tier_request(row): + """A fastest mode request. Its adapter and extra memory are its own: only a device error speaks for other levels.""" + details = row.get('details') + evidence = details.get('decision_evidence') if isinstance(details, dict) else None + return isinstance(evidence, dict) and bool(evidence.get('fast_tier')) + + def failure_evidence(details): # Bookkeeping must never turn a settled failure into another error. try: @@ -247,6 +254,9 @@ def incident(self, row, reason, batch=None, evidence=None): config=row['config'], geometry=row['geometry'], diagnosis='unknown', time=time.time(), policy_revision=revision, applicable=revision == policy_revision(), counted=False, level_changed=False) + fast = fast_tier_request(row) + if fast: + incident['fast_tier'] = True evidence = failure_evidence(evidence) if evidence: incident['evidence'] = evidence @@ -260,7 +270,7 @@ def incident(self, row, reason, batch=None, evidence=None): # once, and so does one that was already running at the last counted interruption. # A request is registered after recovery in the same call, often within one tick # of a coarse system clock, so an equal time counts. - elif (reason in UNEXPLAINED_INTERRUPTIONS + elif (reason in UNEXPLAINED_INTERRUPTIONS and not fast and row['started'] >= value.get('last_counted_interruption', 0) and (batch is None or batch != value.get('last_counted_batch'))): incident['counted'] = True @@ -299,6 +309,8 @@ def success(self, row): """Account for one settled generation; the caller validates its outcome.""" if row.get('purpose') != 'generation' or not row.get('worker'): return + if fast_tier_request(row): + return # Two steps on another adapter are no evidence for restoring the other levels. key = device_key(row.get('identity')) if key is None or not self.path.exists(): # No state was ever stored here: no streak to clear, no level to restore. diff --git a/freevideo_engine/continuation.py b/freevideo_engine/continuation.py index 316b2c2b..21f7c8f4 100644 --- a/freevideo_engine/continuation.py +++ b/freevideo_engine/continuation.py @@ -30,14 +30,14 @@ FIRST_FRAME_REFERENCE_SHORT = 384 VERSION = 1 -MISSING = 'The previous video has no usable continuation data. Generate it again with this version of FreeVideo.' +MISSING = 'The previous video lacks the data needed to extend it. Generate it again with this version of FreeVideo.' SIZE_MISMATCH = 'Use the same aspect ratio as the previous video.' # Every refusal starts with UNSUPPORTED, then says what to change. -UNSUPPORTED = 'Continue from video cannot be used with these settings.' -UNSUPPORTED_DEVICE = UNSUPPORTED + ' Continuing a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Continue from video".' -UNSUPPORTED_PASSES = UNSUPPORTED + ' Turn on "Two-pass acceleration" and turn off the first-pass preview.' -UNSUPPORTED_REFINE = UNSUPPORTED + ' Clear either "Second pass of preview" or "Continue from video".' -UNSUPPORTED_MEDIA = UNSUPPORTED + ' Connect up to 3 pictures as references, and remove video, audio and pre-encoded inputs.' +UNSUPPORTED = 'Extend from video cannot be used with these settings.' +UNSUPPORTED_DEVICE = UNSUPPORTED + ' Extending a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Extend from video".' +UNSUPPORTED_PASSES = UNSUPPORTED + ' Turn on "Faster second pass" and turn off the first-pass preview.' +UNSUPPORTED_REFINE = UNSUPPORTED + ' Clear either "Second pass of preview" or "Extend from video".' +UNSUPPORTED_MEDIA = UNSUPPORTED + ' Connect up to 3 images as references, and remove video, audio and pre-encoded inputs.' # A continued part keeps the cast's pictures, one per person and at most three people in a frame. PICTURES_MAX = 3 @@ -164,7 +164,7 @@ def encoded_references(conditions, task, anchor): sound = (task == ('ref2va_av' if anchor else 'ref2va_audio') and len(rows) == len(images) + 1 and rows[-1]['kind'] == 'audio' and rows[-1].get('audio_latent') is not None) if not rows or anchor != bool(images) or len(images) + sound != len(rows) or len(images) > PICTURES_MAX: - raise ValueError('Continuation pictures must be one to %d images, followed only by its own sound' % PICTURES_MAX) + raise ValueError('Extending takes one to %d images, followed only by its own sound' % PICTURES_MAX) return sound diff --git a/freevideo_engine/continuation_tail.py b/freevideo_engine/continuation_tail.py index a7bc4e7e..d969b806 100644 --- a/freevideo_engine/continuation_tail.py +++ b/freevideo_engine/continuation_tail.py @@ -24,9 +24,9 @@ TICK_SAMPLES = 800 AUDIO_WINDOW_TICKS = 600 # 15 s, the longest sound H3 generates FPS = 24 -TOO_SHORT = 'The previous video is too short to continue; it needs to be at least 1.7 s long.' # NOMINAL_FRAMES is 1.625 s at 24 fps; the message rounds up so a 1.7 s video always fits +TOO_SHORT = 'The previous video is too short to extend; it needs to be at least 1.7 s long.' # NOMINAL_FRAMES is 1.625 s at 24 fps; the message rounds up so a 1.7 s video always fits UNREADABLE = 'The previous video cannot be read.' -LOW_RATE = "The previous video's frame rate is too low to continue; it needs at least 10 frames per second." +LOW_RATE = "The previous video's frame rate is too low to extend; it needs at least 10 frames per second." def _fit(image, width, height): diff --git a/freevideo_engine/desktop.py b/freevideo_engine/desktop.py index 3871693d..46130358 100644 --- a/freevideo_engine/desktop.py +++ b/freevideo_engine/desktop.py @@ -145,8 +145,10 @@ def resize_layout(event): self.update_buttons() self.poll_timer = window.after(100, self.poll) - def t(self, english, chinese): - return chinese if self.zh else english + def t(self, english, chinese, values=None): + from .i18n import fill + text = chinese if self.zh else english + return fill(text, values) if values else text def label(self, parent, english, chinese, **kwargs): widget = self.ttk.Label(parent, text=self.t(english, chinese), **kwargs) @@ -559,7 +561,7 @@ def progress_event(self, value): total, done = value.get('total') or 0, value.get('done') or 0 self.progress.stop() self.progress.configure(mode='determinate', maximum=max(1, total), value=done) - self.phase_status.set(self.t('Stages', '阶段') + ' %d / %d · %s' % (done, total, value.get('label', ''))) + self.phase_status.set(self.t('Stages {done} / {total} · {label}', '阶段 {done} / {total} · {label}', dict(done=done, total=total, label=value.get('label', '')))) return key = value.get('key') or value.get('label', 'task') if key not in self.progress_rows: @@ -611,7 +613,7 @@ def refresh_progress_times(self): value, age = row['value'], time.monotonic() - row['received'] finished = value.get('state') in ('complete', 'failed', 'cancelled') elapsed = (value.get('elapsed_seconds') or 0) + (0 if finished else age) - pieces = [self.t('Elapsed ', '已用 ') + duration(elapsed)] + pieces = [self.t('Elapsed {time}', '已用 {time}', dict(time=duration(elapsed)))] if value.get('total'): pieces.insert(0, '%.0f%%' % min(100, max(0, 100*(value.get('done') or 0)/value['total']))) remaining = value.get('remaining_seconds') if age <= 10 else None @@ -620,7 +622,7 @@ def refresh_progress_times(self): elif remaining == 0: pieces.append(self.t('Finalizing', '正在收尾')) elif remaining is not None: - pieces.append(self.t('ETA ~', '预计剩余约 ') + duration(remaining)) + pieces.append(self.t('ETA ~{time}', '预计剩余约 {time}', dict(time=duration(remaining)))) else: pieces.append(self.t('Estimating…', '估算中…')) row['meta'].set(' · '.join(pieces)) diff --git a/freevideo_engine/dwd_decode.py b/freevideo_engine/dwd_decode.py new file mode 100644 index 00000000..b9a65a0f --- /dev/null +++ b/freevideo_engine/dwd_decode.py @@ -0,0 +1,111 @@ +"""The fastest mode's decode: the pixel head's frames, the audio VAE for the sound, the usual MP4. + +The video VAE is neither loaded nor read. Everything after the picture (the audio +decode with the resident audio VAE, the saved artifacts and the MP4) is the same as +decode_to_file's, and the metrics carry the same names, with the video VAE ones at zero. +""" +import gc +import json +from pathlib import Path +import time + +import torch + +from .decode import DECODE_LABELS + +# The phase the pixel head reports while it runs. +HEAD_LABEL = 'Drawing the video' + + +@torch.no_grad() +def pixels_to_file(features, grid, audio_latents, out_path, *, base, adapter, artifacts_dir=None, phase_callback=None, + model_cache=None, output_size=None, **_decoder_options): + """features, grid: Features.take() of the fastest mode's Engine. Decoder placement options do not apply.""" + from .video_threads import encode_video + from src.inference.render import FPS + from . import dwd_head + + def phase(name, label=None): + if phase_callback is not None: + phase_callback(name) + print(json.dumps({'event': 'decode_phase', 'phase': label or DECODE_LABELS[name]}), flush=True) + started = time.perf_counter() + phase('video_decode', HEAD_LABEL) + gc.collect() + torch.cuda.empty_cache() # what sampling left cached is not the head's to count + frames, head = dwd_head.render(features, grid, adapter, torch.device('cuda')) + del features + gc.collect() + torch.cuda.empty_cache() + video_decode_seconds = time.perf_counter() - started + artifact_seconds = 0. + if artifacts_dir: + import numpy as np + phase('rgb_save') + tick = time.perf_counter() + artifacts_dir = Path(artifacts_dir) + artifacts_dir.mkdir(parents=True, exist_ok=True) + np.save(artifacts_dir / 'rgb.npy', frames.numpy(), allow_pickle=False) + artifact_seconds += time.perf_counter() - tick + audio_start = time.perf_counter() + phase('audio_load_decode') + audio_vae = None + if model_cache is not None: + from .resident_models import key, file_identity + audio_key = key([file_identity(path) for path in sorted((Path(base) / 'audio_vae').iterdir()) if path.is_file()]) + audio_vae = model_cache.take('audio_vae', audio_key) + model_cache.make_room('audio_vae', 1 * 2**30, model=audio_vae, ram_need=256 * 2**20) + audio_cache_hit = audio_vae is not None + if audio_vae is None: + from .vae_weights import load_audio_vae + audio_vae, _ = load_audio_vae(base) + if model_cache is not None: + model_cache.put('audio_vae', audio_key, audio_vae) + audio_vae.eval().requires_grad_(False) + audio_mean = torch.tensor(audio_vae.config.latents_mean, device='cuda').view(1, -1, 1) + audio_std = torch.tensor(audio_vae.config.latents_std, device='cuda').view(1, -1, 1) + print(json.dumps({'event': 'decode_phase', 'phase': 'Decoding audio'}), flush=True) + audio = audio_vae.decode(audio_latents * audio_std + audio_mean, return_dict=False)[0] + audio = audio.float().permute(1, 0, 2)[0].cpu() + rate = audio_vae.config.sampling_rate + audio_level = {'audio_rms': float(audio.square().mean().sqrt()) if audio.numel() else 0., + 'audio_peak': float(audio.abs().max()) if audio.numel() else 0., + 'audio_samples': int(audio.shape[-1])} + del audio_vae, audio_mean, audio_std + gc.collect() + torch.cuda.empty_cache() + audio_seconds = time.perf_counter() - audio_start + if artifacts_dir: + import numpy as np + import wave + phase('audio_save') + tick = time.perf_counter() + np.save(artifacts_dir / 'audio.npy', audio.numpy(), allow_pickle=False) + pcm = (audio.clamp(-1, 1).t().contiguous().numpy() * 32767).round().astype('= 0 + flat = rows.clamp(min=0) + q, k, v = take(flat.reshape(-1)) + tokens = flat.shape[1] + q, k, v = (t.view(len(rows), tokens, HEADS, HEAD_DIM) for t in (q, k, v)) + picked = register_ids[start:start + self.window_batch] + k = torch.cat((k, gk[picked]), 1) + v = torch.cat((v, gv[picked]), 1) + mask = torch.cat((present, register_valid[start:start + self.window_batch]), 1) + o = _attention(q, k, v, mask[:, None, None, :]).flatten(2) + out[rows[present]] = o[present] + del q, k, v, o + x = x + F.linear(out, layer.out, layer.out_bias) * layer.scale1 + del out + registers = flat_registers + F.linear(out_registers, layer.out, layer.out_bias) * layer.scale1 + + def feed_forward(h): + gate, up = F.linear(_norm(h, layer.norm2), layer.w1, layer.w1_bias).chunk(2, -1) + return F.linear(F.silu(gate) * up, layer.w2, layer.w2_bias) + for start in range(0, len(x), self.tile): + x[start:start + self.tile] += feed_forward(x[start:start + self.tile]) * layer.scale2 + registers = registers + feed_forward(registers) * layer.scale2 + return x, registers.view(blocks, per_block, DIM) + + @torch.no_grad() + def __call__(self, features, grid): + """features (frames * h * w, 5376) on the head's device; grid (latent frames, h, w). Float pixels per block.""" + frames, h, w = grid + height, width = h * 2, w * 2 + x = torch.cat([F.linear(features[a:a + 8192].to(torch.bfloat16), self.expand, self.expand_bias) + for a in range(0, len(features), 8192)]) + x = x.view(frames, h, w, 2, 2, DIM).permute(0, 1, 3, 2, 4, 5).reshape(frames * height * width, DIM) + blocks = -(-frames // BLOCK_FRAMES) + registers = torch.cat((self.registers[0], self.registers.new_zeros(1, DIM))).unsqueeze(0).expand(blocks, -1, -1).contiguous() + cache = {} + for depth, layer in enumerate(self.layers, LAYERS - 8): + x, registers = self._layer(layer, depth, x, registers, frames, height, width, cache) + for a in range(0, frames, BLOCK_FRAMES): + c = F.layer_norm(x[a * height * width:(a + BLOCK_FRAMES) * height * width].float(), (DIM,), + self.norm_weight, self.norm_bias, 1e-5).to(torch.bfloat16).view(-1, height, width, DIM) + n = len(c) + parts = [F.linear(c[:1], self.first, self.first_bias).view(height, width, CHANNELS, 1, PATCH, PATCH).permute( + 3, 2, 0, 4, 1, 5).reshape(1, CHANNELS, height * PATCH, width * PATCH)] + if n > 1: + parts.append(F.linear(c[1:], self.project, self.project_bias).view( + n - 1, height, width, CHANNELS, TIME_PATCH, PATCH, PATCH).permute(0, 4, 3, 1, 5, 2, 6).reshape( + (n - 1) * TIME_PATCH, CHANNELS, height * PATCH, width * PATCH)) + yield torch.cat(parts).float() + + +def render(features, grid, adapter, device): + """uint8 frames (count, height, width, 3) on the CPU and the head's timings and peak.""" + import time + from .fast_tier_runtime import adapter_tensors + started = time.perf_counter() + weights = adapter_tensors(adapter, lambda name: name.startswith(PREFIX)) + torch.cuda.reset_peak_memory_stats(device) + head = Head(weights, device) + loaded = time.perf_counter() + mean = torch.tensor(PIXEL_MEAN, device=device).view(3, 1, 1) + std = torch.tensor(PIXEL_STD, device=device).view(3, 1, 1) + frames = [] + for pixels in head(features.to(device), grid): + frames.append((((pixels * std + mean).clamp(-1, 1) * .5 + .5) * 255).round().byte().permute(0, 2, 3, 1).cpu()) + torch.cuda.synchronize(device) + result = torch.cat(frames) + report = dict(head_load_seconds=round(loaded - started, 3), head_seconds=round(time.perf_counter() - loaded, 3), + head_peak_reserved_bytes=torch.cuda.max_memory_reserved(device), + head_peak_allocated_bytes=torch.cuda.max_memory_allocated(device), frames=len(result)) + del head, weights + return result, report diff --git a/freevideo_engine/engine_exit.py b/freevideo_engine/engine_exit.py index c3d21ad6..4bac7c93 100644 --- a/freevideo_engine/engine_exit.py +++ b/freevideo_engine/engine_exit.py @@ -72,12 +72,76 @@ def log_tail(log, lines=LOG_LINES): return rows[-lines:] -def build(code, log=None, *, now=None, system=None): +def oom_kills(path='/proc/vmstat', name='oom_kill'): + """How many processes the Linux kernel has ended for want of memory since it started (oom_kill), or None elsewhere.""" + try: + with open(path, encoding='ascii') as stream: + for line in stream: + key, _, value = line.partition(' ') + if key == name: + return int(value) + except (OSError, ValueError): + pass + return None + + +def cgroup_events(pid, *, proc='/proc', root='/sys/fs/cgroup'): + """The memory.events file of the Linux cgroup (v2) a process runs in, or None (another system, cgroup v1, unreadable).""" + try: + with open(f'{proc}/{int(pid)}/cgroup', encoding='utf-8') as stream: + lines = stream.read().splitlines() + except (OSError, TypeError, ValueError): + return None + for line in lines: + if line.startswith('0::/'): + relative = line[3:].strip().lstrip('/') + if '..' in relative.split('/'): + return None + return str(Path(root) / relative / 'memory.events') if relative else str(Path(root) / 'memory.events') + return None + + +def cgroup_oom_kills(events): + """How many processes of this cgroup and those under it the kernel ended for want of memory (memory.events oom_kill).""" + return oom_kills(events, name='oom_kill') if events else None + + +def oom_baseline(pid, *, proc='/proc', root='/sys/fs/cgroup', vmstat='/proc/vmstat'): + """The kernel's out-of-memory counts when ComfyUI started: its own cgroup's, which counts only that group of + processes, and the whole computer's, for when the cgroup cannot be read at the exit.""" + events = cgroup_events(pid, proc=proc, root=root) + return dict(cgroup=events, cgroup_count=cgroup_oom_kills(events), system=oom_kills(vmstat)) + + +def oom_since(before, *, vmstat='/proc/vmstat', system_now=None): + """(count, 'cgroup' | 'system') of out-of-memory kills since the baseline, or (None, None) when neither can be read. + The cgroup count is preferred: the whole computer's also counts other programs the kernel ended.""" + if isinstance(before, dict): + events, start = before.get('cgroup'), before.get('cgroup_count') + now = cgroup_oom_kills(events) if type(start) is int else None + if type(now) is int: + return max(0, now - start), 'cgroup' + before = before.get('system') + after = oom_kills(vmstat) if system_now is None else system_now + if type(before) is int and type(after) is int: + return max(0, after - before), 'system' + return None, None + + +def build(code, log=None, *, now=None, system=None, oom_before=None, oom_now=None): record = dict(at=time.time() if now is None else now, code_text=code_text(code, system)) record.update(exit_reading(code, system=system)) # The computer's memory when the exit was seen; the readings of this process are not the engine's. record['memory'] = {key: value for key, value in memory_sample().items() if not key.startswith('process_')} record['log_tail'] = log_tail(log) if log else [] + # The kernel's count of processes it ended for want of memory, against its count when this ComfyUI started: ComfyUI's + # own cgroup's when it can be read (only that group of processes), else the whole computer's. A rise with SIGKILL + # means the kernel most likely ended it for memory; with SIGTERM, systemd stopping the rest of the group after the + # kernel ended one of its processes. The memory sample above was taken after the exit, when the memory was free again. + count, scope = oom_since(oom_before, system_now=oom_now) + if type(count) is int: + record['oom_kills_since_start'] = count + record['oom_scope'] = scope # What the engine's last lines complained about, as fixed words: the lines stay on this computer, the words may leave it. kinds = stderr_kinds('\n'.join(record['log_tail'])) if kinds: @@ -85,9 +149,9 @@ def build(code, log=None, *, now=None, system=None): return record -def record(engine, code, log=None, *, now=None, system=None): +def record(engine, code, log=None, *, now=None, system=None, oom_before=None): """Write the record of an exit and return it. A failed write loses the file, never the notice.""" - value = build(code, log, now=now, system=system) + value = build(code, log, now=now, system=system, oom_before=oom_before) try: save(location(engine), value, plain_paths=False) except Exception: @@ -116,9 +180,37 @@ def public(value): if isinstance(text, str) and _CODE_TEXT.match(text): result['code_text'] = text result.update(clean_reading(value)) + count = value.get('oom_kills_since_start') + if type(count) is int and 0 <= count < 2**31: + result['oom_kills_since_start'] = count + if value.get('oom_scope') in ('cgroup', 'system'): + result['oom_scope'] = value['oom_scope'] return result +def out_of_memory(value): + """The system ended it for want of memory: a Windows memory status, or SIGKILL while the kernel's out-of-memory count rose.""" + if not isinstance(value, dict): + return False + kind = value.get('exit_class') + if kind in ('system_commit_limit', 'system_no_memory'): + return True + count = value.get('oom_kills_since_start') + return kind == 'killed_by_signal' and value.get('code_text') == 'SIGKILL' and type(count) is int and count > 0 + + +def maybe_out_of_memory(value): + """SIGTERM while the kernel's out-of-memory count rose: under systemd, the rest of a group is stopped this way after + the kernel ended one of its processes for memory. Said as "possibly", with the same next step.""" + if not isinstance(value, dict): + return False + count = value.get('oom_kills_since_start') + # Only ComfyUI's own group's count: the whole computer's also rises for other programs, and a SIGTERM the user sent + # after one of those must stay "ended" (dataroot-5x review, 11-25). + return (value.get('exit_class') == 'killed_by_signal' and value.get('code_text') == 'SIGTERM' + and value.get('oom_scope') == 'cgroup' and type(count) is int and count > 0) + + def describe(value, zh): """The launcher's sentence about a stopped engine, in the language of the window: when, why as far as known, what next. @@ -126,12 +218,15 @@ def describe(value, zh): """ clock = time.strftime('%H:%M', time.localtime(value['at'])) kind = value.get('exit_class') - memory = kind in ('system_commit_limit', 'system_no_memory') + memory = out_of_memory(value) + maybe = not memory and maybe_out_of_memory(value) ended = kind in ('killed_by_signal', 'terminated_externally') crashed = kind in ('native_crash', 'abort', 'system_stack_overflow') if zh: - cause = (',原因是电脑内存不足' if memory else ',被系统或其他程序结束' if ended else ',程序自身崩溃' if crashed else '') + cause = (',原因是电脑内存不足' if memory else ',可能是因为电脑内存不足' if maybe + else ',被系统或其他程序结束' if ended else ',程序自身崩溃' if crashed else '') return ('FreeVideo 于 %s 意外停止%s。请点击“重新连接”重新启动;如再次停止,请导出报告,再点击“提交问题”并附上报告。' % (clock, cause)) - cause = (': the computer ran out of memory' if memory else ': the system or another program ended it' if ended + cause = (': the computer ran out of memory' if memory else ', possibly because the computer ran out of memory' if maybe + else ': the system or another program ended it' if ended else ': it crashed' if crashed else '') return 'FreeVideo stopped unexpectedly at %s%s. Click "Connect again" to restart it; if it stops again, export the report and use "Report a problem".' % (clock, cause) diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.py index 785e4950..4fa581c2 100644 --- a/freevideo_engine/failure_details.py +++ b/freevideo_engine/failure_details.py @@ -14,6 +14,8 @@ STEP_OUTPUT = '\n\nFull step output:\n' QUALITY_LEVELS = (('Light', '轻量'), ('Medium', '标准'), ('High', '精细'), ('Max', '极致')) # tiers.TIERS order +# Marks a fastest mode failure. web/error_panel.js shows its card when no more specific one applies. +FAST_MODE_FAILED = 'FAST_MODE_FAILED: The fastest mode could not run.' ENGINE_BUSY_TITLE = ('FreeVideo is busy with another task', 'FreeVideo 正在处理另一个任务') ENGINE_BUSY_DETAIL = ( 'Try again when it finishes. If nothing else is running, close duplicate FreeVideo instances, then try again.', @@ -880,16 +882,16 @@ class names and errno, no text), when the message is that exception's str(); it ('The ports for LAN access and the ports after them are in use or reserved by the system. Close the programs ' 'using these ports, then turn on LAN access again.', '局域网访问要用的端口和后面的端口都已被占用或被系统保留。请关闭占用这些端口的程序,再重新开启局域网访问。')), - (r'The previous video has no usable continuation data', 'continuation-missing', - ('This video cannot be continued', '这个视频暂时不能接续'), - ('Generate the previous video again, then continue it.', '请重新生成上一段视频,再接续。')), - (r'The previous video is too short to continue', 'continuation-short', + (r'The previous video lacks the data needed to extend it', 'continuation-missing', + ('This video cannot be extended', '这个视频暂时不能接续'), + ('Generate the previous video again, then extend it.', '请重新生成上一段视频,再接续。')), + (r'The previous video is too short to extend', 'continuation-short', ('The previous video is too short', '上一段视频太短'), ('Choose a video that is at least 1.7 seconds long.', '请选择至少 1.7 秒的视频。')), (r'The previous video cannot be read', 'continuation-unreadable', ('The previous video cannot be read', '无法读取上一段视频'), ('Choose an MP4 video that plays normally.', '请选择能正常播放的 MP4 视频。')), - (r"The previous video's frame rate is too low to continue", 'continuation-rate', + (r"The previous video's frame rate is too low to extend", 'continuation-rate', ("The previous video's frame rate is too low", '上一段视频帧率太低'), ('Choose a video with at least 10 frames per second.', '请选择每秒至少 10 帧的视频。')), (r'Use the same aspect ratio as the previous video', 'continuation-size', @@ -897,26 +899,26 @@ class names and errno, no text), when the message is that exception's str(); it ('Choose a video size with the same aspect ratio as the previous video.', '请选择与上一段视频比例相同的画面大小。')), (r'Frame count must be 5 \+ 17n and at least 39', 'continuation-frames', ('Choose a supported frame count', '请选择支持的帧数'), - ('Use 39, 56, 73, 90, or another value reached by adding 17. This includes the 22 repeated frames when continuing a video.', + ('Use 39, 56, 73, 90, or another value reached by adding 17. This includes the 22 repeated frames when extending a video.', '请使用 39、56、73、90 等每次增加 17 的帧数;接续时,这个数包含开头重复的 22 帧。')), - (r'Continue from video cannot be used with these settings\. Continuing a video needs an NVIDIA', 'continuation-route', - ("This computer can't continue a video", '这台电脑无法接续视频'), - ('Continuing a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Continue from video".', '接续视频需要 NVIDIA 显卡或 Mac。要生成新视频,请清空“接着生成”。')), - (r'Continue from video cannot be used with these settings\. Turn on "Two-pass', 'continuation-passes', - ('Continuing needs two-pass acceleration', '接续需要二采加速'), - ('Turn on "Two-pass acceleration" and turn off the first-pass preview.', '请打开“二采加速”,并关闭先出预览。')), + (r'Extend from video cannot be used with these settings\. Extending a video needs an NVIDIA', 'continuation-route', + ("This computer can't extend a video", '这台电脑无法接续视频'), + ('Extending a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Extend from video".', '接续视频需要 NVIDIA 显卡或 Mac。要生成新视频,请清空“接着生成”。')), + (r'Extend from video cannot be used with these settings\. Turn on "Faster', 'continuation-passes', + ('Extending needs the faster second pass', '接续需要二采加速'), + ('Turn on "Faster second pass" and turn off the first-pass preview.', '请打开“二采加速”,并关闭先出预览。')), (r'audio_original_passes: ', 'audio-original-passes', - ('This audio needs two-pass acceleration', '这段音频需要二采加速'), - ('Turn on "Two-pass acceleration" or set the audio to "Reference".', '请打开“二采加速”,或把音频改选“参考”。')), + ('This audio needs the faster second pass', '这段音频需要二采加速'), + ('Turn on "Faster second pass" or set the audio to "Reference".', '请打开“二采加速”,或把音频改选“参考”。')), (r'audio_original_route: ', 'audio-original-route', ('"Use as is" is not available here', '这里还不能用“原样使用”'), ('Set the audio to "Reference".', '请把音频改选“参考”。')), - (r'Continue from video cannot be used with these settings\. Clear either', 'continuation-refine', - ('A continued part is made in full', '接续会完整生成这一段'), - ('Clear either "Second pass of preview" or "Continue from video".', '请清空“继续二采”或“接着生成”其中一项。')), - (r'Continue from video cannot be used with these settings\. Connect up to 3 pictures', 'continuation-media', - ('A continued part takes picture references only', '接续段只能用图片参考'), - ('Connect up to 3 pictures as references, and remove video, audio and pre-encoded inputs.', '最多接 3 张图片作为参考图,并移除视频、音频参考和预编码输入。')), + (r'Extend from video cannot be used with these settings\. Clear either', 'continuation-refine', + ('An extended part is made in full', '接续会完整生成这一段'), + ('Clear either "Second pass of preview" or "Extend from video".', '请清空“继续二采”或“接着生成”其中一项。')), + (r'Extend from video cannot be used with these settings\. Connect up to 3 images', 'continuation-media', + ('An extended part takes image references only', '接续段只能用图片参考'), + ('Connect up to 3 images as references, and remove video, audio and pre-encoded inputs.', '最多接 3 张图片作为参考图,并移除视频、音频参考和预编码输入。')), (r'Choose an existing MP4 video using its absolute path', 'continuation-file', ('Choose the previous video', '请选择上一段视频'), ('Select an existing MP4 video generated by FreeVideo. In ComfyUI, keep it inside the output or input folder.', @@ -1043,6 +1045,11 @@ class names and errno, no text), when the message is that exception's str(); it ('The model download sources cannot be reached', '无法连接模型下载源'), ('Check your network or proxy, or change the source or connection mode, then retry.', '请检查网络或代理,或切换下载源、连接模式后重试。')), + # network.PackageResolutionError: every source answered that the versions do not fit this computer. + (r'Required packages cannot be installed on this computer', 'package-resolution', + ('No version of the required packages is available for this computer', '所需的软件包没有适用于这台电脑的版本'), + ('Switching the download source or connection mode gives the same result. Choose "Export report", then "Report a problem", and attach the report.', + '更换下载源或连接方式后结果相同。请先点击“导出报告”,再点击“提交问题”并附上报告。')), (r'Model download paused|unexpected-transfer-size|ConnectionError|ConnectTimeout|ReadTimeout|HTTP probe failed|Could not resolve host|SSL certificate|Every download source failed|All Git sources failed|All package sources failed|Python download failed on every route', 'download', ('Download interrupted', '下载中断了'), ('Check your network or change the source or connection mode in Settings → Downloads, then retry.', '检查网络,或在“设置 → 下载”中切换下载源、连接模式后重试。')), @@ -1156,6 +1163,11 @@ class names and errno, no text), when the message is that exception's str(); it if found: detail = ('检测到:%s' if zh else 'Detected: %s') % found[1] return dict(title=title[zh], detail=detail + '\n' + action[zh], action='', kind=kind) + if kind == 'package-resolution': + found = re.search(r'Required packages cannot be installed on this computer: ([^\r\n]+?)\.(?:\r?\n|$)', text) + if found: + detail = ('软件包:%s' if zh else 'Packages: %s') % found[1] + return dict(title=title[zh], detail=detail + '\n' + action[zh], action='', kind=kind) if kind == 'path-too-long': # A dependency folder Git cannot read is named, above the same next step. found = re.search(r'The path of the dependency folder (.+?) is too long for Git to read', text) @@ -1508,8 +1520,9 @@ def generation_failure(run, exit_code=None, *, repair=None): # Managed failures contain only the exact busy sentence and optional holder # diagnostics. Other output must never acquire a busy classification. busy_lines = [line for line in _read(run / 'generate.log', 8192).splitlines() if line.strip()] - if exit_code == 1 and busy_lines[:1] == [ENGINE_BUSY] \ - and all(line.startswith('Lock file open:') for line in busy_lines[1:]): + busy = exit_code == 1 and busy_lines[:1] == [ENGINE_BUSY] \ + and all(line.startswith('Lock file open:') for line in busy_lines[1:]) + if busy: lines.extend(busy_lines) # What the worker found when cuDNN refused its own files, ahead of the trace. explained = _runtime_explanation(report, REPAIR_MARK) @@ -1590,6 +1603,8 @@ def generation_failure(run, exit_code=None, *, repair=None): summary = _mac_run(report, run, redactor) if summary: lines.insert(1 + bool(promoted) + bool(encoder_missing), summary) + if isinstance(report.get('fast_tier'), dict) and not busy: + lines.append(FAST_MODE_FAILED) lines.append('\nRetained outputs: ' + str(run)) # The table failure can be in a retained child log rather than the report. # Keep its numeric metadata ahead of technical output for all interactive callers. diff --git a/freevideo_engine/fast_pack.json b/freevideo_engine/fast_pack.json new file mode 100644 index 00000000..da5f092f --- /dev/null +++ b/freevideo_engine/fast_pack.json @@ -0,0 +1,43 @@ +{ + "format": 2, + "repo": "BowenXue/FreeVideo-models", + "revision": "d11be6165138ad64cc0d018fd682817f07b7d26e", + "modelscope": "https://www.modelscope.cn/models/BowenXue/FreeVideo-models/resolve/master", + "license": "MiniMax H3 Community License", + "folder": "pi-h3", + "source": "Lakonik/pi-H3@4a864589", + "files": [ + { + "file": "pi-h3/NOTICE", + "bytes": 121, + "sha256": "154fe7fbdf198395d53c57d6786b2fbf7e63a083ff70843c5ef78c0c7303d91a" + }, + { + "file": "pi-h3/MODIFICATIONS.md", + "bytes": 997, + "sha256": "2cde40967ffec60e6786b45e7f3b005e482796c09b4da3ebe1c88b21c65bf8eb" + }, + { + "file": "pi-h3/README.md", + "bytes": 6852, + "sha256": "3ee60659913e5e1c64e221d92af613f74516fc8ee92fddba78a74592696de2e9" + }, + { + "file": "pi-h3/LICENSE.md", + "bytes": 18106, + "sha256": "1cc3d85fd45a893abae2c54cd5ce2eb792142a65132a035ea3ebb0c289ac2f89" + }, + { + "file": "pi-h3/pi_h3_adaln_constants.safetensors", + "bytes": 19435680, + "sha256": "7949a370323b2a15e13f2e9160cfb1325207cde21b2629643f390be3e32f690b", + "engine": true + }, + { + "file": "pi-h3/pi_h3_2step_dwd_adapter_int8_convrot.safetensors", + "bytes": 2192176240, + "sha256": "ef98527409eee4eaec8183265f4ee22d265680524237fae7149dbc203e11e739", + "engine": true + } + ] +} diff --git a/freevideo_engine/fast_pack.py b/freevideo_engine/fast_pack.py new file mode 100644 index 00000000..4117cc53 --- /dev/null +++ b/freevideo_engine/fast_pack.py @@ -0,0 +1,361 @@ +"""On-demand download of the Fast level's files into the model folder. + +Nothing here ships in the installer: the files are fetched when the level is first chosen. The catalog (`fast_pack.json`) +is the one list of files: it pins each one's size and sha256, and adding a file means adding a row. The level reads the +int8 build of the four-step pixel-output adapter (Lakonik/pi-H3@4a864589, unmodified) and the shared timestep constants. +A row whose `revision` is null is not on our copies yet: it is never fetched, and the level stays unavailable until it is. A row may name its own `repo`, `revision` and `modelscope` copy, and a +`target` under the model folder when that differs from `file`. The licence and notes are fetched before the weights. The transfer is the image pack's: the measured source order, the user's +download source and proxy settings (our ModelScope copy or the same files on Hugging Face), resumable partials and +sha256 checks. +""" +import json +from pathlib import Path, PurePosixPath +import re +import threading +import time + +from . import disk_space +from .long_paths import io_path +from .swap_lora import PackError + +RESERVE = 256 * 2**20 +MISSING = 'FAST_MODE_FILES_MISSING: ' +# The receipt beside the files: what each one was when its sha256 last matched (size, times, file id). A file whose identity +# is unchanged is not hashed again; one that changed is checked again before it counts. +LEDGER = 'download-verified.json' +# A copy that did not pass, as network.retain_partial and its rejections name it: [.partial].-, +# with the reasons they use and nothing else, so a name such as weights.bin.backup-1 is never taken for one. +FAILED = re.compile(r'(?:\.partial)?\.(?:rejected|hash-rejected|oversized|oversized-response|resume-unavailable|restart-approved)' + r'-[0-9]{16,20}') + + +def catalog(): + return json.loads(Path(__file__).with_name('fast_pack.json').read_text(encoding='utf-8')) + + +def rows(spec=None): + """The catalog rows, in the order they are fetched (the licence and notes before the weights).""" + return list((spec or catalog())['files']) + + +def model_folder(): + from .paths import installed_model_root + return installed_model_root() + + +def remote(spec, row): + """One catalog file on our ModelScope copy (its branch; the sha256 pins it) or the pinned Hugging Face revision.""" + from .network import source_url + repo, revision = row.get('repo', spec['repo']), row.get('revision', spec['revision']) + if revision is None: + raise ValueError('Not on our copies yet: ' + row['file']) + # A row from another repository has a ModelScope copy only if it names one. + copy = row.get('modelscope') if 'repo' in row else row.get('modelscope', spec['modelscope']) + path = '/%s/resolve/%s/%s' % (repo, revision, row['file']) + sources = [dict(id='modelscope', url=copy + '/' + row['file'])] if copy else [] + sources.append(dict(id='official', url=source_url('models', 'official') + path)) + return dict(repo=repo, revision=revision, file=row['file'], family='image', + sha256=row['sha256'], bytes=row['bytes'], sources=sources) + + +def _target(root, row): + """Where a row's file lives under the model folder; a catalog row never leaves it.""" + name = PurePosixPath(row.get('target', row['file'])) + if name.is_absolute() or '..' in name.parts: + raise ValueError('Invalid catalog path') + return Path(root) / name + + +def _ours(spec, row): + """Whether the file lies in this pack's own folder; a file elsewhere belongs to the rest of the installation.""" + return PurePosixPath(row.get('target', row['file'])).parts[0] == spec['folder'] + + +def _in_place(root, row): + path = _target(root, row) + return path.is_file() and path.stat().st_size == row['bytes'] + + +def published(spec=None): + """Whether every file is on our copies: a page that sees False does not offer the level at all.""" + spec = spec or catalog() + return all(row.get('revision', spec['revision']) is not None for row in rows(spec)) + + +def _ledger_path(root, spec): + return Path(root) / spec['folder'] / LEDGER + + +def _ledger(root, spec, *, retain=False): + """The receipt; a damaged one reads as empty. Only an install renames a damaged one aside (``retain``): reading the + state leaves the folder as it is.""" + from .monitoring import load_ledger + return load_ledger(_ledger_path(root, spec), retain=retain) + + +def _identity(path, row): + from .storage import fingerprint + return dict(fingerprint(path), sha256=row['sha256']) + + +def _receipted(root, row, ledger): + """There at its size, and the same file the receipt says passed its sha256.""" + path = _target(root, row) + try: + return _in_place(root, row) and ledger.get(row['file']) == _identity(path, row) + except (OSError, ValueError): + return False + + +def _receive(root, spec, ledger, row): + """Note a file that has just passed its sha256.""" + from .monitoring import save + try: + ledger[row['file']] = _identity(_target(root, row), row) + save(_ledger_path(root, spec), ledger) + except (OSError, ValueError): + pass # without a receipt it is only hashed once more + + +def failed_copies(path): + """The copies of one catalog file that did not pass, newest first.""" + path = Path(path) + found = [] + try: + entries = list(path.parent.iterdir()) + except OSError: + return [] + for entry in entries: + rest = entry.name[len(path.name):] if entry.name.startswith(path.name) else '' + if rest and FAILED.fullmatch(rest) and entry.is_file() and not entry.is_symlink(): + found.append((int(rest.rsplit('-', 1)[1]), entry)) + return [entry for _, entry in sorted(found, key=lambda item: item[0], reverse=True)] + + +def prune_failed(root, spec, row, keep): + """Keep at most `keep` failed copies of one of this pack's files (the newest, for diagnosis): one while it is not + in place, none once it is. Nothing but this catalog's own names in its own folder is touched.""" + if not _ours(spec, row): + return + for entry in failed_copies(_target(root, row))[keep:]: + try: + entry.unlink() + except OSError: + pass + + +def missing_bytes(root, spec=None): + """The bytes a download would fetch now: every row not there at its size as the receipt knows it.""" + spec = spec or catalog() + root = io_path(root) + ledger = _ledger(root, spec) + return sum(row['bytes'] for row in rows(spec) if not _receipted(root, row, ledger)) + + +def present(root, spec=None): + """Whether the files the engine reads are the ones that passed their sha256, unchanged since (the receipt). + + The licence and notes are fetched with them, and nothing depends on reading them. + """ + spec = spec or catalog() + root = io_path(root) + ledger = _ledger(root, spec) + return all(_receipted(root, row, ledger) for row in rows(spec) if row.get('engine')) + + +def files(root=None, spec=None): + """{file name in the catalog: path} of what the engine reads, each there at its pinned size; otherwise the error the + page knows by its FAST_MODE_FILES_MISSING: prefix, naming what is missing or incomplete.""" + spec = spec or catalog() + root = io_path(root if root is not None else model_folder()) + ledger = _ledger(root, spec) + found, absent = {}, [] + for row in rows(spec): + if not row.get('engine'): + continue + path = _target(root, row) + there = _receipted(root, row, ledger) + if not there and _intact(path, row, lambda: None): # changed since its receipt: checked again before it counts + _receive(root, spec, ledger, row) + there = True + if there: + found[row['file']] = path + else: + absent.append(row['file']) + if absent: + raise FileNotFoundError(MISSING + 'install the fastest mode files (missing or incomplete: ' + ', '.join(absent) + ')') + return found + + +def _intact(path, row, check): + from .depth_reference import digest + try: + return path.is_file() and path.stat().st_size == row['bytes'] and digest(path, check) == row['sha256'] + except OSError: + return False + + +def _partial(path): + return path.with_name(path.name + '.partial') + + +def install(root, progress=None, check=None, *, engine_root=None, spec=None): + """Fetch what is missing into root; a file that is not the pinned one is kept under another name.""" + from . import network + from .image_gen.image_pack import PackError as TransferError, _download_plan, _transfer + from .failure_details import image_pack_error_code + from .locking import runtime_lock + from .paths import data_root + spec = spec or catalog() + progress = progress or (lambda value: None) + check = check or (lambda: None) + root = io_path(root) + try: + lock_root = Path(engine_root) if engine_root is not None else data_root() + with runtime_lock(lock_root / 'fast-pack-download.lock', inherit=False): + ledger = _ledger(root, spec, retain=True) + todo = [] + for row in rows(spec): + check() + path = _target(root, row) + if _receipted(root, row, ledger) or _intact(path, row, check): + if not _receipted(root, row, ledger): + _receive(root, spec, ledger, row) + prune_failed(root, spec, row, 0) # the right copy is here: the failed ones go + continue + if path.exists() or path.is_symlink(): + # Another feature's file is never moved: a different copy there stops the download. + if not _ours(spec, row): + raise PackError('integrity_failed') + network.retain_partial(path, 'rejected') + prune_failed(root, spec, row, 1) # at most the newest failed copy stays while it is not in place + todo.append(row) + if not todo: + return 'present' + if any(row.get('revision', spec['revision']) is None for row in todo): + raise PackError('not_published') # nothing is fetched from anywhere but our copies + root.mkdir(parents=True, exist_ok=True) + total = sum(row['bytes'] for row in todo) + retained = sum(min(_partial(_target(root, r)).stat().st_size, r['bytes']) + for r in todo if _partial(_target(root, r)).is_file()) + if disk_space.free_bytes(root) < total - retained + RESERVE: + raise PackError('disk_space') + plan = _download_plan(engine_root) + plan.update(quiet=True, resource_check=check) + done = 0 + progress(dict(done=0, total=total)) + for row in todo: + check() + path = _target(root, row) + path.parent.mkdir(parents=True, exist_ok=True) + + def moved(current, size, speed, **kwargs): + progress(dict(done=done + current, total=total)) + check() + try: + _transfer(plan, remote(spec, row), path, moved, check) + finally: + if not path.is_file(): + prune_failed(root, spec, row, 1) # each failed copy is the whole file: one is enough to look at + _receive(root, spec, ledger, row) # network.download checked its sha256 before naming it + prune_failed(root, spec, row, 0) + # The record of which source the partial came from is only for resuming it. + _partial(path).with_name(path.name + '.partial.source.json').unlink(missing_ok=True) + done += row['bytes'] + progress(dict(done=done, total=total)) + return 'installed' + except (PackError, InterruptedError): + raise + except TransferError as error: + raise PackError(error.reason) from error + except BlockingIOError as error: + raise PackError('busy') from error + except Exception as error: + raise PackError(image_pack_error_code(error)) from error + + +class Installer: + """One background download at a time; the page polls `status()`.""" + + def __init__(self, root=None, engine_root=None): + self.root, self.engine_root = root or model_folder, engine_root + self.lock = threading.Lock() + self.stop = threading.Event() + self.thread = None + self.value = dict(state='idle', done=0, total=0, reason=None) + + def state(self): + with self.lock: + return dict(self.value) + + def _set(self, **kwargs): + with self.lock: + self.value.update(kwargs) + + def status(self): + spec = catalog() + root = self.root() + return dict(bytes=missing_bytes(root, spec), present=present(root, spec), published=published(spec), install=self.state()) + + def start(self): + with self.lock: + if self.thread is not None and self.thread.is_alive(): + return dict(self.value) + self.stop = threading.Event() + self.value = dict(state='running', done=0, total=0, reason=None, started=time.time()) + self.thread = threading.Thread(target=self._run, args=(self.stop,), name='freevideo-fast-pack', daemon=True) + self.thread.start() + return dict(self.value) + + def cancel(self): + self.stop.set() + return self.state() + + def _run(self, stop): + def check(): + if stop.is_set(): + raise InterruptedError('cancelled') + + def progress(value): + self._set(done=value.get('done', 0), total=value.get('total', 0)) + try: + install(self.root(), progress, check, engine_root=self.engine_root) + self._set(state='done', reason=None) + except InterruptedError: + self._set(state='cancelled', reason=None) + except PackError as error: + self._set(state='failed', reason=error.reason) + except Exception: + self._set(state='failed', reason='failed') + + +def register(): + """GET /freevideo/fast-pack: whether the files are in place and the download state; POST {action: install|cancel}.""" + import asyncio + from aiohttp import web + from server import PromptServer + server = PromptServer.instance + if server is None or getattr(server, '_freevideo_fast_pack', None) is not None: + return + installer = server._freevideo_fast_pack = Installer() + + def reply(value, status=200): + return web.json_response(value, status=status, headers={'Cache-Control': 'no-store'}) + + @server.routes.get('/freevideo/fast-pack') + async def fast_pack_status(request): + return reply(await asyncio.to_thread(installer.status)) + + @server.routes.post('/freevideo/fast-pack') + async def fast_pack_install(request): + try: + body = await request.json() + if not isinstance(body, dict) or set(body) != {'action'} or body['action'] not in ('install', 'cancel'): + raise ValueError('Invalid request') + except (ValueError, TypeError): + return reply({'reason': 'failed'}, 400) + if body['action'] == 'cancel': + installer.cancel() + elif not (await asyncio.to_thread(installer.status))['present']: + installer.start() + return reply(await asyncio.to_thread(installer.status)) diff --git a/freevideo_engine/fast_tier.py b/freevideo_engine/fast_tier.py new file mode 100644 index 00000000..717e0716 --- /dev/null +++ b/freevideo_engine/fast_tier.py @@ -0,0 +1,168 @@ +"""The fastest sampling mode: pi-H3's two-step no-decode adapter on the installed int8 weights. + +fast2 is a single pass of two steps whose pixels come from the adapter's own head on +the last step, so the video VAE is not loaded; the sound still goes through the audio +VAE. Nothing is merged into the installed weights: the adapter's low-rank factors go +through the online LoRA folder, and its output heads, 8-dimensional modulation and the +whole matrices it replaces in the last four blocks change the Engine's in memory only +(fast_tier_runtime). The pixel head runs after sampling (dwd_head). + +The adapter was trained for sigmas 0.99377, 0.86534 and 0 on plain H3. +Using it on VDN is outside what its authors trained or support. + +This module imports no Torch unless it runs as the adapter-preparation child. +""" +import argparse +import json +from pathlib import Path +import stat +import sys + +from .long_paths import io_path + +MODES = ('fast2',) +FOLDER = 'pi-h3' +ADAPTER = 'pi_h3_2step_dwd_adapter_int8_convrot.safetensors' +CONSTANTS = 'pi_h3_adaln_constants.safetensors' +FILES = { + ADAPTER: (2192176240, 'ef98527409eee4eaec8183265f4ee22d265680524237fae7149dbc203e11e739'), + CONSTANTS: (19435680, '7949a370323b2a15e13f2e9160cfb1325207cde21b2629643f390be3e32f690b'), +} +MISSING = 'FAST_MODE_FILES_MISSING: ' +# The adapter's points before the video (12) or audio (3) shift: max_raw_t 0.93, one step +# of 0.93 / 1.6 and a last one to 0, as published with the adapter. +RAW_GRID = (.93, .93 - .93 / 1.6, 0.) +STEPS = len(RAW_GRID) - 1 + + +def files(model_root): + """{relative name: path ready for I/O} after checking each file's published size. + + Only a file that is not there, or has another size, counts as missing. Any other + failure to read it is reported with its own reason. + """ + root = io_path(Path(model_root) / FOLDER) + found, absent = {}, [] + for name, (size, _) in FILES.items(): + path = root / name + try: + info = path.stat() + except (FileNotFoundError, NotADirectoryError): + absent.append(name) + continue + except OSError as error: + raise OSError(error.errno, 'Could not read the fastest mode file %s: %s' + % (name, error.strerror or error)) from error + if stat.S_ISREG(info.st_mode) and info.st_size == size: + found[name] = path + else: + absent.append(name) + if absent: + raise FileNotFoundError(MISSING + 'install the fastest mode files (missing or incomplete: ' + + ', '.join(absent) + ')') + return found + + +def request(args): + """Check a generate command at its entry and set its steps; None without --fast-mode.""" + mode = getattr(args, 'fast_mode', None) + if mode is None: + return None + if mode not in MODES: + raise ValueError('Fast mode must be one of ' + ', '.join(MODES)) + if sys.platform == 'darwin': + raise ValueError('The fastest mode is not available on Mac') + for name, label in (('continue_from', 'a continued part'), ('continue_anchor', 'a continued part'), + ('preview', 'a preview'), ('refine_from', 'finishing a preview'), + ('upscale_from', 'an upscale'), ('redo_sound', 'redoing the sound'), + ('step_cache', 'a step cache')): + if getattr(args, name, None) not in (None, False, 'none'): + raise ValueError('The fastest mode cannot be used with ' + label) + if getattr(args, 'upscale_factor', None) not in (None, 2): + raise ValueError('The fastest mode uses the 2x upscale') + from .paths import installed_model_root + paths = files(installed_model_root()) + args.base_steps = STEPS + args.two_pass = False + args.refine_steps = 3 + return dict(mode=mode, adapter=str(paths[ADAPTER]), constants=str(paths[CONSTANTS]), + adapter_sha256=FILES[ADAPTER][1], constants_sha256=FILES[CONSTANTS][1]) + + +def bridge_steps(mode, *, preview=False, refine_from=None, continue_from=None, upscale_from=None, step_cache=None, + upscale_factor=2, parts=1): + """(two_pass, base_steps, refine_steps) of a queued request, refused before anything is loaded.""" + if mode not in MODES: + raise ValueError('Fast mode must be one of ' + ', '.join(MODES)) + for value, label in ((preview, 'a preview'), (refine_from, 'finishing a preview'), + (continue_from, 'a continued part'), (upscale_from, 'an upscale'), + (step_cache not in (None, 'none'), 'a step cache'), (upscale_factor != 2, 'another upscale factor'), + (parts > 1, 'a video made in parts')): + if value: + raise ValueError('The fastest mode cannot be used with ' + label) + return False, STEPS, 3 + + +def adapter_row(spec): + """The adapter as the first row of the online LoRA request.""" + return dict(path=spec['adapter'], sha256=spec['adapter_sha256'], bytes=FILES[ADAPTER][0], + strength=1., alpha=None, only_factors=True) + + +def factor_patches(row, targets): + """The adapter's low-rank pairs. Its whole tensors are applied by fast_tier_runtime. + + The INT8 file names its layers the original way (blocks.N.mlp.fc1, ...); the shared + LoRA name rules map them and swap fc1's [gate; value] halves, as for any such LoRA. + """ + from .lora_names import _targets, resolve_target + from .tensor_io import open_tensors + suffix = '.lora_A.weight' + result = [] + with open_tensors(row['path']) as source: + for key in source.keys(): + if not key.endswith(suffix): + continue + other = key[:-len(suffix)] + '.lora_B.weight' + ((name, split, swap),) = _targets(key[:-len(suffix)]) + target = resolve_target(name, targets) + a, b = source.get_slice(key).get_shape(), source.get_slice(other).get_shape() + if target not in targets or targets[target]['shape'] != [b[0], a[1]] or a[0] != b[1]: + raise ValueError('The fastest mode adapter does not fit this model: ' + target) + if split is not None: + raise ValueError('The fastest mode adapter has a fused projection: ' + key) + result.append(dict(A=key, B=other, target=target, split=None, swap=swap, + scale=float(row['strength']), file=row['path'])) + if not result: + raise ValueError('The fastest mode adapter has no low-rank factors') + return result + + +def main(): + """The LoRA preparation child for a fast request. + + The folder identity hashes lora_cache.py and lora_online_cache.py, so a change + there would rebuild every installed LoRA folder. Only this process indexes the + adapter row differently; user LoRA rows take the existing route. + """ + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--request', required=True, type=Path) + args = parser.parse_args() + value = json.loads(args.request.read_text(encoding='utf-8')) + if value.get('mode') != 'online': + raise ValueError('The fastest mode needs the online LoRA placement') + import torch + from . import lora_online_cache as online + from .monitoring import save + torch.set_num_threads(8) + existing = online.index_adapter + + def index_adapter(row, targets, skipped=None): + return factor_patches(row, targets) if row.get('only_factors') else existing(row, targets, skipped) + online.index_adapter = index_adapter + output, report = online.prepare(value['cache'], value['adapters']) + save(value['result'], {'cache': str(output), 'report': report}) + + +if __name__ == '__main__': + main() diff --git a/freevideo_engine/fast_tier_runtime.py b/freevideo_engine/fast_tier_runtime.py new file mode 100644 index 00000000..13f7a0f9 --- /dev/null +++ b/freevideo_engine/fast_tier_runtime.py @@ -0,0 +1,245 @@ +"""The fastest mode's output heads, modulation and replaced matrices, installed on one Engine's model. + +Only that Engine's in-memory modules change; the weight files and every other +Engine are untouched. Modulation follows the 8-dimensional form of the pruned H3: +a time coordinate interpolated from a 1025-row table, a projection and a bias. +The adapter also replaces three whole matrices in each of the last four blocks, and +on the last step its features are kept for the pixel head (dwd_head), which runs +after the transformer is released. +""" +import hashlib +import re +import types + +import torch + +from .fast_tier import ADAPTER, CONSTANTS, FILES, files +from .paths import installed_model_root +from .tensor_io import open_tensors + + +class Clock(torch.nn.Module): + """The time coordinates of the current forward, shared by every block.""" + + def __init__(self, table): + super().__init__() + self.register_buffer('table', table) + self.coordinates = None + self.output = None + + def set(self, timestep): + table = self.table + position = timestep.to(table.device).float().clamp(0., 1.) * (len(table) - 1) + lower = position.floor().long().clamp(max=len(table) - 2) + self.coordinates = torch.lerp(table[lower], table[lower + 1], (position - lower).unsqueeze(1)) + self.output = None + + +class Modulation(torch.nn.Module): + """One block's six modulation vectors. Buffers are named like the table steps they replace.""" + + def __init__(self, clock, weight, bias): + super().__init__() + object.__setattr__(self, 'clock', clock) # shared: owned by the model, not by each block + self.register_buffer('step_weight', weight) + self.register_buffer('step_bias', bias) + + def forward(self, temb): + values = (self.clock.coordinates @ self.step_weight.t() + self.step_bias).to(torch.bfloat16) + return values.view(-1, values.shape[-1] // 3).chunk(6, dim=-1) + + +def _rotate256(x): + """The group-256 Hadamard of the ConvRot files (its own inverse): kron(H4, H4) / 4 on each 16x16 group.""" + h4 = torch.tensor([[1, 1, 1, -1], [1, 1, -1, 1], [1, -1, 1, 1], [-1, 1, 1, 1]], dtype=torch.float32) + h = torch.kron(h4, h4) / 4 + groups = x.reshape(x.shape[0], -1, 16, 16) + return (h @ groups @ h).reshape(x.shape) + + +def _diffusers_name(key): + key = re.sub(r'^blocks\.(\d+)\.attn\.out_proj\.', r'transformer_blocks.\1.attn.to_out.0.', key) + key = re.sub(r'^blocks\.(\d+)\.mlp\.fc1\.', r'transformer_blocks.\1.ff.net.0.proj.', key) + key = re.sub(r'^blocks\.(\d+)\.mlp\.fc2\.', r'transformer_blocks.\1.ff.net.2.', key) + key = re.sub(r'^blocks\.(\d+)\.adaln_proj\.', r'transformer_blocks.\1.adaln_proj.', key) + return (key.replace('final_layer.adaln_proj.linear.', 'norm_out.linear.').replace('final_layer.norm.weight', 'norm_out.norm.weight') + .replace('final_layer.video_out.', 'proj_out.').replace('final_layer.audio_out.', 'audio_proj_out.')) + + +def adapter_tensors(path, wanted): + """{diffusers name: tensor} of the adapter file for the names wanted(name) accepts. + + The INT8 ConvRot file names layers the original way and stores 44 matrices as int8 + with a per-row scale after the group-256 rotation; they come back as float16 (rows + rotated back, fc1's halves in the diffusers [value; gate] order). Every other tensor + in it is the BF16 file's, byte for byte. The low-rank factors are not read here. + """ + out = {} + with open_tensors(path) as source: + for key in source.keys(): + if key.endswith('.comfy_quant') or key.endswith('.weight_scale') or '.lora_' in key: + continue + name = _diffusers_name(key) + if not wanted(name): + continue + value = source.get_tensor(key) + if value.dtype == torch.int8: + value = _rotate256(value.float() * source.get_tensor(key + '_scale').float().reshape(-1, 1)).to(torch.float16) + if '.mlp.fc1.' in key: + half = value.shape[0] // 2 + value = torch.cat((value[half:], value[:half])) + out[name] = value + return out + + +# Whole matrices the adapter replaces: (its name, the module in a hybrid block). +REPLACED = (('attn.to_out.0', 'attn.orig.to_out.0'), ('ff.net.0.proj', 'ff.net.0.proj'), ('ff.net.2', 'ff.net.2')) + + +class Features: + """The last step's features for the pixel head: the final block's video rows, layer-normed and modulated.""" + + def __init__(self, clock, weight, bias, steps): + self.clock, self.weight, self.bias, self.steps = clock, weight, bias, steps + self.grid, self.count, self.hidden, self.value = None, 0, None, None + + def begin(self, grid): + self.grid, self.count, self.hidden, self.value = grid, 0, None, None + + def keep_hidden(self, _module, _args, output): + self.hidden = output + + def after_forward(self, _module, _args, kwargs, _output): + self.count += 1 + hidden, self.hidden = self.hidden, None + if self.count < self.steps or self.grid is None: + return + hidden = hidden if torch.is_tensor(hidden) else hidden[0] + hidden = hidden[0] if hidden.dim() == 3 else hidden + rows = kwargs['video_indices'] + rows = rows[-self.grid[0] * self.grid[1] * self.grid[2]:] # conditioning rows come first + # The DWD norm takes the SiLU of the time coordinate, as in the measured runs. + scale, shift = (torch.nn.functional.silu(self.clock.coordinates) @ self.weight.t() + self.bias).to( + torch.bfloat16).chunk(2, dim=-1) + steps = kwargs['timestep_indices'][rows] + picked = hidden[rows] + normed = torch.nn.functional.layer_norm(picked.float(), (picked.shape[-1],), None, None, 1e-5).to(torch.bfloat16) + value = normed * (1. + scale[steps]) + shift[steps] + # Off the GPU, so the transformer can be released before the head runs. + self.value = value.to('cpu') + self.count = 0 + + def take(self): + value, grid, self.value = self.value, self.grid, None + if value is None: + raise RuntimeError('The fastest mode kept no features for its pixel head') + return value, grid + + +class ReplacedLinear(torch.nn.Module): + """One of the adapter's whole matrices, held outside the module's parameters and buffers. + + The block's own weights may be pinned, uploaded or streamed from the prepared files; + these matrices are not in those files, so the offloader must not see them. On a + resident block the weight lives on the GPU; on a streamed block it stays in pinned + host memory and goes up for each call, one matrix at a time. + """ + + def __init__(self, weight): + super().__init__() + self.in_features, self.out_features = weight.shape[1], weight.shape[0] + object.__setattr__(self, 'held', weight) + + def forward(self, x): + weight = self.held if self.held.device == x.device else self.held.to(x.device, non_blocking=True) + return torch.nn.functional.linear(x, weight) + + +class Runtime: + def __init__(self, device): + # Resolved here so that requests and reports carry the mode and no local path. + paths = files(installed_model_root()) + self.device, self.adapter = device, paths[ADAPTER] + constants = paths[CONSTANTS] + if hashlib.sha256(constants.read_bytes()).hexdigest() != FILES[CONSTANTS][1]: + raise ValueError('The fastest mode constants file changed') + with open_tensors(constants) as source: + self.bias = {key: source.get_tensor(key).float() for key in source.keys() if key.endswith('folded_bias')} + table = source.get_tensor('time_embedder.table').float() + self.clock = Clock(table.to(device)) + # Read once: opening the file for each of the fifty blocks is slow on Windows. + names = {f'transformer_blocks.{index}.{name}.weight' for index in range(50) for name, _ in REPLACED} + root = {'proj_out.weight', 'proj_out.bias', 'audio_proj_out.weight', 'audio_proj_out.bias', 'norm_out.norm.weight', + 'norm_out.linear.weight', 'norm_out.linear.bias', 'dwd_norm_out.linear.weight', 'dwd_norm_out.linear.bias'} + tensors = adapter_tensors(self.adapter, lambda name: name in names or name in root or ( + name.startswith('transformer_blocks.') and '.adaln_proj.linear.' in name)) + self.weights = {key: value.float().to(device) for key, value in tensors.items() if key.endswith('.adaln_proj.linear.weight')} + # The two-step adapter brings its own modulation bias for its last four blocks; it wins over the folded one. + self.own_bias = {key: value.float() for key, value in tensors.items() + if key.startswith('transformer_blocks.') and key.endswith('.adaln_proj.linear.bias')} + self.matrices = {key: value for key, value in tensors.items() if key in names} + self.root = {key: value for key, value in tensors.items() if key in root} + self.features = Features(self.clock, self.root['dwd_norm_out.linear.weight'].float().to(device), + self.root['dwd_norm_out.linear.bias'].float().to(device), None) + + def modulation(self, index): + prefix = f'transformer_blocks.{index}.adaln_proj.' + folded = self.bias.pop(prefix + 'folded_bias') + bias = self.own_bias.pop(prefix + 'linear.bias', folded) + return Modulation(self.clock, self.weights.pop(prefix + 'linear.weight'), bias.to(self.device)) + + def replace_matrices(self, index, block, resident): + """This block's whole matrices from the adapter (BF16, no bias, as in H3). None for most blocks. + + resident: the block is uploaded to the GPU (the matrices go there too); otherwise + they wait in pinned host memory. + """ + replaced = 0 + for name, module_name in REPLACED: + weight = self.matrices.pop(f'transformer_blocks.{index}.{name}.weight', None) + if weight is None: + continue + parent, _, leaf = module_name.rpartition('.') + weight = weight.to(torch.bfloat16) + weight = weight.to(self.device) if resident else (weight.pin_memory() if torch.cuda.is_available() else weight) + layer = ReplacedLinear(weight) + owner = block.get_submodule(parent) + if leaf.isdigit(): + owner[int(leaf)] = layer + else: + setattr(owner, leaf, layer) + replaced += 1 + return replaced + + def install_root(self, model): + device = self.device + source = self.root + for name in ('proj_out', 'audio_proj_out'): + module = getattr(model, name) + for part in ('weight', 'bias'): + parameter = getattr(module, part) + parameter.data = source[f'{name}.{part}'].to(device, parameter.dtype) + norm = model.norm_out + norm.norm.weight.data = source['norm_out.norm.weight'].to(device, norm.norm.weight.dtype) + norm.register_buffer('fast_weight', source['norm_out.linear.weight'].float().to(device)) + norm.register_buffer('fast_bias', source['norm_out.linear.bias'].float().to(device)) + self.root = None + norm.linear = torch.nn.Identity() # the 2688-dimensional projection this replaces + clock = self.clock + + def forward(module, hidden, temb, indices): + if clock.output is None: + clock.output = (clock.coordinates @ module.fast_weight.t() + module.fast_bias).to( + torch.bfloat16).chunk(2, dim=-1) + shift, scale = clock.output + hidden = module.norm(hidden) + return hidden * (1. + scale.index_select(0, indices)) + shift.index_select(0, indices) + norm.forward = types.MethodType(forward, norm) + model.add_module('fast_clock', clock) + model.register_forward_pre_hook(lambda _, args, kwargs: clock.set(kwargs['timestep']), with_kwargs=True) + + def install_features(self, model, steps): + """Keep the last step's features; registered after the root so the clock is set first.""" + self.features.steps = steps + model.transformer_blocks[-1].register_forward_hook(self.features.keep_hidden) + model.register_forward_hook(self.features.after_forward, with_kwargs=True) diff --git a/freevideo_engine/feedback.py b/freevideo_engine/feedback.py index 66befc15..a5911220 100644 --- a/freevideo_engine/feedback.py +++ b/freevideo_engine/feedback.py @@ -5,15 +5,55 @@ """ import json import re +from functools import lru_cache +from pathlib import Path +from urllib.parse import urlsplit from .exit_diagnostics import OWN_MEMORY_KEYS +from .long_paths import AUTHORIZATION, EMAIL # The summary travels in a GitHub page address, which has to stay short. MAX_DIAGNOSTICS = 3000 # Anything that looks like a file location or a long secret-like token is replaced. -# A location may contain spaces, so it is removed to the end of the line or quote. -PATH = re.compile(r'(?:[A-Za-z]:[\\/]|\\\\|~[\\/])[^\'"<>|\r\n]+|(?|\r\n]+)+') +# A location may contain spaces, so it is removed to the end of the line or quote, except what follows +# a file name in its last part: "C:\\Users\\...\\x.exe rename denied" keeps "rename denied". A drive +# letter is not the end of a word ("http://..." is no drive "p:"). +# A file URL first (file:///home/..., file://localhost/C:/..., %-escaped): its slashes would not start a path below. +PATH = re.compile(r'''(?]*)?(?:/+|(?=[A-Za-z]:[\\/]))[^'"<>|\r\n]*''' + r'|(?:(?|\r\n]+|(?|\r\n]+)+') +AFTER_FILE_NAME = re.compile(r'\.[A-Za-z0-9]{1,8}(?=[\s:,;)])') +USER_FOLDERS = ('users', 'home', 'documents and settings') TOKEN = re.compile(r'\b[A-Za-z0-9_\-]{32,}\b') +# A web address loses its user, password, query and fragment. On a public download host FreeVideo uses +# (public_hosts) it keeps its path, which names the file that failed; on any other host, or an IP +# address (replaced too), only the scheme, host and port stay. The reason after it stays as well. +URL = re.compile(r'''\b(?P[A-Za-z][A-Za-z0-9+.-]*://)(?P[^\s/?#'"<>]*)(?P[^\s'"<>]*)''') +IP_HOST = re.compile(r'^(?:\[[^\]]*\]|\d{1,3}(?:\.\d{1,3}){3})(?=:\d+$|$)') +# One pass, so a path inside a kept address ("/-/binary/...") is not taken for a local one. +PLACE = re.compile(PATH.pattern + '|' + URL.pattern) +# The shipped files that name download addresses and repositories; their hosts are public_hosts. +DOWNLOAD_CONFIGS = ('bootstrap_versions.json', 'curl_windows.json', 'dependencies.json', 'depth_reference_model.json', + 'frame_preview_weights.json', 'frame_upscale_model.json', 'gcc_linux.json', 'git_linux.json', + 'git_macos.json', 'macos_reference_catalog.json', 'model_files.json', 'model_shares.json', + 'prepared_models.json', 'rife_interp_model.json', 'subtitle_pack.json', 'swap_lora.json', + 'torch_downloads.json', 'uv_downloads.json', 'windows_arm64.json') +# Hosts that keep anyone's repositories, shares or channels: the first part of a path there is usually +# its owner's name, so only the repositories FreeVideo itself uses (own_repositories: "owner/name", or the +# channel alone on conda.anaconda.org, after the parts the host puts before it; "x.git" is "x") keep +# their path. Package hosts (pypi.org, files.pythonhosted.org, +# download.pytorch.org ...) hold public packages only and keep any path. +REPOSITORY_HOSTS = { + 'huggingface.co': r'(?:api/)?(?:models/|datasets/|spaces/)?', + 'hf-mirror.com': r'(?:api/)?(?:models/|datasets/|spaces/)?', + 'modelscope.cn': r'(?:api/v1/)?(?:models/|datasets/)?', + 'www.modelscope.cn': r'(?:api/v1/)?(?:models/|datasets/)?', + 'github.com': '', + 'api.github.com': r'(?:repos/)?', + 'ghfast.top': r'(?:https?:/+github\.com/)?', + 'pan.quark.cn': '', + 'conda.anaconda.org': '', +} +ONE_PART_HOSTS = frozenset(('conda.anaconda.org',)) HARDWARE_KEYS = ('gpu_name', 'vram_total', 'ram_total', 'system', 'architecture', 'driver_version', 'torch_version', 'cuda_version') @@ -22,8 +62,110 @@ MEMORY_KEYS = ('physical_available_bytes', 'commit_available_bytes', 'available_bytes', 'total_bytes') +def _place(match): + value = match.group(0) + parts = re.split(r'[\\/]', value) + last = parts[-1] + # The last part right under the users' folders is a user's own folder: its name may hold a dot and a + # space ("J.R Smith") and goes as a whole. + name = None if len(parts) > 1 and parts[-2].lower() in USER_FOLDERS else AFTER_FILE_NAME.search(last) + return '' + (value[len(value) - len(last) + name.end():] if name else '') + + +@lru_cache(maxsize=1) +def _shipped(): + """The download addresses FreeVideo names and the repository values ("owner/name") of its configuration.""" + addresses, repositories = [], [] + try: + from . import network + addresses += [url for table in network.SOURCES.values() for url in table.values()] + addresses += list(network.PYTHON_MIRRORS.values()) + except Exception: + pass + try: + from . import launcher_update + addresses += [launcher_update.MIRROR_BASE, launcher_update.API, launcher_update.WEB] + repositories.append(launcher_update.REPOSITORY) + except Exception: + pass + + def walk(value, key=''): + if isinstance(value, dict): + for name, item in value.items(): + walk(item, str(name)) + elif isinstance(value, list): + for item in value: + walk(item, key) + elif isinstance(value, str) and 'repo' in key.lower() and re.fullmatch(r'[\w.-]+/[\w.-]+', value): + repositories.append(value) + for name in DOWNLOAD_CONFIGS: + try: + text = (Path(__file__).parent / name).read_text(encoding='utf-8') + addresses += re.findall(r'''https?://[^\s"'<>\\]+''', text) + walk(json.loads(text)) + except (OSError, ValueError, RecursionError): + continue + return tuple(addresses), tuple(repositories) + + +def _host(address): + try: + host = urlsplit(address).hostname + except ValueError: + return None + return host.lower() if host and not IP_HOST.match(host) else None + + +@lru_cache(maxsize=1) +def public_hosts(): + """The public hosts FreeVideo downloads from: the download sources and mirrors, the release hosts and + every host in the shipped download configuration. A host that cannot be read is simply not on it.""" + return frozenset(filter(None, map(_host, _shipped()[0]))) + + +def _repository(host, path): + """"owner/name" (a channel on a one-part host) of an address's path on a repository host, or None.""" + parts = r'([^/]+)' if host in ONE_PART_HOSTS else r'([^/]+/[^/]+)' + found = re.match(r'/*' + REPOSITORY_HOSTS[host] + parts, path, flags=re.IGNORECASE) + return _repository_name(found.group(1)) if found else None + + +def _repository_name(value): + return re.sub(r'\.git$', '', value.lower()) + + +@lru_cache(maxsize=1) +def own_repositories(): + """The repositories, shares and channels FreeVideo itself uses on the repository hosts.""" + addresses, repositories = _shipped() + own = {_repository_name(value) for value in repositories} + for address in addresses: + host = _host(address) + if host in REPOSITORY_HOSTS: + own.add(_repository(host, urlsplit(address).path)) + own.discard(None) + return frozenset(own) + + +def _site(match): + host = match.group('authority').rpartition('@')[2] + if IP_HOST.match(host): + return match.group('scheme') + IP_HOST.sub('', host) + rest = re.split(r'[?#]', match.group('rest'), maxsplit=1)[0] + name = re.sub(r':\d*$', '', host).lower() + if name not in public_hosts() or (name in REPOSITORY_HOSTS and _repository(name, rest) not in own_repositories()): + rest = '' + return match.group('scheme') + host + rest + + +def _found(match): + return _site(match) if match.group('scheme') else _place(match) + + def scrub(value): - return TOKEN.sub('', PATH.sub('', str(value))) + value = AUTHORIZATION.sub(r'\1\2\3', str(value)) + value = PLACE.sub(_found, value) + return TOKEN.sub('', EMAIL.sub('', value)) def summary(report, machine=None): diff --git a/freevideo_engine/generate.py b/freevideo_engine/generate.py index dd3940ff..d2a96160 100644 --- a/freevideo_engine/generate.py +++ b/freevideo_engine/generate.py @@ -273,6 +273,10 @@ def automatic_profile(args, canvas, *, stage, evidence, descriptor=None, environ planning_canvas = dict(canvas) if getattr(args, 'task', None): planning_canvas['task'] = args.task + if getattr(args, 'fast_mode', None) is not None: + # The planner puts the pixel head where the VAE decode was and counts two steps. + from .fast_tier import STEPS + planning_canvas.update(fast_mode=args.fast_mode, steps=STEPS) if getattr(args, 'step_cache', None): # The planner keeps the first-block cache only where it fits. planning_canvas['step_cache'] = args.step_cache @@ -608,6 +612,10 @@ def usable_continuation(value, *check): hide_tail = dict(requested=True, used=False, reason='original_audio') hide_tail_frames = hide_tail['frames'] if hide_tail and hide_tail['used'] else 0 continuation = None + from . import fast_tier + fast_spec = fast_tier.request(args) + if fast_spec is not None and original_audio is not None: + raise ValueError('The fastest mode cannot be used with the original sound of a video') from .two_pass import validate_steps requested_steps = getattr(args, 'base_steps', None) refine_steps = getattr(args, 'refine_steps', 3) @@ -726,6 +734,9 @@ def usable_continuation(value, *check): voice_reference['reason'] = dialogue_reason( args.prompt_file.read_text(encoding='utf-8') if args.prompt_file else None) active_loras = [row for row in media.get('loras', []) if row['strength'] != 0] + if fast_spec is not None: + # First, so its branch order does not depend on which user LoRAs are on. + active_loras = [fast_tier.adapter_row(fast_spec), *active_loras] if media: inferred_task = task_for(media) structural = any(media.get(k) for k in ('first', 'last', 'references', 'conditioning_info')) @@ -795,6 +806,8 @@ def usable_continuation(value, *check): raise ValueError(planned['reason'] + ' A continuation needs two-pass generation.') continuation_first = planned['first'] continuation = usable_continuation(continuation, canvas, None if active_loras else manifest, planned) + if fast_spec is not None and manifest.get('precision') != 'int8': + raise ValueError('The fastest mode needs the int8 model') if manifest.get('precision') not in ('fp8', 'int8', 'bf16'): # BF16: the unquantized reference raise ValueError('Select the prepared official FP8 or int8 cache') destination = args.out.resolve() @@ -821,6 +834,9 @@ def usable_continuation(value, *check): allocator_limit_bytes=allocator_limit_bytes), 'reclaimable_resident_models': resident_credit, 'encoder_mode': 'native H3 encoder library child' if args.prompt_file else 'preencoded shared conditioning'} + if fast_spec is not None: + # From here on, so that a failure while preparing the adapter is reported as this mode's. + report['fast_tier'] = dict(mode=fast_spec['mode'], adapter_sha256=fast_spec['adapter_sha256']) if continuation is not None: report['continuation'] = continuation_summary(continuation, hide_tail_frames=hide_tail_frames) if 'tail' in continuation: @@ -860,7 +876,8 @@ def interrupted(signum, frame): lora_env = dict(os.environ, PYTHONPATH=str(repo), CUDA_VISIBLE_DEVICES='', PYTHONUNBUFFERED='1') lora_env[LOCK_ENV] = str(descriptor) print(json.dumps({'event': 'lora_prepare_start'}), flush=True) - report['lora_resources'] = child([sys.executable, '-m', 'freevideo_engine.lora_cache', '--request', str(lora_request)], + report['lora_resources'] = child([sys.executable, '-m', 'freevideo_engine.fast_tier' if fast_spec is not None + else 'freevideo_engine.lora_cache', '--request', str(lora_request)], lora_env, descriptor, destination.with_suffix('.lora.log'), ram_budget_bytes=profile['inference_ram_budget_gb'] * 1e9) prepared = json.loads(lora_result.read_text(encoding='utf-8')) @@ -1273,6 +1290,8 @@ def launch(selected, attempt): selected['engine'] = dict(selected['engine'], adaln_task=(selected['engine']['task'] if original_audio is not None else ANCHOR_ADALN_TASK if anchored else ADALN_TASK)) + if fast_spec is not None: + selected['engine'] = dict(selected['engine'], fast_tier=fast_spec['mode']) request.update(engine_options=selected['engine'], decoder_options=selected['decoder'], ram_budget_bytes=round(selected['inference_ram_budget_gb'] * 1e9), ram_budget_is_estimate=ram_budget_is_estimate(args), diff --git a/freevideo_engine/geometry.py b/freevideo_engine/geometry.py index e51d49fe..20bef8c2 100644 --- a/freevideo_engine/geometry.py +++ b/freevideo_engine/geometry.py @@ -3,6 +3,10 @@ import math import types +SHORTEST_LATENT_FRAMES = 12 +# The shortest video in seconds: the fewest frames that give SHORTEST_LATENT_FRAMES on the 17*n+5 grid, at 24 fps. +SHORTEST_SECONDS = ((SHORTEST_LATENT_FRAMES - 2) // 5 * 17 + 5) / 24 + def geometry(width=1344, height=768, frames=None, seconds=None): if any(not isinstance(n, int) or n < 256 or n % 32 for n in (width, height)): @@ -16,8 +20,8 @@ def geometry(width=1344, height=768, frames=None, seconds=None): raise ValueError('Frame count must be a positive integer.') aligned = requested + (5 - requested) % 17 latent_frames = (aligned - 5) // 17 * 5 + 2 - if latent_frames < 12: - raise ValueError('The video must be at least 1.625 s long.') + if latent_frames < SHORTEST_LATENT_FRAMES: + raise ValueError('The video must be at least %g s long.' % SHORTEST_SECONDS) return dict(width=width, height=height, fps=24, requested_frames=requested, requested_seconds=seconds, frames=aligned, seconds=aligned / 24, latent_frames=latent_frames, video_tokens=latent_frames * (height // 32) * (width // 32), diff --git a/freevideo_engine/i18n.py b/freevideo_engine/i18n.py new file mode 100644 index 00000000..ff0872cf --- /dev/null +++ b/freevideo_engine/i18n.py @@ -0,0 +1,307 @@ +"""Interface languages on the Python side: which language files there are and which one a wanted language gets. + +The rule is the one in web/i18n.js (negotiate); tests/i18n_negotiate_cases.json holds the cases both must pass. +A language file is web/locales/.json with a "_meta" entry ({"name": "繁體中文", "dir": "ltr"}); adding a language +is adding such a file. Nothing here reads settings or changes what is shown yet. +""" +import json +import re +from pathlib import Path + +LOCALES = Path(__file__).resolve().parents[1] / 'web' / 'locales' +TRADITIONAL_REGIONS = ('tw', 'hk', 'mo') +# Only ASCII spaces are taken off a tag, so this side and web/i18n.js agree (str.strip and String.trim differ). +ASCII_SPACE = ' \t\n\r\f' + + +def negotiate(requested, available, fallback='en'): + """The language file for a list of wanted languages (most wanted first), from the tags there are. For each wanted + language: the same tag; for Chinese, the script (Taiwan, Hong Kong and Macau read Traditional, everything else + Simplified); a shorter form of the tag (es-419 -> es); then any file of the same language (pt-PT -> pt-BR). A single + tag (the launcher's "zh-TW") counts as a list of one.""" + have = {tag.lower(): tag for tag in sorted(available)} + if isinstance(requested, str): + requested = [requested] + for raw in requested or (): + tag = str(raw if raw is not None else '').strip(ASCII_SPACE).replace('_', '-').lower() + if not tag: + continue + if tag in have: + return have[tag] + parts = tag.split('-') + if parts[0] == 'zh': + traditional = 'hant' in parts or ('hans' not in parts and parts[-1] in TRADITIONAL_REGIONS) + script = 'zh-hant' if traditional else 'zh-hans' + if script in have: + return have[script] + for n in range(len(parts) - 1, 0, -1): + shorter = '-'.join(parts[:n]) + if shorter in have: + return have[shorter] + same = next((key for key in have if key.split('-')[0] == parts[0]), None) + if same: + return have[same] + return fallback + + +# The two languages written in the code (t(en, zh)); their files in web/locales are the collector's output and do not ship. +BUILT_IN = {'en': {'name': 'English', 'dir': 'ltr'}, 'zh-Hans': {'name': '简体中文', 'dir': 'ltr'}} + + +def interface_language(setting, system=None, folder=None): + """The language the interface shows for a saved setting: 'auto' (or nothing) follows the system language, anything + else is a wanted tag ('en', 'zh', a locale string an older version saved such as 'zh_cn', 'zh-TW'). English and + Simplified Chinese are written in the code; any other language needs its file.""" + setting = str(setting or '').strip(ASCII_SPACE) + if not setting or setting.lower() == 'auto': + setting = system() if callable(system) else system + return negotiate([setting], interface_languages(folder)) + + +def interface_languages(folder=None): + """Every language the interface can show, {tag: {"name", "dir"}}: the two in the code and every language file.""" + return {**available_languages(LOCALES if folder is None else folder), **BUILT_IN} + + +def available_languages(folder=LOCALES, drafts=False): + """{tag: {"name": its own name, "dir": "ltr" or "rtl"}} for every language file in the folder that is ready to show + (_meta.ready is true once its screens are signed); drafts=True lists the others too. A file without a _meta name + (the collector's list of calls, a broken file) is not a language. A draft is still read when a page asks for it by + name (?freevideo_lang=ru), so it can be checked before it is offered.""" + result = {} + for path in sorted(Path(folder).glob('*.json')): + try: + meta = json.loads(path.read_text(encoding='utf-8')).get('_meta') + except (OSError, ValueError, AttributeError, RecursionError): + continue + if isinstance(meta, dict) and isinstance(meta.get('name'), str) and meta['name'].strip() and (drafts or meta.get('ready') is True): + result[path.stem] = {'name': meta['name'], 'dir': 'rtl' if meta.get('dir') == 'rtl' else 'ltr'} + return result + + +# Words read back from text: what a person types ("Cut:", "@Image2", "Subject 1") and what the page wrote in its own +# language. A language file names its own in _meta.keywords, e.g. {"cut": ["Corte"], "subject": ["Sujeto"], +# "image": ["Imagen"]}; the built-in words (English and Chinese, Simplified and Traditional) always work. This is the +# rule of web/i18n.js (keywordsIn, keywordWords); tests/i18n_keywords_cases.json holds the cases both must pass. +KEYWORD_KINDS = ('cut', 'subject', 'image') +BUILT_IN_KEYWORDS = {'cut': ('切', 'cut', 'CUT', 'Cut'), 'subject': ('主体', '主體', 'Subject'), 'image': ('图', '圖', 'Image')} +MAX_KEYWORDS = 8 +MAX_KEYWORD_LENGTH = 24 +# \s of ECMAScript, so this side and the page agree on what a space is. +_SPACE = '\t\n\v\f\r \xa0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff' +_BAD_KEYWORD = re.compile('[::@<>0-9\r\n\t]|^[' + _SPACE + ']|[' + _SPACE + ']$|[' + _SPACE + ']{2,}') + + +def keyword_list(words): + """The valid words of a list, once each, at most MAX_KEYWORDS (a word holds no colon, digit, mark of a mention or + tag or line break and is at most 24 characters).""" + if not isinstance(words, (list, tuple)): + return [] + good = [] + for word in words: + if isinstance(word, str) and 1 <= len(word) <= MAX_KEYWORD_LENGTH and not _BAD_KEYWORD.search(word) and word not in good: + good.append(word) + return good[:MAX_KEYWORDS] + + +def keywords_in(meta): + """{kind: [words]} a language file's _meta names; a kind it does not name has none.""" + given = meta.get('keywords') if isinstance(meta, dict) else None + given = given if isinstance(given, dict) else {} + return {kind: keyword_list(given.get(kind)) for kind in KEYWORD_KINDS} + + +def _spellings(word, kind): + """How a word is read: as written, in capitals and with a capital first letter, and for a cut in lower case too. An image + or subject word is not read in lower case unless the language file wrote it so ("image 4", "una imagen 4K").""" + if kind == 'cut': + return [word, word.lower(), word.upper(), word[:1].upper() + word[1:]] + return [word, word.upper(), word[:1].upper() + word[1:]] + + +def keyword_words(kind, own=()): + """Every word of a kind that is read: the built-in ones, then the language's own (see _spellings), longest first. + The page reads an image or subject word of the language's own only where it stands on its own, not after a letter or + digit and not before a quantity such as "4K" (web/i18n.js keywordSource); the engine reads no such word.""" + words = list(BUILT_IN_KEYWORDS[kind]) + for word in keyword_list(own): + words.extend(_spellings(word, kind)) + return sorted(dict.fromkeys(words), key=lambda w: (-len(w), w)) + + +def language_keywords(tag, folder=LOCALES): + """The keywords of a language file (any file, ready or not, as a page can ask for a draft by name); no words for a + language without a file or without keywords. `tag` is negotiated like a wanted language (pt-PT reads pt-BR's file).""" + available = available_languages(folder, drafts=True) + chosen = negotiate([tag], available, fallback=None) if tag else None + if not chosen: + return {kind: [] for kind in KEYWORD_KINDS} + try: + meta = json.loads((Path(folder) / (chosen + '.json')).read_text(encoding='utf-8')).get('_meta') + except (OSError, ValueError, AttributeError, RecursionError): + meta = None + return keywords_in(meta) + + +def all_keywords(kind, folder=LOCALES): + """The words of a kind in every language file: for a server that does not know which language wrote a text.""" + words = [] + for tag in available_languages(folder, drafts=True): + for word in language_keywords(tag, folder)[kind]: + if word not in words: + words.append(word) + return words[:MAX_KEYWORDS * 64] + + +# The language list (the launcher's language key, the page's settings): languages in this order first, the rest by tag. +# Each is shown by its own name; the English name is for search only. +LANGUAGE_ORDER = ('zh-Hans', 'zh-Hant', 'en', 'es', 'pt-BR', 'ru', 'uk', 'ja', 'ko', 'fr', 'de', 'tr', 'id', 'vi', 'it', 'ar', 'fa') +ENGLISH_NAMES = {'zh-Hans': 'Chinese Simplified', 'zh-Hant': 'Chinese Traditional', 'en': 'English', 'es': 'Spanish', + 'pt-BR': 'Portuguese Brazil', 'ru': 'Russian', 'uk': 'Ukrainian', 'ja': 'Japanese', 'ko': 'Korean', + 'fr': 'French', 'de': 'German', 'tr': 'Turkish', 'id': 'Indonesian', 'vi': 'Vietnamese', 'it': 'Italian', + 'ar': 'Arabic', 'fa': 'Persian'} + + +def language_choices(folder=None): + """[{"tag", "name" (its own), "english", "dir"}] for every language the interface can show, in list order.""" + languages = interface_languages(folder) + rank = {tag: index for index, tag in enumerate(LANGUAGE_ORDER)} + return [dict(tag=tag, name=meta['name'], english=ENGLISH_NAMES.get(tag, tag), dir=meta.get('dir', 'ltr')) + for tag, meta in sorted(languages.items(), key=lambda item: (rank.get(item[0], len(rank)), item[0]))] + +# Looking up text (the launcher and Python side; web/i18n.js lookup is the same rule). +KEY_SEPARATOR = '␟' +CODE_LANGUAGES = ('en', 'zh-Hans') # their text is the en and zh written in the code, never read from a file +_catalogs = {} + + +def fill(text, values): + """{name} placeholders filled from values; a name values does not hold stays as written.""" + import re + return re.sub(r'\{(\w+)\}', lambda match: str(values[match.group(1)]) if match.group(1) in values else match.group(0), + str(text)) + + +PLURAL_FORMS = ('zero', 'one', 'two', 'few', 'many', 'other') +# Languages whose nouns do not change with the number: every number reads as 'other'. +_PLURAL_OTHER_ONLY = {'ja', 'ko', 'zh', 'vi', 'id', 'th', 'ms'} + + +def plural_form(language, number): + """The CLDR cardinal plural form of a number in a language, as Intl.PluralRules gives it in the page (one, few, many, + other), for the languages FreeVideo has files for; tests/i18n_plural_cases.json holds the browser's answers.""" + try: + n = abs(float(number)) + except (TypeError, ValueError): + return 'other' + if n != n or n == float('inf'): + return 'other' + whole = n == int(n) + i = int(n) + base = str(language or '').replace('_', '-').split('-')[0].lower() + if base in _PLURAL_OTHER_ONLY: + return 'other' + if base in ('ru', 'uk'): + if not whole: + return 'other' + if i % 10 == 1 and i % 100 != 11: + return 'one' + if 2 <= i % 10 <= 4 and not 12 <= i % 100 <= 14: + return 'few' + return 'many' + if base in ('fr', 'pt') and str(language).lower() != 'pt-pt': + return 'one' if i in (0, 1) else 'other' + return 'one' if whole and i == 1 else 'other' + + +def plural_text(entry, values, language): + """An entry written as plural forms ({"one": ..., "few": ..., "many": ..., "other": ...}) as the text for the number in + values: the placeholder its "_by" names, else n, else count. A form the entry lacks, or no number, gives "other". + A string is itself; anything else is None. web/i18n.js pluralText.""" + if isinstance(entry, str): + return entry + if not isinstance(entry, dict) or not isinstance(entry.get('other'), str): + return None + name = entry.get('_by') if isinstance(entry.get('_by'), str) else next((k for k in ('n', 'count') if values and k in values), None) + form = plural_form(language, values[name]) if name and values and name in values else 'other' + return entry[form] if form in PLURAL_FORMS and isinstance(entry.get(form), str) else entry['other'] + + +def lookup(catalog, en, zh, values=None, language=None): + """A language file's text for a pair: the entry for the English and Chinese together (when the English has more than + one meaning), then for the English alone, then the English itself. An entry with plural forms gives the one for the + number in values, by the plural rules of language (the file's own tag when it was read by catalog()).""" + meta_tag = (catalog.get('_meta') or {}).get('tag') if isinstance(catalog, dict) and isinstance(catalog.get('_meta'), dict) else None + rules = language or meta_tag + + def own(key): + value = catalog.get(key) if isinstance(catalog, dict) else None + return plural_text(value, values, rules) if key != '_meta' else None + text = own(en + KEY_SEPARATOR + zh) + text = own(en) if text is None else text + if text is None: + # A file whose fallback is zh-Hans (Traditional Chinese) shows text it does not hold as the code's Simplified + # Chinese in its own characters, not as English: the rule of web/i18n.js lookup. + meta = catalog.get('_meta') if isinstance(catalog, dict) else None + text = from_simplified(catalog, zh) if isinstance(meta, dict) and meta.get('fallback') == 'zh-Hans' else en + return fill(text, values) if values else text + + +_char_tables = {} + + +def from_simplified(catalog, text): + """Simplified Chinese text in the characters of a file's _meta.chars (pairs of a Simplified character and the one it + becomes); the text itself when the file has none. web/i18n.js fromSimplified.""" + meta = catalog.get('_meta') if isinstance(catalog, dict) else None + chars = meta.get('chars') if isinstance(meta, dict) else None + if not isinstance(chars, str) or not chars: + return str(text) + table = _char_tables.get(chars) + if table is None: + table = _char_tables[chars] = dict(zip(chars[0::2], chars[1::2])) + return ''.join(table.get(ch, ch) for ch in str(text)) + + +def catalog(language, folder=None): + """The entries of a language file ({} for the code's own languages, a missing file or an unreadable one). Read once.""" + folder = LOCALES if folder is None else folder + key = (str(folder), language) + if key not in _catalogs: + value = {} + if language and language not in CODE_LANGUAGES and '/' not in language and '\\' not in language: + try: + loaded = json.loads((Path(folder) / (language + '.json')).read_text(encoding='utf-8')) + if isinstance(loaded, dict): + # Texts, and entries with plural forms (an object whose "other" is a text). + value = {k: v for k, v in loaded.items() if k != '_meta' + and (isinstance(v, str) or isinstance(v, dict) and isinstance(v.get('other'), str))} + # What a missing entry falls back to (web/i18n.js lookup): Traditional Chinese reads the code's + # Simplified Chinese in its own characters. + meta = loaded.get('_meta') if isinstance(loaded.get('_meta'), dict) else {} + kept = {k: meta[k] for k in ('fallback', 'chars') if isinstance(meta.get(k), str)} + # Its plural rules are the file's language. + value['_meta'] = dict(kept, tag=language) + except (OSError, ValueError): + pass + _catalogs[key] = value + return _catalogs[key] + + +def code_language(language): + """The code language a tag reads as during the change-over: 'zh' (and any zh-Hans form) is Simplified Chinese.""" + tag = str(language or '').replace('_', '-').lower() + if tag == 'zh' or tag.startswith('zh-hans') or tag in ('zh-cn', 'zh-sg'): + return 'zh-Hans' + return 'en' if tag in ('', 'en') or tag.startswith('en-') else language + + +def tr(en, zh, language, values=None, folder=None): + """The text for a pair in a language: the code's own English or Chinese, else the language file's entry (English + when it has none). {name} placeholders are filled from values in every language.""" + language = code_language(language) + if language == 'zh-Hans': + return fill(zh, values) if values else zh + if language == 'en': + return fill(en, values) if values else en + return lookup(catalog(language, folder), en, zh, values, language) diff --git a/freevideo_engine/image_gen/failure.py b/freevideo_engine/image_gen/failure.py index 2b936765..00486847 100644 --- a/freevideo_engine/image_gen/failure.py +++ b/freevideo_engine/image_gen/failure.py @@ -15,12 +15,12 @@ MODEL_IDS = (H3, QWEN) from ..exit_diagnostics import clean_reading, clean_sample, clean_memory_during_request from ..diagnostic_resources import commit_exhausted -from ..failure_details import Redactor -from .loras import ERRORS as LORA_ERRORS, MESSAGE_ZH as LORA_MESSAGE_ZH +from ..failure_details import KERNEL_CHECKS_FAILED, Redactor +from .loras import ERRORS as LORA_ERRORS, MESSAGES as LORA_MESSAGES ERRORS = frozenset(('no_memory', 'small_memory', 'busy_video', 'busy', 'pack_missing', 'model_unavailable', 'model_unreadable', - 'device_unavailable', 'worker_exit', 'timeout', 'cancelled', 'disk_full', + 'device_unavailable', 'gpu_kernels_failed', 'worker_exit', 'timeout', 'cancelled', 'disk_full', 'invalid_request', 'invalid_prompt', 'invalid_dimensions', 'invalid_seed', 'too_many_images', 'output_unwritable', 'invalid_media', 'invalid_points', 'segment_not_installed', 'generation_failed')) | LORA_ERRORS NO_REPORT = frozenset(('small_memory', 'busy', 'invalid_request', 'invalid_prompt', 'invalid_dimensions', 'invalid_seed', @@ -28,30 +28,58 @@ 'disk_full')) | LORA_ERRORS STAGES = ('start', 'load', 'text', 'encode', 'denoise', 'decode') KINDS = ('generate', 'edit', 'cast', 'compose', 'download', 'install') -MESSAGE_ZH = { - **LORA_MESSAGE_ZH, - 'no_memory': '显存不足,最小尺寸也无法生成。请关闭其他占用显卡的程序后重试。', - 'small_memory': '这台 Mac 的内存不足 16 GB,无法生成图片。', - 'busy_video': '视频正在生成,完成后再试。', - 'busy': '排队的图已满,请等前面的完成后再试。', - 'pack_missing': '请先在启动器里下载“图像生成模型”。', - 'model_unavailable': '这台电脑不支持所选的图片模型。请改用 Qwen-Image 2.1。', - 'model_unreadable': '图像生成模型的文件读不出来。在启动器里修复后再试。', - 'device_unavailable': '显卡暂时用不了,稍后再试。', - 'worker_exit': '图像生成意外停止了,请再试一次。', - 'timeout': '这一张用时太长,已停止。请再试一次。', - 'disk_full': '保存图片时出错:磁盘空间不够,空出空间后再生成。', - 'generation_failed': '图像生成出错了,请再试一次。', - 'invalid_request': '图片设置有误,请调整后重试。', - 'invalid_prompt': '提示词为空,或加上图片引用后超过 2000 字。请缩短提示词后重试。', - 'invalid_dimensions': '图片尺寸超出所选模型支持的范围。请调整尺寸后重试。', - 'invalid_seed': '随机种子无效。请清空种子或改用较小的整数后重试。', - 'too_many_images': '参考图超过所选模型支持的数量。请减少参考图后重试。', - 'output_unwritable': '无法写入保存图片的文件夹(ComfyUI 的 input 目录下的 freevideo-image)。请确认该目录存在、可写,且没有同名文件,然后重试。', - 'invalid_media': '图片无效,请重新选择输入目录中的图片。点选支持不超过 4096×4096 像素总数的图片。', - 'invalid_points': '请选择 1–16 个图片范围内的点,且至少有一个选中点;1 为选中,0 为排除。', - 'segment_not_installed': '点选模型未安装,请先下载点选模型(SAM 2.1 small)。', +# Each failure in English and Chinese. The image page writes the same sentences in imageGenError (a test keeps the +# codes both have equal); these reach API and agent callers as message_en and message_zh. Wording: Lane, 11-25. +MESSAGES = { + **LORA_MESSAGES, + 'no_memory': ('Not enough GPU memory, even at the smallest size. Close other apps using the GPU, then try again.', + '显存不足,最小尺寸也无法生成。请关闭其他占用显卡的程序后重试。'), + 'small_memory': ('This Mac has less than 16 GB of memory and cannot generate images.', + '这台 Mac 的内存不足 16 GB,无法生成图片。'), + 'busy_video': ('A video is generating. Try again when it finishes.', + '视频正在生成,完成后再试。'), + 'busy': ('The image queue is full. Wait for the earlier images to finish, then try again.', + '等待生成的图片已满,请等前面的图片完成后再试。'), + 'pack_missing': ('Download the image model in the launcher first.', + '请先在启动器中下载图片模型。'), + 'model_unavailable': ('This computer does not support the chosen image model. Use Qwen-Image 2.1.', + '这台电脑不支持所选的图片模型。请改用 Qwen-Image 2.1。'), + 'model_unreadable': ('The image generation model files could not be read. Repair them in the launcher and try again.', + '图像生成模型的文件读不出来。在启动器里修复后再试。'), + 'device_unavailable': ('The graphics card is not available right now. Try again later.', + '显卡暂时用不了,稍后再试。'), + 'gpu_kernels_failed': ("The graphics card's computation check did not pass. Update the graphics card driver, then restart " + 'FreeVideo. If the check still does not pass, download the report and report the problem.', + '显卡的计算检查未通过。请更新显卡驱动后重新启动 FreeVideo;如仍未通过,请下载报告并提交问题。'), + 'worker_exit': ('Image generation stopped unexpectedly. Try again.', + '图像生成意外停止了,请再试一次。'), + 'timeout': ('This image took too long and was stopped. Try again.', + '这一张用时太长,已停止。请再试一次。'), + 'disk_full': ('Saving the image failed: the disk is full. Free some space, then generate again.', + '保存图片时出错:磁盘空间不够,空出空间后再生成。'), + 'generation_failed': ('Image generation ran into an error. Try again.', + '图像生成出错了,请再试一次。'), + 'invalid_request': ('The image settings are invalid. Adjust them and try again.', + '图片设置有误,请调整后重试。'), + 'invalid_prompt': ('The prompt is empty, or longer than 2,000 characters once the image references are counted. Shorten it and try again.', + '提示词为空,或加上图片引用后超过 2000 字。请缩短提示词后重试。'), + 'invalid_dimensions': ('The image size is outside what the chosen model supports. Change the size and try again.', + '图片尺寸超出所选模型支持的范围。请调整尺寸后重试。'), + 'invalid_seed': ('The seed is not valid. Clear it or use a smaller whole number, then try again.', + '随机种子无效。请清空种子或改用较小的整数后重试。'), + 'too_many_images': ('There are more reference images than the chosen model supports. Remove some and try again.', + '参考图超过所选模型支持的数量。请减少参考图后重试。'), + 'output_unwritable': ('The folder that keeps the images cannot be written (freevideo-image in the ComfyUI input folder). Check that it exists, is writable and has no file of the same name, then try again.', + '无法写入保存图片的文件夹(ComfyUI 的 input 目录下的 freevideo-image)。请确认该目录存在、可写,且没有同名文件,然后重试。'), + 'invalid_media': ('This image cannot be read or is larger than 4096×4096 pixels. Choose another image.', + '这张图片读不出来,或超过 4096×4096 像素。请换一张图片。'), + 'invalid_points': ('Choose 1 to 16 points inside the image, with at least one to select (1 selects, 0 excludes).', + '请在图片内选 1 到 16 个点,其中至少一个是选中点(1 表示选中,0 表示排除)。'), + 'segment_not_installed': ('The click-select model is not installed. Download it first.', + '点选模型尚未安装,请先下载点选模型。'), } +MESSAGE_EN = {code: pair[0] for code, pair in MESSAGES.items()} +MESSAGE_ZH = {code: pair[1] for code, pair in MESSAGES.items()} _DEVICE = re.compile( r'cuda.*(?:initializ|device.*(?:lost|unavailable|removed)|invalid device ordinal|' r'driver.*(?:insufficient|too old|mismatch|shutting down)|context.*destroyed|system not yet initialized)|' @@ -68,8 +96,12 @@ _MPS_MEMORY = re.compile(r'MPS backend out of memory', re.I) _LIMIT = 16 * 1024 # On a Mac the GPU's memory is the machine's: the same failure, in its words. -UNIFIED_MESSAGE_ZH = {'no_memory': '内存不足,最小尺寸也无法生成。请关闭其他程序后重试。'} -HOST_MESSAGE_ZH = '虚拟内存不足,无法载入图像模型。请关闭其他程序,或在系统设置中调大虚拟内存,然后重试。' +UNIFIED_MESSAGES = {'no_memory': ('Not enough memory, even at the smallest size. Close other apps, then try again.', + '内存不足,最小尺寸也无法生成。请关闭其他程序后重试。')} +HOST_MESSAGE = ('Not enough virtual memory to load the image model. Close other apps, or increase virtual memory in system ' + 'settings, then try again.', '虚拟内存不足,无法载入图像模型。请关闭其他程序,或在系统设置中调大虚拟内存,然后重试。') +UNIFIED_MESSAGE_ZH = {code: pair[1] for code, pair in UNIFIED_MESSAGES.items()} +HOST_MESSAGE_ZH = HOST_MESSAGE[1] def host_memory_shortage(error): @@ -81,8 +113,9 @@ def append_other_usage(result, machine): from ..other_usage import at_failure, fact, join value = at_failure(result.get('error'), machine) result['other_usage'] = value - if value and result.get('message_zh'): - result['message_zh'] = join(result['message_zh'], fact(value, zh=True), zh=True) + for key, zh in (('message_zh', True), ('message_en', False)): + if value and result.get(key): + result[key] = join(result[key], fact(value, zh=zh), zh=zh) return result @@ -112,6 +145,10 @@ def classify_exception(error, *, stage='start', cancelled=False): return 'no_memory' if chain and ran_out(chain[0]): return 'disk_full' + # The GPU's own kernel checks found no working path (kernel_capabilities): nothing on this card can run until the + # driver or the installation changes, so it is said as such, not as a step that failed. + if any(str(item).startswith(KERNEL_CHECKS_FAILED) for item in chain): + return 'gpu_kernels_failed' for item in chain: cuda_init = any(frame.f_globals.get('__name__') == 'torch.cuda' and frame.f_code.co_name in ('_lazy_init', '_check_driver') diff --git a/freevideo_engine/image_gen/loras.py b/freevideo_engine/image_gen/loras.py index 63023ba0..64979fd7 100644 --- a/freevideo_engine/image_gen/loras.py +++ b/freevideo_engine/image_gen/loras.py @@ -8,22 +8,22 @@ MIN_STRENGTH, MAX_STRENGTH = -2., 2. ERRORS = frozenset(('invalid_loras', 'invalid_lora_strength', 'duplicate_lora', 'too_many_loras', 'lora_not_found', 'invalid_lora_model')) -MESSAGE_ZH = { - 'invalid_loras': 'LoRA 设置有误,请重新选择文件。', - 'invalid_lora_strength': 'LoRA 强度必须在 -2 到 2 之间。', - 'duplicate_lora': '同一个 LoRA 只能选择一次,请移除重复项。', - 'too_many_loras': '一张图片最多使用 8 个 LoRA,请减少数量。', - 'lora_not_found': 'LoRA 文件找不到,请重新选择。', - 'invalid_lora_model': '此 LoRA 不适用于图片生成,请换一个。', -} -MESSAGE_EN = { - 'invalid_loras': 'The LoRA selection is invalid. Choose the files again.', - 'invalid_lora_strength': 'LoRA strength must be between -2 and 2.', - 'duplicate_lora': 'Select each LoRA only once. Remove the duplicate.', - 'too_many_loras': 'Use at most eight LoRAs per picture.', - 'lora_not_found': 'The LoRA file could not be found. Choose it again.', - 'invalid_lora_model': 'This LoRA cannot be used for pictures. Choose another one.', +MESSAGES = { + 'invalid_loras': ('The LoRA selection is invalid. Choose the files again.', + 'LoRA 设置有误,请重新选择文件。'), + 'invalid_lora_strength': ('LoRA strength must be between -2 and 2.', + 'LoRA 强度必须在 -2 到 2 之间。'), + 'duplicate_lora': ('Select each LoRA only once. Remove the duplicate.', + '同一个 LoRA 只能选择一次,请移除重复项。'), + 'too_many_loras': ('Use at most eight LoRAs per image.', + '一张图片最多使用 8 个 LoRA,请减少数量。'), + 'lora_not_found': ('The LoRA file could not be found. Choose it again.', + 'LoRA 文件找不到,请重新选择。'), + 'invalid_lora_model': ('This LoRA cannot be used for images. Choose another one.', + '此 LoRA 不适用于图片生成,请换一个。'), } +MESSAGE_EN = {code: pair[0] for code, pair in MESSAGES.items()} +MESSAGE_ZH = {code: pair[1] for code, pair in MESSAGES.items()} def validate_selection(value): diff --git a/freevideo_engine/image_gen/service.py b/freevideo_engine/image_gen/service.py index e9648600..e0b39a15 100644 --- a/freevideo_engine/image_gen/service.py +++ b/freevideo_engine/image_gen/service.py @@ -29,9 +29,14 @@ from ..download_settings import observed_speed from ..exit_diagnostics import clean_reading from ..monitoring import save -from .failure import (Context, classify_exception, HOST_MESSAGE_ZH, host_memory_shortage, ERRORS, FailureError, MESSAGE_ZH, NO_REPORT, STAGES, UNIFIED_MESSAGE_ZH, +from .failure import (Context, classify_exception, HOST_MESSAGE, host_memory_shortage, ERRORS, FailureError, MESSAGE_ZH, MESSAGES, NO_REPORT, STAGES, UNIFIED_MESSAGES, classify_exception) +def messages(code): + """A failure's sentence in English and Chinese, as message_en and message_zh; nothing for a code without one.""" + return dict(zip(('message_en', 'message_zh'), MESSAGES[code])) if code in MESSAGES else {} + + def write_refused(error): """Whether an OSError says a folder or file cannot be written (no permission, read-only volume, in use).""" import errno @@ -2103,13 +2108,14 @@ def failed(self, code, context, *, row=None, error=None, video_busy=None): stage = row.get('stage') if isinstance(row, dict) else None stage = stage if stage in STAGES else context.timing.stage result = dict(phase='failed', error=code, report_id=None, stage=stage) - if code in MESSAGE_ZH: - result['message_zh'] = MESSAGE_ZH[code] - if context.machine.get('device_backend') == 'mps' and code in UNIFIED_MESSAGE_ZH: - result['message_zh'] = UNIFIED_MESSAGE_ZH[code] + if code in MESSAGES: + pair = MESSAGES[code] + if context.machine.get('device_backend') == 'mps' and code in UNIFIED_MESSAGES: + pair = UNIFIED_MESSAGES[code] if code == 'no_memory' and (isinstance(row, dict) and row.get('memory') == 'host' or error is not None and host_memory_shortage(error)): - result.update(memory='host', message_zh=HOST_MESSAGE_ZH) + result['memory'], pair = 'host', HOST_MESSAGE + result.update(message_en=pair[0], message_zh=pair[1]) if code in ('no_memory', 'small_memory'): from .failure import append_other_usage append_other_usage(result, context.machine) @@ -3112,7 +3118,7 @@ async def info(request): except Exception: # A damaged model folder or pack record must not turn into a plain-text 500 that blocks every later action. logging.getLogger(__name__).exception('image info failed') - return web.json_response(dict(error='model_unreadable', message_zh=MESSAGE_ZH['model_unreadable']), status=500) + return web.json_response(dict(error='model_unreadable', **messages('model_unreadable')), status=500) @server.routes.get('/freevideo/image-gen/report/{report_id}') async def report(request): @@ -3221,8 +3227,7 @@ async def action(request): elif isinstance(error, ValueError): code = code if code in ERRORS else 'invalid_request' result = dict(phase='failed', error=code, report_id=None, stage='start') - if code in MESSAGE_ZH: - result['message_zh'] = MESSAGE_ZH[code] + result.update(messages(code)) else: # An OSError is not one of the request checks: a disk, a folder or a file went wrong, or something unexpected did. # It says what it is and carries a report, instead of being called a wrong setting. @@ -3237,12 +3242,10 @@ async def action(request): context = Context(request.match_info.get('action', ''), value if isinstance(value, dict) else {}) result = service.failed(reason, context, error=error) result.setdefault('error', reason) - if result['error'] in MESSAGE_ZH: - result.setdefault('message_zh', MESSAGE_ZH[result['error']]) + result = dict(messages(result['error']), **result) except Exception: result = dict(phase='failed', error=reason, report_id=None, stage='start') - if reason in MESSAGE_ZH: - result['message_zh'] = MESSAGE_ZH[reason] + result.update(messages(reason)) return web.json_response(result, status=500) return web.json_response(result, status=400) except Exception as error: @@ -3255,6 +3258,5 @@ async def action(request): except Exception: result = dict(phase='failed', error='generation_failed', report_id=None, stage='start') result.setdefault('error', 'generation_failed') - if result['error'] in MESSAGE_ZH: - result.setdefault('message_zh', MESSAGE_ZH[result['error']]) + result = dict(messages(result['error']), **result) return web.json_response(result, status=500) diff --git a/freevideo_engine/language_page.py b/freevideo_engine/language_page.py new file mode 100644 index 00000000..00577614 --- /dev/null +++ b/freevideo_engine/language_page.py @@ -0,0 +1,47 @@ +"""The interface language from the page's settings, independent of the HTTP server. + +One setting for the launcher and the page (saved with the launcher's settings): 'auto' follows the system language, +otherwise a language's tag. The page reads it with the languages it can offer and the one each choice shows. +""" +from .i18n import interface_language, interface_languages +from .launcher_settings import Store, default_language + +AUTO = 'auto' + + +class InvalidRequest(ValueError): + def __init__(self, field, allowed, got): + super().__init__(field) + self.field, self.allowed, self.got = field, allowed, got + + +def read(engine): + """{setting, language, system, languages}: the saved choice ('auto' or a tag; an older saved value such as 'zh' or + 'zh_cn' reads as the tag it shows), the language it shows, what 'auto' shows on this computer, and every language + ready to offer as {tag, name, dir}, English and Simplified Chinese included.""" + languages = interface_languages() + saved = Store(engine).read().get('language') + saved = saved.strip() if isinstance(saved, str) else '' + if not saved or saved.lower() == AUTO: + setting = AUTO + else: + setting = saved if saved in languages else interface_language(saved, default_language) + return dict(setting=setting, language=interface_language(setting, default_language), + system=interface_language(AUTO, default_language), + languages=[dict(tag=tag, **meta) for tag, meta in sorted(languages.items())]) + + +def apply(engine, body): + """Save {language: 'auto' or a tag of a language ready to offer}; returns read().""" + if not isinstance(body, dict): + raise InvalidRequest('', 'an object', None) + for field in body: + if field != 'language': + raise InvalidRequest(field, 'absent (unknown field)', None) + value = body.get('language') + offered = interface_languages() + if not isinstance(value, str) or (value != AUTO and value not in offered): + raise InvalidRequest('language', 'one of ' + ', '.join([AUTO, *sorted(offered)]), + value if isinstance(value, str) and len(value) <= 40 else None) + Store(engine).save_language(value) + return read(engine) diff --git a/freevideo_engine/launcher/FIcon.qml b/freevideo_engine/launcher/FIcon.qml index f0bf633b..bb79d8bc 100644 --- a/freevideo_engine/launcher/FIcon.qml +++ b/freevideo_engine/launcher/FIcon.qml @@ -12,6 +12,8 @@ Canvas { var c = getContext("2d"); c.reset(); c.scale(width/24, height/24) c.strokeStyle = ink; c.lineWidth = 1.6; c.lineCap = "round"; c.lineJoin = "round"; c.beginPath() if (kind === "folder") { c.moveTo(3,7); c.lineTo(3,19); c.lineTo(21,19); c.lineTo(21,7); c.lineTo(12,7); c.lineTo(10,4); c.lineTo(3,4); c.closePath() } + else if (kind === "search") { c.moveTo(17,10.5); c.arc(10.5,10.5,6.5,0,Math.PI*2); c.moveTo(15.2,15.2); c.lineTo(20.5,20.5) } + else if (kind === "check") { c.moveTo(5,12.5); c.lineTo(10,17.5); c.lineTo(19.5,7) } else if (kind === "chevron-down") { c.moveTo(5,9); c.lineTo(12,16); c.lineTo(19,9) } else if (kind === "play") { c.moveTo(8,4); c.lineTo(20,12); c.lineTo(8,20); c.closePath() } else if (kind === "terminal") { c.rect(2,4,20,16); c.moveTo(6,9); c.lineTo(9,12); c.lineTo(6,15); c.moveTo(12,15); c.lineTo(17,15) } diff --git a/freevideo_engine/launcher/FLanguage.qml b/freevideo_engine/launcher/FLanguage.qml new file mode 100644 index 00000000..4b7ed756 --- /dev/null +++ b/freevideo_engine/launcher/FLanguage.qml @@ -0,0 +1,216 @@ +import QtQuick +import QtQuick.Controls.Basic +import QtQuick.Layouts + +// The interface language key (review/i18n/language-switch.md, direction A): a globe, the shown language's own name and an +// arrow; it opens a self-drawn list whose first item follows the system, then every language there is by its own name. +// The current choice is ticked. Up and down move, Enter chooses, Esc and a press outside close; typing finds a language +// (in the search box when there are more than ten, else by jumping to the first name that starts with what was typed). +Item { + id: root + property var languages: [] // [{tag, name, english, dir}] from the launcher (i18n.language_choices) + property string setting: "auto" // the saved choice: "auto" or a tag + property string shown: "en" // the language the interface shows now + property string system: "en" // the system's language + property var t: function(en, zh, values) { return en } + signal picked(string value) + readonly property bool searchable: languages.length > 10 + property string query: "" + property int highlighted: 0 + property string typed: "" + implicitWidth: key.implicitWidth; implicitHeight: key.implicitHeight + // Names for tests and measuring; the header key and the settings key are two of these, so they carry their own name. + readonly property string prefix: objectName || "language" + readonly property int nameX: 32 // 8 px inset, the 16 px tick column, 8 px gap: the search text starts here too + readonly property int ruleRoom: 9 // under "follow the system": 4 px, the 1 px rule, 4 px + + function nameOf(tag) { for (var i = 0; i < languages.length; i++) if (languages[i].tag === tag) return languages[i].name; return tag } + function matches(item, text) { + var q = text.trim().toLowerCase() + if (!q) return true + var words = (item.name + " " + item.english + " " + item.tag).toLowerCase().split(/[\s()\-]+/) + for (var i = 0; i < words.length; i++) if (words[i].indexOf(q) === 0) return true + return false + } + // The rows as listed: following the system first (not while searching), then the languages that match. + readonly property var rows: (query ? [] : [{tag: "auto", name: t("Follow system ({name})", "跟随系统({name})", {name: nameOf(system)})}]) + .concat(languages.filter(function(item) { return matches(item, query) })) + function choose(index) { + var row = rows[index] + list.close() + if (row && row.tag !== setting) root.picked(row.tag) + } + function move(step) { if (rows.length) highlighted = Math.max(0, Math.min(rows.length - 1, highlighted + step)) } + function jump(letter) { + typed = (typeTimer.running ? typed : "") + letter; typeTimer.restart() + for (var i = 0; i < rows.length; i++) if (rows[i].tag !== "auto" && matches(rows[i], typed)) { highlighted = i; return } + } + Timer { id: typeTimer; interval: 900 } + onQueryChanged: highlighted = 0 + onHighlightedChanged: rowList.positionViewAtIndex(highlighted, ListView.Contain) + + Button { + id: key; objectName: root.prefix + "Key" + anchors.right: parent.right + implicitHeight: theme.heightSm + topPadding: 0; bottomPadding: 0; leftPadding: 10; rightPadding: 10 + implicitWidth: keyRow.implicitWidth + leftPadding + rightPadding + hoverEnabled: true + onClicked: list.opened ? list.close() : list.open() + Accessible.name: root.t("Interface language: {name}", "界面语言:{name}", {name: root.nameOf(root.shown)}) + // Icon, name and arrow share one centre line: the middle of the name's first glyph ink (a capital or a CJK square, + // so a descender does not pull it down), placed on the middle of the key. It is measured at 16 times the size + // (glyph boxes come back in whole pixels) with the application font, so a CJK name is measured in the fallback + // font it is drawn with; hinting is off for the name and its measure. The baseline sits on a whole screen pixel. + contentItem: Item { + id: keyRow + readonly property int gap: 7 + readonly property real glyph: 15 + implicitWidth: glyph + gap + label.width + gap + arrow.width + readonly property real dpr: Screen.devicePixelRatio || 1 + TextMetrics { id: firstGlyph; font.hintingPreference: Font.PreferNoHinting; font.weight: label.font.weight; font.pixelSize: label.font.pixelSize * 16; text: label.text.charAt(0) } + readonly property real glyphMiddle: (firstGlyph.tightBoundingRect.y + firstGlyph.tightBoundingRect.height / 2) / 16 + readonly property real baselineY: Math.round((height / 2 - glyphMiddle) * dpr) / dpr + readonly property real middle: baselineY + glyphMiddle + onMiddleChanged: { globe.requestPaint(); arrow.requestPaint() } + Canvas { + id: globe; objectName: root.prefix + "Globe" + width: keyRow.glyph; height: keyRow.height + property color ink: theme.text + onInkChanged: requestPaint(); onHeightChanged: requestPaint() + onPaint: { + var c = getContext("2d"); c.reset() + c.translate(0, keyRow.middle - width / 2); c.scale(width / 24, width / 24) + c.strokeStyle = ink; c.lineWidth = 2; c.lineCap = "round"; c.lineJoin = "round"; c.beginPath() + c.moveTo(21,12); c.arc(12,12,9,0,Math.PI*2); c.moveTo(3,12); c.lineTo(21,12) + c.moveTo(12,3); c.bezierCurveTo(7.5,7.5,7.5,16.5,12,21); c.moveTo(12,3); c.bezierCurveTo(16.5,7.5,16.5,16.5,12,21) + c.stroke() + } + } + FText { + id: label; objectName: root.prefix + "Name" + x: globe.width + keyRow.gap; y: keyRow.baselineY - baselineOffset + text: root.nameOf(root.shown); font.pixelSize: theme.micro + 1; font.hintingPreference: Font.PreferNoHinting; color: theme.text + wrapMode: Text.NoWrap + } + Canvas { + id: arrow; objectName: root.prefix + "Arrow" + x: label.x + label.width + keyRow.gap + width: 10; height: keyRow.height + property color ink: theme.text + onInkChanged: requestPaint(); onHeightChanged: requestPaint() + onPaint: { + // Chevron 7 wide, 3.5 tall, drawn about the shared centre line. + var c = getContext("2d"); c.reset() + var m = keyRow.middle + c.strokeStyle = ink; c.lineWidth = 1.6; c.lineCap = "round"; c.lineJoin = "round"; c.beginPath() + c.moveTo(1.5, m - 1.75); c.lineTo(5, m + 1.75); c.lineTo(8.5, m - 1.75) + c.stroke() + } + } + } + background: Rectangle { + radius: theme.radiusSm + color: list.opened ? theme.raised : key.hovered ? theme.hover : "transparent" + border.width: 1; border.color: list.opened ? theme.sheen : theme.border + } + } + + Popup { + id: list; objectName: root.prefix + "List" + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + width: 264; leftPadding: 6; rightPadding: 6; topPadding: 4; bottomPadding: 4; focus: true + x: root.width - width; y: key.height + 6 + // Height left below the key in the window (12 px clear of the bottom edge), taken when the list opens. + property real room: 400 + onAboutToShow: { + root.query = ""; search.text = "" + var window = root.Window.window + if (window) room = window.height - root.mapToItem(null, 0, key.height + 6).y - topPadding - bottomPadding - 12 + var at = 0 + for (var i = 0; i < root.rows.length; i++) if (root.rows[i].tag === root.setting) at = i + root.highlighted = at + } + onOpened: (root.searchable ? search : keys).forceActiveFocus() + background: Rectangle { radius: theme.radiusMd; color: theme.canvas; border.color: theme.sheen } + contentItem: ColumnLayout { + spacing: 0 + // Keys for the list: up, down, Enter, Esc (handled here too: the popup's own Esc needs the window to hold focus); + // without a search box a typed letter jumps. + Item { + id: keys; objectName: root.prefix + "ListKeys"; implicitHeight: 0; Layout.preferredHeight: 0 + Keys.onPressed: function(event) { + if (event.key === Qt.Key_Escape) { list.close(); event.accepted = true } + else if (event.key === Qt.Key_Down) { root.move(1); event.accepted = true } + else if (event.key === Qt.Key_Up) { root.move(-1); event.accepted = true } + else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { root.choose(root.highlighted); event.accepted = true } + else if (event.text && event.text.trim() && !(event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier))) { root.jump(event.text); event.accepted = true } + } + } + TextField { + id: search; objectName: root.prefix + "Search"; visible: root.searchable + Layout.fillWidth: true; Layout.bottomMargin: 4 + implicitHeight: theme.heightSm + onTextChanged: root.query = text + placeholderText: root.t("Search languages", "搜索语言") + color: theme.text; placeholderTextColor: theme.disabled + font.pixelSize: theme.micro + 1 + leftPadding: root.nameX; rightPadding: 10 + Keys.onPressed: function(event) { + if (event.key === Qt.Key_Escape) { list.close(); event.accepted = true } + else if (event.key === Qt.Key_Down) { root.move(1); event.accepted = true } + else if (event.key === Qt.Key_Up) { root.move(-1); event.accepted = true } + else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { root.choose(root.highlighted); event.accepted = true } + } + background: Rectangle { + radius: theme.radiusSm; color: theme.bg; border.width: 1; border.color: search.activeFocus ? theme.accent : theme.border + FIcon { kind: "search"; ink: theme.muted; x: 10; anchors.verticalCenter: parent.verticalCenter; width: 14; height: 14 } + } + } + FText { + objectName: root.prefix + "None"; visible: !!root.query && root.rows.length === 0 + Layout.fillWidth: true; Layout.topMargin: 6; Layout.bottomMargin: 6; horizontalAlignment: Text.AlignHCenter + text: root.t("No matching language", "没有找到这种语言"); color: theme.muted; font.pixelSize: theme.micro + 1 + } + // At most ten rows show, and never more than the room below the key; the rest scroll, so a small window still + // reaches every language and the list ends at its last row. + ListView { + id: rowList; objectName: root.prefix + "Rows" + Layout.fillWidth: true + readonly property real tenRows: theme.heightSm * 10 + (root.rows.length > 1 && root.rows[0].tag === "auto" ? root.ruleRoom : 0) + Layout.preferredHeight: Math.min(contentHeight, tenRows, Math.max(theme.heightSm * 3, list.room - (search.visible ? search.height + 4 : 0))) + clip: true; spacing: 0; boundsBehavior: Flickable.StopAtBounds + model: root.rows + ScrollBar.vertical: FScrollBar {} + delegate: Item { + id: row + required property var modelData + required property int index + objectName: root.prefix + "Row_" + modelData.tag + // "Follow the system" carries the rule under it: 1 px with 4 px above and below. + readonly property bool ruled: modelData.tag === "auto" && root.rows.length > 1 + width: ListView.view.width; height: theme.heightSm + (ruled ? root.ruleRoom : 0) + readonly property bool chosen: modelData.tag === root.setting + Rectangle { + width: parent.width; height: theme.heightSm; radius: theme.radiusXs + color: row.chosen ? theme.accentSubtle : row.index === root.highlighted ? theme.hover : "transparent" + } + Rectangle { visible: row.ruled; y: theme.heightSm + 4; width: parent.width; height: 1; color: theme.border } + // The tick has its own 16 px column on the left; rows without it leave the column empty, so every name + // starts on one line (with the search text above). + FIcon { objectName: row.objectName + "Tick"; visible: row.chosen; kind: "check"; ink: theme.accent + x: 9; y: (theme.heightSm - height) / 2; width: 14; height: 14 } + FText { x: root.nameX; y: (theme.heightSm - height) / 2; text: row.modelData.name; font.pixelSize: theme.micro + 1 + font.weight: row.chosen ? Font.DemiBold : Font.Normal; color: theme.text; elide: Text.ElideRight + wrapMode: Text.NoWrap; lineHeight: 1; width: parent.width - root.nameX - 10 } + MouseArea { + width: parent.width; height: theme.heightSm; hoverEnabled: true; cursorShape: Qt.PointingHandCursor + onEntered: root.highlighted = row.index + onClicked: root.choose(row.index) + } + Accessible.role: Accessible.MenuItem; Accessible.name: row.modelData.name; Accessible.checked: row.chosen + } + } + } + } +} diff --git a/freevideo_engine/launcher/FReleaseMedia.qml b/freevideo_engine/launcher/FReleaseMedia.qml index 2c4c2893..677c1e5f 100644 --- a/freevideo_engine/launcher/FReleaseMedia.qml +++ b/freevideo_engine/launcher/FReleaseMedia.qml @@ -9,6 +9,8 @@ Item { // {kind: "video" | "animated" | "image", poster, source}: file URLs, "" while absent. property var media: null property bool zh: false + // The interface text for a pair; Main.qml passes its own t (the language file lookup), this is the fallback. + property var t: function(en, cn, values) { var text = zh ? cn : en; return values ? text.replace(/\{(\w+)\}/g, (whole, name) => name in values ? String(values[name]) : whole) : text } // The window's corner radius; the top corners are rounded to it when the block sits on the window's top edge. property real radius: 0 property color cornerColor: theme.canvas @@ -60,7 +62,7 @@ Item { anchors.right: parent.right; anchors.bottom: parent.bottom; anchors.margins: 12 color: soundArea.containsMouse ? "#2a2c31" : "#141518" Accessible.role: Accessible.Button - Accessible.name: root.zh ? (root.soundOn ? "关闭声音" : "打开声音") : (root.soundOn ? "Turn the sound off" : "Turn the sound on") + Accessible.name: root.soundOn ? root.t("Turn the sound off", "关闭声音") : root.t("Turn the sound on", "打开声音") Canvas { id: speaker; anchors.centerIn: parent; width: 16; height: 16 property bool on: root.soundOn diff --git a/freevideo_engine/launcher/FReleaseNotes.qml b/freevideo_engine/launcher/FReleaseNotes.qml index 59890844..1c6f1d88 100644 --- a/freevideo_engine/launcher/FReleaseNotes.qml +++ b/freevideo_engine/launcher/FReleaseNotes.qml @@ -7,6 +7,8 @@ ColumnLayout { // Versions between the installed one and `release`, newest first. property var earlier: [] property bool zh: false + // The interface text for a pair; Main.qml passes its own t (the language file lookup), this is the fallback. + property var t: function(en, cn, values) { var text = zh ? cn : en; return values ? text.replace(/\{(\w+)\}/g, (whole, name) => name in values ? String(values[name]) : whole) : text } property string heading: "" readonly property var notes: release && release.release_notes ? release.release_notes[zh ? "zh" : "en"] : null // The width of the window the notes sit in. The layout is chosen from it, not from the notes' own width: that @@ -56,7 +58,7 @@ ColumnLayout { Rectangle { width: Math.min(parent.width, tag.implicitWidth + 12); height: parent.height; radius: theme.radiusXs; color: theme.raised } Text { id: tag; x: 6; y: 1; width: parent.width - 12 - text: change.parts ? change.parts[0] : ""; color: theme.accent; font.pixelSize: theme.micro; elide: Text.ElideRight + text: change.parts ? change.parts[0] : ""; color: theme.accent; font.family: backend.fontFamily; font.pixelSize: theme.micro; elide: Text.ElideRight } } FText { text: change.parts ? change.parts[1] : "• " + change.text; color: change.parts ? theme.text : theme.muted; Layout.fillWidth: true } @@ -64,10 +66,10 @@ ColumnLayout { FText { text: heading; font.weight: Font.DemiBold; font.pixelSize: theme.section; Layout.fillWidth: true } FText { - text: release && release.development ? (zh ? "开发版本" : "Development version") : (zh ? "构建号:" : "Build: ") + (release && release.version || "—") + text: release && release.development ? t("Development version", "开发版本") : t("Build: {version}", "构建号:{version}", {version: release && release.version || "—"}) color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } - FText { text: notes ? notes.summary : (zh ? "此版本未附带更新说明。" : "No release notes were included with this version."); Layout.fillWidth: true } + FText { text: notes ? notes.summary : t("No release notes were included with this version.", "此版本未附带更新说明。"); Layout.fillWidth: true } Repeater { model: notes ? notes.changes : [] delegate: Change { diff --git a/freevideo_engine/launcher/FText.qml b/freevideo_engine/launcher/FText.qml index 7663c89b..d9ece180 100644 --- a/freevideo_engine/launcher/FText.qml +++ b/freevideo_engine/launcher/FText.qml @@ -2,6 +2,7 @@ import QtQuick Text { color: theme.text + font.family: backend.fontFamily // the interface language's font order (Traditional Chinese has its own) font.pixelSize: theme.body wrapMode: Text.Wrap lineHeight: 1.2 diff --git a/freevideo_engine/launcher/Main.qml b/freevideo_engine/launcher/Main.qml index 1dcfce8c..5f20e84d 100644 --- a/freevideo_engine/launcher/Main.qml +++ b/freevideo_engine/launcher/Main.qml @@ -9,6 +9,10 @@ ApplicationWindow { color: unifiedChrome ? theme.canvas : theme.bg width: 1280; height: 860 property var s: initialState + // Controls take the window's font; plain text items bind the same list (FText and the few below). + font.family: backend.fontFamily + // The web page's settings change the same interface language; take it when the launcher comes back to the front. + onActiveChanged: if (active) backend.followSavedLanguage() readonly property var downloads: backend.downloadList // Keep expansion by family across language changes and new checked lists. property var downloadExpanded: ({}) @@ -54,9 +58,38 @@ ApplicationWindow { property string previousPage: "" property bool errorDetailsOpen: false property string previousError: "" - function t(en, zh) { return s.zh ? zh : en } + // The interface text for a pair, the rule of web/i18n.js: English and Simplified Chinese are the text written here; + // another language reads its file (the entry for both, then for the English, then the English itself). {name} + // placeholders are filled from values. A binding through t() follows the language and its file, not every state change. + readonly property string uiLanguage: s.ui_language || (s.zh ? "zh-Hans" : "en") + readonly property var catalog: backend.catalog + function fill(text, values) { + return values ? String(text).replace(/\{(\w+)\}/g, (whole, name) => Object.prototype.hasOwnProperty.call(values, name) ? String(values[name]) : whole) : text + } + function t(en, zh, values) { + if (uiLanguage === "zh-Hans") return fill(zh, values) + if (uiLanguage === "en") return fill(en, values) + const own = key => catalog && typeof catalog[key] === "string" ? catalog[key] : null + // A file whose fallback is zh-Hans (Traditional Chinese) shows text it does not hold as the code's Simplified + // Chinese in its own characters, not as English (web/i18n.js lookup). + const missing = () => catalog && catalog._meta && catalog._meta.fallback === "zh-Hans" ? fromSimplified(zh) : en + return fill(own(en + "\u241f" + zh) ?? own(en) ?? missing(), values) + } + // Simplified Chinese in the characters of the language file's _meta.chars (pairs of a Simplified character and the + // one it becomes). The table follows the file (computed when it changes); reading it never writes a property, so the + // texts that call t() in their bindings do not loop. + readonly property var charTable: { + const pairs = Array.from(String(catalog && catalog._meta && catalog._meta.chars || "")) + const table = {} + for (let i = 0; i + 1 < pairs.length; i += 2) table[pairs[i]] = pairs[i + 1] + return table + } + function fromSimplified(text) { + const table = charTable + return Array.from(String(text)).map(ch => Object.prototype.hasOwnProperty.call(table, ch) ? table[ch] : ch).join("") + } function releaseVersion(value) { return value && value.product_version ? "v" + value.product_version : value && value.version || "—" } - function releaseSummary(value) { return value && value.release_notes ? value.release_notes[s.zh ? "zh" : "en"].summary : "" } + function releaseSummary(value) { return value && value.release_notes ? value.release_notes[s.notes_zh ? "zh" : "en"].summary : "" } readonly property var currentRelease: s.update.current_release || {version: s.update.current} readonly property var engineRelease: s.update.engine_release || {} readonly property string engineBuild: engineRelease.version || s.update.installed || "" @@ -72,7 +105,7 @@ ApplicationWindow { // While something downloads, the installer gives the seconds left from its bytes and speed; nothing otherwise. readonly property string remainingText: !number(s.remaining_seconds) || s.remaining_seconds <= 0 ? "" : s.remaining_seconds < 60 ? t("Less than a minute left", "预计还需不到 1 分钟") - : t("About " + Math.round(s.remaining_seconds / 60) + "\u00a0min left", "预计还需约 " + Math.round(s.remaining_seconds / 60) + "\u00a0分钟") + : t("About {minutes}\u00a0min left", "预计还需约 {minutes}\u00a0分钟", {minutes: Math.round(s.remaining_seconds / 60)}) readonly property var availableRelease: s.update.candidate || (s.update.engine ? currentRelease : null) readonly property var availableEarlier: s.update.candidate ? (s.update.candidate_earlier || []) : s.update.engine ? (s.update.engine_earlier || []) : [] function sourceName(value) { return ({"auto": t("Automatic", "自动选择"), "official": "Hugging Face", "hf-mirror": t("HF Mirror", "HF 镜像"), "modelscope": t("ModelScope", "魔搭")})[value] || value } @@ -102,7 +135,7 @@ ApplicationWindow { var size = gb(n), speed = rate > 0 ? rate : s.bytes_per_second if (!(speed > 0) || !(n > 0)) return size var seconds = n / speed, minutes = Math.ceil(seconds / 60) - return size + " · " + (seconds >= 60 ? t("about " + minutes + " min", "约 " + minutes + " 分钟") : t("under 1 min", "不到 1 分钟")) + return size + " · " + (seconds >= 60 ? t("about {minutes} min", "约 {minutes} 分钟", {minutes: minutes}) : t("under 1 min", "不到 1 分钟")) } // The home-page line for the prompt model: the suggestion, then progress, a pause or the reason it stopped. function promptModelLine() { @@ -110,13 +143,13 @@ ApplicationWindow { if (m.busy) { var rate = m.install.bytes_per_second, left = m.total_bytes - m.install.done var more = rate > 0 || s.bytes_per_second > 0 ? sizeAndTime(left, rate).split(" · ")[1] : "" - return t("Downloading the prompt model · ", "正在下载提示词模型 · ") + gb(m.install.done) + " / " + total + (more ? " · " + more : "") + return t("Downloading the prompt model · {done} / {total}", "正在下载提示词模型 · {done} / {total}", {done: gb(m.install.done), total: total}) + (more ? " · " + more : "") } if (m.checking) return t("Checking the prompt model…", "正在检查提示词模型…") if (m.failure) return m.failure - if (m.install.state === "cancelled") return t("Prompt model download paused · ", "提示词模型下载已暂停 · ") + done + " / " + total - return t("You can also download the prompt model (", "可以再下载提示词模型(") + sizeAndTime(m.total_bytes).replace(" · ", t(", ", ",")) - + t(") to refine prompts before generating.", "),生成前会自动完善提示词。") + if (m.install.state === "cancelled") return t("Prompt model download paused · {done} / {total}", "提示词模型下载已暂停 · {done} / {total}", {done: done, total: total}) + return t("You can also download the prompt model ({size}) to refine prompts before generating.", "可以再下载提示词模型({size}),生成前会自动完善提示词。", + {size: sizeAndTime(m.total_bytes).replace(" · ", t(", ", ","))}) } function bytes(n) { // macOS counts in decimal units like Finder: 1.26 TB, 64.4 GB. @@ -135,15 +168,14 @@ ApplicationWindow { function diskLine() { var d = disk if (!d) return "" - var en = "\"" + d.name + "\"", zh = "“" + d.name + "”" - if (d.problem === "fat32") return t(en + " can't store files over 4 GB. Choose another disk.", zh + " 不能存放 4 GB 以上的文件,请换一块硬盘。") - if (d.problem === "exfat") return t(en + " can't hold FreeVideo. Choose another disk.", zh + " 不能安装 FreeVideo,请换一块硬盘。") - if (d.problem === "disconnected") return t(en + " is not connected. Connect it to continue.", zh + "没有连接,请接上这块硬盘。") - if (d.problem === "read-only") return t(en + " is read-only. Choose another disk.", zh + " 不能写入,请换一块硬盘。") - if (d.short) return t(en + " has " + d.free + " available; this installation needs about " + d.need + ".", - zh + "可用 " + d.free + ",这次安装需要约 " + d.need + "。") - return t(d.name + " · " + d.free + " available", d.name + " · 可用 " + d.free) - + (d.need ? t(" · about " + d.need + " needed", " · 需要约 " + d.need) : "") + var named = {name: d.name, free: d.free, need: d.need} + if (d.problem === "fat32") return t("\"{name}\" can't store files over 4 GB. Choose another disk.", "“{name}” 不能存放 4 GB 以上的文件,请换一块硬盘。", named) + if (d.problem === "exfat") return t("\"{name}\" can't hold FreeVideo. Choose another disk.", "“{name}” 不能安装 FreeVideo,请换一块硬盘。", named) + if (d.problem === "disconnected") return t("\"{name}\" is not connected. Connect it to continue.", "“{name}”没有连接,请接上这块硬盘。", named) + if (d.problem === "read-only") return t("\"{name}\" is read-only. Choose another disk.", "“{name}” 不能写入,请换一块硬盘。", named) + if (d.short) return t("\"{name}\" has {free} available; this installation needs about {need}.", "“{name}”可用 {free},这次安装需要约 {need}。", named) + return t("{name} · {free} available", "{name} · 可用 {free}", named) + + (d.need ? t(" · about {size} needed", " · 需要约 {size}", {size: d.need}) : "") } // The label before diskLine() when the line states the disk rather than a problem. function diskLabel() { return disk && !disk.problem && !disk.short ? t("Disk:", "所在硬盘:") : "" } @@ -202,15 +234,17 @@ ApplicationWindow { : t("about 10–30% faster on this GPU", "在这张显卡上预计快约 10–30%") if (u.status === "available") return (u.resized ? t("Download size updated. ", "下载量已更新。") : "") - + t("The faster model is ", "更快的模型") + speed + t(" and closer to the original quality. It downloads ", ",画质也更接近原版。需要下载约 ") + bytes(u.download_bytes) + + t("The faster model is {speed} and closer to the original quality. It downloads {size}", "更快的模型{speed},画质也更接近原版。需要下载约 {size}", + {speed: speed, size: bytes(u.download_bytes)}) + (lora ? t("; the old model stays so your LoRAs keep working, and no space is freed.", ";为了继续使用已有的 LoRA,旧模型会保留,空间不会释放。") - : t(", then removes the old model and frees about ", ",完成后删除旧模型,释放约 ") + bytes(u.release_bytes) + t(".", "。")) + : t(", then removes the old model and frees about {size}.", ",完成后删除旧模型,释放约 {size}。", {size: bytes(u.release_bytes)})) + t(" You can keep generating while it downloads.", "下载期间可以继续生成。") if (u.status === "low-disk") - return t("It needs about ", "需要约 ") + bytes(u.required_bytes) + t(" free; ", " 可用空间,目前剩 ") + bytes(u.free_bytes) - + t(" is free. Clean the download cache in Settings → Storage or free some space, then reopen FreeVideo.", "。可以在 设置 → 存储 清理下载缓存,或者腾出空间后重新打开 FreeVideo。") + return t("It needs about {required} free; {free} is free. Clean the download cache in Settings → Storage or free some space, then reopen FreeVideo.", + "需要约 {required} 可用空间,目前剩 {free}。可以在 设置 → 存储 清理下载缓存,或者腾出空间后重新打开 FreeVideo。", + {required: bytes(u.required_bytes), free: bytes(u.free_bytes)}) if (u.status === "downloading") - return u.progress && u.progress.unit === "bytes" && u.progress.total ? bytes(u.progress.done) + " / " + bytes(u.progress.total) + t(" · you can keep generating", " · 可以继续生成") + return u.progress && u.progress.unit === "bytes" && u.progress.total ? t("{done} / {total} · you can keep generating", "{done} / {total} · 可以继续生成", {done: bytes(u.progress.done), total: bytes(u.progress.total)}) : t("Checking the download…", "正在检查下载内容…") if (u.status === "downloaded" && u.waiting === "comfy") return t("FreeVideo was not started by the launcher, so it cannot be restarted automatically. Once it is closed, the switch starts; until then the current model keeps working.", @@ -218,14 +252,14 @@ ApplicationWindow { if (u.status === "downloaded" || u.status === "switching") return t("Generation pauses for about 2 minutes during the switch; settings and videos are kept.", "切换期间暂停生成约 2 分钟,设置和视频会保留。") if (u.status === "releasable" && u.in_use === "int8_convrot") - return t("FreeVideo now uses the faster model. Removing the old model frees about ", "已在用更快的模型,删除旧模型可释放约 ") + bytes(u.release_bytes) - + t("; only its own files are removed.", ",只删除旧模型自己的文件。") + return t("FreeVideo now uses the faster model. Removing the old model frees about {size}; only its own files are removed.", + "已在用更快的模型,删除旧模型可释放约 {size},只删除旧模型自己的文件。", {size: bytes(u.release_bytes)}) if (u.status === "releasable") - return t("Removing unused model files frees about ", "删除未使用的模型文件可释放约 ") + bytes(u.release_bytes) - + t("; the model in use is not touched.", ",正在使用的模型不受影响。") + return t("Removing unused model files frees about {size}; the model in use is not touched.", "删除未使用的模型文件可释放约 {size},正在使用的模型不受影响。", + {size: bytes(u.release_bytes)}) if (u.status === "releasing") return t("Only the old model's own files are removed.", "只删除旧模型自己的文件。") if (u.status === "complete") - return (u.released_bytes ? t("Freed ", "已释放 ") + bytes(u.released_bytes) + t(".", "。") : "") + return (u.released_bytes ? t("Freed {size}.", "已释放 {size}。", {size: bytes(u.released_bytes)}) : "") + (lora ? t(" The old model stays for your fused LoRAs.", "旧模型为需要合并的 LoRA 保留。") : "") if (u.status === "failed") return (u.blockers && u.blockers.length ? upgradeBlocker(u.blockers[0]) + t(" ", "") : upgradeCause(u.cause, u.step) + "\n") @@ -236,14 +270,14 @@ ApplicationWindow { } function updateHeadline() { var phase = s.update.phase - if (phase === "downloading") return t("Downloading update ", "正在下载更新 ") + percent(s.update.progress) + if (phase === "downloading") return t("Downloading update {percent}", "正在下载更新 {percent}", {percent: percent(s.update.progress)}) if (phase === "waiting") return t("Updating after the current video finishes", "当前视频生成完成后自动更新") if (phase === "restarting") return t("Restarting FreeVideo…", "正在重启 FreeVideo…") if (phase === "engine") return t("Updating…", "正在更新…") if (phase === "checking") return t("Checking for updates…", "正在检查更新…") if (s.update.status === "error") return t("Update incomplete", "更新未完成") - if (s.update.candidate) return t("FreeVideo ", "FreeVideo ") + releaseVersion(s.update.candidate) + t(" is available", " 可以更新") - return t("New engine ", "新版引擎 ") + releaseVersion(currentRelease) + t(" is ready", " 已就绪") + if (s.update.candidate) return t("FreeVideo {version} is available", "FreeVideo {version} 可以更新", {version: releaseVersion(s.update.candidate)}) + return t("New engine {version} is ready", "新版引擎 {version} 已就绪", {version: releaseVersion(currentRelease)}) } function updateExplanation() { var phase = s.update.phase @@ -252,9 +286,12 @@ ApplicationWindow { if (phase === "restarting" || phase === "engine") return t("FreeVideo restarts once; open pages refresh automatically.", "FreeVideo 会重启一次,已打开的页面会自动刷新。") if (phase === "checking") return "" if (s.update.status === "error" && s.update.error) return s.update.error - if (s.update.candidate && s.update.manual) return t("Current version ", "当前版本 ") + releaseVersion(currentRelease) + t(". Download it and replace this version; models and settings are kept.", "。下载新版后替换当前版本,模型和设置会保留。") - if (s.update.candidate) return t("Current version ", "当前版本 ") + releaseVersion(currentRelease) + t(". Updating keeps your models and settings and takes about a minute.", "。更新会保留模型和设置,约需 1 分钟。") - return t("Installed engine ", "已安装引擎 ") + engineVersion + t(". Updating takes about a minute and keeps your models and settings.", "。更新约需 1 分钟,模型和设置都会保留。") + if (s.update.candidate && s.update.manual) return t("Current version {version}. Download it and replace this version; models and settings are kept.", + "当前版本 {version}。下载新版后替换当前版本,模型和设置会保留。", {version: releaseVersion(currentRelease)}) + if (s.update.candidate) return t("Current version {version}. Updating keeps your models and settings and takes about a minute.", + "当前版本 {version}。更新会保留模型和设置,约需 1 分钟。", {version: releaseVersion(currentRelease)}) + return t("Installed engine {version}. Updating takes about a minute and keeps your models and settings.", "已安装引擎 {version}。更新约需 1 分钟,模型和设置都会保留。", + {version: engineVersion}) } // A narrow window may wrap the waiting sentence; "自动继续" is not split in the middle. function keepTogether(text) { return String(text).replace("自动继续", "自\u2060动\u2060继\u2060续") } @@ -375,8 +412,8 @@ ApplicationWindow { spacing: 2 Text { objectName: "launcherVersionLabel"; text: versionInfoButton.text; font: versionInfoButton.font color: versionInfoButton.hovered ? theme.text : theme.muted; horizontalAlignment: Text.AlignLeft; Layout.fillWidth: true } - Text { objectName: "engineVersionLabel"; visible: separateVersions; text: t("Engine ", "引擎 ") + engineVersion - font.pixelSize: 10; color: theme.muted; horizontalAlignment: Text.AlignLeft; Layout.fillWidth: true } + Text { objectName: "engineVersionLabel"; visible: separateVersions; text: t("Engine {version}", "引擎 {version}", {version: engineVersion}) + font.family: backend.fontFamily; font.pixelSize: 10; color: theme.muted; horizontalAlignment: Text.AlignLeft; Layout.fillWidth: true } } } } @@ -433,26 +470,48 @@ ApplicationWindow { id: headerTools anchors.right: parent.right; anchors.rightMargin: win.narrow ? 12 : 20; anchors.verticalCenter: parent.verticalCenter spacing: 12 + // The same height as the language key, with its top and bottom edges; fully round, since it only shows a state. + // The dot and the word are centred as one by their ink (measured as in the language key). Rectangle { + id: pill; objectName: "connectedPill" visible: s.status === "open"; anchors.verticalCenter: parent.verticalCenter - height: 26; width: connected.implicitWidth + 30; radius: 13; color: theme.successSubtle + readonly property real dpr: Screen.devicePixelRatio || 1 + readonly property real px: theme.micro + readonly property int dotSize: 7 + readonly property int gap: 6 + readonly property int pad: 12 + TextMetrics { id: connectedInk; font.hintingPreference: Font.PreferNoHinting; font.pixelSize: pill.px * 16; text: connected.text } + readonly property real inkLeft: connectedInk.tightBoundingRect.x / 16 + readonly property real inkRight: (connectedInk.tightBoundingRect.x + connectedInk.tightBoundingRect.width) / 16 + TextMetrics { id: connectedFirst; font.hintingPreference: Font.PreferNoHinting; font.pixelSize: pill.px * 16; text: connected.text.charAt(0) } + readonly property real inkMiddle: (connectedFirst.tightBoundingRect.y + connectedFirst.tightBoundingRect.height / 2) / 16 + readonly property real inkWidth: dotSize + gap + inkRight - inkLeft + readonly property real start: Math.round((width - inkWidth) / 2 * dpr) / dpr + readonly property real baselineY: Math.round((height / 2 - inkMiddle) * dpr) / dpr + height: theme.heightSm; radius: height / 2; color: theme.successSubtle + width: Math.ceil((inkWidth + 2 * pad) * dpr) / dpr Rectangle { - id: liveDot; x: 11; anchors.verticalCenter: parent.verticalCenter; width: 7; height: 7; radius: 4; color: theme.success + id: liveDot; objectName: "connectedDot" + x: pill.start; y: (pill.height - pill.dotSize) / 2 + width: pill.dotSize; height: pill.dotSize; radius: pill.dotSize / 2; color: theme.success SequentialAnimation on opacity { running: liveDot.visible; loops: Animation.Infinite NumberAnimation { to: 0.35; duration: 1400; easing.type: Easing.InOutSine } NumberAnimation { to: 1; duration: 1400; easing.type: Easing.InOutSine } } } - FText { id: connected; x: 23; anchors.verticalCenter: parent.verticalCenter; text: t("Connected", "已连接"); font.pixelSize: theme.micro; color: theme.success } + FText { + id: connected; objectName: "connectedText"; wrapMode: Text.NoWrap + x: pill.start + pill.dotSize + pill.gap - pill.inkLeft; y: pill.baselineY - baselineOffset + text: t("Connected", "已连接"); font.pixelSize: pill.px; font.hintingPreference: Font.PreferNoHinting; color: theme.success + } } - // Both languages stay visible; the current one is marked. - FSegmented { - objectName: "languageSwitch"; compact: true; anchors.verticalCenter: parent.verticalCenter - width: 104; current: s.zh ? "zh" : "en" - options: [{value: "zh", label: "中文"}, {value: "en", label: "EN"}] - onPicked: function(value) { if (value !== current) backend.edit("language", value) } - Accessible.name: t("Language", "语言") + // The interface language: a globe and the shown language's own name; the list follows the system or names one. + FLanguage { + objectName: "languageSwitch"; anchors.verticalCenter: parent.verticalCenter + languages: s.languages || []; setting: s.language_setting || "auto"; shown: win.uiLanguage; system: s.system_language || win.uiLanguage + t: win.t + onPicked: function(value) { backend.edit("language", value) } } } } @@ -503,19 +562,19 @@ ApplicationWindow { // What each download source returned: one short line per source. FText { objectName: "failureSources"; visible: !!s.failure.sources; text: sourceLines(s.failure.sources); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } TextEdit { - objectName: "failurePath"; visible: !!s.failure.path; text: s.failure.path || "" + objectName: "failurePath"; visible: !!s.failure.path; text: s.failure.path || ""; font.family: backend.fontFamily readOnly: true; selectByMouse: true; wrapMode: Text.WrapAnywhere; textFormat: TextEdit.PlainText color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true selectionColor: theme.accentDim; selectedTextColor: theme.text } // Repair sets up again from the launcher's own engine, so it brings the update along. FText { objectName: "repairUpdatesEngine"; visible: !!s.update.with_repair; Layout.fillWidth: true; color: theme.text - text: t("Repair also updates the engine to " + releaseVersion(currentRelease) + ".", "修复时会一并更新到新版引擎 " + releaseVersion(currentRelease) + "。") } + text: t("Repair also updates the engine to {version}.", "修复时会一并更新到新版引擎 {version}。", {version: releaseVersion(currentRelease)}) } Flow { visible: !notAFault; Layout.fillWidth: true; spacing: 8 // Actions that resolve the problem first, then the report buttons. FButton { objectName: "moveToDisk"; visible: diskFailure && s.form.new_comfy && !!bestDisk; enabled: !s.busy; primary: true - text: bestDisk ? t("Install on \"" + bestDisk.name + "\"", "改装到“" + bestDisk.name + "”") : "" + text: bestDisk ? t("Install on \"{name}\"", "改装到“{name}”", {name: bestDisk.name}) : "" onClicked: backend.useDisk(bestDisk.path) } FButton { objectName: "chooseDisk"; visible: diskFailure && s.form.new_comfy && diskChoices.length > (bestDisk ? 1 : 0); enabled: !s.busy text: t("Other disks…", "其他硬盘…"); onClicked: diskDialogOpen = true } @@ -527,8 +586,8 @@ ApplicationWindow { text: t("Open install folder", "打开安装目录"); onClicked: backend.openInstallFolder() } FButton { objectName: "latestLauncherLink"; visible: s.failure.kind === "older-launcher"; flat: true text: t("Download the latest ↗", "下载最新版 ↗"); onClicked: backend.link("https://github.com/FlashML-org/FreeVideo/releases/latest") } - FButton { objectName: "reportProblem"; visible: !diskFailure && !notAFault && s.failure.kind !== "port-taken" && s.failure.kind !== "comfy-restart" && s.failure.kind !== "comfy-folder" && s.failure.kind !== "engine-folder-denied"; text: reportOpened(s.error, s.failure.title || "") ? t("Opened", "已打开") : t("Report a problem", "提交问题"); widthText: t("Report a problem", "提交问题"); enabled: !reportOpened(s.error, s.failure.title || ""); onClicked: backend.reportProblem(s.error, s.failure.title || "") } FButton { objectName: "exportError"; visible: !diskFailure && !notAFault; text: t("Export report", "导出报告"); enabled: s.report.status !== "running"; onClicked: backend.exportReport() } + FButton { objectName: "reportProblem"; visible: !diskFailure && !notAFault && s.failure.kind !== "port-taken" && s.failure.kind !== "comfy-restart" && s.failure.kind !== "comfy-folder" && s.failure.kind !== "engine-folder-denied"; text: reportOpened(s.error, s.failure.title || "") ? t("Opened", "已打开") : t("Report a problem", "提交问题"); widthText: t("Report a problem", "提交问题"); enabled: !reportOpened(s.error, s.failure.title || ""); onClicked: backend.reportProblem(s.error, s.failure.title || "") } } FButton { objectName: "showError"; visible: !notAFault; text: t("Technical details", "技术详情"); flat: true @@ -555,9 +614,9 @@ ApplicationWindow { objectName: "reportStatus" visible: s.report.status !== "idle"; Layout.fillWidth: true; font.pixelSize: theme.micro color: s.report.status === "error" ? theme.danger : theme.muted - text: s.report.status === "running" ? t("Exporting full logs…", "正在导出完整日志…") + (s.report.files > 0 ? t(" · " + s.report.files + " files packed", " · 已打包 " + s.report.files + " 个文件") : "") : - s.report.status === "error" ? t("Export failed: ", "导出失败:") + s.report.error : - t("Report saved locally: ", "报告已保存到本机:") + s.report.path + + text: s.report.status === "running" ? t("Exporting full logs…", "正在导出完整日志…") + (s.report.files > 0 ? t(" · {count} files packed", " · 已打包 {count} 个文件", {count: s.report.files}) : "") : + s.report.status === "error" ? t("Export failed: {error}", "导出失败:{error}", {error: s.report.error}) : + t("Report saved locally: {path}", "报告已保存到本机:{path}", {path: s.report.path}) + (s.report.collection_errors ? t("\nReport saved with some diagnostic information missing.", "\n报告已保存,部分诊断信息未能收集。") : "") } @@ -610,7 +669,7 @@ ApplicationWindow { FIcon { kind: "disk"; ink: disk && (disk.problem || disk.short) ? theme.danger : theme.muted; Layout.preferredWidth: 16; Layout.preferredHeight: 16; Layout.alignment: Qt.AlignVCenter } // A full-width colon carries its own space; pull the value up to it. FText { id: diskLabelText; objectName: "installDiskLabel"; visible: !!diskLabel(); text: diskLabel(); color: theme.muted; font.pixelSize: theme.micro + 1; wrapMode: Text.NoWrap - Layout.alignment: Qt.AlignBaseline; Layout.rightMargin: s.zh ? -(8 + Math.round(font.pixelSize / 2) - 2) : -4 } + Layout.alignment: Qt.AlignBaseline; Layout.rightMargin: text.slice(-1) === ":" ? -(8 + Math.round(font.pixelSize / 2) - 2) : -4 } FText { objectName: "installDiskText"; text: diskLine(); color: disk && (disk.problem || disk.short) ? theme.danger : theme.muted; font.pixelSize: theme.micro + 1; Layout.fillWidth: true; Layout.alignment: Qt.AlignBaseline } // The label's right edge lines up with Browse; the hover fill reaches into the card's padding. FButton { objectName: "changeDisk"; visible: s.form.new_comfy && diskChoices.length > 0; enabled: s.can_manage; flat: true; implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1 @@ -649,7 +708,7 @@ ApplicationWindow { } FMeter { visible: ["running", "preparing"].indexOf(s.offline.status) >= 0; Layout.fillWidth: true; fraction: win.fraction(s.offline); active: visible } FText { visible: !!s.offline.detail; text: s.offline.detail + (number(s.offline.total) ? " · " + bytes(s.offline.done) + " / " + bytes(s.offline.total) : ""); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } - FText { visible: s.offline.models > 0; text: t("Model packages also saved for the next step: ", "同时导入的模型包将在下一步使用:") + s.offline.models; color: theme.success; font.pixelSize: theme.micro; Layout.fillWidth: true } + FText { visible: s.offline.models > 0; text: t("Model packages also saved for the next step: {count}", "同时导入的模型包将在下一步使用:{count}", {count: s.offline.models}); color: theme.success; font.pixelSize: theme.micro; Layout.fillWidth: true } } } @@ -671,7 +730,7 @@ ApplicationWindow { FChoice { objectName: "installImageModel"; Layout.fillWidth: true; Layout.minimumWidth: 0; Layout.preferredWidth: 1; Layout.fillHeight: true text: "MiniMax H3\u00a0Image" - detail: s.image_installed ? t("Installed.", "已安装。") : checked ? t("Makes pictures.", "生成图片。") : t("Makes pictures. Can be added later in the app.", "生成图片。以后可在应用内添加。") + detail: s.image_installed ? t("Installed.", "已安装。") : checked ? t("Makes images.", "生成图片。") : t("Makes images. Can be added later in the app.", "生成图片。以后可在应用内添加。") checked: !!s.image_only; enabled: !s.busy onClicked: backend.edit("install_model", "image") } @@ -822,7 +881,7 @@ ApplicationWindow { } } } - FText { visible: s.offline.models > 0; text: "✓ " + t("Model packages: ", "已导入模型包:") + s.offline.models; color: theme.success; font.pixelSize: theme.micro; Layout.fillWidth: true } + FText { visible: s.offline.models > 0; text: "✓ " + t("Model packages: {count}", "已导入模型包:{count}", {count: s.offline.models}); color: theme.success; font.pixelSize: theme.micro; Layout.fillWidth: true } } FCard { @@ -846,7 +905,7 @@ ApplicationWindow { // the elapsed time and, while something downloads, one estimate of what is left. RowLayout { Layout.alignment: Qt.AlignRight; spacing: 20; visible: !!s.elapsed - FText { objectName: "elapsedText"; text: t("Elapsed ", "已用时 ") + s.elapsed; font.pixelSize: theme.micro; color: theme.muted } + FText { objectName: "elapsedText"; text: t("Elapsed {time}", "已用时 {time}", {time: s.elapsed}); font.pixelSize: theme.micro; color: theme.muted } FText { objectName: "remainingText"; visible: !!remainingText; text: remainingText; font.pixelSize: theme.micro; color: theme.muted } } Rectangle { visible: !!stepText; Layout.fillWidth: true; Layout.topMargin: 4; Layout.bottomMargin: 4; height: 1; color: theme.border } @@ -1313,7 +1372,7 @@ ApplicationWindow { ColumnLayout { Layout.fillWidth: true; spacing: 2 FText { text: t("Connection speed", "连接速度"); Layout.fillWidth: true } - FText { text: s.probe.status === "running" ? t("Testing sources: ", "正在测速:") + (s.probe.progress?.done || 0) + "/" + (s.probe.progress?.total || "…") : t("Compare sources on this computer.", "比较本机下载源速度。"); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } + FText { text: s.probe.status === "running" ? t("Testing sources: {done}/{total}", "正在测速:{done}/{total}", {done: s.probe.progress?.done || 0, total: s.probe.progress?.total || "…"}) : t("Compare sources on this computer.", "比较本机下载源速度。"); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } } FButton { text: s.probe.status === "running" ? t("Testing…", "测速中…") : t("Test speed", "测速"); implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1; enabled: s.probe.status !== "running"; onClicked: backend.speedTest() } } @@ -1347,10 +1406,13 @@ ApplicationWindow { Layout.fillWidth: true; title: t("General", "通用") RowLayout { Layout.fillWidth: true; spacing: 12 - FText { text: t("Language", "语言"); Layout.fillWidth: true } - FSegmented { - Layout.preferredWidth: 200; current: s.zh ? "zh" : "en"; onPicked: function(value) { if (value !== current) backend.edit("language", value) } - options: [{value: "zh", label: "简体中文"}, {value: "en", label: "English"}] + FText { text: t("Interface language", "界面语言"); Layout.fillWidth: true } + FLanguage { + objectName: "settingsLanguage" + Layout.preferredWidth: implicitWidth; Layout.preferredHeight: implicitHeight + languages: s.languages || []; setting: s.language_setting || "auto"; shown: win.uiLanguage; system: s.system_language || win.uiLanguage + t: win.t + onPicked: function(value) { backend.edit("language", value) } } } FDivider {} @@ -1361,7 +1423,7 @@ ApplicationWindow { FText { text: t("Updates", "更新"); Layout.fillWidth: true } FText { text: t("Settings are kept in Documents across updates.", "设置保存在文档目录中,更新后保留。"); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } } - FButton { objectName: "checkUpdatesButton"; text: s.update.check_requested ? s.update.check_text : t("Check now", "检查更新"); implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1; onClicked: { manualUpdate = true; backend.checkUpdates("") } } + FButton { objectName: "checkUpdatesButton"; text: s.update.check_requested ? s.update.check_text : t("Check for updates", "检查更新"); implicitHeight: theme.heightSm; font.pixelSize: theme.micro + 1; onClicked: { manualUpdate = true; backend.checkUpdates("") } } } FButton { text: t("Version & release notes", "版本与更新说明") + " · " + releaseVersion(currentRelease); flat: true; Layout.fillWidth: true; onClicked: releaseNotesOpen = true } } @@ -1375,8 +1437,10 @@ ApplicationWindow { objectName: "lanFirewallHint" visible: Qt.platform.os === "windows" && !!s.form.lan_access && !(s.lan_qr && s.lan_qr.length > 0) Layout.fillWidth: true - FText { text: t("Windows will ask for permission. Check \"Private networks\", then click \"Allow access\".", "Windows 会弹出确认框,"); color: theme.muted; font.pixelSize: theme.micro; width: Math.min(implicitWidth, parent.width); wrapMode: Text.WordWrap } - FText { text: "请勾选“专用网络”,再点“允许访问”。"; visible: s.zh; color: theme.muted; font.pixelSize: theme.micro; width: Math.min(implicitWidth, parent.width); wrapMode: Text.WordWrap } + // The whole sentence in English (and in a language file that translates it whole); Chinese + // has two halves, each through t(), the second only where the first stops at the comma. + FText { objectName: "lanFirewallFirst"; text: t("Windows will ask for permission. Check \"Private networks\", then click \"Allow access\".", "Windows 会弹出确认框,"); color: theme.muted; font.pixelSize: theme.micro; width: Math.min(implicitWidth, parent.width); wrapMode: Text.WordWrap } + FText { objectName: "lanFirewallSecond"; text: t("Check \"Private networks\", then click \"Allow access\".", "请勾选“专用网络”,再点“允许访问”。"); visible: uiLanguage.indexOf("zh") === 0; color: theme.muted; font.pixelSize: theme.micro; width: Math.min(implicitWidth, parent.width); wrapMode: Text.WordWrap } } GridLayout { id: lanQrRow; objectName: "lanQrRow" @@ -1467,8 +1531,9 @@ ApplicationWindow { color: s.cleanup.status === "error" ? theme.danger : theme.muted text: s.cleanup.status === "scanning" ? t("Checking…", "正在检查…") : s.cleanup.status === "cleaning" ? t("Cleaning…", "正在清理…") : - s.cleanup.status === "ready" ? (s.cleanup.bytes > 0 ? t("About ", "约 ") + bytes(s.cleanup.bytes) + t(" can be freed. Models, environments and videos are kept.", " 可清理,保留模型、运行环境和视频。") : t("Nothing to clean.", "暂无可清理的下载缓存。")) : - s.cleanup.status === "complete" ? t("Freed ", "已释放 ") + bytes(s.cleanup.released_bytes || 0) + (s.cleanup.skipped ? t(". Some files changed; check again.", "。部分文件已变化,请重新检查。") : t(".", "。")) : + s.cleanup.status === "ready" ? (s.cleanup.bytes > 0 ? t("About {size} can be freed. Models, environments and videos are kept.", "约 {size} 可清理,保留模型、运行环境和视频。", {size: bytes(s.cleanup.bytes)}) : t("Nothing to clean.", "暂无可清理的下载缓存。")) : + s.cleanup.status === "complete" ? (s.cleanup.skipped ? t("Freed {size}. Some files changed; check again.", "已释放 {size}。部分文件已变化,请重新检查。", {size: bytes(s.cleanup.released_bytes || 0)}) + : t("Freed {size}.", "已释放 {size}。", {size: bytes(s.cleanup.released_bytes || 0)})) : s.cleanup.status === "busy" ? t("Another task is using these files. Try again when it finishes.", "其他任务正在使用这些文件,完成后可重试。") : s.cleanup.status === "error" ? (s.cleanup.message || t("Cleanup could not finish. Check again to retry.", "清理未完成,可重新检查后再试。")) : t("Installation files kept for repairs. Models, environments and videos are never removed.", "安装时缓存的文件,清理时不会删除模型、运行环境和视频。") @@ -1518,9 +1583,13 @@ ApplicationWindow { FText { text: t("Video model", "视频模型"); Layout.fillWidth: true } FText { objectName: "modelStorageStatus"; Layout.fillWidth: true; font.pixelSize: theme.micro; color: theme.muted; wrapMode: Text.WordWrap - text: upgrade.status === "available" ? t("A faster model is available: about ", "有更快的模型:下载约 ") + bytes(upgrade.download_bytes) - + (upgrade.release_bytes ? t(" to download, about ", ",完成后删除旧模型,释放约 ") + bytes(upgrade.release_bytes) + t(" freed afterwards.", "。") : t(" to download.", "。")) - : upgrade.status === "releasable" ? (upgrade.in_use === "int8_convrot" ? t("The old model is no longer used; about ", "旧模型已不再使用,删除可释放约 ") : t("Model files not in use; about ", "有没在使用的模型文件,删除可释放约 ")) + bytes(upgrade.release_bytes) + t(" can be freed.", "。") + text: upgrade.status === "available" ? (upgrade.release_bytes + ? t("A faster model is available: about {size} to download, about {freed} freed afterwards.", "有更快的模型:下载约 {size},完成后删除旧模型,释放约 {freed}。", + {size: bytes(upgrade.download_bytes), freed: bytes(upgrade.release_bytes)}) + : t("A faster model is available: about {size} to download.", "有更快的模型:下载约 {size}。", {size: bytes(upgrade.download_bytes)})) + : upgrade.status === "releasable" ? (upgrade.in_use === "int8_convrot" + ? t("The old model is no longer used; about {size} can be freed.", "旧模型已不再使用,删除可释放约 {size}。", {size: bytes(upgrade.release_bytes)}) + : t("Model files not in use; about {size} can be freed.", "有没在使用的模型文件,删除可释放约 {size}。", {size: bytes(upgrade.release_bytes)})) : upgradeHeadline() } } @@ -1591,7 +1660,7 @@ ApplicationWindow { FText { text: s.failure.title + "\n" + (s.failure.action || s.failure.detail); color: theme.danger; font.pixelSize: theme.micro + 1; Layout.fillWidth: true } FText { objectName: "settingsFailureSources"; visible: !!s.failure.sources; text: sourceLines(s.failure.sources); color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } TextEdit { - objectName: "settingsFailurePath"; visible: !!s.failure.path; text: s.failure.path || "" + objectName: "settingsFailurePath"; visible: !!s.failure.path; text: s.failure.path || ""; font.family: backend.fontFamily readOnly: true; selectByMouse: true; wrapMode: Text.WrapAnywhere; textFormat: TextEdit.PlainText color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true selectionColor: theme.accentDim; selectedTextColor: theme.text @@ -1604,8 +1673,8 @@ ApplicationWindow { } FText { visible: s.report.status !== "idle"; Layout.fillWidth: true; font.pixelSize: theme.micro; color: theme.muted - text: s.report.status === "running" ? t("Exporting full logs…", "正在导出完整日志…") + (s.report.files > 0 ? t(" · " + s.report.files + " files packed", " · 已打包 " + s.report.files + " 个文件") : "") : - s.report.status === "error" ? s.report.error : t("Saved: ", "已保存:") + s.report.path + text: s.report.status === "running" ? t("Exporting full logs…", "正在导出完整日志…") + (s.report.files > 0 ? t(" · {count} files packed", " · 已打包 {count} 个文件", {count: s.report.files}) : "") : + s.report.status === "error" ? s.report.error : t("Saved: {path}", "已保存:{path}", {path: s.report.path}) } } } @@ -1622,7 +1691,7 @@ ApplicationWindow { id: diskContents; spacing: 12 FText { text: t("Choose a disk", "选择安装硬盘"); font.pixelSize: theme.section + 2; font.weight: Font.DemiBold; Layout.fillWidth: true } FText { objectName: "diskDialogText"; Layout.fillWidth: true; color: theme.muted; font.pixelSize: theme.micro + 1 - text: (disk && disk.need ? t("This installation needs about " + disk.need + ".\n", "这次安装需要约 " + disk.need + "。\n") : "") + text: (disk && disk.need ? t("This installation needs about {size}.\n", "这次安装需要约 {size}。\n", {size: disk.need}) : "") + t("FreeVideo is installed in a FreeVideo folder on the disk you choose.", "FreeVideo 会装在所选硬盘的 FreeVideo 文件夹里。") } Repeater { model: diskChoices @@ -1644,7 +1713,7 @@ ApplicationWindow { : modelData.problem === "fat32" ? t("Cannot install", "无法安装") : t("Not enough space", "空间不够") } } - FText { text: t(modelData.free + " available", "可用 " + modelData.free); color: theme.muted; font.pixelSize: theme.micro + 1; font.features: { "tnum": 1 }; wrapMode: Text.NoWrap; Layout.alignment: Qt.AlignVCenter } + FText { text: t("{free} available", "可用 {free}", {free: modelData.free}); color: theme.muted; font.pixelSize: theme.micro + 1; font.features: { "tnum": 1 }; wrapMode: Text.NoWrap; Layout.alignment: Qt.AlignVCenter } } MouseArea { id: diskArea; anchors.fill: parent; hoverEnabled: true; enabled: modelData.enough && !s.busy @@ -1807,7 +1876,7 @@ ApplicationWindow { objectName: "archivesDialogText"; color: theme.muted; Layout.fillWidth: true visible: !!s.archives_dialog.body; text: s.archives_dialog.body } - FButton { objectName: "archivesFilesToggle"; visible: !s.archives_dialog.retry; text: t("Show these files (" + s.archives_dialog.count + ")", "查看这些文件(" + s.archives_dialog.count + " 个)") + (archivesExpanded ? " −" : " +"); flat: true; leftPadding: 0; onClicked: archivesExpanded = !archivesExpanded } + FButton { objectName: "archivesFilesToggle"; visible: !s.archives_dialog.retry; text: t("Show these files ({count})", "查看这些文件({count} 个)", {count: s.archives_dialog.count}) + (archivesExpanded ? " −" : " +"); flat: true; leftPadding: 0; onClicked: archivesExpanded = !archivesExpanded } ColumnLayout { objectName: "archivesFileList"; visible: archivesExpanded && !s.archives_dialog.retry; Layout.fillWidth: true; spacing: 12 Repeater { @@ -1864,12 +1933,13 @@ ApplicationWindow { spacing: 14 // The update's picture or video on the window's top edge, above what changed. FReleaseMedia { + t: win.t id: updateMedia; objectName: "updateDialogMedia" Layout.fillWidth: true; Layout.preferredHeight: implicitHeight Layout.topMargin: -updateDialog.topPadding; Layout.leftMargin: -updateDialog.leftPadding Layout.rightMargin: -updateDialog.rightPadding; Layout.bottomMargin: 6 media: s.update.candidate ? (s.update.media || {}).candidate || null : s.update.engine ? (s.update.media || {}).current || null : null - zh: s.zh; radius: theme.radiusLg; maxHeight: Math.round(win.height * 0.4) + zh: !!s.notes_zh; radius: theme.radiusLg; maxHeight: Math.round(win.height * 0.4) } ScrollView { ScrollBar.vertical: FScrollBar {} @@ -1903,7 +1973,7 @@ ApplicationWindow { FButton { objectName: "updateDialogReport"; text: reportOpened(s.update.error, t("Update", "更新")) ? t("Opened", "已打开") : t("Report a problem", "提交问题"); widthText: t("Report a problem", "提交问题"); enabled: !reportOpened(s.update.error, t("Update", "更新")); flat: true; visible: s.update.status === "error" && !!s.update.error; onClicked: backend.reportProblem(s.update.error, t("Update", "更新")) } } FMeter { Layout.fillWidth: true; visible: s.update.status === "downloading"; active: true; fraction: s.update.progress && s.update.progress.total ? s.update.progress.done/s.update.progress.total : -1 } - FReleaseNotes { objectName: "updateReleaseNotes"; visible: !!availableRelease; Layout.fillWidth: true; room: updateDialog.availableWidth; release: availableRelease; earlier: availableEarlier; zh: s.zh; heading: releaseVersion(availableRelease) } + FReleaseNotes { t: win.t; objectName: "updateReleaseNotes"; visible: !!availableRelease; Layout.fillWidth: true; room: updateDialog.availableWidth; release: availableRelease; earlier: availableEarlier; zh: !!s.notes_zh; heading: releaseVersion(availableRelease) } FButton { text: t("Version & release notes", "版本与更新说明"); flat: true; Layout.maximumWidth: updateContents.width; onClicked: releaseNotesOpen = true } } } @@ -1997,12 +2067,13 @@ ApplicationWindow { spacing: 14 // On the window's top edge, as wide as the window: the update's media, else the current version's. FReleaseMedia { + t: win.t id: releaseMedia; objectName: "releaseNotesMedia" Layout.fillWidth: true; Layout.preferredHeight: implicitHeight Layout.topMargin: -releaseNotesPopup.topPadding; Layout.leftMargin: -releaseNotesPopup.leftPadding Layout.rightMargin: -releaseNotesPopup.rightPadding; Layout.bottomMargin: 6 media: s.update.candidate ? (s.update.media || {}).candidate || null : (s.update.media || {}).current || null - zh: s.zh; radius: theme.radiusLg; maxHeight: Math.round(win.height * 0.4) + zh: !!s.notes_zh; radius: theme.radiusLg; maxHeight: Math.round(win.height * 0.4) } ScrollView { ScrollBar.vertical: FScrollBar {} @@ -2012,13 +2083,13 @@ ApplicationWindow { ColumnLayout { id: releaseContents; width: releaseScroll.availableWidth - releaseScroll.ScrollBar.vertical.width; spacing: 18 FText { text: t("Version & release notes", "版本与更新说明"); font.pixelSize: theme.section + 2; font.weight: Font.DemiBold; Layout.fillWidth: true } - FReleaseNotes { visible: !!s.update.candidate; Layout.fillWidth: true; room: releaseNotesPopup.availableWidth; release: s.update.candidate; earlier: s.update.candidate_earlier || []; zh: s.zh; heading: releaseVersion(s.update.candidate) } + FReleaseNotes { t: win.t; visible: !!s.update.candidate; Layout.fillWidth: true; room: releaseNotesPopup.availableWidth; release: s.update.candidate; earlier: s.update.candidate_earlier || []; zh: !!s.notes_zh; heading: releaseVersion(s.update.candidate) } FDivider { visible: !!s.update.candidate } - FReleaseNotes { objectName: "currentReleaseNotes"; Layout.fillWidth: true; room: releaseNotesPopup.availableWidth; release: currentRelease; zh: s.zh; heading: (separateVersions ? t("Launcher", "启动器") : t("Current version", "当前版本")) + " · " + releaseVersion(currentRelease) } + FReleaseNotes { t: win.t; objectName: "currentReleaseNotes"; Layout.fillWidth: true; room: releaseNotesPopup.availableWidth; release: currentRelease; zh: !!s.notes_zh; heading: (separateVersions ? t("Launcher", "启动器") : t("Current version", "当前版本")) + " · " + releaseVersion(currentRelease) } FText { objectName: "engineReleaseInfo"; visible: !!engineRelease.product_version || !!engineBuild - text: t("Engine in use: ", "正在使用的引擎:") + (engineRelease.product_version - ? engineVersion + (engineBuild ? t(" (build ", "(构建号 ") + engineBuild + t(")", ")") : "") - : t("build ", "构建号 ") + engineBuild) + text: !engineRelease.product_version ? t("Engine in use: build {build}", "正在使用的引擎:构建号 {build}", {build: engineBuild}) + : engineBuild ? t("Engine in use: {version} (build {build})", "正在使用的引擎:{version}(构建号 {build})", {version: engineVersion, build: engineBuild}) + : t("Engine in use: {version}", "正在使用的引擎:{version}", {version: engineVersion}) color: theme.muted; font.pixelSize: theme.micro; Layout.fillWidth: true } } } @@ -2030,7 +2101,8 @@ ApplicationWindow { FDialog { objectName: "cleanupConfirmation"; visible: cleanupConfirm title: t("Clean download cache?", "清理下载缓存?") - text: t("About ", "将释放约 ") + bytes(s.cleanup.bytes || 0) + t(" will be freed. Future repairs may need to download these installation files again.", "。以后修复环境时,可能需要重新下载这些安装文件。") + text: t("About {size} will be freed. Future repairs may need to download these installation files again.", "将释放约 {size}。以后修复环境时,可能需要重新下载这些安装文件。", + {size: bytes(s.cleanup.bytes || 0)}) acceptText: t("Clean", "清理"); rejectText: t("Cancel", "取消") onAccepted: { cleanupConfirm = false; backend.cleanupDownloads(true) } onRejected: cleanupConfirm = false @@ -2058,10 +2130,18 @@ ApplicationWindow { objectName: "closeChoiceDialog"; visible: closeChoice !== "" title: t("Close FreeVideo?", "关闭 FreeVideo?") text: closeChoice === "generating" - ? t("A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the " + (closePlace === "menubar" ? "menu bar icon." : closePlace === "taskbar" ? "taskbar." : "tray icon."), - "正在生成视频。退出会停止 FreeVideo 和这次生成;后台运行时生成会继续,可从" + (closePlace === "menubar" ? "菜单栏图标" : closePlace === "taskbar" ? "任务栏" : "托盘图标") + "重新打开此窗口。") - : t("Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the " + (closePlace === "menubar" ? "menu bar icon." : closePlace === "taskbar" ? "taskbar." : "tray icon."), - "退出会停止 FreeVideo。后台运行时 FreeVideo 继续运行,可从" + (closePlace === "menubar" ? "菜单栏图标" : closePlace === "taskbar" ? "任务栏" : "托盘图标") + "重新打开此窗口。") + ? (closePlace === "menubar" ? t("A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the menu bar icon.", + "正在生成视频。退出会停止 FreeVideo 和这次生成;后台运行时生成会继续,可从菜单栏图标重新打开此窗口。") + : closePlace === "taskbar" ? t("A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the taskbar.", + "正在生成视频。退出会停止 FreeVideo 和这次生成;后台运行时生成会继续,可从任务栏重新打开此窗口。") + : t("A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the tray icon.", + "正在生成视频。退出会停止 FreeVideo 和这次生成;后台运行时生成会继续,可从托盘图标重新打开此窗口。")) + : (closePlace === "menubar" ? t("Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the menu bar icon.", + "退出会停止 FreeVideo。后台运行时 FreeVideo 继续运行,可从菜单栏图标重新打开此窗口。") + : closePlace === "taskbar" ? t("Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the taskbar.", + "退出会停止 FreeVideo。后台运行时 FreeVideo 继续运行,可从任务栏重新打开此窗口。") + : t("Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the tray icon.", + "退出会停止 FreeVideo。后台运行时 FreeVideo 继续运行,可从托盘图标重新打开此窗口。")) acceptText: t("Run in background", "后台运行"); altText: t("Exit", "退出"); rejectText: t("Cancel", "取消"); defaultFocus: true onAccepted: { closeChoice = ""; backend.runInBackground() } onAlternative: { closeChoice = ""; backend.close() } diff --git a/freevideo_engine/launcher_copy.py b/freevideo_engine/launcher_copy.py index 046a0f95..700e3a63 100644 --- a/freevideo_engine/launcher_copy.py +++ b/freevideo_engine/launcher_copy.py @@ -4,6 +4,7 @@ from .terminal_ui import clean from .model_repair import PROGRESS as MODEL_REPAIR_PROGRESS from .model_status import NAMES +from .i18n import KEY_SEPARATOR, catalog, code_language, from_simplified, lookup ACTION_COPY = { @@ -185,26 +186,33 @@ def size_text(value, decimal_sizes=False): class Phrase(str): - """Text shown in one interface language that keeps the other, so a message already - on screen can follow a language switch. Equal to, and used as, the shown text.""" - - def __new__(cls, en, zh, chinese): - text = super().__new__(cls, zh if chinese else en) - text.en, text.zh = en, zh + """Text shown in one interface language that keeps the others, so a message already on screen can follow a language + switch. Equal to, and used as, the shown text. language is a tag ('en', 'zh-Hans', a language file's) or, as before, + True for Simplified Chinese and False for English. Another language is built from make with the file's entries.""" + + def __new__(cls, en, zh, language, make=None): + from .i18n import code_language, tr + tag = 'zh-Hans' if language is True else 'en' if language in (False, None) else code_language(language) + shown = zh if tag == 'zh-Hans' else en if tag == 'en' or make is None else \ + make(lambda e, z, values=None: tr(e, z, tag, values)) + text = super().__new__(cls, shown) + text.en, text.zh, text.make = en, zh, make return text @classmethod - def build(cls, make, chinese): - """make(t) builds the text with t(en, zh); it is built once per language.""" - return cls(make(lambda en, zh: en), make(lambda en, zh: zh), chinese) + def build(cls, make, language): + """make(t) builds the text with t(en, zh) or t(en, zh, values); it is built once per language.""" + from .i18n import fill + return cls(make(lambda en, zh, values=None: fill(en, values) if values else en), + make(lambda en, zh, values=None: fill(zh, values) if values else zh), language, make) - def follow(self, chinese): - return Phrase(self.en, self.zh, chinese) + def follow(self, language): + return Phrase(self.en, self.zh, language, self.make) -def follow_language(value, chinese): +def follow_language(value, language): """The value in the interface language now chosen; text that kept no other language is unchanged.""" - return value.follow(chinese) if isinstance(value, Phrase) else value + return value.follow(language) if isinstance(value, Phrase) else value def source_name(value, zh=False): @@ -298,7 +306,45 @@ def without_names(value): r'retry \d+ in \d+s': 'Retrying download'} +# Progress text the engine sends in English: a beginning followed by more text, and whole lines with values. The Chinese is +# the code's own; another language's file holds the same English (the pattern itself for a line with values, its +# replacement written with \\1, \\2) and its own text. +# Stage names the engine reports in Chinese, with their English: written (English, Chinese) so the language files collect +# them like every other pair. +CHINESE_STAGES = (('Checking offline packages', '检查离线包'), ('Checking packages', '检查配套包'), ('Downloading models', '下载模型')) +ZH_PREFIXES = ( + MODEL_REPAIR_PROGRESS, + ('Switched current download to ', '已切换至 '), ('Connecting to ', '正在连接'), + ('Assemble downloaded parts', '合并已下载文件'), ('Reuse verified FP8 ', '使用已有模型文件 '), + ('Prepare FP8 ', '准备模型文件 '), ('Verified ', '已校验'), ('Verify ', '正在校验'), + ('Download ', '正在下载'), ('Prepare ', '准备 '), ('Source: ', '下载源:'), ('Log: ', '日志:'), +) +ZH_PATTERNS = ( + (r'Downloading packages · about (.+) across (\d+) files', r'下载组件 · 约 \1,共 \2 个文件'), + (r'about (.+) across (\d+) files', r'约 \1,共 \2 个文件'), + (r'This is the first installation of the native runtime for this computer, so the runtime components are downloaded ' + r'again \(about (.+)\)\.', r'首次安装适用于这台电脑的原生运行环境,需要重新下载运行组件(约 \1)。'), + (r'This is the first installation of the native runtime for this computer, so the runtime components are downloaded ' + r'again\.', '首次安装适用于这台电脑的原生运行环境,需要重新下载运行组件。'), + (r'(\d+) files / folders scanned', '正在查找文件'), + (r'Testing download sources (\d+ / \d+)', r'正在测试下载源 \1'), + (r'(\d+ / \d+) files', r'\1 个文件'), (r'shard (\d+ / \d+)', '正在下载'), + (r'([\d.]+ MiB) retained', r'已保留 \1'), (r'([\d.]+ GiB) released', r'已释放 \1'), + (r'([\d.]+ MiB) downloaded', r'已下载 \1'), + (r'Resuming ([\d.]+ MiB) retained', r'继续下载,已保留 \1'), + (r'retry (\d+) in (\d+)s', '正在重试下载'), + (r'Receiving objects:.*', '正在下载组件'), (r'Resolving deltas:.*', '正在整理组件'), + (r'Updating files:.*', '正在准备文件'), +) + + def display(value, zh=False): + """Engine progress text as the interface shows it. `zh` is True or False (Simplified Chinese or English) or an interface + language tag; a language with a file takes its entries, and plain English where the file has none.""" + language = 'zh-Hans' if zh is True else 'en' if not zh else code_language(zh) + if language not in ('en', 'zh-Hans'): + return display_from(without_names(clean(value)), catalog(language)) + zh = language == 'zh-Hans' value = without_names(clean(value)) if not zh: if ' · ' in value: @@ -310,7 +356,7 @@ def display(value, zh=False): if value.startswith(prefix): return translated + display(value[len(prefix):]) # English names for stages whose internal names describe how they run, not what they do. - value = {'检查离线包': 'Checking offline packages', '检查配套包': 'Checking packages', '下载模型': 'Downloading models', + value = {**{zh: en for en, zh in CHINESE_STAGES}, 'Prepare Python': 'Prepare environment', 'Install Python': 'Install environment', 'Download PyTorch + CUDA': 'Download runtime components', @@ -354,37 +400,51 @@ def display(value, zh=False): return source_name(value, True) if ' · ' in value: return ' · '.join(display(part, True) for part in value.split(' · ')) - for prefix, translated in ( - MODEL_REPAIR_PROGRESS, - ('Switched current download to ', '已切换至 '), ('Connecting to ', '正在连接'), - ('Assemble downloaded parts', '合并已下载文件'), ('Reuse verified FP8 ', '使用已有模型文件 '), - ('Prepare FP8 ', '准备模型文件 '), ('Verified ', '已校验'), ('Verify ', '正在校验'), - ('Download ', '正在下载'), ('Prepare ', '准备 '), ('Source: ', '下载源:'), ('Log: ', '日志:'), - ): + for prefix, translated in ZH_PREFIXES: if value.startswith(prefix): return translated + display(value[len(prefix):], True) - for pattern, translated in ( - (r'Downloading packages · about (.+) across (\d+) files', r'下载组件 · 约 \1,共 \2 个文件'), - (r'about (.+) across (\d+) files', r'约 \1,共 \2 个文件'), - (r'This is the first installation of the native runtime for this computer, so the runtime components are downloaded ' - r'again \(about (.+)\)\.', r'首次安装适用于这台电脑的原生运行环境,需要重新下载运行组件(约 \1)。'), - (r'This is the first installation of the native runtime for this computer, so the runtime components are downloaded ' - r'again\.', '首次安装适用于这台电脑的原生运行环境,需要重新下载运行组件。'), - (r'(\d+) files / folders scanned', '正在查找文件'), - (r'Testing download sources (\d+ / \d+)', r'正在测试下载源 \1'), - (r'(\d+ / \d+) files', r'\1 个文件'), (r'shard (\d+ / \d+)', '正在下载'), - (r'([\d.]+ MiB) retained', r'已保留 \1'), (r'([\d.]+ GiB) released', r'已释放 \1'), - (r'([\d.]+ MiB) downloaded', r'已下载 \1'), - (r'Resuming ([\d.]+ MiB) retained', r'继续下载,已保留 \1'), - (r'retry (\d+) in (\d+)s', '正在重试下载'), - (r'Receiving objects:.*', '正在下载组件'), (r'Resolving deltas:.*', '正在整理组件'), - (r'Updating files:.*', '正在准备文件'), - ): + for pattern, translated in ZH_PATTERNS: if re.fullmatch(pattern, value): return re.sub(pattern, translated, value) return value +def display_from(value, entries): + """display() for a language with a file: the same steps as the Chinese, each looked up in the file's entries (the + English with its Chinese first, for an English with more than one meaning, then the English alone).""" + def own(en, zh): + for key in (en + KEY_SEPARATOR + zh, en): + if isinstance(entries.get(key), str): + return entries[key] + return None + + text = own(value, ZH[value]) if value in ZH else entries.get(value) + if text is not None: + return text + if value in SOURCES: + return lookup(entries, *SOURCES[value]) + if ' · ' in value: + return ' · '.join(display_from(part, entries) for part in value.split(' · ')) + for prefix, zh in ZH_PREFIXES: + if value.startswith(prefix) and own(prefix, zh) is not None: + return own(prefix, zh) + display_from(value[len(prefix):], entries) + for pattern, zh in ZH_PATTERNS: + sentence = own(pattern, zh) + match = re.fullmatch(pattern, value) if sentence is not None else None + if match: + # \1, \2 in the file's sentence take the values; any other backslash is text, never an error. + return re.sub(r'\\([1-9])', lambda ref: match.group(int(ref.group(1))) or '', sentence) + plain = display(value) + if isinstance(entries.get(plain), str): + return entries[plain] + # A file whose fallback is zh-Hans (Traditional Chinese) shows what it does not hold as the code's Simplified Chinese in + # its own characters, as i18n.lookup does; any other file shows the plain English. + meta = entries.get('_meta') if isinstance(entries, dict) else None + if isinstance(meta, dict) and meta.get('fallback') == 'zh-Hans': + return from_simplified(entries, display(value, True)) + return plain + + def progress_view(event, zh=False): return {key: display(value, zh) if key in ('label', 'detail', 'name') else value for key, value in event.items()} diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py index 1c88a81e..4d534c5c 100644 --- a/freevideo_engine/launcher_session.py +++ b/freevideo_engine/launcher_session.py @@ -137,6 +137,9 @@ class BrowserRefused(OSError): """The system did not accept the request to open the browser.""" +# Texts a function gave only in Chinese (no English to look the pair up by); Session.both notes them, tests read it. +CHINESE_ONLY = set() + class Session: # A launcher started from an offline package (portable_launcher.PortableSession). bundled = False @@ -216,7 +219,11 @@ def __init__(self, source=None, *, controller=None, store=None, updater=None, sm self.form['engine'] = os.environ.get('FREEVIDEO_HOME') or self.form['engine'] if saved.get('comfy') and 'new_comfy' not in saved: self.form['new_comfy'] = False - self.language = saved['language'] if 'language' in saved else default_language() + # A new installation follows the system language ('auto'); the language key's first item. + self.language = saved['language'] if 'language' in saved else 'auto' + # The language in the settings file as last read or written here: the web page's settings write the same file, and a + # different value there means it was changed on the page (a choice made here is written at once). + self._language_seen = saved.get('language') self.selected = saved.get('installation') self.repair_request = None self.saved_setup = saved.get('setup', {}) @@ -302,12 +309,19 @@ def __init__(self, source=None, *, controller=None, store=None, updater=None, sm self.activate_offline(root) self.inspect_compatibility() - def t(self, en, zh): - return zh if self.language.startswith('zh') else en + def t(self, en, zh, values=None): + """The interface text for a pair in the interface language ({name} placeholders filled from values).""" + from .i18n import tr + return tr(en, zh, self.ui_language(), values) + + def chinese(self): + """Whether text written as an (English, Chinese) pair shows its Chinese: the interface is Simplified Chinese. Other + languages read their file through t(); functions that only take zh= give them English for now.""" + return self.ui_language() == 'zh-Hans' def phrase(self, make): """Text that stays on screen: make(t) builds it with t(en, zh), and a language switch rewords it.""" - return Phrase.build(make, self.language.startswith('zh')) + return Phrase.build(make, self.ui_language()) def task_busy(self): """Work that must finish before another installation operation starts.""" @@ -347,7 +361,33 @@ def persist(self): self.selected['lan_access'] = self.form.get('lan_access') is True except ValueError: pass # Save the editable draft while retaining a valid installation. + self.follow_saved_language() self.store.write(self.form, self.language, self.selected, self.saved_setup) + self._language_seen = self.language + + def follow_saved_language(self): + """Take the interface language saved on the web page while the launcher is open, so saving any other setting here + does not put the old language back. Read before every save and when the window comes to the front; True when the + language changed.""" + try: + saved = self.store.read().get('language') + except (OSError, ValueError): + return False + if saved is None or saved == self._language_seen: + return False + self._language_seen = saved + if saved == self.language: + return False + self.set_language(saved) + return True + + def set_language(self, value): + self.language = str(value) + if self.updater: + self.updater.language = self.language + # Messages already shown are reworded too, not left in the old language until the next failure. + for name in ('browser_error', 'notice', 'download_error'): + setattr(self, name, follow_language(getattr(self, name), self.ui_language())) def remember(self, selection, persist=True): self.selected = dict(selection) @@ -367,12 +407,9 @@ def edit(self, key, value): self.explain_busy() return if key == 'language': - self.language = str(value) - if self.updater: - self.updater.language = self.language - # Messages already shown are reworded too, not left in the old language until the next failure. - for name in ('browser_error', 'notice', 'download_error'): - setattr(self, name, follow_language(getattr(self, name), self.language.startswith('zh'))) + # Take a change made on the web page first, so the save below does not read this choice as stale. + self.follow_saved_language() + self.set_language(value) self.persist(); return if key == 'token': if self.controller.busy: @@ -405,8 +442,8 @@ def edit(self, key, value): raise ValueError('Unknown environment installation method') if key == 'environment_method' and value == 'manual' and not runtime_packages_supported(): system = 'Mac' if sys.platform == 'darwin' else 'Linux' - raise ValueError(self.t('The %s environment is prepared automatically. Import model packages in the next step.' % system, - '%s 运行环境由安装器自动准备,请在下一步导入模型包。' % system)) + raise ValueError(self.t('The {system} environment is prepared automatically. Import model packages in the next step.', + '{system} 运行环境由安装器自动准备,请在下一步导入模型包。', dict(system=system))) if key == 'model_method' and value not in ('auto', 'manual', 'reuse'): raise ValueError('Unknown model download method') if key == 'install_model' and value not in ('video', 'image'): @@ -542,7 +579,7 @@ def use_downloaded_folder(self, folder): def downloads_view(self): if self.download_scope == 'image': - zh, decimal_sizes = self.language.startswith('zh'), sys.platform == 'darwin' + zh, decimal_sizes = self.ui_language(), sys.platform == 'darwin' key = (zh, decimal_sizes) if self._image_download_view is None or self._image_download_view[0] != key: self._image_download_view = (key, image_download_view(zh, decimal_sizes=decimal_sizes)) @@ -551,7 +588,7 @@ def downloads_view(self): plan = row.get('plan', {}) if row.get('status') == 'review' else {} if not plan.get('download_files_verified', True): plan = {} - zh = self.language.startswith('zh') + zh = self.ui_language() decimal_sizes = sys.platform == 'darwin' # Only inputs that affect list content belong here. Disk/progress/notice # updates must not replace the QML model or its file delegates. @@ -1101,14 +1138,15 @@ def image_pack_view(self, model='image'): bad = sum(1 for v in installer.file_checks.values() if v.get('verification') in ('mismatch', 'missing')) or 1 active = dict(active, state='checked') repairable = True - detail = self.t('1 file needs repair' if bad == 1 else f'{bad} files need repair', f'有 {bad} 个文件需要修复') + detail = (self.t('1 file needs repair', '有 1 个文件需要修复') if bad == 1 else + self.t('{count} files need repair', '有 {count} 个文件需要修复', {'count': bad})) if active.get('state') == 'running': labels = {'install': ('Downloading', '正在下载'), 'repair': ('Repairing', '正在修复'), 'remove': ('Removing', '正在删除'), 'verify': ('Checking', '正在检查')} detail = self.t(*labels[active['action']]) if active['action'] == 'verify' and active.get('verify_total'): percent = min(100, int(100 * (active.get('verify_done') or 0) / active['verify_total'])) - detail = self.t(f'Checking {percent}%', f'检查中 {percent}%') + detail = self.t('Checking {percent}%', '检查中 {percent}%', {'percent': percent}) if active.get('action') == 'install' and active.get('phase') == 'verify': detail = self.t('Checking', '正在校验') elif active.get('action') == 'verify' and active.get('state') == 'done': @@ -1116,13 +1154,13 @@ def image_pack_view(self, model='image'): elif active.get('state') == 'paused_for_generation': # What the download waits for: a video, a picture, or another task holding the graphics card. detail = {'busy_video': self.t('Paused while a video generates', '视频生成中,已暂停'), - 'busy_picture': self.t('Paused while a picture is made', '正在出图,已暂停'), + 'busy_picture': self.t('Paused while an image is made', '正在出图,已暂停'), 'busy_setup': self.t('Paused while FreeVideo installs, updates or cleans up', 'FreeVideo 正在安装、更新或清理,已暂停')}.get( active.get('reason'), self.t('Paused: the graphics card is busy', '显卡忙,已暂停')) elif active.get('state') == 'cancelled': detail = self.t('Paused', '已暂停') elif active.get('state') == 'failed': - failure = image_pack_failure(active.get('reason'), zh=self.language.startswith('zh')) + failure = self.both(lambda zh: image_pack_failure(active.get('reason'), zh=zh)) detail = failure['detail'] repairable = repairable or active.get('reason') in ('needs_repair', 'integrity_failed') blocked = (self.controller.busy or self.importer.busy or self.cleaner.busy or self.archives_busy @@ -1138,7 +1176,7 @@ def image_pack_view(self, model='image'): repairable=repairable, failure=failure, report_id=active.get('report_id'), report_line=self._image_pack_report_line(), engine_state=engine_state, - engine_note=image_pack_failure('busy_engine', zh=self.language.startswith('zh'))['detail'] if running else '', + engine_note=self.both(lambda zh: image_pack_failure('busy_engine', zh=zh))['detail'] if running else '', engine_clicked=running and self.image_engine_clicked) def _image_pack_report_line(self): @@ -1373,13 +1411,94 @@ def _tick_model_upgrade(self, row, busy): 'the previous model is restored.', '模型切换未完成。请在安装页点击“重试”;无法完成时会恢复原来的模型。'), kept=self._installation_ready()) + def language_view(self): + """For the language key: the languages there are, the saved choice ('auto' or the tag it reads as) and the + system's language. The list reads every language file, so it is made again only when the choice changes.""" + if getattr(self, '_language_view', (None, None))[0] != self.language: + from .i18n import interface_language, language_choices + setting = str(self.language or '').strip() + follows = not setting or setting.lower() == 'auto' + self._language_view = (self.language, dict( + languages=language_choices(), language_setting='auto' if follows else interface_language(setting, default_language), + system_language=interface_language('auto', default_language))) + return self._language_view[1] + + def both(self, make): + """make(zh) in the interface language. English and Simplified Chinese call it once; any other language calls it in + both and takes every text through t(English, Chinese): the language file's entry, Traditional Chinese's own + characters, else the English. A Chinese text without its English is noted in CHINESE_ONLY (tests read it).""" + language = self.ui_language() + if language in ('en', 'zh-Hans'): + return make(language == 'zh-Hans') + return self._paired(make(False), make(True), getattr(make, '__qualname__', 'text')) + + def _paired(self, en, zh, where): + if isinstance(en, dict) and isinstance(zh, dict): + return {key: self._paired(en.get(key), zh.get(key), where + '.' + str(key)) for key in {**en, **zh}} + if isinstance(en, (list, tuple)) and isinstance(zh, (list, tuple)) and len(en) == len(zh): + return type(en)(self._paired(a, b, where) for a, b in zip(en, zh)) + if isinstance(zh, str) and zh and not (isinstance(en, str) and en): + CHINESE_ONLY.add(where) + return self.t('', zh) + if isinstance(en, str) and isinstance(zh, str) and en != zh: + # A card's text is often a few sentences joined line by line (a detected model, then the steps): when the + # whole is not in the file, each line is looked up on its own. + lines_en, lines_zh = en.split('\n'), zh.split('\n') + if len(lines_en) > 1 and len(lines_en) == len(lines_zh) and not self._held(en, zh): + return '\n'.join(self._paired(a, b, where) for a, b in zip(lines_en, lines_zh)) + return self.t(en, zh) + return en + + def _held(self, en, zh): + """Whether the interface language's file holds this text (as English␟Chinese or as the English).""" + from .i18n import KEY_SEPARATOR, catalog + entries = catalog(self.ui_language()) + return isinstance(entries.get(en + KEY_SEPARATOR + zh), str) or isinstance(entries.get(en), str) + + def notes_zh(self): + """Whether release notes and their media captions show in Chinese: Simplified Chinese, and a language whose file + falls back to it (Traditional Chinese reads the Chinese notes in its own characters, not the English).""" + return self.chinese() or self._falls_back_to_chinese() + + def _falls_back_to_chinese(self): + from .i18n import catalog + meta = catalog(self.ui_language()).get('_meta') or {} + return meta.get('fallback') == 'zh-Hans' + + def notes_in_language(self, value): + """The update view with every Chinese text of its releases (notes, media captions) in the interface language's + characters; unchanged unless the language falls back to Simplified Chinese.""" + if self.chinese() or not self._falls_back_to_chinese(): + return value + from .i18n import catalog, from_simplified + entries = catalog(self.ui_language()) + + def convert(item, chinese=False): + if isinstance(item, dict): + return {key: convert(part, chinese or key == 'zh') for key, part in item.items()} + if isinstance(item, list): + return [convert(part, chinese) for part in item] + return from_simplified(entries, item) if chinese and isinstance(item, str) else item + return convert(value) + + def ui_language(self): + """The language the interface shows (a language file's tag: 'en', 'zh-Hans', 'zh-Hant', ...): the saved setting, + or the system language when it is 'auto', matched to the languages there are. Kept until the setting changes.""" + if getattr(self, '_ui_language', (None, None))[0] != self.language: + from .i18n import interface_language + self._ui_language = (self.language, interface_language(self.language, default_language)) + return self._ui_language[1] + def _browser_url(self, address): - """Return the URL used by the browser, with the launcher locale hint.""" - if not address or not self.language.startswith('zh'): + """Return the URL used by the browser, with the launcher's interface language: freevideo_lang=zh for Simplified + Chinese, en for English, the tag for any other language. English is named too, so a page in a Chinese browser + still shows English when English is the chosen language.""" + language = self.ui_language() + if not address: return address parsed = urlsplit(address) query = dict(parse_qsl(parsed.query, keep_blank_values=True)) - query['freevideo_lang'] = 'zh' + query['freevideo_lang'] = 'zh' if language == 'zh-Hans' else language return urlunsplit((parsed.scheme, parsed.netloc, parsed.path, urlencode(query), parsed.fragment)) @@ -1443,7 +1562,7 @@ def inspect_compatibility(self): if self.compatibility.get('notice'): from .compatibility_copy import notice_text self.notice = Phrase(notice_text(self.compatibility, False), notice_text(self.compatibility, True), - self.language.startswith('zh')) + self.ui_language()) except (OSError, ValueError, RuntimeError): self.compatibility = dict(available=False, level=0, automatic=False) @@ -1481,7 +1600,7 @@ def _raw_error(self, *, installer=True): if installer: errors += [row.get('error', ''), *row.get('errors', [])] if shortcut.get('status') == 'failed': - errors.append(shortcut.get('error_zh' if self.language.startswith('zh') else 'error') or shortcut.get('error', '')) + errors.append(self.both(lambda zh: shortcut.get('error_zh' if zh else 'error') or shortcut.get('error', ''))) message = plain_text('\n'.join(str(e) for e in errors if e)) if installer and row.get('error') and row.get('denied'): from .denied_access import text @@ -1489,7 +1608,7 @@ def _raw_error(self, *, installer=True): # Windows words many refusals alike and often names no file; where it happened travels with the message. # Only a permission failure takes the line: the other cards read the first lines of the message. if launcher_failure(message)['kind'] in ('permission', 'engine-folder-denied'): - message = plain_text(text(row['denied'], self.language.startswith('zh')) + '\n' + message) + message = plain_text(self.both(lambda zh: text(row['denied'], zh)) + '\n' + message) return message def diagnostic_error(self): @@ -1947,14 +2066,15 @@ def update_view(self): view = {k: row[k] for k in ('status', 'error', 'progress', 'candidate') if k in row} from .launcher_update import error_text, manual_install, release_page if row.get('error_code'): - view['error'] = error_text(row, self.language.startswith('zh')) + view['error'] = self.both(lambda zh: error_text(row, zh)) view['release_page'] = release_page(self.updater.current) if self.updater else '' if self.updater and self.updater.install_failed and view.get('candidate'): # The new app did not go in and the old one is back: the reminder says so. from .launcher_update import mac_install_failure - reason = mac_install_failure(self.updater.install_failed_reason, self.language.startswith('zh')) - view['status'], view['error'] = 'error', self.t(*ACTION_COPY['update_install_failed']) + ( - ('' if self.language.startswith('zh') else ' ') + reason if reason else '') + reason = self.both(lambda zh: mac_install_failure(self.updater.install_failed_reason, zh)) + first = self.t(*ACTION_COPY['update_install_failed']) + # Sentences that end in a full stop of their own (Chinese, Japanese) need no space between them. + view['status'], view['error'] = 'error', first + (('' if first.endswith(('。', '.', '!', '?')) else ' ') + reason if reason else '') key = self.update_key() view.update(engine=self.engine_update_pending(), current=__version__, current_release=public_details(self.updater.current) if self.updater else self.release_details, @@ -2108,7 +2228,7 @@ def adaln_dialog_view(self, error, update): body=self.t('This frees %s of disk space. If the files are needed later, they will be downloaded again automatically.', '可释放 %s 磁盘空间。以后如需要,会自动重新下载。') % size, delete_text=(self.t('Deleting…', '正在删除…') if thread is not None else - self.t('Try again', '再试一次') if self.adaln_retry else self.t('Delete', '删除')), + self.t('Retry', '重试') if self.adaln_retry else self.t('Delete', '删除')), later_text=self.t('Not now', '暂不删除')) def sync_lan_from_store(self): @@ -2315,7 +2435,7 @@ def engine_exit_text(self, row): if row.get('status') != 'restart-required' or not isinstance(value, dict) or type(value.get('at')) not in (int, float): return '' from .engine_exit import describe - return describe(value, self.language.startswith('zh')) + return self.both(lambda zh: describe(value, zh)) def old_versions_text(self): """What the background removal of earlier FreeVideo copies freed this session.""" @@ -2479,7 +2599,7 @@ def archives_dialog_view(self, offer, idle, error, update): 'Deleting them does not affect models, the runtime or your videos.', '导入过的离线包压缩包仍保留在磁盘上,FreeVideo 已不再需要。删除后,模型、运行环境和作品都不受影响。'), delete_text=(self.t('Deleting…', '正在删除…') if self.archives_busy else - self.t('Try again', '再试一次') if retry else + self.t('Retry', '重试') if retry else self.t('Delete and free %s', '删除并释放 %s') % size), keep_text=self.t('Keep for now', '暂时保留'), footnote=self.t('You can also delete them later in Settings › Preferences › Storage.', @@ -2498,8 +2618,10 @@ def archives_confirm_text(self): if not offer or offer['bytes'] <= 0: return '' count = len(offer['paths']) - english = 'Delete 1 ZIP file (%s)? This cannot be undone.' if count == 1 else 'Delete %d ZIP files (%%s)? This cannot be undone.' % count - return self.t(english % self.archive_size(offer['bytes']), '删除 %d 个压缩包(%s)?删除后不能恢复。' % (count, self.archive_size(offer['bytes']))) + values = dict(count=count, size=self.archive_size(offer['bytes'])) + if count == 1: + return self.t('Delete 1 ZIP file ({size})? This cannot be undone.', '删除 {count} 个压缩包({size})?删除后不能恢复。', values) + return self.t('Delete {count} ZIP files ({size})? This cannot be undone.', '删除 {count} 个压缩包({size})?删除后不能恢复。', values) def archives_done_text(self): freed = getattr(self, 'archives_freed', 0) or 0 @@ -2557,7 +2679,7 @@ def change_lan_password(self, text=None): text = str(text) least = self.lan_password_min() if len(text) < least: - raise ValueError(self.t('Use at least %d characters.' % least, '至少 %d 个字符。' % least)) + raise ValueError(self.t('Use at least {count} characters.', '至少 {count} 个字符。', dict(count=least))) lan_password.set_password(engine, text) # The links change with the password; do not wait for the next poll. self.controller.access_polled = 0 @@ -2600,7 +2722,7 @@ def offline_model_count(self): def snapshot(self): from .failure_details import REPAIR_KINDS, launcher_failure, redacted_launcher_error, display_launcher_error, model_mismatch_package from .launcher_copy import display, progress_view, source_name - zh = self.language.startswith('zh') + language = self.ui_language() # engine progress text in any language with a file row = self.controller.state busy = self.controller.busy or self.importer.busy or self.cleaner.busy # The sidebar card shows work being done; a plan waiting for confirmation is not work, but an @@ -2610,12 +2732,12 @@ def snapshot(self): task = row.get('task', {}) port_from = int(row['moved_from']) if row.get('status') == 'open' and 'moved_from' in row else 0 port_to = (urlsplit(row.get('selection', {}).get('url') or row['url']).port or 80) if port_from else 0 - progress = progress_view(task.get('progress') or {}, zh) + progress = progress_view(task.get('progress') or {}, language) offline_review = self.importer.state.get('status') == 'review' offline_progress = self.page == 'progress' and self.offline_review_page is not None if offline_progress: - progress = progress_view(self.importer.state, zh) - overall = progress_view(row.get('overall') or task.get('phase_progress') or {}, zh) + progress = progress_view(self.importer.state, language) + overall = progress_view(row.get('overall') or task.get('phase_progress') or {}, language) if self.importer.busy: # The sidebar's Working card follows the offline import, not the idle installer. state = self.importer.state @@ -2628,7 +2750,7 @@ def snapshot(self): if (state.get('count') or 0) > 1: label += ' %d/%d' % (state.get('index') or 1, state['count']) if state.get('detail'): - label += ' · ' + display(state['detail'], zh) + label += ' · ' + display(state['detail'], language) overall = dict(label=label, done=state.get('done'), total=state.get('total')) shortcut = row.get('shortcut') or {} # The offline import reports through self.error; what the idle installer last reported stays off its page. @@ -2722,22 +2844,22 @@ def snapshot(self): current = dict(progress, unit='bytes', total=group['download_bytes'], done=min(group['download_bytes'], group.get('downloaded_bytes') or 0), rate=group.get('bytes_per_second') or progress.get('rate')) - file_text = progress_text(current, zh, decimal_sizes=sys.platform == 'darwin') + file_text = progress_text(current, self.ui_language(), decimal_sizes=sys.platform == 'darwin') if not hasattr(self, 'model_line'): self.model_line = ModelLine() - steady = self.model_line.line(progress, groups, display('Connecting to download server', zh), zh, + steady = self.model_line.line(progress, groups, display('Connecting to download server', language), language, sys.platform == 'darwin') file_text = steady if steady is not None else file_text if self.importer.busy and self.importer.state.get('activity'): imported = self.importer.state file_text = progress_text(dict(activity=imported['activity'], unit='bytes', - name=display('Package files', zh), done=imported.get('activity_done'), total=imported.get('activity_total')), zh) + name=display('Package files', language), done=imported.get('activity_done'), total=imported.get('activity_total')), language) if not hasattr(self, 'line_hold'): self.line_hold = LineHold() detail = clean(progress.get('detail', '')) urgent = (progress.get('notice') or progress.get('activity') == 'resume' - or progress.get('state') in ('failed', 'cancelled') or steady == display('Connecting to download server', zh)) - held = self.line_hold.text(file_text or detail, immediate=bool(urgent), zh=zh) + or progress.get('state') in ('failed', 'cancelled') or steady == display('Connecting to download server', language)) + held = self.line_hold.text(file_text or detail, immediate=bool(urgent), zh=language) # a change of language resets the hold if held != (file_text or detail): file_text, detail = held, '' else: @@ -2754,8 +2876,8 @@ def snapshot(self): source = preferences['source'] plan = row.get('plan', {}) from .model_repair import review_lines - replace_models = review_lines(self.importer.state.get('replace_models', []) if offline_review else - plan.get('replace_models', []), zh=zh, offline=offline_review) + replace_models = self.both(lambda zh: review_lines(self.importer.state.get('replace_models', []) if offline_review else + plan.get('replace_models', []), zh=zh, offline=offline_review)) estimate = [] if plan.get('disk_mode') == 'extreme': estimate.append(self.t('Space saver (automatic)', '极限省空间(自动启用)')) @@ -2764,9 +2886,9 @@ def snapshot(self): estimate.append(gpu) if 'model_download_bytes' in plan: from .bootstrap import download_bytes - estimate.append(self.t('Download ', '需下载 ')+disk_space.size_text(download_bytes(plan))) + estimate.append(self.t('Download {size}', '需下载 {size}', dict(size=disk_space.size_text(download_bytes(plan))))) if row.get('disks'): - estimate.append(self.t('Peak disk ~', '磁盘峰值约 ')+disk_space.size_text(sum(d.get('needed_bytes', 0) for d in row['disks']))) + estimate.append(self.t('Peak disk ~{size}', '磁盘峰值约 {size}', dict(size=disk_space.size_text(sum(d.get('needed_bytes', 0) for d in row['disks']))))) update = self.update_view() probe = self.probe.snapshot() if probe.get('status') == 'failed' and probe.get('error'): @@ -2783,34 +2905,33 @@ def snapshot(self): if group.startswith('torch-'): names[group] = ('GPU packages', 'GPU 依赖') route = self.t('direct', '直连') if entry.get('route') == 'direct' else self.t('current connection', '当前连接') - speeds.append(dict(source=source_name(entry['id'], zh)+' · '+route, group=self.t(*names.get(group, (group, group))), - ok=entry.get('ok', False), rate=speed_text(entry, self.language.startswith('zh')))) + speeds.append(dict(source=self.both(lambda zh: source_name(entry['id'], zh))+' · '+route, group=self.t(*names.get(group, (group, group))), + ok=entry.get('ok', False), rate=self.both(lambda zh: speed_text(entry, zh)))) from .sampling_assets import total_bytes # The controller's record of the exception (class names and errno) belongs to its own message only: it tells an # unexpected failure from a message the launcher wrote, which str(error) alone cannot. own = (bool(row.get('error')) and not (self.error or self.browser_error or self.page_error) and not self.offline_page()) - failure = launcher_failure(error, zh=self.language.startswith('zh'), can_repair=self.can_repair(), - repairs_comfy=self.repairs_comfy(), unavailable=self.repair_unavailable(), - model_package=model_mismatch_package(raw_error, zh), - exception=row.get('exception') if own else None) + repair_state = dict(can_repair=self.can_repair(), repairs_comfy=self.repairs_comfy(), unavailable=self.repair_unavailable()) + failure = self.both(lambda zh: launcher_failure(error, zh=zh, **repair_state, model_package=model_mismatch_package(raw_error, zh), + exception=row.get('exception') if own else None)) if failure.get('kind') == 'gpu-driver-missing': from .display_adapters import adapters, line, nvidia_driver_listed, only_other_vendors - zh = self.language.startswith('zh') names = adapters() - if line(zh, names): - failure['note'] = line(zh, names) + note = self.both(lambda zh: line(zh, names)) + if note: + failure['note'] = note if only_other_vendors(names): # No NVIDIA card is listed: the card says what FreeVideo needs; the note names what was found. from .failure_details import UNSUPPORTED_VENDOR - failure['title'], failure['action'] = UNSUPPORTED_VENDOR[1 if zh else 0] + failure['title'], failure['action'] = self.both(lambda zh: UNSUPPORTED_VENDOR[1 if zh else 0]) elif nvidia_driver_listed(names): # Its driver named the card, so a driver is installed but does not answer: reinstall it. from .failure_details import DRIVER_NOT_WORKING - failure['title'], failure['action'] = DRIVER_NOT_WORKING[1 if zh else 0] + failure['title'], failure['action'] = self.both(lambda zh: DRIVER_NOT_WORKING[1 if zh else 0]) elif names: from .failure_details import DRIVER_FOR_LISTED_CARD - failure['title'], failure['action'] = DRIVER_FOR_LISTED_CARD[1 if zh else 0] + failure['title'], failure['action'] = self.both(lambda zh: DRIVER_FOR_LISTED_CARD[1 if zh else 0]) if failure.get('path'): # The local repair instruction needs the actual file location; copied details stay redacted. from .model_repair import MISMATCH_PATH @@ -2821,20 +2942,20 @@ def snapshot(self): if failure.get('kind') in ('permission', 'engine-folder-denied') and row.get('error') and row.get('denied'): from .denied_access import card_text # The card shows the detail instead of the action, so the action goes under the location. - location = card_text(row['denied'], zh) + location = self.both(lambda zh: card_text(row['denied'], zh)) if location: failure = dict(failure, detail=location + '\n' + failure['action'], action='') reasons = self.importer.state.get('write_reasons') or [] if (self.importer.state.get('status') == 'error' and reasons and self.error == self.importer.state.get('error') and failure.get('kind') != 'runtime-alias'): from .offline_errors import guidance - failure = dict(title=guidance('import-title', zh), - detail=guidance(reasons[0], zh), action='', kind='offline-write') + failure = dict(title=self.both(lambda zh: guidance('import-title', zh)), + detail=self.both(lambda zh: guidance(reasons[0], zh)), action='', kind='offline-write') disk = self.disk_view(row, failure) if disk and str(failure.get('kind', '')).startswith('disk'): - failure = launcher_failure(error, zh=self.language.startswith('zh'), - other_disk=self.form['new_comfy'] and any(d['enough'] for d in disk['others']), - disk_name=disk['name'] if disk['problem'] == 'disconnected' else '') + other_disk = self.form['new_comfy'] and any(d['enough'] for d in disk['others']) + failure = self.both(lambda zh: launcher_failure(error, zh=zh, other_disk=other_disk, + disk_name=disk['name'] if disk['problem'] == 'disconnected' else '')) # A problem card comes first: no update window opens over it (one already open closes # without counting as "Later", and reminds again once the card is gone). Repair installs # the launcher's own engine as it sets up again, so with Repair on the card the engine @@ -2845,12 +2966,12 @@ def snapshot(self): cleanup = dict(self.cleaner.state, busy=self.cleaner.busy) from .offline_errors import alias_failure if alias_failure(cleanup.get('error', '')): - cleanup['error'] = display_launcher_error(cleanup['error'], zh=zh) + cleanup['error'] = self.both(lambda zh: display_launcher_error(cleanup['error'], zh=zh)) elif cleanup.get('status') == 'error': cleanup['message'] = self.t(*CLEANUP_FAILURES.get(cleanup.get('reason'), CLEANUP_FAILURES['failed'])) model_upgrade = dict(self.upgrade.state, busy=self.upgrade.busy) if alias_failure(model_upgrade.get('error', '')): - model_upgrade['error'] = display_launcher_error(model_upgrade['error'], zh=zh) + model_upgrade['error'] = self.both(lambda zh: display_launcher_error(model_upgrade['error'], zh=zh)) archive_offer = (self.archives_deleting_offer if self.archives_busy else self.archives_prompt_offer if self.archives_retry_dialog else self.archive_offer()) archives_idle = bool(archive_offer and archive_offer['paths']) and self.archives_idle() @@ -2868,7 +2989,8 @@ def snapshot(self): download_state.update(error=self.t(*DOWNLOAD_COPY['error_read']), needs_check=True) return plain_data(dict(download_list=download_state, sampling_cache_bytes=total_bytes(), version=__version__, image_pack=image_pack, prompt_model=prompt_model, bytes_per_second=speed, - disk=disk, decimal_sizes=sys.platform == 'darwin', zh=self.language.startswith('zh'), form=dict(self.form), + disk=disk, decimal_sizes=sys.platform == 'darwin', zh=self.chinese(), ui_language=self.ui_language(), **self.language_view(), + form=dict(self.form), model_choice=self.model_choice(), image_only=self.image_only_choice(), image_installed=self.installed_machine().get('video_model') is False, video_missing=self.page == 'launcher' and self.video_missing(), can_add_video=self.can_repair(), @@ -2882,11 +3004,11 @@ def snapshot(self): cleanup=cleanup, can_cleanup=self.can_manage() and not (self.updater and self.updater.busy), model_upgrade=dict(model_upgrade, switching=bool(self.model_switch)), - offline=dict(progress_view(self.importer.state, zh), runtime=bool(self.form['offline_runtime']), + offline=dict(progress_view(self.importer.state, language), runtime=bool(self.form['offline_runtime']), runtime_supported=runtime_packages_supported(), - models=self.offline_model_count(), guide=package_instructions(self.form['new_comfy'] and self.form['environment_method'] == 'manual' - and not self.form['offline_runtime'], zh)), - video_model_guide=video_instructions(zh), + models=self.offline_model_count(), guide=self.both(lambda zh: package_instructions( + self.form['new_comfy'] and self.form['environment_method'] == 'manual' and not self.form['offline_runtime'], zh))), + video_model_guide=self.both(video_instructions), adaln_dialog=self.adaln_dialog_view(error, update), selected=bool(self.selected), can_repair=self.can_repair(), repair_offered=repair_offered, error=error, field_error=dict(self.field_error or {}), retry_kind=self.retry_kind(), notice=self.notice, @@ -2901,9 +3023,9 @@ def snapshot(self): # keep publishing changed snapshots after a launch has failed. elapsed=duration(time.monotonic()-self.started) if self.started and busy else '', summary=' · '.join(estimate), failure=failure, report_opened=self.report_opened[0] if self.report_cooling(self.report_opened[0]) else '', - source=source, source_name=source_name(source, zh), proxy_mode=preferences['proxy_mode'], + source=source, source_name=self.both(lambda zh: source_name(source, zh)), proxy_mode=preferences['proxy_mode'], probe=probe, speeds=speeds, token_set=bool(self.token), - log=self.tail.text, logs=[dict(label=display(n, zh), path=str(p)) for n, p in self.controller.terminal_sources()], + log=self.tail.text, logs=[dict(label=display(n, language), path=str(p)) for n, p in self.controller.terminal_sources()], url=(self._browser_url(row.get('url', '')) if row.get('status') == 'open' else ''), shortcut=shortcut, access_links=(list(self.controller.access_links) if row.get('status') == 'open' and isinstance(self.controller.access_links, list) else []), @@ -2923,7 +3045,7 @@ def snapshot(self): archives_toast=(self.t('Freed %s', '已释放 %s') % self.archive_size(self.archives_freed) if self.archives_freed and time.monotonic() < self.archives_toast_until else ''), can_shortcut=bool(self.controller.selection and self.controller.selection.get('ready')), - update=update, engine_update_available=bool(row.get('engine_update_available')), + update=self.notes_in_language(update), notes_zh=self.notes_zh(), engine_update_available=bool(row.get('engine_update_available')), settings_path=str(self.store.primary), review_id=json.dumps(self.importer.state.get('replace_models', []), sort_keys=True) if offline_review else row.get('plan', {}).get('plan_id', ''), diff --git a/freevideo_engine/launcher_settings.py b/freevideo_engine/launcher_settings.py index ed877269..6c192ebd 100644 --- a/freevideo_engine/launcher_settings.py +++ b/freevideo_engine/launcher_settings.py @@ -32,8 +32,37 @@ def default_language(): return language except (OSError, AttributeError, ValueError): pass + if sys.platform == 'win32': + language = windows_language() + if language: + return language import locale - return (locale.getlocale()[0] or '').lower() + try: + return (locale.getlocale()[0] or '').lower() + except ValueError: # an unparsable locale setting: no system language, English follows + return '' + + +def windows_language(): + """Windows's display language as a tag ('zh-CN', 'en-US'), else its regional format's; '' when neither can be read. + locale.getlocale() there gives a full name such as 'Chinese (Simplified)_China', which no language tag matches.""" + try: + import ctypes + kernel = ctypes.windll.kernel32 + count, size = ctypes.c_ulong(0), ctypes.c_ulong(0) + MUI_LANGUAGE_NAME = 0x8 + if kernel.GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, ctypes.byref(count), None, ctypes.byref(size)) and size.value: + buffer = ctypes.create_unicode_buffer(size.value) + if kernel.GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, ctypes.byref(count), buffer, ctypes.byref(size)): + first = buffer.value # the list is NUL-separated; value stops at the first NUL + if first: + return first + buffer = ctypes.create_unicode_buffer(85) + if kernel.GetUserDefaultLocaleName(buffer, 85): + return buffer.value + except Exception: # any failure of the system call reads as "not known": English follows + pass + return '' def sanitize(value): @@ -241,6 +270,13 @@ def write_locked(self, values, language, selection=None, setup=None): raise failures[0][1] return written, failures + def save_language(self, language): + """The interface language, set from the page's settings: the launcher and the page share it.""" + with self.exclusive(): + saved = self.read() + self.write_locked(saved, language, saved.get('installation'), saved.get('setup')) + return language + def save_model_directories(self, values): from .local_models import directory_choices choices = directory_choices(values) diff --git a/freevideo_engine/launcher_update.py b/freevideo_engine/launcher_update.py index 080c07d3..40773ca4 100644 --- a/freevideo_engine/launcher_update.py +++ b/freevideo_engine/launcher_update.py @@ -52,7 +52,8 @@ def mirror_url(relative): def source_order(language=None): - language = (default_language() if language is None else language).lower() + # 'auto' (follow the system) and nothing both mean the system's language. + language = (default_language() if language is None or str(language).strip().lower() in ('', 'auto') else language).lower() # Windows names its locales in words ('Chinese (Simplified)_China'), not 'zh_CN'. return ('mirror', 'github') if language.startswith(('zh', 'chinese')) else ('github', 'mirror') diff --git a/freevideo_engine/licenses/LakonLab-Apache-2.0.txt b/freevideo_engine/licenses/LakonLab-Apache-2.0.txt new file mode 100644 index 00000000..adebc4bd --- /dev/null +++ b/freevideo_engine/licenses/LakonLab-Apache-2.0.txt @@ -0,0 +1,189 @@ +Copyright 2026 Hansheng Chen. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. \ No newline at end of file diff --git a/freevideo_engine/long_paths.py b/freevideo_engine/long_paths.py index 3f3bb837..1d2def42 100644 --- a/freevideo_engine/long_paths.py +++ b/freevideo_engine/long_paths.py @@ -234,6 +234,12 @@ def path_chars(path): return len(str(path).encode('utf-16-le', errors='surrogatepass')) // 2 +# A local file written as a URL, as package managers print local wheels, find-links folders and build +# directories: file:///C:/Users/..., file://localhost/..., file://server/share/..., file:/C:/..., file:C:/..., +# with %-escapes (%20, a user name in UTF-8). It must start a path after "file:" ("file: name.txt" is prose). +FILE_URL = (r'''(?P(?i:file):(?://(?P[^/\s"'<>]*))?(?:/+|(?=[A-Za-z]:[\\/]))''' + r'''[^"'<>;\r\n,\)\]}]*)''') + ABSOLUTE_PATH = re.compile( # The preceding character guard prevents URL slashes from being treated # as local paths while still matching a drive path after prose such as @@ -242,20 +248,44 @@ def path_chars(path): # Consume explicit relative paths too, spaces included, so an interior # slash (after e.g. a hyphen) cannot subsequently be mistaken for an # absolute path. Only our own ``./setup.sh`` command stays as written. + # A file URL comes first, with its own guard (a word or a URL's slash before "file" stops it, so + # "uri:file:///..." counts and "https://host/file:x" stays a URL): its slashes are a path, which the + # guard below would otherwise leave as a URL's. + r'''(?\./setup\.sh(?![\w/\\-]|\.\w))|\.{1,2}/[^"'<>;\r\n,\)\]}]*|''' r'''(?:(?:[A-Za-z]:[\\/])|(?:\\\\[^\\/\s"'<>]+[\\/])|/(?![/\s]))[^"'<>;\r\n,\)\]}]*)''') +# A path that ends at a user's own folder: its last component is the user name, so none is kept. +HOME_FOLDER = re.compile(r'(?i)^(?:[A-Za-z]:)?[\\/]+(?:users|home|documents and settings)[\\/]+[^\\/]+$') + def path_placeholder(value): """``/`` and the last component: no usernames, drives, shares or parent directories.""" normalized = str(value).rstrip('\\/') + if HOME_FOLDER.match(normalized): + return '' name = re.split(r'[\\/]', normalized)[-1] return '/' + name if name else '' +def file_url_path(url): + """The local path a file URL names, %-escapes decoded (an unreadable escape stays as it is).""" + from urllib.parse import unquote + rest = re.sub(r'(?i)^file:', '', url) + if rest.startswith('//'): + rest = rest[2:] + host, slash, rest = rest.partition('/') + rest = slash + rest if host.lower() in ('', 'localhost') else '//' + host + '/' + rest + rest = unquote(rest, errors='replace') + # file:///C:/x is the drive path C:/x. + return rest[1:] if re.match(r'/[A-Za-z]:[\\/]', rest) else rest + + def path_match(match): """Replacement for an ``ABSOLUTE_PATH`` match. Spaces, UNC shares and ``\\\\?\\`` prefixes count.""" value = match.group(0) + if match.groupdict().get('url') is not None: + return path_placeholder(file_url_path(value)) if match.group('command') is not None: return value # Text is often redacted again (a worker's log inside a report, the @@ -264,3 +294,19 @@ def path_match(match): if match.string.endswith('', 0, match.start()) and not re.search(r'[\\/]', value[1:].rstrip('\\/')): return value return path_placeholder(value) + + +# Report text: an email address on its own (not the user part of a URL, removed as such) and an +# authorization value of any kind, as a header, a query, JSON (also with escaped quotes) or a Python repr +# writes it. A quoted value goes to its closing quote. After a known scheme ("Bearer", "token", "Digest" ...) only its credentials +# go, a single word or a list of name=value pairs, so the reason after them stays ("... timed out"); any +# other value goes to the end of its line. Replace with ``\1\2\3`` and the placeholder. +# "icon@2x.png" is a file name and "git@host:org/repo" a repository, not an address. +EMAIL = re.compile(r'(?=|<=|~=|!=|<|>)\s*[\w*]', plain): + name = re.sub(r'[-_.]+', '-', name).lower() + if name not in names and name != 'freevideo-engine': + names.append(name) + return names[:6] + + _ANSI_ESCAPE = re.compile(r'\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') def _redact(value): - """Report-safe text: no credentials, URL parameters, tokens or local paths.""" + """Report-safe text: no credentials, email addresses, URL parameters, tokens or local paths.""" if isinstance(value, bytes): value = value.decode('utf-8', errors='replace') value = _ANSI_ESCAPE.sub('', str(value)).replace('\x00', '') @@ -606,6 +651,9 @@ def _redact(value): value = re.sub(r'(?@', value) # Query strings routinely carry signed URLs and access tokens. value = re.sub(r'(?i)(https?://[^\s?\x27\x22]+)\?[^\s\x27\x22]+', r'\1', value) + # Any authorization value, not only a token-shaped one; then an email address on its own. + value = AUTHORIZATION.sub(r'\1\2\3', value) + value = EMAIL.sub('', value) value = re.sub(r'(?i)(\b(?:Bearer|Basic)\s+)[A-Za-z0-9._~+/=-]+', r'\1', value) # Hugging Face, GitHub and API keys, wherever they appear (a URL path, a header). value = re.sub(r'\b(?:hf_|sk-|gh[pousr]_|github_pat_)[A-Za-z0-9_-]{8,}\b', '', value) @@ -749,8 +797,11 @@ def _package_attempt(error, source, route, host='', seconds=0.): error_class, message = failure_reason(error) returncode = getattr(error, 'returncode', None) code = exit_code(error) if returncode is None else None + output = getattr(error, 'stderr', None) or getattr(error, 'stdout', None) or str(error) + reason = resolution_reason(output.decode('utf-8', errors='replace') if isinstance(output, bytes) else output) return _source_row(source, route, host, error_class, message, seconds, '' if code is None else 'exit %d' % code, - error_type=type(error).__name__, returncode=returncode, detail=detail, summary=summary) + error_type=type(error).__name__, returncode=returncode, detail=detail, summary=summary, + **({'resolution': reason} if reason else {})) def download_environment(environ, retry_mode='fast'): @@ -925,6 +976,12 @@ def download_command(network, family, run, env=None, *, category=None, extra_sou if retry_mode == 'patient': event(network, category=category, action='download-round-result', retry_mode=retry_mode, result='failed', attempts=len(attempts)-round_start) + # A mirror can lack a new version, so a resolution failure there moves on to the next source. When every + # source answered so, or the official index did, the versions are what fails, not the download. + resolved = [row for row in attempts if row.get('resolution')] + if resolved and (len(resolved) == len(attempts) or any(row['source'] == 'official' for row in resolved)): + reason = next((row['resolution'] for row in resolved if row['source'] == 'official'), resolved[-1]['resolution']) + raise PackageResolutionError(category, attempts, reason) raise PackageSourcesError(category, attempts) diff --git a/freevideo_engine/original_audio.py b/freevideo_engine/original_audio.py index 1ad495e4..f82eac4c 100644 --- a/freevideo_engine/original_audio.py +++ b/freevideo_engine/original_audio.py @@ -18,7 +18,7 @@ 'audio_original_long': ('This audio is longer than 30 seconds. Generate it in the Create view, or use an audio file of 30 seconds or less.', '这段音频超过 30 秒,请到创作面板里生成,或换一段 30 秒以内的音频。'), 'audio_original_limit': ('This audio is longer than 2 hours. Use an audio file of 2 hours or less.', '这段音频超过 2 小时,请换一段 2 小时以内的音频。'), 'audio_original_part': ('With "Use as is", each part can be up to 30 seconds.', '用“原样使用”时,每一段最长 30 秒。'), - 'audio_original_passes': ('Audio longer than 30 seconds used as is is made in parts, which needs "Two-pass acceleration". Turn it on or set the audio to "Reference".', '超过 30 秒的音频选“原样使用”时会分段生成,需要“二采加速”。请打开“二采加速”,或把音频改选“参考”。'), + 'audio_original_passes': ('Audio longer than 30 seconds used as is is made in parts, which needs "Faster second pass". Turn it on or set the audio to "Reference".', '超过 30 秒的音频选“原样使用”时会分段生成,需要“二采加速”。请打开“二采加速”,或把音频改选“参考”。'), 'audio_original_route': ('"Use as is" is not available here yet. Set the audio to "Reference".', '这里还不能用“原样使用”的音频,请改选“参考”。'), 'audio_original_backend': ('"Use as is" is not available on this computer yet.', '这台电脑上还不能用“原样使用”。'), 'audio_original_lead': ('To continue a video with audio used as is, select audio that starts at least 1 second into the file: the first second overlaps the saved video.', '续接已保存的视频并原样使用音频时,所选音频要从文件第 1 秒之后开始:前 1 秒与已保存的视频重叠。'), diff --git a/freevideo_engine/policy.py b/freevideo_engine/policy.py index 63a15d78..9608b3c3 100644 --- a/freevideo_engine/policy.py +++ b/freevideo_engine/policy.py @@ -671,6 +671,15 @@ def __init__(self, hardware, gpu_total, ram_total, free_gpu, free_ram, reserve_g lines.append('Available memory includes validated idle-cache credit, if present. Resolution, frames and steps were not reduced.') super().__init__('\n'.join(lines)) + def name_pixel_head(self, canvas): + """The fast mode's sampling fits and its pixel head does not: say so, with the two ways out.""" + self.details['gpu_requirement'] = 'fast_mode_decode' + line = ('Fastest mode: sampling fits, but its pixel head, which decodes the video after sampling, needs ' + '%.2f GiB of VRAM for %d x %d, %d frames. Use the light level, or a shorter video. This is a planning ' + 'estimate from measured peaks, not a measured OOM.' + % (pixel_head_bytes(canvas) / GiB, canvas['width'], canvas['height'], canvas['frames'])) + self.args = ((self.args[0] + '\n' if self.args else '') + line,) + def add_own_memory(self, own): """Say how much of the physical RAM already taken is FreeVideo's own.""" self.details.update(own) @@ -903,6 +912,98 @@ def decoder_workspace(canvas=None): return int(3.25 * GiB * max(1., area)) +# The fast mode ('fast2': two steps, no VAE) decodes with the adapter's pixel head instead of the video VAE. Like the +# VAE it runs after sampling has released the transformer, and the head's weights load only then; the VAE is not read. +# Reserved peaks of the memory-saving head, its BF16 weights (1.1 GiB) included, by latent frames and pixel area. They were +# measured with the four-step adapter's head, whose tensors have the same names and shapes as the two-step one's +# (pih3-5x, 11-25), on the product path (INT8 adapter, RTX PRO 6000 with 8-24 GB caps; torch.cuda.max_memory_reserved over the whole +# pixel-head stage, after empty_cache). 1344x768 and 768x1344: 5 s 5.24-5.54, 10 s 8.94-9.56, 15 s 12.72 GiB (c4 stages 1 +# and 2), 20 s 16.47 GiB (24 GB cap). 960x544: 5 s 3.15-3.37, 10 s 5.14-5.30, 15 s 7.02-7.43, 20 s 9.37-9.38 GiB (c4 +# stage 2). 480x288 15 s measured 2.78 GiB, under the line. The reserve is not proportional to the area (the +# allocator keeps relatively more at the smaller size: reserved/allocated 1.19 against 1.14 at 15 s), so at each length the +# planner draws the line through the two sizes' largest reserved peaks, by pixel area, and keeps that plus +# PIXEL_HEAD_MARGIN; smaller sizes follow the line (never below the weights), larger ones the line or the large size scaled +# by the area, whichever is more; lengths beyond the points follow the nearest segment. +FAST_MODES = ('none', 'fast2') +PIXEL_HEAD_WEIGHT_BYTES = int(1.1 * GiB) +PIXEL_HEAD_MARGIN = int(.25 * GiB) +_SMALL_AREA = 960 * 544 / (1344 * 768) +PIXEL_HEAD_MEASURED = ((37, ((1., int(5.54 * GiB)), (_SMALL_AREA, int(3.37 * GiB)))), + (72, ((1., int(9.56 * GiB)), (_SMALL_AREA, int(5.30 * GiB)))), + (107, ((1., int(12.72 * GiB)), (_SMALL_AREA, int(7.43 * GiB)))), + (142, ((1., int(16.47 * GiB)), (_SMALL_AREA, int(9.38 * GiB))))) + + +def _pixel_head_points(area): + """(latent frames, reserved bytes) at this pixel area (1 = 1344x768), margin included.""" + points = [] + for latent, ((a1, p1), (a2, p2)) in PIXEL_HEAD_MEASURED: + peak = p2 + (p1 - p2) * (area - a2) / (a1 - a2) + if area > a1: # larger than any size measured: no lower than the larger size's figure scaled by the area + peak = max(peak, PIXEL_HEAD_WEIGHT_BYTES + (p1 - PIXEL_HEAD_WEIGHT_BYTES) * area / a1) + points.append((latent, int(max(PIXEL_HEAD_WEIGHT_BYTES, peak)) + PIXEL_HEAD_MARGIN)) + return tuple(points) + + +PIXEL_HEAD_RESERVED = _pixel_head_points(1.) +# In the fast mode blocks 46-49 swap twelve int8 matrices for the adapter's BF16 ones (2.16 GB): about 1.08 GB more +# weight than the int8 layers they replace (pih3-5x; inferred, not measured). They go with their blocks during sampling. +FAST2_EXTRA_WEIGHT_BYTES = 2_160_000_000 // 2 +# Those twelve BF16 matrices are not module parameters (c2 d3c873ecb): a resident block keeps them on the GPU (counted +# above), a streamed one keeps all 2.16 GB pinned in host memory and lends one (about 180 MB) to the GPU per call. So a +# fast plan that streams any block holds them in RAM beside its weight cache (the int8 layers they replace are no longer +# read, which this does not count back). +FAST2_PINNED_BYTES = 2_160_000_000 +# At the end of the last step the pixel head's features (the final block's video rows, 5376 BF16 channels each) are +# copied to host memory, while the weight cache is still held, so the transformer can be released before the head runs +# (fast_tier_runtime.Features). c4 stage 2: 1344x768 15 s at a 16 GiB budget crossed the RAM guard by 0.34 GiB there. +FAST2_FEATURE_BYTES_PER_TOKEN = 5376 * 2 +# With both counted, the peak working PSS (PSS less clean file pages) under a RAM cap, on the second RTX PRO 6000 +# machine: 1344x768 15 s, 16 GiB RAM and 16 GB VRAM, 14.04-14.32 GiB against a 14.97 GiB budget; 960x544 15 s, 12 GiB +# RAM, 9.86-10.18 GiB against 10.95-10.97 GiB. The same request run twice on the same tree differed by 0.28 GiB (14.32 +# and 14.04), and two and four steps on one tree agreed within that (c3 planner measurements). +# A RAM margin set from such measurements covers at least that run-to-run spread. +# The RAM floor of a fast plan that offloads blocks, beside those host bytes. Ten requests at --ram-gib 8 with nothing +# pinned (Linux, same machine; 480x288 to 1920x1088, 5 to 20 s, 4 to 40 resident blocks, streamed or not) peaked at +# 2.33-2.45 GiB of working PSS above the pinned matrices and the features, always when the features are copied at the +# end of sampling (c3 planner measurements). The floor is the largest of them plus the +# 0.28 GiB run-to-run spread. All of them kept their outputs and residuals on the GPU (0.5 GiB of host activations); a +# plan that puts them in host memory, and every other system, was not measured and keeps the video stage's floor. +FAST2_HOST_FLOOR_BYTES = int((2.45 + .28) * GiB) + + +def fast_host_bytes(canvas, stage='generation'): + """Host bytes the fast mode holds beside the weight cache during sampling: the pinned matrices and the features.""" + if canvas is None or stage != 'generation' or fast_mode(canvas) != 'fast2': + return 0 + return FAST2_PINNED_BYTES + canvas['video_tokens'] * FAST2_FEATURE_BYTES_PER_TOKEN + + +def fast_mode(canvas=None): + """The canvas's fast mode: 'none' (every quality level) or 'fast2'.""" + value = (canvas or {}).get('fast_mode') or 'none' + if value not in FAST_MODES: + raise ValueError('Unsupported fast mode') + return value + + +def pixel_head_bytes(canvas): + """Reserved GPU bytes of the fast mode's pixel head for this canvas, its weights included.""" + from .geometry import geometry + latent = geometry(canvas['width'], canvas['height'], frames=canvas['frames'])['latent_frames'] + points = _pixel_head_points(canvas['width'] * canvas['height'] / (1344 * 768)) + index = next((i for i in range(1, len(points) - 1) if latent <= points[i][0]), len(points) - 1) + (x0, y0), (x1, y1) = points[index - 1], points[index] + return int(max(PIXEL_HEAD_WEIGHT_BYTES + PIXEL_HEAD_MARGIN, y0 + (y1 - y0) * (latent - x0) / (x1 - x0))) + + +def decode_workspace(canvas=None): + """GPU bytes the stage after sampling needs: the pixel head in the fast mode, else the VAE decoder's workspace.""" + if canvas is not None and fast_mode(canvas) == 'fast2' and canvas.get('fast_decode') != 'vae': + return pixel_head_bytes(canvas) + return decoder_workspace(canvas) + + def decoder_block_bytes(*, linear_compute_cache=False): """GPU bytes of one resident decoder block. @@ -1059,7 +1160,20 @@ def choose(hardware: Hardware, *, canvas=None, stage='generation', **options): request keeps the per-pixel preview and the placement of a request without it. """ from dataclasses import replace - plan = choose_placement(hardware, canvas=canvas, stage=stage, **options) + try: + plan = choose_placement(hardware, canvas=canvas, stage=stage, **options) + except ResourceBudgetError as error: + # In the fast mode, a refusal the VAE's workspace would not have made is the pixel head's: its way out (the + # light level, or a shorter video) differs from a sampling shortfall's. Ask the same plan once more with that. + if (canvas is not None and fast_mode(canvas) == 'fast2' and 'ram' not in error.details['insufficient'] + and error.details.get('gpu_requirement') != 'fast_mode_decode'): + try: + choose_placement(hardware, canvas=dict(canvas, fast_decode='vae'), stage=stage, **options) + except ResourceBudgetError: + pass + else: + error.name_pixel_head(canvas) + raise if (stage != 'generation' or canvas is None or hardware.system == 'Darwin' or not hardware.vram_total or options.get('allow_capacity_trial') or plan.capacity_trial): return plan @@ -1113,7 +1227,9 @@ def _choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto' lora_workspace = (128 * 2**20 + 2 * lora_max_block_bytes + lora_root_bytes if lora_max_block_bytes or lora_root_bytes else 0) table_workspace = adaln_extra_bytes(canvas) if stage == 'generation' else 0 - placement_workspace = lora_workspace + table_workspace + step_cache_bytes + fast2 = canvas is not None and fast_mode(canvas) == 'fast2' + fast_weights = FAST2_EXTRA_WEIGHT_BYTES if fast2 and stage == 'generation' else 0 + placement_workspace = lora_workspace + table_workspace + step_cache_bytes + fast_weights if canvas is not None: checked = geometry(canvas['width'], canvas['height'], frames=canvas['frames']) if any(canvas.get(k) != checked[k] for k in ('width', 'height', 'frames', 'video_tokens')): @@ -1206,7 +1322,7 @@ def _choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto' # they do not cover. Sampling still has to fit its own working set beside # them. Charging both refused full-size requests whose sampling and decode # each fit the card. - fixed_workspace = max(0, decoder_workspace(canvas) - placement_workspace) + fixed_workspace = max(0, decode_workspace(canvas) - placement_workspace) # The staging estimate was measured on per-tensor FP8, whose FF keeps every # SwiGLU row for one scale (1.94 GiB at 72576 tokens). Int8 rows carry their # own scales and stash nothing. At 1344x768x243 on int8, with a 4.70 GiB @@ -1245,7 +1361,7 @@ def _choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto' # admission; the cards this reduction already covered spend the headroom # keeping attention outputs on the GPU, which is worth more than the margin. if (not desktop and gpu_reserve_gib is None and free_gpu < 10 * GiB - and gpu_budget < max(residual_need, decoder_workspace(canvas))): + and gpu_budget < max(residual_need, decode_workspace(canvas))): reserve_gpu = MIN_GPU_RESERVE_GIB request_gpu_budget = free_gpu - int(reserve_gpu * GiB) gpu_budget = request_gpu_budget - placement_workspace @@ -1781,7 +1897,8 @@ def held(group): if capacity_trial: head, resident, prefetch = 4, 0, False cpu_outputs = residual_offload = True - pin = max(0, min(22_000_000_000, retention_budget - HOST_WEIGHT_HEADROOM)) / 1e9 + fast_host = fast_host_bytes(canvas, stage) # the fast mode's pinned matrices and its pixel head's features + pin = max(0, min(22_000_000_000, retention_budget - HOST_WEIGHT_HEADROOM - fast_host)) / 1e9 pin = min(pin, (50 - (resident if pinned_like is None else pinned_like)) * block_bytes / 1e9) if small: # Only locking every offloaded layer removes the offloader's own @@ -1810,7 +1927,11 @@ def held(group): # Use this only when keeping all offloaded mappings would exceed live RAM. # Larger machines keep the faster persistent mappings and optional pins. residual_host = residual_host_headroom(canvas) if residual_offload else 0 - host_activation = (2. if small or cpu_outputs else .5) * GiB + residual_host + host_activation = (2. if small or cpu_outputs else .5) * GiB + residual_host + fast_host + # Where the fast mode's host bytes were measured (Linux, outputs and residuals on the GPU: check_8g_24g_zh, floor_zh), + # they are not a reason to stream, and the RAM floor is the measured working set beside them. Elsewhere the plan + # stays as it was: the host bytes count toward streaming and the floor is the video stage's beside them. + fast_measured = hardware.system == 'Linux' and not (small or cpu_outputs or residual_offload) # Residency is not a way to spend spare VRAM: 8 blocks measured faster # than 29 or 48 at the same cap. What it is for is keeping the rest of the # model in RAM, because rereading weights from disk every step dominates a @@ -1838,7 +1959,16 @@ def held(group): # and 2.5 GiB available. Streaming pins a bounded subset block by block and # keeps read-only views of the rest, which avoid rereads while RAM allows. streamed_weights = ((hardware.system == 'Windows' and resident < 50) - or (50 - resident) * block_bytes + host_activation + 2 * GiB > retention_budget) + or (50 - resident) * block_bytes + host_activation - (fast_host if fast_measured else 0) + + 2 * GiB > retention_budget) + fast_floor = ((FAST2_HOST_FLOOR_BYTES if fast_measured else ram_minimum) + fast_host + if fast_host and resident < 50 else 0) + if ram_budget < fast_floor: + # A fast plan that offloads blocks holds the adapter's matrices and the features beside its measured working set. + raise ResourceBudgetError(hardware, gpu_total, ram_total, free_gpu, free_ram, reserve_gpu, reserve_ram, + gpu_minimum_bytes=gpu_minimum + placement_workspace, + ram_minimum_bytes=max(ram_minimum, fast_floor), canvas=canvas, + gpu_reserve_explicit=gpu_reserve_gib is not None) if unified_memory(hardware): # Nothing is kept in host memory there (retention_budget is 0): only blocks the GPU does not hold are read. streamed_weights = resident < 50 @@ -1858,7 +1988,7 @@ def held(group): host_headroom = (weight_cache_headroom(system=hardware.system, streamed=True, cpu_outputs=cpu_outputs, canvas=canvas) if ram_budget >= 8 * GiB else HOST_WEIGHT_HEADROOM) - host_headroom += residual_host + host_headroom += residual_host + fast_host pin = max(0, min((50 - resident) * block_bytes, retention_budget - host_headroom)) / 1e9 if small and not streamed_weights and pin * 1e9 < (50 - resident) * block_bytes: # All or nothing only when the weights already sit in RAM. On a @@ -2040,6 +2170,13 @@ def held(group): notes.append('Decoder keeps %d/36 %s blocks on GPU using live free VRAM; streams only the remainder, with original tiles and blending.' % (vae_resident, weight_format)) if stream_output: notes.append('Decode streams original temporal clips into rgb.npy; full floating video and duplicate RGB storage are avoided.') + pixel_head = {} + if fast2: + pixel_head = dict(vae='skipped', pixel_head_bytes=decode_workspace(canvas)) + notes.append('Fastest mode: after sampling releases the transformer, the pixel head decodes the video within ' + '%.2f GiB (estimated from measured peaks), and the video VAE is not loaded. The %d-step sampling ' + 'keeps %.2f GB for the adapter\'s BF16 layers in blocks 46-49.' + % (pixel_head['pixel_head_bytes'] / GiB, canvas['steps'], fast_weights / 1e9)) return Policy(2, hardware.to_dict(), gpu_budget, ram_budget, int(reserve_gpu * GiB), int(reserve_ram * GiB), 'backend:native,pinned_max_round_threshold_mb:1,expandable_segments:True', # 504 serialized VAE weight transfers fill 124.8 s of a @@ -2052,7 +2189,7 @@ def held(group): pin_weights=decoder_offload and ram_budget >= 16 * GiB, stream_output=stream_output, stream_weights=decoder_stream_weights, resident_blocks=vae_resident, - linear_compute_cache=decoder_linear_cache), + linear_compute_cache=decoder_linear_cache, **pixel_head), 'Architecture-specific candidate; validate this exact policy on the target GPU.', notes, capacity_trial=capacity_trial, lora_max_block_bytes=lora_max_block_bytes, lora_root_bytes=lora_root_bytes, adaln_extra_bytes=table_workspace, diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json index 79040d13..26ec4eac 100644 --- a/freevideo_engine/release_notes.json +++ b/freevideo_engine/release_notes.json @@ -1,29 +1,66 @@ { "schema": 1, - "product_version": "0.6.12", + "product_version": "0.6.13", "en": { - "summary": "0.6.12 fixes the Linux and Mac launchers failing to open ComfyUI in 0.6.11, keeps dialogue in more languages when prompts are enhanced, and voices Ukrainian dialogue in Ukrainian.", + "summary": "0.6.13 gives the create panel the same three-column layout as the image view, adds a Traditional Chinese interface and a Fast quality level that generates faster than Light, no longer stops installation on Windows on Arm computers while packages are prepared, and removes more user folder names, email addresses and sign-in details from reports.", "changes": [ - "Linux and Mac: the 0.6.11 launcher failed to open ComfyUI; it now opens normally.", - "Prompt enhancement keeps dialogue in more languages: when a scene is written in Russian, Ukrainian, Spanish, French, German, Turkish, Vietnamese or a similar language, the quoted lines are passed to the voice word for word instead of being left out, and text on signs and posters stays on screen.", - "Ukrainian dialogue is voiced more accurately: lines are passed to the model as Ukrainian instead of Russian, so they no longer take on a Russian accent, while Russian lines that mention a Ukrainian place are still spoken as Russian.", - "Picture editing on Windows: when Windows has little memory left to commit, FreeVideo now places less of the text encoder on the graphics card and tries once more if that is still not enough, so editing with several reference pictures is less likely to stop at the text step for lack of memory.", - "More complete diagnostic reports: when the engine stops answering for more than five seconds, FreeVideo records what each part was doing at the time and includes it in feedback and diagnostic reports, to help find the cause.", - "Feedback and diagnostic reports keep numbers such as \"2.00 GiB\" intact when a field holds a short value." + "Three-column create panel: settings on the left, the video in the middle and your creations on the right, laid out like the image view. In narrower windows the side columns fold into icons that open as drawers, and in a phone-width window the video sits above the settings.", + "Creations beside the video: search, sort and favorite your videos, or pick two to compare, without leaving the create panel. A Favorite button under the video adds the current video to your favorites.", + "Advanced options in one section: LoRA, generation mode, seed, steps and parts are grouped in one section that stays closed until you open it and remembers how you left it.", + "Compact layout: turn on Compact layout in Settings > Appearance to keep only the prompt, the video and Generate in the create panel.", + "Queue: each task has its own stop or remove button, which asks before it acts, in both the create panel and the image view.", + "Traditional Chinese: the web interface and the launcher are available in Traditional Chinese, with Taiwan wording that also serves Hong Kong and Macau.", + "Choosing the interface language: the launcher's globe button opens a list of the languages, and Settings > Language in the web interface offers the same list. Until a language is chosen, FreeVideo follows the system language.", + "Messages in the chosen language: failure cards for videos, images and the launcher, and the reasons the engine gives, are shown in the interface language.", + "Fast level: the new Fast quality level generates faster than Light; in shots with a lot of motion, fine detail may flicker. The first time you choose it, FreeVideo downloads about 2.2 GB, only once.", + "Windows on Arm installation: on Windows on Arm computers, installation no longer fails while preparing packages and can continue. When a required package has no version for the computer, the launcher names the package instead of showing an interrupted download. Generating videos and images works as usual; editing projects and images with the Agent is not available yet, because a component it needs has no Arm version.", + "Privacy in reports: diagnostic reports and problem reports remove your user folder name from more forms of local file paths. Problem reports and download failure records also remove email addresses and sign-in details sent to download servers, while keeping the reason a file or connection failed.", + "Options row in narrow windows: when the editor's options row is short of room, Media and LoRA fold to their icon and count, then Enhance to its icon, and then the duration, size and quality keys take their short form, instead of the row wrapping or cutting keys off." ] }, "zh": { - "summary": "0.6.12 修复了 0.6.11 在 Linux 和 Mac 上无法打开 ComfyUI 的问题;提示词改写会保留更多语言的台词,乌克兰语台词按乌克兰语配音。", + "summary": "0.6.13 的创作面板改为与图像视图一致的三栏布局,新增繁体中文界面和比轻量档更快的“极速”质量档;Windows on Arm 电脑上的安装不再在准备软件包时失败;报告中会去掉更多用户文件夹名、邮箱地址和登录信息。", "changes": [ - "Linux 和 Mac:0.6.11 的启动器打开 ComfyUI 时会失败,现在可以正常打开。", - "提示词改写能保留更多语言的台词:用俄语、乌克兰语、西班牙语、法语、德语、土耳其语、越南语等写场景时,引号里的台词会原样交给模型配音,不再被漏掉;招牌、海报上的文字仍作为画面中的文字。", - "乌克兰语台词的配音更准:台词按乌克兰语交给模型,不再标成俄语,发音不再带俄语腔;俄语台词里提到乌克兰地名时仍按俄语念。", - "Windows 上编辑图片:当 Windows 可提交的内存所剩不多时,FreeVideo 在文本编码时少放一部分到显卡上,仍不足时再试一次,带多张参考图编辑时,文本这一步不容易再因内存不足停下。", - "诊断报告更完整:引擎停止应答超过五秒时,FreeVideo 会记下各部分当时在做什么,并随反馈和诊断报告一起带出,便于找出原因。", - "反馈和诊断报告里,输入框中的短内容不再改坏“2.00 GiB”这类数字。" + "三栏创作面板:左边是设置,中间是视频,右边是作品,排法与图像视图一致。窗口较窄时两侧栏收成图标,点开后以抽屉展开;窗口为手机宽度时,视频位于设置上方。", + "作品就在视频旁边:不离开创作面板,即可搜索、排序、收藏视频,或选两条视频并排对比。视频下方新增“收藏”键,可直接收藏当前视频。", + "高级选项收在一节:LoRA、生成方式、种子、步数和分段放在同一节,默认收起,并记住您上次的状态。", + "简洁模式:在“设置 > 外观”中打开“简洁模式”后,创作面板只保留提示词、视频和生成。", + "队列:每个任务都有自己的停止或移出键,操作前会先确认;创作面板和图像视图都一样。", + "繁体中文:网页界面和启动器都提供繁体中文,用词按台湾习惯,香港和澳门也适用。", + "选择界面语言:启动器右上角的地球按钮打开语言列表,网页的“设置 > 语言”里是同样的列表。没有选过时,FreeVideo 跟随系统语言。", + "提示用所选语言显示:视频、图片和启动器的失败卡片,以及引擎给出的原因,都按界面语言显示。", + "极速档:质量档位新增“极速”,生成比轻量档更快;动作较多的镜头里,画面细节可能闪烁。第一次选用时需下载约 2.2 GB,只需下载一次。", + "Windows on Arm 安装:在 Windows on Arm 电脑上,安装不再在准备软件包时失败,可以继续进行。所需软件包没有适用于这台电脑的版本时,启动器会写明是哪个软件包,不再显示为下载中断。生成视频和图片照常可用;用 Agent 编辑项目和图片暂不可用,因为所需组件尚无 Arm 版本。", + "报告中的隐私:诊断报告和提交的问题会从更多形式的本机文件路径中去掉用户文件夹名;提交的问题和下载失败的记录还会去掉邮箱地址和发给下载服务器的登录信息,同时保留文件或连接失败的原因。", + "窄窗口里的选项行:剪辑页的选项行放不下时,先把素材和 LoRA 收成图标加数量,再把增强收成图标,最后时长、尺寸和质量键改用简短写法,不再换行或截断按键。" ] }, "history": [ + { + "product_version": "0.6.12", + "en": { + "summary": "0.6.12 fixes the Linux and Mac launchers failing to open ComfyUI in 0.6.11, keeps dialogue in more languages when prompts are enhanced, and voices Ukrainian dialogue in Ukrainian.", + "changes": [ + "Linux and Mac: the 0.6.11 launcher failed to open ComfyUI; it now opens normally.", + "Prompt enhancement keeps dialogue in more languages: when a scene is written in Russian, Ukrainian, Spanish, French, German, Turkish, Vietnamese or a similar language, the quoted lines are passed to the voice word for word instead of being left out, and text on signs and posters stays on screen.", + "Ukrainian dialogue is voiced more accurately: lines are passed to the model as Ukrainian instead of Russian, so they no longer take on a Russian accent, while Russian lines that mention a Ukrainian place are still spoken as Russian.", + "Picture editing on Windows: when Windows has little memory left to commit, FreeVideo now places less of the text encoder on the graphics card and tries once more if that is still not enough, so editing with several reference pictures is less likely to stop at the text step for lack of memory.", + "More complete diagnostic reports: when the engine stops answering for more than five seconds, FreeVideo records what each part was doing at the time and includes it in feedback and diagnostic reports, to help find the cause.", + "Feedback and diagnostic reports keep numbers such as \"2.00 GiB\" intact when a field holds a short value." + ] + }, + "zh": { + "summary": "0.6.12 修复了 0.6.11 在 Linux 和 Mac 上无法打开 ComfyUI 的问题;提示词改写会保留更多语言的台词,乌克兰语台词按乌克兰语配音。", + "changes": [ + "Linux 和 Mac:0.6.11 的启动器打开 ComfyUI 时会失败,现在可以正常打开。", + "提示词改写能保留更多语言的台词:用俄语、乌克兰语、西班牙语、法语、德语、土耳其语、越南语等写场景时,引号里的台词会原样交给模型配音,不再被漏掉;招牌、海报上的文字仍作为画面中的文字。", + "乌克兰语台词的配音更准:台词按乌克兰语交给模型,不再标成俄语,发音不再带俄语腔;俄语台词里提到乌克兰地名时仍按俄语念。", + "Windows 上编辑图片:当 Windows 可提交的内存所剩不多时,FreeVideo 在文本编码时少放一部分到显卡上,仍不足时再试一次,带多张参考图编辑时,文本这一步不容易再因内存不足停下。", + "诊断报告更完整:引擎停止应答超过五秒时,FreeVideo 会记下各部分当时在做什么,并随反馈和诊断报告一起带出,便于找出原因。", + "反馈和诊断报告里,输入框中的短内容不再改坏“2.00 GiB”这类数字。" + ] + } + }, { "product_version": "0.6.11", "en": { @@ -397,43 +434,6 @@ "其他:窄窗口下创作面板的按钮会换行,不再滑出视野;质量滑块拖动更跟手;新建角色时服装选项和 LoRA 在同一行。" ] } - }, - { - "product_version": "0.6.0", - "en": { - "summary": "The new interface is friendlier, smoother and more modern, and privacy protection is stronger.", - "changes": [ - "New interface: friendlier, smoother and more modern. Every running and queued video and picture can be seen and managed from any page. Generation keeps running when you switch pages, and your half-written prompt and reference pictures stay in place. Earlier videos can serve as references, and first and last frames can be picked straight from your works. A light theme is also available.", - "Stronger privacy: deleting a work also deletes its uploaded pictures and prompts, and downloads and shares leave out the prompt by default.", - "Image generation with more control: LoRA is supported, and hand-drawn sketches give finer control over the result. A picture deleted by mistake can be recovered from Recently deleted.", - "Characters from a photo: one photo makes a character card with front, side and back views.", - "Editor: the microphone is turned off automatically when you leave the editor, what has been recorded is kept when you stop with Esc, and export defaults to the full video at high quality.", - "Works library: works can be viewed and played properly even in a narrow window.", - "More reliable Mac installation: fixes an issue that kept the installation from completing on some Macs.", - "More reliable generation: prompt enhancement fails less often on 12 GB graphics cards, and graphics cards with little memory generate pictures normally.", - "Download and launcher: a video that cannot be downloaded now says so, and the launcher starts normally even if its saved template is missing or damaged.", - "Built-in director and agent tools: the director's choices and shot joining are shown in the conversation, a job's queue position is reported, and more clients are supported.", - "ComfyUI console: each log line now appears once.", - "Tutorial: new chapters on closing the launcher, repairing model files and making pictures of different shapes on a canvas." - ] - }, - "zh": { - "summary": "全新界面带来更友好、丝滑、现代的体验,隐私保护进一步加强。", - "changes": [ - "全新界面:更友好、丝滑、现代的体验。在任何页面都能看到和管理所有正在生成、排队的视频和图片;切换页面不会中断生成,写到一半的描述和参考图都还在;以前生成的视频也可以直接用作参考,首尾帧可以从作品中直接选;支持浅色主题。", - "隐私保护加强:删除作品时一并删除相关的上传图片和提示词,下载和分享默认不含提示词。", - "图片生成更可控:支持 LoRA,并可以通过手绘草图更精细地控制生成;误删的图片可在“最近删除”中找回。", - "照片生成角色:支持用一张照片生成角色卡,包括正面、侧面和背面形象。", - "剪辑:离开剪辑页面时自动关闭麦克风,按 Esc 结束录制时已录内容会保留,导出默认选择完整视频和高画质。", - "作品库:窄窗口下也能正常查看和播放作品。", - "Mac 安装更稳定:修复部分 Mac 无法完成安装的问题。", - "生成更稳定:12 GB 显卡上的提示词增强更不容易失败,显存较小的显卡也能正常生成图片。", - "下载与启动:视频无法下载时会给出提示,保存的模板缺失或损坏时启动器也能正常启动。", - "内置导演与智能体工具:导演的选择和镜头拼接过程显示在对话中,智能体工具会报告任务的排队位置,并兼容更多客户端。", - "ComfyUI 控制台:每行日志只显示一次。", - "教程:新增关闭启动器、修复模型文件、在画布上做不同比例图片三章。" - ] - } } ] } diff --git a/freevideo_engine/request_assets.py b/freevideo_engine/request_assets.py index dcddb4f6..5379524d 100644 --- a/freevideo_engine/request_assets.py +++ b/freevideo_engine/request_assets.py @@ -26,6 +26,11 @@ def _sampling(root, machine, request): # Same rule as generation: a reference video with an audio track selects the audio tables. task = sampling_assets.engine_task({'references': request['references']}, request.get('media_base')) canvas = sampling_canvas(geometry(request['width'], request['height'], seconds=request['seconds']))[0] + if request.get('fast_mode') not in (None, 'none'): + # Its modulation comes from the adapter, so no sampling table is needed. + from . import fast_tier + two_pass, base, refine = fast_tier.bridge_steps(request['fast_mode']) + return plan(canvas, two_pass, task, base_steps=base, refine_steps=refine), [] two_pass = bool(request.get('two_pass', True)) sampled = plan(canvas, two_pass, task, base_steps=request.get('base_steps', 8), refine_steps=request.get('refine_steps', 3), scale=request.get('upscale_factor', 2)) diff --git a/freevideo_engine/runtime.py b/freevideo_engine/runtime.py index 84175e78..86fc3d97 100644 --- a/freevideo_engine/runtime.py +++ b/freevideo_engine/runtime.py @@ -63,7 +63,7 @@ def __init__(self, cache, *, base=None, checkpoint=None, fp8_gemm='auto', window_varlen=False, varlen_smooth_k=True, task='t2va', stream_weights=False, canvas=None, head_parallelism=1, residual_offload=False, device_backend=None, gpu_allocation_bytes=None, - fetch_tables=True, adaln_task=None, step_cache=None): + fetch_tables=True, adaln_task=None, step_cache=None, fast_tier=None): from .step_cache import requested requested(step_cache) # Validate the effective selection before loading weights. self.device_backend = device_backend if device_backend is not None else get_backend() @@ -152,6 +152,16 @@ def __init__(self, cache, *, base=None, checkpoint=None, # In the slim format these constants are model parameters, not a # disposable optimization cache. The effective mode is reported. adaln_cache = True + fast = None + self.raw_grid = None + if fast_tier is not None: + # The adapter's own modulation replaces the tables; no 8-step table is read. + from .fast_tier import RAW_GRID + from .fast_tier_runtime import Runtime + from .fast_tier import STEPS + if manifest.get('precision') != 'int8' or steps != STEPS: + raise ValueError('The fastest mode runs two steps on the int8 model') + fast, self.raw_grid = Runtime(self.device_backend.device), RAW_GRID for group in manifest['groups']: if (self.cache / group['file']).stat().st_size != group['bytes']: raise ValueError('Incomplete prepared weights') @@ -269,6 +279,10 @@ def prepare_streamed(block, index, unread=False): if result.unexpected_keys or any(not key.startswith('transformer_blocks.') for key in result.missing_keys): raise ValueError('Unexpected root weight keys') del root_weights + if fast is not None: + fast.install_root(model) + fast.install_features(model, steps) + self.fast = fast if online_lora: from .lora_online import attach_block attach_block(model, 'root', self.cache, manifest, _load_safetensors, @@ -284,13 +298,14 @@ def prepare_streamed(block, index, unread=False): self.cursor = None self.schedule_hook = None embeddings = None - if adaln_cache: + if adaln_cache and fast is None: self.cursor = ScheduleCursor(schedule_timesteps(steps, task=self.adaln_task)) table_cache = (TableCache(self.cache, manifest['source_id'], steps, task=self.adaln_task, manifest=manifest, timesteps=self.cursor.timesteps, channels=model.config.hidden_size, device='cpu', fetch=fetch_tables) - if adaln_cache and (adaln_disk_cache or portable_adaln) else None) + if adaln_cache and fast is None and (adaln_disk_cache or portable_adaln) else None) table_cache_hits = 0 + fast_replaced = 0 adaln_prepare_seconds = 0. self.resident_weight_bytes = 0 block_bind_seconds = 0. @@ -312,7 +327,9 @@ def prepare_streamed(block, index, unread=False): adaln_started = time.perf_counter() table = table_cache.load(index, steps) if table_cache is not None else None cache_hit = table is not None - if cache_hit: + if fast is not None: + block.adaln_proj = fast.modulation(index) + elif cache_hit: block.adaln_proj = CachedModulation(table, self.cursor).to(self.device_backend.device, non_blocking=True) table_cache_hits += 1 del table @@ -321,7 +338,7 @@ def prepare_streamed(block, index, unread=False): restore_projections(self.cache, manifest) adaln = {name.removeprefix(prefix): value for name, value in _load_safetensors(self.cache / f'adaln/{index:02d}.safetensors').items()} - if adaln_cache and not cache_hit: + if adaln_cache and fast is None and not cache_hit: if embeddings is None: _, embeddings = schedule_embeddings(model, steps, task=self.adaln_task) block.load_state_dict({name: value.to(self.device_backend.device) for name, value in adaln.items()}, strict=False, assign=True) @@ -346,6 +363,9 @@ def prepare_streamed(block, index, unread=False): if online_lora: from .lora_online import attach_block attach_block(block, index, self.cache, manifest, _load_safetensors) + if fast is not None: + # Outside the block's own tensors: the offloader and the prepared files never see them. + fast_replaced += fast.replace_matrices(index, block, index < resident_blocks) if not adaln_cache: # ``weights.update(adaln)`` leaves the source dictionary alive # until the next iteration. Drop it before replacing this @@ -372,6 +392,7 @@ def prepare_streamed(block, index, unread=False): phase='Load cached blocks and upload resident weights', seconds=time.perf_counter() - started) if adaln_cache: del embeddings + if self.cursor is not None: self.schedule_hook = model.register_forward_pre_hook(self.cursor.before, with_kwargs=True) if any(p.is_meta for p in list(model.parameters()) + list(model.buffers())): raise RuntimeError('Some transformer parameters are still on meta') @@ -541,6 +562,8 @@ def pin_report(pinned, required): 'steps': steps, 'source_id': manifest['source_id']} if step_cache is not None: self.config['step_cache'] = step_cache + if fast_tier is not None: + self.config.update(fast_tier=fast_tier, adaln_mode='fast-tier-adapter', fast_replaced_matrices=fast_replaced) if self.adaln_task != self.task: self.config['adaln_task'] = self.adaln_task @@ -555,7 +578,15 @@ def gpu_commit_reserve(self): def sample(self, *args, compute_options=None, **kwargs): from .pass_configuration import configuration from .refine_schedule import modulation - with configuration(self, compute_options), modulation(self, kwargs.get('refine_schedule')) as prepared: + from .step_grid import using + if vars(self).get('fast') is not None: + from .geometry import geometry + canvas = geometry(kwargs.get('width', args[3] if len(args) > 3 else 1344), + kwargs.get('height', args[4] if len(args) > 4 else 768), + frames=kwargs.get('frames', args[2] if len(args) > 2 else 243)) + # The token grid of the video rows the pixel head reads: latent frames, height and width / 32. + self.fast.features.begin((canvas['latent_frames'], canvas['height'] // 32, canvas['width'] // 32)) + with using(self.raw_grid), configuration(self, compute_options), modulation(self, kwargs.get('refine_schedule')) as prepared: result = self._sample(*args, **kwargs) if prepared is not None: result[2]['refinement_schedule_preparation'] = prepared diff --git a/freevideo_engine/setup_progress.py b/freevideo_engine/setup_progress.py index 3907b94a..d2e63524 100644 --- a/freevideo_engine/setup_progress.py +++ b/freevideo_engine/setup_progress.py @@ -128,24 +128,29 @@ def transfer_parts(done, total, rate, decimal_sizes=False): def progress_text(event, zh=False, *, decimal_sizes=False): - """One activity line for the launcher, including known transfer counts.""" - t = lambda en, cn: cn if zh else en + """One activity line for the launcher, including known transfer counts. zh is the interface language: a tag ('en', + 'zh-Hans', a language file's) or, as before, True for Simplified Chinese.""" + from .i18n import code_language, tr + language = 'zh-Hans' if zh is True else 'en' if not zh else code_language(zh) + t = lambda en, cn, values=None: tr(en, cn, language, values) + zh = language == 'zh-Hans' activity, name = event.get('activity'), event.get('name') or '' # A Chinese name follows its verb directly; a Latin one (Python) keeps a space. gap = ' ' if name[:1].isascii() and name[:1].isalnum() else '' - if not zh and activity in VERB_ACTIVITIES and ( + if language == 'en' and activity in VERB_ACTIVITIES and ( name.startswith(COMPONENT_NAMES) or any(name == en for en, _ in NAMES.values())): name = name[:1].lower() + name[1:] # In the middle of a sentence. if activity == 'count': done, total = event.get('done'), event.get('total') if number(done) and number(total) and total > 0 and done <= total: - return name + t(' · Completed ', ' · 已完成 ') + '%d / %d' % (done, total) + return t('{name} · Completed {done} / {total}', '{name} · 已完成 {done} / {total}', dict(name=name, done='%d' % done, total='%d' % total)) return name if activity in ('verify', 'assemble', 'copy_bytes'): - verb = {'verify': ('Verifying ', '正在校验'), 'assemble': ('Assembling ', '正在合并'), - 'copy_bytes': ('Copying ', '正在复制')}[activity] + values = dict(name=name, gap=gap) # MiB rather than tenths of GiB: even slow disks change the visible text. - parts = [t(verb[0], verb[1] + gap) + name] + parts = [t('Verifying {name}', '正在校验{gap}{name}', values) if activity == 'verify' + else t('Assembling {name}', '正在合并{gap}{name}', values) if activity == 'assemble' + else t('Copying {name}', '正在复制{gap}{name}', values)] done, total = event.get('done'), event.get('total') # Sampling caches are checked file by file; the changing count would only flicker. if (event.get('unit') == 'bytes' and number(done) and number(total) and total >= 2**20 and done <= total @@ -156,8 +161,8 @@ def progress_text(event, zh=False, *, decimal_sizes=False): return t('The connection dropped; resuming the download and keeping what was already downloaded', '连接中断,正在继续下载,已下载的部分会保留') if activity in ('check', 'copy'): - parts = [t('Checking ', '正在校验' + gap) + name if activity == 'check' - else t('Copying ', '正在复制' + gap) + name] + parts = [t('Checking {name}', '正在校验{gap}{name}', dict(name=name, gap=gap)) if activity == 'check' + else t('Copying {name}', '正在复制{gap}{name}', dict(name=name, gap=gap))] done, total = event.get('done'), event.get('total') # Below 1 KiB the size would read "0 / 0 KiB". if event.get('unit') == 'bytes' and number(done) and number(total) and total >= 1024 and done <= total: @@ -173,7 +178,7 @@ def progress_text(event, zh=False, *, decimal_sizes=False): return ' · '.join(parts + transfer_parts(0, 0, event.get('rate'), decimal_sizes)) if activity == 'download': total = event.get('total') if event.get('unit') == 'bytes' else 0 - return ' · '.join([t('Downloading ', '正在下载' + gap) + name] + + return ' · '.join([t('Downloading {name}', '正在下载{gap}{name}', dict(name=name, gap=gap))] + transfer_parts(event.get('done'), total or 0, event.get('rate'), decimal_sizes)) return '' diff --git a/freevideo_engine/step_grid.py b/freevideo_engine/step_grid.py index ab2f9195..9e581c9e 100644 --- a/freevideo_engine/step_grid.py +++ b/freevideo_engine/step_grid.py @@ -14,8 +14,23 @@ Every schedule the engine builds therefore takes its grid from here. The values are the fused ones, which the published tables were made with. """ +from contextlib import contextmanager +from contextvars import ContextVar from functools import lru_cache +# Unshifted points of a schedule that is not the uniform grid (fast_tier.RAW_GRID). +_RAW_GRID = ContextVar('freevideo_raw_grid', default=None) + + +@contextmanager +def using(points): + """Sample on these unshifted points; None keeps the uniform grid.""" + token = _RAW_GRID.set(points) + try: + yield + finally: + _RAW_GRID.reset(token) + def uniform(steps): """linspace(1, 0, steps + 1) in float32, each point rounded once from its exact value.""" @@ -44,9 +59,17 @@ class Scheduler(MiniMaxH3Scheduler): def set_timesteps(self, num_inference_steps=None, device=None, sigmas=None): if sigmas is None and type(num_inference_steps) is int and num_inference_steps >= 1: - base = uniform(num_inference_steps) - # The scheduler's own shift, applied to a grid it did not build. - sigmas = self._shift * base / (1 + (self._shift - 1) * base) + points = _RAW_GRID.get() + if points is None: + base = uniform(num_inference_steps) + # The scheduler's own shift, applied to a grid it did not build. + sigmas = self._shift * base / (1 + (self._shift - 1) * base) + else: + import torch + if len(points) != num_inference_steps + 1: + raise ValueError('The sampling grid does not match the step count') + base = torch.tensor(points, dtype=torch.float64) + sigmas = (self._shift * base / (1 + (self._shift - 1) * base)).float() super().set_timesteps(num_inference_steps, device=device, sigmas=sigmas) if self.start: if not 0 < self.start < len(self.timesteps): diff --git a/freevideo_engine/tiers.py b/freevideo_engine/tiers.py index a5c08fda..05114772 100644 --- a/freevideo_engine/tiers.py +++ b/freevideo_engine/tiers.py @@ -38,17 +38,15 @@ LEGACY_MAC_HIGH = dict(steps=16, two_pass=False, step_cache=None, upscale=2) # Sampling time of a cached pass as a share of the same pass without a cache, -# for estimates that have no run with that cache yet. B200, 20 s clips -# (/mnt/fvbench/eng5/tiers/RESULTS-b200.md): EasyCache-AV sampled 1.8-1.9x and -# the first-block cache 1.4-1.5x faster than plain 20 steps. 10 s clips with the -# GPU held to 8-48 GiB (/mnt/fvbench/remy/tiers-v2/REPORT.md): EasyCache-AV +# for estimates that have no run with that cache yet. B200, 20 s clips: +# EasyCache-AV sampled 1.8-1.9x and the first-block cache 1.4-1.5x faster than +# plain 20 steps. 10 s clips with the GPU held to 8-48 GiB: EasyCache-AV # 0.48-0.75 of plain 20 steps (median about 0.6); a first-block cache kept at -# 32-48 GiB 0.71-0.82. Under the current keep rule at 8-24 GiB -# (review/quality-tiers-v2/linux-evidence.md) it is kept at 12 and 24 GiB, -# 0.81-1.28 (median 0.87), and dropped at 8 and 16 GiB. The shares are not -# fitted to the median: EasyCache-AV is slightly conservative, the first-block -# cache near the 8-24 GiB median. A first-block cache the planner did not keep -# is plain 20 steps. +# 32-48 GiB 0.71-0.82. Under the current keep rule, on a B200 held to 8-24 GiB, +# it is kept at 12 and 24 GiB, 0.81-1.28 (median 0.87), and dropped at 8 and +# 16 GiB. The shares are not fitted to the median: EasyCache-AV is slightly +# conservative, the first-block cache near the 8-24 GiB median. A first-block +# cache the planner did not keep is plain 20 steps. # EasyCache-AV, guarded (at most 40% of steps reused, never twice in a row): measured on the RTX PRO 6000, # 864x1184, 5 s, 20 steps, 2 reused steps: 212 s against 238 s for the plain 20 steps (about .88 of the sampling). # At 16 steps the guarded cache reused 1–4 steps (about 14% on average), @@ -57,10 +55,9 @@ # Sampling time (both passes) of a two-pass request with this upscale factor, # as a share of the same request at 2x, for estimates without a run of that -# factor. 1.5: H200, 1344x768 20 s, 221.5 s against 177.8 s -# (/mnt/fvbench/eng5/tiers/REPORT.md section 2); the stage model gives 1.25-1.30 -# from 10 to 20 s on 8-141 GiB cards. 1.2: the stage model only (1.62-1.78), -# not yet measured. +# factor. 1.5: H200, 1344x768 20 s, 221.5 s against 177.8 s; the stage model +# gives 1.25-1.30 from 10 to 20 s on 8-141 GiB cards. 1.2: the stage model +# only (1.62-1.78), not yet measured. UPSCALE_SHARE = {2: 1., 1.5: 1.27, 1.2: 1.72} diff --git a/freevideo_engine/timed_prompt.py b/freevideo_engine/timed_prompt.py index 6c5323ab..c48d54e0 100644 --- a/freevideo_engine/timed_prompt.py +++ b/freevideo_engine/timed_prompt.py @@ -6,14 +6,15 @@ are checked against tests/fixtures/timed_prompt_cases.json. """ import re +from functools import lru_cache + +from .i18n import keyword_list, keyword_words # The same space set as ECMAScript's \s and trim(), written out so Python and JavaScript read a line alike. SP = '\t\n\v\f\r \xa0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff' SPACES = '\t\n\v\f\r \xa0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff' TIME = re.compile(r'^[ \t ]*([0-9]{1,3}):([0-5][0-9])(?:\.([0-9]{1,3}))?(?![0-9.:])[ \t ]*(.*)$') LOOSE = re.compile(r'^[ \t ]*[0-9]{1,3}:[0-9]{1,2}(?![0-9:])') -CUT = re.compile(r'^(?:cut|CUT|Cut|切)[ \t ]*[::][ \t ]*(.*)$') -CUT_BARE = re.compile(r'^(?:cut|CUT|Cut|切)$') SPEECH = re.compile(r'^@?([^::' + SP + r'][^::]{0,11}?)[ \t ]*[::][ \t ]*([^' + SP + r'].*)$') NAME_BREAK = re.compile(r'[,.;!?,。;!?]') WRITTEN = re.compile(r'\[Shot [0-9]+\]|\bAt [0-9]{2,}:[0-9]{2}\.[0-9]{3}', re.ASCII) @@ -67,6 +68,13 @@ def ukrainian(words): return ukrainian_words > russian_words +@lru_cache(maxsize=64) +def _cuts(own): + """(line, bare) patterns for the built-in cut words ("Cut:", "切:") and a language's own (_meta.keywords.cut).""" + source = '(?:' + '|'.join(re.escape(word) for word in keyword_words('cut', own)) + ')' + return re.compile('^' + source + r'[ \t ]*[::][ \t ]*(.*)$'), re.compile('^' + source + '$') + + def language(words): if re.search('[぀-ヿ]', words): return 'Japanese' @@ -90,9 +98,11 @@ def sentence(words): return words + ('。' if CJK.search(words) else '.') -def parse(text): - """(head lines, timed lines, errors); a timed line is {n, ms, kind, who, words}.""" +def parse(text, cut_words=()): + """(head lines, timed lines, errors); a timed line is {n, ms, kind, who, words}. `cut_words`: the language's own + words for a new shot, besides "Cut" and "切" (language_keywords(tag)['cut'] in freevideo_engine/i18n.py).""" head, lines, errors = [], [], [] + CUT, CUT_BARE = _cuts(tuple(keyword_list(cut_words))) for n, raw in enumerate(re.split(r'\r\n|\r|\n', text), 1): found = TIME.match(raw) if not found: @@ -117,12 +127,12 @@ def parse(text): return head, lines, errors -def convert(text, seconds, speakers=None, offset=0): +def convert(text, seconds, speakers=None, offset=0, cut_words=()): """{text, errors, timed}: errors name the lines left out ({line, code}); the caller stops on any. - Times are read on a ruler that starts `offset` seconds before this text's first second.""" + Times are read on a ruler that starts `offset` seconds before this text's first second. `cut_words` as in parse.""" if not isinstance(text, str) or WRITTEN.search(text): return {'text': text, 'errors': [], 'timed': False} - head, lines, errors = parse(text) + head, lines, errors = parse(text, cut_words) if not lines and not errors: return {'text': text, 'errors': [], 'timed': False} limit = round(seconds * 1000) diff --git a/freevideo_engine/worker.py b/freevideo_engine/worker.py index 8a5ccaf7..5120fad4 100644 --- a/freevideo_engine/worker.py +++ b/freevideo_engine/worker.py @@ -76,6 +76,8 @@ def released(engine): live_budget = None decode_read_ahead = None decoder_read_ahead_closed = False + pixel_head = False + pixel_features = None # the fastest mode's features for its pixel head, taken before the transformer is released original_error = None # A reused engine runs this request's tiling for the request and goes back to the one it was loaded with. from contextlib import ExitStack @@ -386,7 +388,13 @@ def capture_first(video): decode_read_ahead = DecoderReadAhead(engine.base, ram_budget_bytes=request.get('ram_budget_bytes'), budget_is_estimate=request.get('ram_budget_is_estimate') is True) decoder_cached = resident is not None and 'video_vae' in resident.entries - if decoder_cached: + # Set only by a real Engine in the fastest mode (stand-ins and other engines have none of their own). + pixel_head = type(vars(engine).get('fast')).__name__ == 'Runtime' if hasattr(engine, '__dict__') else False + if pixel_head: + # The fastest mode draws its pixels with its own head; the video VAE is never read. + decoder_cached = True + decode_read_ahead.result.update(state='skipped', reason='The fastest mode does not use the video VAE') + elif decoder_cached: decode_read_ahead.result.update(state='skipped', reason='Video VAE is already resident on the GPU') def read_decoder_ahead(): # Every offloaded layer in memory and none read in the last step. @@ -735,6 +743,9 @@ def refine_checkpoint(done, rows, seconds): metrics.update(sampled) metrics.pop('sample_metrics_scope', None) base = engine.base + if pixel_head: + # On the CPU already; kept before the transformer goes. + pixel_features, pixel_adapter = engine.fast.features.take(), str(engine.fast.adapter) sample_finalize_phase('transformer_release') # A one-shot worker releases the transformer. An interactive worker # keeps it if live memory also covers decoding, otherwise evicts it. @@ -787,7 +798,13 @@ def keep_audio_lead_in(value): continuation_data['audio_lead_in'] = value # Older retained sampling tails predate the predecessor binding. continuation_data['metadata']['source_id'] = continuation['source_id'] - if redo_sound is not None: + if pixel_features is not None: + from .dwd_decode import pixels_to_file + metrics.update(pixels_to_file(*pixel_features, audio, request['output'], base=base, adapter=pixel_adapter, + artifacts_dir=artifacts, phase_callback=decode_phase, model_cache=resident, + output_size=output_size)) + pixel_features = None + elif redo_sound is not None: from . import redo_audio decode_phase('audio_decode') sound = redo_audio.decode_sound(audio, base, request['geometry']['frames']) diff --git a/freevideo_engine/workflow_repairs.py b/freevideo_engine/workflow_repairs.py index aca6bba3..af4a7d29 100644 --- a/freevideo_engine/workflow_repairs.py +++ b/freevideo_engine/workflow_repairs.py @@ -23,6 +23,7 @@ 'hide_tail': ('bool', False, None), 'step_cache': ('choice', 'none', ('none', 'easycache-av', 'fbcache')), 'upscale_factor': ('choice', '2', ('2', '1.5', '1.2')), + 'fast_mode': ('choice', 'none', ('none', 'fast2')), } KEPT = 50 diff --git a/pyproject.toml b/pyproject.toml index 428ef840..c616cc46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,8 @@ dependencies = ["psutil>=6", "safetensors>=0.8.0", "numpy>=2", "pillow>=11", "av launcher = ["PySide6-Essentials==6.11.2"] runtime = [ "triton==3.7.1; sys_platform == 'linux'", - "triton-windows==3.7.1.post27; sys_platform == 'win32'", + "triton-windows==3.7.1.post27; sys_platform == 'win32' and platform_machine != 'ARM64'", + "triton-windows==3.8.0.post28; sys_platform == 'win32' and platform_machine == 'ARM64'", "transformers==5.15.0", "accelerate==1.14.0", "peft==0.20.0", "safetensors==0.8.0", "huggingface_hub==1.30.0", "hf-xet==1.6.1a0", "omegaconf==2.3.1", "pyyaml==6.0.3", "einops==0.8.2", @@ -37,4 +38,4 @@ include = ["freevideo_engine*"] "freevideo_engine.prompt_vlm" = ["model.json"] "freevideo_engine.dubbing" = ["cosyvoice3_pack.json"] "freevideo_engine.image_gen" = ["image_models.json", "face_box_weights.json", "licenses/NOTICE.txt"] -freevideo_engine = ["stage_estimate_params.json", "build-version.txt", "build-identity.json", "release_notes.json", "dependencies.json", "model_files.json", "model_shares.json", "prepared_models.json", "macos_reference_catalog.json", "superseded_tables.json", "bootstrap_versions.json", "curl_windows.json", "git_linux.json", "git_macos.json", "gcc_linux.json", "uv_downloads.json", "torch_downloads.json", "test_prompts.json", "windows_bootstrap.ps1", "assets/*.png", "assets/*.ico", "launcher/*.qml", "launcher/licenses/*.txt", "licenses/*.txt", "licenses/runtime/*.txt", "subtitle_pack.json", "frame_preview_weights.json", "frame_preview_decoder.safetensors", "agent/skill/freevideo/*.txt", "agent/skill/freevideo/references/*.txt", "depth_reference_model.json", "frame_upscale_model.json", "rife_interp_model.json", "swap_lora.json"] +freevideo_engine = ["stage_estimate_params.json", "build-version.txt", "build-identity.json", "release_notes.json", "dependencies.json", "model_files.json", "model_shares.json", "prepared_models.json", "macos_reference_catalog.json", "superseded_tables.json", "bootstrap_versions.json", "curl_windows.json", "git_linux.json", "git_macos.json", "gcc_linux.json", "uv_downloads.json", "torch_downloads.json", "test_prompts.json", "windows_bootstrap.ps1", "assets/*.png", "assets/*.ico", "launcher/*.qml", "launcher/licenses/*.txt", "licenses/*.txt", "licenses/runtime/*.txt", "subtitle_pack.json", "frame_preview_weights.json", "frame_preview_decoder.safetensors", "agent/skill/freevideo/*.txt", "agent/skill/freevideo/references/*.txt", "depth_reference_model.json", "frame_upscale_model.json", "rife_interp_model.json", "swap_lora.json", "fast_pack.json"] diff --git a/scripts/test_freevideo_entry.mjs b/scripts/test_freevideo_entry.mjs index 512ca4d9..3adec007 100644 --- a/scripts/test_freevideo_entry.mjs +++ b/scripts/test_freevideo_entry.mjs @@ -134,7 +134,12 @@ test('main browser entry registers both views and preserves node hooks', async t source = source.replace("from './fv_player.js'", `from '${new URL('../web/fv_player.js', import.meta.url).href}'`); source = source.replace("from './fv_select.js'", `from '${new URL('../web/fv_select.js', import.meta.url).href}'`); source = source.replace("from './tip_words.js'", `from '${new URL('../web/tip_words.js', import.meta.url).href}'`); - source = source.replace("from './i18n.js'", `from '${new URL('../web/i18n.js', import.meta.url).href}'`); + // i18n.js decides the page's language once, when it loads (as a page does on each load). Each round below sets + // navigator.language and loads freevideo.js again, so it gets an i18n.js of its own, read under that language; + // a single shared one would keep the system language Node started with (LANG=zh_CN gave the zh rules in en rounds). + const i18nHref = new URL('../web/i18n.js', import.meta.url).href; + source = source.replace("from './i18n.js'", `from '${i18nHref}'`); + const withLanguage = text => text.replaceAll(`from '${i18nHref}'`, `from '${i18nHref}?navigator=${encodeURIComponent(globalThis.navigator.language)}'`); source = source.replace("from './cut_tip.js'", `from '${new URL('../web/cut_tip.js', import.meta.url).href}'`); source = source.replace("from './middle_frames.js'", `from '${new URL('../web/middle_frames.js', import.meta.url).href}'`); source = source.replace("from './workflow_drafts.js'", `from '${new URL('../web/workflow_drafts.js', import.meta.url).href}'`); @@ -182,7 +187,7 @@ test('main browser entry registers both views and preserves node hooks', async t .replace("import { installNativeErrorGuard } from './native_errors.js';", 'const installNativeErrorGuard = () => {};') .replace("import { installTranslateGuard } from './translate_guard.js';", 'const installTranslateGuard = () => {};') .replace("import { AUDIO_USE, usesOriginal, checkOriginal, checkedLength, failureText, multipleText, createUseSwitch, originalBlocked, stuckText, liftBlock } from './audio_original.js';", 'const {AUDIO_USE,usesOriginal,checkOriginal,checkedLength,failureText,multipleText,createUseSwitch,originalBlocked,stuckText,liftBlock} = globalThis.__freevideoEntryTest;'); - await import('data:text/javascript;base64,' + Buffer.from(source).toString('base64')); + await import('data:text/javascript;base64,' + Buffer.from(withLanguage(source)).toString('base64')); const extension = extensions.find(row => row.name === 'FreeVideo.UnifiedMedia'); assert.ok(extension, 'the main extension must register'); await extension.setup(); @@ -253,7 +258,7 @@ test('main browser entry registers both views and preserves node hooks', async t await t.test(`${language} node step tooltips include the three-step exception for valid plans`, async () => { navigator.language = language; try { - await import('data:text/javascript;base64,' + Buffer.from(source + `\n// tooltip language: ${language}`).toString('base64')); + await import('data:text/javascript;base64,' + Buffer.from(withLanguage(source) + `\n// tooltip language: ${language}`).toString('base64')); const localized = extensions.at(-1); class LocalizedGenerateNode extends GenerateNode {} await localized.beforeRegisterNodeDef(LocalizedGenerateNode, {name: 'FreeVideoGenerate'}); @@ -271,7 +276,7 @@ test('main browser entry registers both views and preserves node hooks', async t await t.test(`${language} advanced node labels preserve keys, values and untranslated copy`, async () => { navigator.language = language; try { - await import('data:text/javascript;base64,' + Buffer.from(source + `\n// label language: ${language}`).toString('base64')); + await import('data:text/javascript;base64,' + Buffer.from(withLanguage(source) + `\n// label language: ${language}`).toString('base64')); const localized = extensions.at(-1); class LocalizedGenerateNode extends GenerateNode {} await localized.beforeRegisterNodeDef(LocalizedGenerateNode, {name: 'FreeVideoGenerate'}); @@ -281,10 +286,10 @@ test('main browser entry registers both views and preserves node hooks', async t ['seconds', 'Duration (s)', '时长(秒)', 10], ['seed', 'seed', '种子', 2026090903], ['force_regenerate', 'Force regeneration', '重新生成', false, '跳过已保存结果的缓存。'], - ['preview', 'Two-pass: preview first pass', '先出预览', false, + ['preview', 'Preview first', '先出预览', false, '先出低分辨率预览,满意后在结果里点“继续二采”,成片与直接生成一致。'], ['refine_from', 'Second pass of preview', '继续二采', 'preview.mp4', '从这个预览继续生成全分辨率视频。'], - ['continue_from', 'Continue from video', '接着生成', 'previous.mp4'], + ['continue_from', 'Extend from video', '接着生成', 'previous.mp4'], ['frames', 'Total frames', '帧数', 141], ['first_frame_reference', 'First-frame reference', '首帧参考', true, '减小漂移'], ['step_cache', 'Step cache', '步间缓存', 'none', @@ -293,7 +298,7 @@ test('main browser entry registers both views and preserves node hooks', async t ['voice_reference', 'Voice reference', '声音参考', true, '接着生成对白时,沿用原视频开头的声音,让前后声音一致。'], ['hide_tail', 'Hide dialogue tail', '隐藏对白尾段', true, '多生成 17 帧后丢弃,让对白在前后两段之间连贯。'], - ['allow_empty_prompt', 'Allow empty prompt', '允许空描述', false, '描述为空时直接生成,不再提示。'], + ['allow_empty_prompt', 'Allow empty prompt', '允许空提示词', false, '提示词为空时直接生成,不再提示。'], ]; const node = new LocalizedGenerateNode(); node.widgets = rows.map(([name, label, , value]) => ({name, label, value, tooltip: `original ${name}`})); @@ -617,7 +622,7 @@ test('main browser entry registers both views and preserves node hooks', async t const calls = [], changes = []; const callback = function (...args) { calls.push({receiver: this, args}); return 'chosen'; }; try { - await import('data:text/javascript;base64,' + Buffer.from(source + `\n// audio warning: ${language}`).toString('base64')); + await import('data:text/javascript;base64,' + Buffer.from(withLanguage(source) + `\n// audio warning: ${language}`).toString('base64')); class AudioMedia extends GenerateNode { constructor() { super(); this.id = 570; this.type = 'FreeVideoMedia'; diff --git a/web/agent_activity.js b/web/agent_activity.js index 9cbe39cc..f16068e5 100644 --- a/web/agent_activity.js +++ b/web/agent_activity.js @@ -3,6 +3,7 @@ import {retryAgentPost} from './agent_session.js'; import {issueButton} from './issue_button.js'; import {tip} from './autopilot_tips.js'; import {failureAdvice} from './error_panel.js'; +import {engineReason} from './other_usage.js'; // What agents connected to this FreeVideo are doing. Their requests share the // studio's queue, so people can see them, follow progress and stop them. const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = new URL('./agent_activity.css', import.meta.url).href; document.head.append(css); @@ -44,14 +45,12 @@ export function failureReason(job, t) { } function failureLine(error, t) { // The engine's reason, then its next step when it has one. - const next = (said, step, zh) => said && step ? said.replace(/[。.]$/, '') + (zh ? '。' : '. ') + step : said; - if (error.error_en && error.error_en !== 'Did not finish') - return t(next(error.error_en, error.next_en), next(error.error_zh || error.error_en, error.next_zh, !!error.error_zh)); + if (error.error_en && error.error_en !== 'Did not finish') return engineReason(error, t); const message = String(error.message || '').trim(); const advice = message && failureAdvice(message, t); if (advice && advice.kind !== 'unknown') return [advice.title, advice.action].filter(Boolean).join(t('. ', ',')); const line = message.split(/\r?\n/).find(text => text.trim() && !/^Traceback/.test(text))?.trim().slice(0, 160); - return line ? t(`Did not finish: ${line}`, `没有完成:${line}`) : t('Did not finish', '没有完成'); + return line ? t('Did not finish: {line}', '没有完成:{line}', { line }) : t('Did not finish', '没有完成'); } function el(tag, cls, text) { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; } function glyph(path) { @@ -61,18 +60,18 @@ function glyph(path) { return svg; } // The same two wordings as the conversation's cards. -const left = (s, t) => s >= 60 ? t(`About ${Math.ceil(s / 60)} min`, `约 ${Math.ceil(s / 60)} 分钟`) : t('Under 1 min', '不到 1 分钟'); +const left = (s, t) => s >= 60 ? t('About {minutes} min', '约 {minutes} 分钟', { minutes: Math.ceil(s / 60) }) : t('Under 1 min', '不到 1 分钟'); // The engine's phases in the reader's language. function phaseText(p, t, kind) { const step = p.step; // The first step is still getting ready: the line does not count from zero. A row here does not know which // part of a long video it is on, and a later part loads nothing, so it does not say the model is loading. - if (p.phase === 'sampling' && step?.total) return step.done >= 1 ? t(`Step ${step.done} / ${step.total}`, `生成 ${step.done} / ${step.total}`) : t('Preparing', '准备中'); + if (p.phase === 'sampling' && step?.total) return step.done >= 1 ? t('Step {done} / {total}', '生成 {done} / {total}', { done: step.done, total: step.total }) : t('Preparing', '准备中'); // Dubbing counts lines, not steps. - if (p.phase === 'dubbing' && step?.total) return t(`Line ${step.done} / ${step.total}`, `第 ${step.done} / ${step.total} 句`); + if (p.phase === 'dubbing' && step?.total) return t('Line {done} / {total}', '第 {done} / {total} 句', { done: step.done, total: step.total }); // The sound finish separates each source clip in turn. const clip = /^separating (\d+)\/(\d+)$/.exec(p.phase || ''); - if (clip) return t(`Separating tracks · clip ${clip[1]} / ${clip[2]}`, `分离音轨 · 第 ${clip[1]} / ${clip[2]} 段`); + if (clip) return t('Separating tracks · clip {clip} / {clips}', '分离音轨 · 第 {clip} / {clips} 段', { clip: clip[1], clips: clip[2] }); // A picture's stages share names with a video's, but it saves no sound. if (kind === 'image' || kind === 'image_edit') { const own = {text: t('Reading prompt', '读取提示词'), encode: t('Preparing images', '准备图片'), @@ -97,13 +96,13 @@ function status(job, t) { if (job.status === 'running') return t(en, zh); if (job.status === 'cancelling') return t('Stopping', '正在停止'); if (job.status === 'queued') return job.progress?.queue_position - ? t(`In queue · #${job.progress.queue_position}`, `排队 · 第 ${job.progress.queue_position} 位`) : t('Queued', '排队中'); + ? t('In queue · #{queue_position}', '排队 · 第 {queue_position} 位', { queue_position: job.progress.queue_position }) : t('Queued', '排队中'); if (job.status === 'waiting') return job.waiting_for ? t('Waiting for earlier tasks', '等待前面的任务') : t('Waiting for the GPU', '等待显卡'); return {succeeded: t('Done', '已完成'), failed: t('Failed', '失败'), cancelled: t('Cancelled', '已取消')}[job.status] || job.status; } export function title(job, t) { const name = NAMES[job.kind] || NAMES.generate; - return job.label || (t(name[0], name[1]) + (job.take ? ' · ' + t(`Take ${job.take}`, `第 ${job.take} 条`) : '')); + return job.label || (t(...name) + (job.take ? ' · ' + t('Take {take}', '第 {take} 条', { take: job.take }) : '')); } function row(job, t, api, refresh, open, cancellationErrors) { const item = el('li', 'fv-agent-job'); item.dataset.status = job.status; item.dataset.job = job.id; @@ -229,7 +228,7 @@ export function createAgentActivity(t, api, host, {interval = [1500, 8000], open const key = refill(panel, list, fresh); const unreadable = Number.isSafeInteger(data.unreadable) && data.unreadable > 0 ? data.unreadable : 0; const skipped = el('div', 'fv-agent-unreadable', unreadable > 0 - ? t(`${unreadable} ${unreadable === 1 ? 'job' : 'jobs'} could not be read`, `另有 ${unreadable} 个任务无法读取`) : ''); + ? (unreadable === 1 ? t('1 job could not be read', '另有 1 个任务无法读取') : t('{count} jobs could not be read', '另有 {count} 个任务无法读取', { count: unreadable })) : ''); skipped.hidden = !unreadable; if (list.parentNode === panel) { panel.querySelector(':scope > header')?.replaceWith(header); @@ -252,7 +251,7 @@ export function createAgentActivity(t, api, host, {interval = [1500, 8000], open state = t(KINDS[running.kind]?.[0] || 'Working', KINDS[running.kind]?.[1] || '进行中'); if (Number.isFinite(fraction) && fraction > 0) percent = ` ${Math.round(fraction * 100)}%`; if (active > 1) more = ` · +${active - 1}`; - } else if (active) state = t(`${active} waiting`, `${active} 个等待中`); + } else if (active) state = t('{active} waiting', '{active} 个等待中', { active }); else state = t('Done', '已完成'); label.replaceChildren(t('Assistant', '助手'), el('span', 'fv-agent-state-text', ' · ' + state), percent, el('span', 'fv-agent-more', more)); element.setAttribute('aria-label', label.textContent); diff --git a/web/agent_confirm_settings.js b/web/agent_confirm_settings.js index 30e812da..ef82f418 100644 --- a/web/agent_confirm_settings.js +++ b/web/agent_confirm_settings.js @@ -76,7 +76,7 @@ export function agentConfirmSettings(t, api) { startBox.onchange = () => save(confirmPatch('start', startBox.checked)); longBox.onchange = () => save(confirmPatch('long', {on: longBox.checked, seconds: shown.seconds})); minutesField.onchange = () => { - if (!validMinutes(minutesField.value)) { render(); status.textContent = t(`Enter a number from 0 to ${MAX_MINUTES}.`, `请输入 0 到 ${MAX_MINUTES} 之间的数。`); return; } + if (!validMinutes(minutesField.value)) { render(); status.textContent = t('Enter a number from 0 to {MAX_MINUTES}.', '请输入 0 到 {MAX_MINUTES} 之间的数。', { MAX_MINUTES }); return; } const seconds = Math.round(Number(minutesField.value) * 60); return save(confirmPatch('long', {on: true, seconds})); }; diff --git a/web/agent_connect.css b/web/agent_connect.css index 36b6de70..99b077a5 100644 --- a/web/agent_connect.css +++ b/web/agent_connect.css @@ -50,29 +50,29 @@ /* Order: connection label, time left, phone, progress ring, feedback, tutorial; thresholds intentionally stay the same when feedback becomes an icon. */ @container fv-autopilot-actions (width<619px){.fv-header[data-hx-now] :lang(zh) .fv-autopilot-lamp{width:30px;height:30px;padding:0;justify-content:center}.fv-header[data-hx-now] :lang(zh) .fv-autopilot-lamp>span{display:none}} -@container fv-autopilot-actions (width<786px){.fv-header[data-hx-now] :lang(en) .fv-autopilot-lamp{width:30px;height:30px;padding:0;justify-content:center}.fv-header[data-hx-now] :lang(en) .fv-autopilot-lamp>span{display:none}} +@container fv-autopilot-actions (width<786px){.fv-header[data-hx-now] :not(:lang(zh)) .fv-autopilot-lamp{width:30px;height:30px;padding:0;justify-content:center}.fv-header[data-hx-now] :not(:lang(zh)) .fv-autopilot-lamp>span{display:none}} @container fv-autopilot-actions (width<565px){:lang(zh) .fv-autopilot-now-go>em{display:none}} -@container fv-autopilot-actions (width<704px){:lang(en) .fv-autopilot-now-go>em{display:none}} +@container fv-autopilot-actions (width<704px){:not(:lang(zh)) .fv-autopilot-now-go>em{display:none}} @container fv-autopilot-actions (max-width:289px){:lang(zh) .fv-autopilot-now-go>span{display:none}} -@container fv-autopilot-actions (max-width:330px){:lang(en) .fv-autopilot-now-go>span{display:none}} +@container fv-autopilot-actions (max-width:330px){:not(:lang(zh)) .fv-autopilot-now-go>span{display:none}} @container fv-autopilot-actions (width<483px){:lang(zh) .fv-header[data-hx-now] .fv-lan{display:none}} @container fv-autopilot-actions (width<433px){:lang(zh) .fv-autopilot-now-go>i{display:none}} @container fv-autopilot-actions (width<412px){:lang(zh) .fv-header[data-hx-now] .fv-feedback-entry:not(.fv-guide-entry){display:none}} @container fv-autopilot-actions (width<362px){:lang(zh) .fv-header[data-hx-now] .fv-guide-entry{display:none}} -@container fv-autopilot-actions (width<601px){:lang(en) .fv-header[data-hx-now] .fv-lan{display:none}} -@container fv-autopilot-actions (width<537px){:lang(en) .fv-autopilot-now-go>i{display:none}} -@container fv-autopilot-actions (width<516px){:lang(en) .fv-header[data-hx-now] .fv-feedback-entry:not(.fv-guide-entry){display:none}} -@container fv-autopilot-actions (width<431px){:lang(en) .fv-header[data-hx-now] .fv-guide-entry{display:none}} +@container fv-autopilot-actions (width<601px){:not(:lang(zh)) .fv-header[data-hx-now] .fv-lan{display:none}} +@container fv-autopilot-actions (width<537px){:not(:lang(zh)) .fv-autopilot-now-go>i{display:none}} +@container fv-autopilot-actions (width<516px){:not(:lang(zh)) .fv-header[data-hx-now] .fv-feedback-entry:not(.fv-guide-entry){display:none}} +@container fv-autopilot-actions (width<431px){:not(:lang(zh)) .fv-header[data-hx-now] .fv-guide-entry{display:none}} @container fv-autopilot-actions (max-width:260px){.fv-header[data-hx-now] .fv-feedback-entry:not(.fv-guide-entry){display:none}} /* Then the version entry, so the running job keeps its percentage and Stop beside the dot and Settings. */ @container fv-autopilot-actions (width<203px){:lang(zh) .fv-header[data-hx-now] .fv-version-info{display:none}} -@container fv-autopilot-actions (width<256px){:lang(en) .fv-header[data-hx-now] .fv-version-info{display:none}} +@container fv-autopilot-actions (width<256px){:not(:lang(zh)) .fv-header[data-hx-now] .fv-version-info{display:none}} /* Without a job nothing but the entries share the column; they yield in the same order, by the width they need. */ -@container fv-autopilot-actions (width<480px){.fv-header:not([data-hx-now]) .fv-autopilot-lamp:lang(en){width:30px;height:30px;padding:0;justify-content:center}.fv-header:not([data-hx-now]) .fv-autopilot-lamp:lang(en)>span{display:none}} -@container fv-autopilot-actions (width<398px){.fv-header:not([data-hx-now]) .fv-lan:lang(en){display:none}} -@container fv-autopilot-actions (width<334px){.fv-header:not([data-hx-now]) .fv-feedback-entry:not(.fv-guide-entry):lang(en){display:none}} -@container fv-autopilot-actions (width<249px){.fv-header:not([data-hx-now]) .fv-guide-entry:lang(en){display:none}} -@container fv-autopilot-actions (width<176px){.fv-header:not([data-hx-now]) .fv-version-info:lang(en){display:none}} +@container fv-autopilot-actions (width<480px){.fv-header:not([data-hx-now]) .fv-autopilot-lamp:not(:lang(zh)){width:30px;height:30px;padding:0;justify-content:center}.fv-header:not([data-hx-now]) .fv-autopilot-lamp:not(:lang(zh))>span{display:none}} +@container fv-autopilot-actions (width<398px){.fv-header:not([data-hx-now]) .fv-lan:not(:lang(zh)){display:none}} +@container fv-autopilot-actions (width<334px){.fv-header:not([data-hx-now]) .fv-feedback-entry:not(.fv-guide-entry):not(:lang(zh)){display:none}} +@container fv-autopilot-actions (width<249px){.fv-header:not([data-hx-now]) .fv-guide-entry:not(:lang(zh)){display:none}} +@container fv-autopilot-actions (width<176px){.fv-header:not([data-hx-now]) .fv-version-info:not(:lang(zh)){display:none}} @container fv-autopilot-actions (width<335px){.fv-header:not([data-hx-now]) .fv-autopilot-lamp:lang(zh){width:30px;height:30px;padding:0;justify-content:center}.fv-header:not([data-hx-now]) .fv-autopilot-lamp:lang(zh)>span{display:none}} @container fv-autopilot-actions (width<281px){.fv-header:not([data-hx-now]) .fv-lan:lang(zh){display:none}} @container fv-autopilot-actions (width<231px){.fv-header:not([data-hx-now]) .fv-feedback-entry:not(.fv-guide-entry):lang(zh){display:none}} diff --git a/web/agent_connect.js b/web/agent_connect.js index 1f40489b..6c6e42b0 100644 --- a/web/agent_connect.js +++ b/web/agent_connect.js @@ -1,4 +1,5 @@ import {issueButton} from './issue_button.js'; +import {LANGUAGE} from './i18n.js'; import {tip} from './autopilot_tips.js'; // 0.6.11 only (remove in 0.6.12): the note on updated steps stays away once this card's Copy was used on this computer. const NOTE_SEEN = 'freevideo.agentConnectNote.0611'; @@ -15,7 +16,7 @@ export function connectionLabel(agent, t) { export function connectionSentence(address, t) { const url = address + '/freevideo/agent'; - return t(`Connect to FreeVideo: open ${url} and follow the instructions.`, `请连接 FreeVideo:打开 ${url} 并按说明操作。`); + return t('Connect to FreeVideo: open {url} and follow the instructions.', '请连接 FreeVideo:打开 {url} 并按说明操作。', { url }); } // Whether this FreeVideo has the Agent interface on: 'on', 'off' or 'unknown'. Only an explicit `enabled: false` @@ -56,7 +57,7 @@ export function localhostAddress(location = globalThis.location) { export function refusalHint(code, t, kind = addressKind(globalThis.location?.hostname), address = localhostAddress()) { if (code === 'origin_forbidden') return t('Open FreeVideo on this computer with a localhost address, then retry.', '请在本机使用 localhost 地址打开 FreeVideo,然后重试。'); if (code === 'local_only') return kind && kind !== 'localhost' && address - ? t(`On the computer that runs FreeVideo, open ${address}, then retry.`, `请在运行 FreeVideo 的电脑上打开 ${address},然后重试。`) + ? t('On the computer that runs FreeVideo, open {address}, then retry.', '请在运行 FreeVideo 的电脑上打开 {address},然后重试。', { address }) : t('An assistant can only be connected on the computer that runs FreeVideo.', '只能在运行 FreeVideo 的电脑上连接助手。'); if (code === 'not_ready') return t('The assistant connection service is not ready. Restart FreeVideo, then retry.', '助手连接服务尚未就绪,请重启 FreeVideo 后重试。'); return ''; @@ -87,9 +88,9 @@ export function linkReason(agent, t) { next: t('Choose Reconnect and paste the steps to it again. If it is still refused, restart the assistant.', '请点“重新连接”,把连接说明再粘贴给它一次;仍被拒绝时,请重启助手。')}; if (agent?.reason === 'quiet') { const minutes = Math.max(10, Math.round((Number(agent.quiet_s) || 0) / 60)), hours = Math.round(minutes / 60); - const span = minutes >= 120 ? t(`${hours} hours`, `${hours} 小时`) : t(`${minutes} minutes`, `${minutes} 分钟`); + const span = minutes >= 120 ? t('{hours} hours', '{hours} 小时', { hours }) : t('{minutes} minutes', '{minutes} 分钟', { minutes }); return {reason: 'quiet', report: false, - text: t(`The assistant has not contacted FreeVideo for ${span}; it may have finished or been closed.`, `助手已有 ${span}没有联系 FreeVideo,可能已经结束或被关闭。`), + text: t('The assistant has not contacted FreeVideo for {span}; it may have finished or been closed.', '助手已有 {span}没有联系 FreeVideo,可能已经结束或被关闭。', { span }), next: reconnect}; } if (agent?.reason === 'never') return {reason: 'never', report: false, @@ -149,7 +150,7 @@ export function agentLinkMenu(t, host, anchor, {disconnect: send, steps = () => const value = await response.json().catch(() => null); if (!response.ok) { const code = String(value?.error?.code || '').slice(0, 40) || null; - failure = {code, text: refusalHint(code, t) || t(`Could not disconnect (HTTP ${response.status}). Retry, or report it.`, `断开失败(HTTP ${response.status})。请重试,或提交问题。`)}; + failure = {code, text: refusalHint(code, t) || t('Could not disconnect (HTTP {status}). Retry, or report it.', '断开失败(HTTP {status})。请重试,或提交问题。', { status: response.status })}; return; } close(); changed(value?.agent || null); @@ -281,8 +282,10 @@ export function agentConnectCard(t, api, shown = () => true, changed = () => {}) // What the lookup lacked if it fails without a refusal: the request itself fails first, then the reply is read. let lacked = 'unreachable'; try { - // The sentence carries no parameter: the server gives the agent the language this card showed. - const response = await api.fetchApi('/freevideo/agent/connect?lang=' + t('en', 'zh'), {cache: 'no-store', signal: request.signal}); + // The sentence carries no parameter: the server gives the agent the language this card showed. The guide is + // written in Chinese and English only (an agent reads English); the page's language picks, not a language file. + const response = await api.fetchApi('/freevideo/agent/connect?lang=' + (LANGUAGE.startsWith('zh') ? 'zh' : 'en'), + {cache: 'no-store', signal: request.signal}); const connect = await response.json().catch(() => null); if (current !== generation) return; if (!response.ok || !connect?.address) { diff --git a/web/audio_original.js b/web/audio_original.js index de8c89b4..2011a4a1 100644 --- a/web/audio_original.js +++ b/web/audio_original.js @@ -74,7 +74,7 @@ export function liftBlock(t) { return originalBlocked() ? {ok: false, text: stuckText(t)} : {ok: true, note: notes.join(' ')}; } -export const partsNeedTwoPassText = t => t('Audio longer than 30 seconds used as is is made in parts, which needs "Two-pass acceleration". Turn it on or set the audio to "Reference".', +export const partsNeedTwoPassText = t => t('Audio longer than 30 seconds used as is is made in parts, which needs "Faster second pass". Turn it on or set the audio to "Reference".', '超过 30 秒的音频选“原样使用”时会分段生成,需要“二采加速”。请打开“二采加速”,或把音频改选“参考”。'); export const multipleText = t => t('Choose "Use as is" for only one audio file.', '一次只能有一段音频选择“原样使用”。'); diff --git a/web/autopilot.js b/web/autopilot.js index 9540b136..95fcfaab 100644 --- a/web/autopilot.js +++ b/web/autopilot.js @@ -16,6 +16,7 @@ import { keepViewSwitchPlace } from './view_switch_place.js'; import { tip } from './autopilot_tips.js'; import { agentPost } from './agent_session.js'; import { isChinese, translator } from './i18n.js'; +import { pageLang } from './i18n_tables.js'; const cn = isChinese(); const t = translator(cn); @@ -30,7 +31,7 @@ export function openAutopilotView(node, {studio = null, initialPrompt = '', init studio?.querySelectorAll('video,audio').forEach(media => media.pause()); if (kept && kept.node === node && !initialScene) return kept.reopen(studio, initialPrompt); kept?.dispose(); kept = null; - const dialog = el('dialog', 'fv-studio fv-autopilot'); dialog.lang = cn ? 'zh' : 'en'; dialog.setAttribute('aria-label', t('Autopilot', 'AI 全自动')); + const dialog = el('dialog', 'fv-studio fv-autopilot'); dialog.lang = pageLang(); dialog.setAttribute('aria-label', t('Autopilot', 'AI 全自动')); // The shell's switch waits for the first screen: not ready until the card or the conversation is in place. dialog.dataset.fvReady = 'false'; const header = el('header', 'fv-header'), brand = el('div', 'fv-brand'), tools = el('div', 'fv-header-actions'); @@ -115,7 +116,7 @@ export function openAutopilotView(node, {studio = null, initialPrompt = '', init halt.title = last.stopping ? t('Stopping…', '正在停止…') : t('Stop all', '全部停止'); halt.setAttribute('aria-label', halt.title); if (job) { const fraction = last.fraction || 0, running = job.status === 'running'; - currentId = job.id; name.textContent = jobName(job, t); more.textContent = last.active > 1 ? t(`${last.active - 1} more`, `另有 ${last.active - 1} 项`) : ''; + currentId = job.id; name.textContent = jobName(job, t); more.textContent = last.active > 1 ? t('{count} more', '另有 {count} 项', { count: last.active - 1 }) : ''; percent.textContent = running && fraction >= .01 ? `${Math.floor(fraction * 100)}%` : ''; eta.textContent = running && last.left != null ? about(last.left, t) : ''; ring.style.setProperty('--p', String(fraction * 100)); line.style.width = `${fraction * 100}%`; diff --git a/web/autopilot_chat.js b/web/autopilot_chat.js index 1c992f78..16bbb782 100644 --- a/web/autopilot_chat.js +++ b/web/autopilot_chat.js @@ -4,6 +4,7 @@ import { cutTip } from './cut_tip.js'; import { setTip } from './tip_words.js'; import {agentGet, agentPost, retryAgentPost} from './agent_session.js'; import {emptyFrameIcon} from './empty_frame.js'; +import {engineReason} from './other_usage.js'; import {ATTACH, attachmentURL, pickPictures, pictureGone, picturesOf, releasePicture, releasePictures, thumbnail, uploadPicture} from './chat_attachments.js'; import {SCENE_TEXT, pickScene, sceneList, startScene, watchScene} from './whitebox_scenes.js'; import {chatData, chatDelay, chatReadRequest, emptyChat, chatMerge, chatEntries, canSend, newId, SEND_ATTEMPTS, WAIT_FOR_AGENT, sendRefused, sendError, messageTooLong} from './chat_data.js'; @@ -48,15 +49,16 @@ let chatNumber = 0; // What the agent is doing before it answers, by the key it reports. Words the page does not know are not shown. export const STAGE_TEXT = Object.freeze({ reading: ['Reading the request', '正在理解要求'], scripting: ['Writing the script', '正在写剧本'], - storyboarding: ['Planning the shots', '正在拆分镜头'], prompting: ['Writing the shot prompts', '正在写画面描述'], + storyboarding: ['Planning the shots', '正在拆分镜头'], prompting: ['Writing the shot prompts', '正在写提示词'], checking: ['Checking the results', '正在检查结果'], assembling: ['Joining the shots', '正在拼接镜头'], }); const WORKING = ['running', 'queued', 'waiting', 'cancelling'], VIDEOS = ['generate', 'assemble']; // Beside the dots while the agent names no stage: the sentence is still on its way, or the agent has it and the seconds count. export function waitingText(s, t) { const m = Math.floor(s / 60), r = s % 60; - return s < 60 ? t(`Waiting for a reply · ${s} s`, `正在等待回复 · ${s} 秒`) - : t(`Waiting for a reply · ${m} min${r ? ` ${r} s` : ''}`, `正在等待回复 · ${m} 分${r ? ` ${r} 秒` : ''}`); + return s < 60 ? t('Waiting for a reply · {s} s', '正在等待回复 · {s} 秒', { s }) + : r ? t('Waiting for a reply · {minutes} min {seconds} s', '正在等待回复 · {minutes} 分 {seconds} 秒', { minutes: m, seconds: r }) + : t('Waiting for a reply · {minutes} min', '正在等待回复 · {minutes} 分', { minutes: m }); } // What a job with no picture of its own is doing, in the reader's language. const QUIET = {vlm: ['Checking', '检查中'], enhance: ['Enhancing prompt', '增强提示词']}; @@ -65,7 +67,7 @@ const BUSY = {music: ['Making music', '制作配乐']}; // A failed card's one action: go on keeping the finished parts, run the same request again, or say the words again. const AGAIN = {continue: ['Continue generating', '继续生成'], retry: ['Retry', '重试'], resend: ['Send again', '再发一次']}; const WHITEBOX = { - generate: ['Generate video', '生成视频'], edit: ['Edit prompt', '改描述'], decline: ['Skip', '跳过'], + generate: ['Generate video', '生成视频'], edit: ['Edit prompt', '修改提示词'], decline: ['Skip', '跳过'], approved: ['Approved', '已确认'], superseded: ['Replaced', '已被替换'], declined: ['Skipped', '已跳过'], preview: ['Whitebox preview', '白模预览'], unavailable: ['Preview could not load', '预览加载失败'], play: ['Play', '播放'], pause: ['Pause', '暂停'], seconds: ['s', '秒'], @@ -74,8 +76,6 @@ const WHITEBOX = { const GENERIC_FAILURE_ZH = '没有完成'; // The failures whose next step is the problem report (agent/errors.py FAILURE_NEXT_*). const UNEXPECTED_FAILURES = ['internal_error', 'generation_failed']; -// The engine's next step for a reason, as the sentence after it. -const withNext = (reason, next, zh) => next ? reason.replace(/[。.]$/, '') + (zh ? '。' : '. ') + next : reason; // Sends and failure cards use the same public reason, including the engine's Chinese mapping. function failureReason(value, t) { const error = value.error, reason = error?.error_zh || value.error_zh, reasonEn = error?.error_en || value.error_en; @@ -85,8 +85,9 @@ function failureReason(value, t) { const own = error?.error_zh ? error : value; // `message` is written for programs; people read the engine's own English reason. A refusal the engine // did not classify keeps its sentence, as before. - return t(withNext(reasonEn || error?.message || 'Did not finish', reasonEn && own.next_en), - withNext(reason || GENERIC_FAILURE_ZH, reason && own.next_zh, true)); + return engineReason({error_en: reasonEn || error?.message || 'Did not finish', error_zh: reason || GENERIC_FAILURE_ZH, + reason_en: own.reason_en, reason_zh: own.reason_zh, other_usage: own.other_usage ?? error?.other_usage, + next_en: reasonEn && own.next_en, next_zh: reason && own.next_zh}, t); } // A failed job's one reason line. The engine's classified sentence (both languages) is for people; anything else is @@ -106,7 +107,7 @@ export function failureCardReason(value, t) { export {about}; export function clock(seconds) { const s = Math.max(0, Math.round(seconds)); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`; } -export const jobName = (job, t) => job.label || (job.kind === 'image' ? t('Picture', '图片') : t('Video', '视频')); +export const jobName = (job, t) => job.label || (job.kind === 'image' ? t('Image', '图片') : t('Video', '视频')); export {promptOf}; export const jobFraction = job => Math.max(0, Math.min(1, Number(job.progress?.fraction) || 0)); // What a job's last progress stands for `age` seconds after it was made, by the creation panel's rule. @@ -194,7 +195,7 @@ const TAB_PREFIX = {ask: ['Needs your OK · ', '要确认 · '], failed: ['Faile export function jobMeta(job, t) { const parts = []; if (job.width > 0 && job.height > 0) parts.push(`${job.width} × ${job.height}`); - if (job.seconds > 0) parts.push(t(`${job.seconds} s`, `${job.seconds} 秒`)); + if (job.seconds > 0) parts.push(t('{seconds} s', '{seconds} 秒', { seconds: job.seconds })); return parts.join(' · '); } // One number per part of a long video: 1 when made, how far along for the one being made, 0 for the rest. @@ -394,7 +395,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () const attachButton = press('fv-chat-attach', null, () => fileInput.click()), fileInput = el('input'), strip = el('ul', 'fv-chat-attached'); attachButton.append(glyph(ATTACH.icon)); attachButton.title = t(...ATTACH.add); attachButton.setAttribute('aria-label', attachButton.title); fileInput.type = 'file'; fileInput.accept = ATTACH.types.join(','); fileInput.multiple = true; fileInput.hidden = true; - strip.hidden = true; strip.setAttribute('aria-label', t('Attached pictures', '已添加的图片')); + strip.hidden = true; strip.setAttribute('aria-label', t('Attached images', '已添加的图片')); const staged = new Map(), uploads = new Set(); const stagedList = (session = draftSession) => { if (!staged.has(session)) staged.set(session, []); return staged.get(session); }; const readyPictures = () => stagedList().filter(item => item.attachment).map(item => ({...item.attachment, preview: item.url})); @@ -714,7 +715,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () if (conversations.current === session && neighbor) chooseChat(neighbor); else renderConversations(); (listNodes.get(neighbor)?.button || newChat).focus({preventScroll: true}); receiptFor = session; - receipt(t(`Deleted “${row?.title || 'chat'}”`, `已删除“${row?.title || '对话'}”`), t('Undo', '撤销'), 'undoDelete', () => { + receipt(t('Deleted “{title}”', '已删除“{title}”', { title: row?.title || t('chat', '对话') }), t('Undo', '撤销'), 'undoDelete', () => { clearTimeout(undoing.get(session)); undoing.delete(session); receiptFor = null; say(''); renderConversations(); listNodes.get(session)?.button.focus({preventScroll: true}); }); @@ -816,7 +817,8 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () menuState = conversationMenu(conversations, menuState); // After the final deletion, keep New chat reachable as the keyboard destination. const unreadable = conversations.unreadable; - skippedConversations.textContent = unreadable > 0 ? t(`${unreadable} ${unreadable === 1 ? 'conversation' : 'conversations'} could not be read`, `另有 ${unreadable} 个对话无法读取`) : ''; + skippedConversations.textContent = !(unreadable > 0) ? '' : unreadable === 1 ? t('1 conversation could not be read', '另有 1 个对话无法读取') + : t('{count} conversations could not be read', '另有 {count} 个对话无法读取', { count: unreadable }); skippedConversations.hidden = !unreadable; const visible = hasConversations(conversations) || conversations.supported === true && (deleted.size > 0 || unreadable > 0); element.dataset.conversations = String(visible); sidebar.hidden = tools.hidden = !visible; railEmpty.hidden = visible; @@ -878,7 +880,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () const group = row.running > 0 ? 'running' : dayGroup(row.updated_at); node.row.dataset.group = group; node.row.dataset.groupLabel = t(...GROUP_WORDS[group]); - node.more.setAttribute('aria-label', t(`More: ${row.title}`, `更多:${row.title}`)); + node.more.setAttribute('aria-label', t('More: {title}', '更多:{title}', { title: row.title })); node.more.hidden = !canDeleteConversation(row) && !canRenameConversation(row) || naming?.session === row.id; if (row.id === conversations.current) node.button.setAttribute('aria-current', 'true'); else node.button.removeAttribute('aria-current'); if (list.children[index] !== node.row) list.insertBefore(node.row, list.children[index] || null); @@ -1304,7 +1306,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () const where = cardLine(said, next, t); quiet = stalled(next); const waiting = t('Progress has not updated recently; generation is still running.', '进度暂未更新,仍在生成中。'); - put(part, cells.length ? t(`Part ${block.index} / ${block.total}`, `第 ${block.index} / ${block.total} 段`) : quiet ? waiting : where); + put(part, cells.length ? t('Part {index} / {total}', '第 {index} / {total} 段', { index: block.index, total: block.total }) : quiet ? waiting : where); put(step, cells.length ? quiet ? waiting : where : ''); const going = stopping.has(next.id) || next.status === 'cancelling'; stop.disabled = going; stop.textContent = going ? t('Stopping…', '正在停止…') : t('Stop', '停止'); @@ -1631,7 +1633,7 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () if (folded) { const rest = beats.length - BEATS_SHOWN + 1; const more = el('li', 'fv-chat-beats-more'); - more.append(tip(press('fv-chat-link', t(`${rest} more`, `另外 ${rest} 拍`), () => { allBeats = true; shownState = null; render(); }), 'more8', t)); + more.append(tip(press('fv-chat-link', t('{rest} more', '另外 {rest} 拍', { rest }), () => { allBeats = true; shownState = null; render(); }), 'more8', t)); outline.append(more); } outline.hidden = !beats.length; @@ -1804,15 +1806,15 @@ export function agentChat(t, api, {open, edit, shown = () => true, changed = () const running = of('running')[0], queued = of('queued').length, failed = of('failed').length, done = of('done').length; chatSummary = !state.session || !tasks.length ? null : running ? {text: running.title + ((running.fraction?.() ?? 0) >= .01 ? ` · ${Math.floor(running.fraction() * 100)}%` : ''), state: 'running'} - : queued ? {text: t(`${queued} queued`, `${queued} 项排队中`), state: 'queued'} - : failed ? {text: t(`${failed} did not finish`, `${failed} 项没有完成`), state: 'failed'} - : {text: t(`${done} done`, `${done} 项已完成`), state: 'done'}; + : queued ? {text: t('{queued} queued', '{queued} 项排队中', { queued }), state: 'queued'} + : failed ? {text: t('{failed} did not finish', '{failed} 项没有完成', { failed }), state: 'failed'} + : {text: t('{done} done', '{done} 项已完成', { done }), state: 'done'}; shotWords = tasks.flatMap(row => [row.title, row.prompt].filter(Boolean)); const node = listNodes.get(state.session); if (node && !searchBox.value.trim()) { put(node.where, chatSummary?.text || ''); node.where.dataset.state = chatSummary?.state || ''; node.where.hidden = !chatSummary; } const row = conversations.conversations.find(item => item.id === state.session); put(headTitle, row?.title || (state.session && entries().length ? t('New chat', '新对话') : '')); - put(headSub, [tasks.length ? t(`${tasks.length} tasks`, `${tasks.length} 个任务`) : '', chatSummary && chatSummary.state !== 'done' ? chatSummary.text : '', row ? localTime(row.updated_at, t) : ''].filter(Boolean).join(' · ')); + put(headSub, [tasks.length ? t('{count} tasks', '{count} 个任务', { count: tasks.length }) : '', chatSummary && chatSummary.state !== 'done' ? chatSummary.text : '', row ? localTime(row.updated_at, t) : ''].filter(Boolean).join(' · ')); head.dataset.empty = String(!headTitle.textContent); } const entries = () => chatEntries(state); diff --git a/web/autopilot_panels.js b/web/autopilot_panels.js index c9b27d34..3d9248e9 100644 --- a/web/autopilot_panels.js +++ b/web/autopilot_panels.js @@ -1,6 +1,7 @@ // The Autopilot view's side panels. The conversation stays in the middle column; the right panel lists every task // of the chat being read (what is being made first, then the finished ones, newest first), each with its prompt, // time and state, searchable, and below it the details of the one picked. Pure helpers are exported for tests. +import { LANGUAGE } from './i18n.js'; import { setTip } from './tip_words.js'; import {tip} from './autopilot_tips.js'; @@ -47,25 +48,29 @@ export function statusText(job, t, fraction = null) { // A time of day for today, with the day before it otherwise; nothing when the time is not known. `short` drops the // hour from earlier days (a list where the date is enough). -export function localTime(value, t, now = new Date(), {short = false} = {}) { +export function localTime(value, t, now = new Date(), {short = false, language = LANGUAGE} = {}) { const at = value instanceof Date ? value : typeof value === 'number' ? new Date(value * (value < 1e12 ? 1000 : 1)) : value ? new Date(value) : null; if (!at || Number.isNaN(at.getTime())) return ''; const hm = `${String(at.getHours()).padStart(2, '0')}:${String(at.getMinutes()).padStart(2, '0')}`; const day = d => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime(); const days = Math.round((day(now) - day(at)) / 86400000); if (days === 0) return hm; - if (days === 1) return short ? t('Yesterday', '昨天') : t(`Yesterday ${hm}`, `昨天 ${hm}`); - const month = t(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][at.getMonth()], `${at.getMonth() + 1}月`); - if (short) return at.getFullYear() === now.getFullYear() ? t(`${month} ${at.getDate()}`, `${month}${at.getDate()}日`) : t(`${month} ${at.getFullYear()}`, `${at.getFullYear()}年${month}`); - return at.getFullYear() === now.getFullYear() ? t(`${month} ${at.getDate()}, ${hm}`, `${month}${at.getDate()}日 ${hm}`) - : t(`${month} ${at.getDate()} ${at.getFullYear()}, ${hm}`, `${at.getFullYear()}年${month}${at.getDate()}日 ${hm}`); + if (days === 1) return short ? t('Yesterday', '昨天') : t('Yesterday {hm}', '昨天 {hm}', { hm }); + const thisYear = at.getFullYear() === now.getFullYear(), year = at.getFullYear(), date = at.getDate(); + // A language file's page: the date as that language writes it. + if (language !== 'en' && language !== 'zh-Hans') return new Intl.DateTimeFormat(language, {...(thisYear ? {} : {year: 'numeric'}), month: 'short', + ...(short && !thisYear ? {} : {day: 'numeric'}), ...(short ? {} : {hour: '2-digit', minute: '2-digit', hourCycle: 'h23'})}).format(at); + const en = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][at.getMonth()], zh = `${at.getMonth() + 1}月`; + const written = short ? (thisYear ? [`${en} ${date}`, `${zh}${date}日`] : [`${en} ${year}`, `${year}年${zh}`]) + : thisYear ? [`${en} ${date}, ${hm}`, `${zh}${date}日 ${hm}`] : [`${en} ${date} ${year}, ${hm}`, `${year}年${zh}${date}日 ${hm}`]; + return t(...written); } // How long a finished task took, from its two times; '' when either is missing. export function tookText(from, to, t) { const a = new Date(from).getTime(), b = new Date(to).getTime(); if (!Number.isFinite(a) || !Number.isFinite(b) || b < a) return ''; const s = Math.round((b - a) / 1000), m = Math.floor(s / 60); - return s < 60 ? t(`${s} s`, `${s} 秒`) : t(`${m} min ${s % 60} s`, `${m} 分 ${s % 60} 秒`); + return s < 60 ? t('{s} s', '{s} 秒', { s }) : t('{m} min {seconds} s', '{m} 分 {seconds} 秒', { m, seconds: s % 60 }); } // A task's time line: when it started, how long it has run and about how long is left; how long a finished one took. @@ -73,15 +78,15 @@ const mmss = seconds => { const v = Math.max(0, Math.round(seconds)); return `${ export function taskTimes(job, t, {left = null, now = Date.now()} = {}) { const key = statusKey(job), start = localTime(job.created_at, t, new Date(now)), began = new Date(job.created_at).getTime(); if (key === 'running' || key === 'stopping') { - const parts = [start && t(`started ${start}`, `${start} 开始`)]; - if (Number.isFinite(began) && now > began) parts.push(t(`${mmss((now - began) / 1000)} so far`, `已用 ${mmss((now - began) / 1000)}`)); - if (left > 0) parts.push(left >= 60 ? t(`about ${Math.ceil(left / 60)} min left`, `约 ${Math.ceil(left / 60)} 分钟`) : t('under 1 min left', '不到 1 分钟')); + const parts = [start && t('started {start}', '{start} 开始', { start })]; + if (Number.isFinite(began) && now > began) parts.push(t('{time} so far', '已用 {time}', { time: mmss((now - began) / 1000) })); + if (left > 0) parts.push(left >= 60 ? t('about {minutes} min left', '约 {minutes} 分钟', { minutes: Math.ceil(left / 60) }) : t('under 1 min left', '不到 1 分钟')); return parts.filter(Boolean).join(' · '); } - if (key === 'queued') return start ? t(`added ${start}`, `${start} 加入`) : ''; + if (key === 'queued') return start ? t('added {start}', '{start} 加入', { start }) : ''; if (key === 'done') { const took = Number.isFinite(began) ? (new Date(job.finished_at).getTime() - began) / 1000 : NaN; - return [start && t(`started ${start}`, `${start} 开始`), Number.isFinite(took) && took >= 0 ? t(`took ${mmss(took)}`, `用时 ${mmss(took)}`) : ''].filter(Boolean).join(' · '); + return [start && t('started {start}', '{start} 开始', { start }), Number.isFinite(took) && took >= 0 ? t('took {time}', '用时 {time}', { time: mmss(took) }) : ''].filter(Boolean).join(' · '); } return localTime(job.finished_at || job.created_at, t, new Date(now)); } @@ -205,9 +210,9 @@ export function createSideRail(t, handlers = {}) { }); const active = rows.filter(row => ['running', 'queued', 'stopping'].includes(statusKey(row.job))).length; put(count, rows.length ? String(rows.length) : ''); count.hidden = !rows.length; - count.setAttribute('aria-label', t(`${rows.length} tasks, ${active} under way`, `${rows.length} 个任务,${active} 个进行中`)); + count.setAttribute('aria-label', t('{count} tasks, {active} under way', '{count} 个任务,{active} 个进行中', { count: rows.length, active })); put(emptyTitle, rows.length ? (shown.length ? '' : t('No task matches', '没有匹配的任务')) : t('No tasks yet', '还没有任务')); - put(emptyText, rows.length ? (shown.length ? '' : t('Try other words or another filter.', '换个词或换个筛选试试。')) : t('Each video and picture the assistant makes is listed here, with its prompt, time and state.', '助手生成的每段视频和每张图片都会列在这里,带描述、时间和状态。')); + put(emptyText, rows.length ? (shown.length ? '' : t('Try other words or another filter.', '换个词或换个筛选试试。')) : t('Each video and image the assistant makes is listed here, with its prompt, time and state.', '助手生成的每段视频和每张图片都会列在这里,带提示词、时间和状态。')); emptyMark.hidden = !!rows.length; empty.hidden = !emptyTitle.textContent; searchRow.hidden = rows.length < 2 && !query; filters.hidden = !rows.length; drawDetail(); edges(list); edges(detail); @@ -249,9 +254,9 @@ export function createSideRail(t, handlers = {}) { put(dPrompt, row.prompt || ''); dPrompt.hidden = !row.prompt; dPrompt.dataset.source = row.promptSource || 'request'; setTip(dPrompt, {name: row.promptSource === 'job' ? t('Prompt', '提示词') : t('What you asked for', '你提出的要求')}); - dFacts.replaceChildren(...fact(t('Kind', '类型'), job.kind === 'image' ? t('Picture', '图片') : job.kind === 'production' ? t('Film', '成片') : t('Video', '视频')), + dFacts.replaceChildren(...fact(t('Kind', '类型'), job.kind === 'image' ? t('Image', '图片') : job.kind === 'production' ? t('Film', '成片') : t('Video', '视频')), ...fact(t('Size', '尺寸'), job.width > 0 && job.height > 0 ? `${job.width} × ${job.height}` : ''), - ...fact(t('Length', '时长'), job.seconds > 0 ? t(`${job.seconds} s`, `${job.seconds} 秒`) : ''), + ...fact(t('Length', '时长'), job.seconds > 0 ? t('{seconds} s', '{seconds} 秒', { seconds: job.seconds }) : ''), ...fact(t('Started', '开始'), localTime(job.created_at, t)), ...fact(t('Took', '用时'), key === 'done' ? tookText(job.created_at, job.finished_at, t) : '')); dFacts.hidden = !dFacts.childElementCount; diff --git a/web/autopilot_tips.js b/web/autopilot_tips.js index 6e00f250..ffa9c26f 100644 --- a/web/autopilot_tips.js +++ b/web/autopilot_tips.js @@ -23,10 +23,10 @@ export const TIPS = Object.freeze({ task: {name: ['Task', '任务'], use: ['Show its details and find it in the chat', '查看详情并在对话里定位']}, locate: {name: ['Show in chat', '在对话中定位'], use: ['Scroll the chat to this card', '把对话滚到这张卡片']}, stop: {name: ['Stop', '停止'], use: ['Stop making this; nothing is kept', '停止生成这一条,不保留结果']}, - open: {name: ['Open', '打开'], use: ['Open it in your works', '在作品库里打开']}, - openPicture: {name: ['Open', '打开'], use: ['View the picture full size', '查看大图']}, + open: {name: ['Open', '打开'], use: ['Open it in your creations', '在作品库里打开']}, + openPicture: {name: ['Open', '打开'], use: ['View the image full size', '查看大图']}, edit: {name: ['Edit', '剪辑'], use: ['Open it in Edit to cut and add sound', '在剪辑视图里继续剪辑和配音']}, - download: {name: ['Download', '下载'], use: ['Save the picture to this computer', '把图片保存到本机']}, + download: {name: ['Download', '下载'], use: ['Save the image to this computer', '把图片保存到本机']}, why: {name: ['See why', '查看原因'], use: ['What went wrong and what to do', '出了什么问题、可以怎么做']}, retry: {name: ['Retry', '重试'], use: ['Try again with the same request', '用同样的要求再试一次']}, continue: {name: ['Continue generating', '继续生成'], use: ['Go on from the finished parts', '从已完成的部分接着生成']}, @@ -34,7 +34,7 @@ export const TIPS = Object.freeze({ report: {name: ['Download report', '下载报告'], use: ['Save the diagnostic report to send us', '保存诊断报告,方便发给我们']}, send: {name: ['Send', '发送'], use: ['Send this to the assistant', '把这句话发给助手'], key: 'Enter'}, halt: {name: ['Stop', '停止'], use: ['Stop the reply that is being written', '停止助手正在写的回复']}, - attach: {name: ['Add pictures', '添加图片'], use: ['Give the assistant reference pictures', '给助手参考图片']}, + attach: {name: ['Add images', '添加图片'], use: ['Give the assistant reference images', '给助手参考图片']}, whitebox: {name: ['White model', '白模'], use: ['Preview the motion as a white model first', '先用白模预览动作']}, scenes: {name: ['Ready scenes', '现成场景'], use: ['Start from a ready-made scene', '从现成的场景开始']}, latest: {name: ['Latest', '最新'], use: ['Jump to the newest message', '跳到最新的消息']}, @@ -49,12 +49,12 @@ export const TIPS = Object.freeze({ removeNo: {name: ['Cancel', '取消'], use: ['Keep this chat', '保留这段对话']}, stopDelete: {name: ['Stop and delete', '停止并删除'], use: ['Stop its work, then delete the chat', '先停止生成,再删除对话']}, scene: {name: ['Ready scene', '现成场景'], use: ['Make a video from this scene', '用这个场景生成视频']}, - dropPicture: {name: ['Remove', '移除'], use: ['Take this picture out of the message', '从这条消息里拿掉这张图']}, - uploadAgain: {name: ['Upload again', '重新上传'], use: ['Try sending this picture again', '再上传一次这张图片']}, + dropPicture: {name: ['Remove', '移除'], use: ['Take this image out of the message', '从这条消息里拿掉这张图']}, + uploadAgain: {name: ['Upload again', '重新上传'], use: ['Try sending this image again', '再上传一次这张图片']}, seek: {name: ['Position', '播放位置'], use: ['Drag to move through the video', '拖动以跳到视频的任意位置']}, more8: {name: ['More beats', '更多节拍'], use: ['Show the rest of the outline', '展开剩下的分镜']}, whiteboxGo: {name: ['Generate video', '生成视频'], use: ['Make the video from this white model', '按这个白模生成视频']}, - whiteboxEdit: {name: ['Edit prompt', '改描述'], use: ['Put the description in the box to change', '把描述放进输入框修改']}, + whiteboxEdit: {name: ['Edit prompt', '修改提示词'], use: ['Put the prompt in the box to change', '把提示词放进输入框修改']}, whiteboxSkip: {name: ['Skip', '跳过'], use: ['Go on without this preview', '不用这个预览,继续']}, editCancel: {name: ['Cancel', '取消'], use: ['Keep the message as it was', '保留原来的消息']}, editSend: {name: ['Send', '发送'], use: ['Send the changed message', '发送修改后的消息'], key: 'Enter'}, @@ -76,8 +76,8 @@ export const TIPS = Object.freeze({ export const WHY = Object.freeze({ notConnected: ['Connect an assistant first', '先连接助手'], loading: ['This chat is still loading', '这段对话还在读取'], - empty: ['Write a sentence or add a picture first', '先写一句话或加一张图片'], - uploading: ['Wait for the pictures to finish uploading', '等图片上传完'], + empty: ['Write a sentence or add an image first', '先写一句话或加一张图片'], + uploading: ['Wait for the images to finish uploading', '等图片上传完'], sending: ['This message is being sent', '这条消息正在发送'], sceneOnly: ['A ready scene takes words only', '现成场景只接受文字'], creating: ['A new chat is being made', '正在新建对话'], diff --git a/web/capability_view.js b/web/capability_view.js index ad66b894..518be00c 100644 --- a/web/capability_view.js +++ b/web/capability_view.js @@ -34,11 +34,11 @@ export function curve(xs, ys) { } export function aboutTime(seconds, t) { - if (seconds < 55) { const n = Math.max(10, Math.round(seconds / 10) * 10); return t(`About ${n} s`, `约 ${n} 秒`); } + if (seconds < 55) { const n = Math.max(10, Math.round(seconds / 10) * 10); return t('About {n} s', '约 {n} 秒', { n }); } const minutes = Math.round(seconds / 60); - if (minutes < 100) return t(`About ${minutes} min`, `约 ${minutes} 分钟`); + if (minutes < 100) return t('About {minutes} min', '约 {minutes} 分钟', { minutes }); const hours = Math.round(seconds / 1800) / 2; - return t(`About ${hours} h`, `约 ${hours} 小时`); + return t('About {hours} h', '约 {hours} 小时', { hours }); } // Send material facts only. An incomplete reference list uses the server's @@ -189,6 +189,9 @@ export function surfacePixels(surface, width, height) { } let serial = 0; +// What the estimate adds while the first build is still owed. +export const setupNote = t => t(' · \u2060includes\u00a0first-time\u00a0setup', ' · \u2060含\u2060首\u2060次\u2060准\u2060备'); + export function createCapabilityView({node, api, t, getState, onPick, onEstimate, onGrid}) { if (!document.querySelector('link[data-fv-capability]')) { const css = el('link', ''); css.rel = 'stylesheet'; css.dataset.fvCapability = ''; @@ -222,7 +225,7 @@ export function createCapabilityView({node, api, t, getState, onPick, onEstimate hover = point; position(mark, x, y); time.textContent = aboutTime(point.estimate, t); const duration = point.seconds < 30 && point.seconds === surface.sizes[point.size].max - ? t(`up to ${point.seconds} s`, `单次最长 ${point.seconds} 秒`) : t(`${point.seconds} s`, `${point.seconds} 秒`); + ? t('up to {seconds} s', '单次最长 {seconds} 秒', { seconds: point.seconds }) : t('{seconds} s', '{seconds} 秒', { seconds: point.seconds }); configuration.textContent = `${point.width} × ${point.height} · ${duration}`; plot.classList.add('is-hover'); highlight(); @@ -256,7 +259,7 @@ export function createCapabilityView({node, api, t, getState, onPick, onEstimate now.hidden = !point || seconds > surface.top || seconds > surface.sizes[i].max; if (!now.hidden) position(now, surface.xs[i] * plot.clientWidth, (1 - seconds / surface.top) * plot.clientHeight); const max = i >= 0 ? Math.min(30, surface.sizes[i].max) : 0; - longest.textContent = !max ? '' : max < 30 ? t(`Up to ${max} s`, `单次最长 ${max} 秒`) : t('Single run: under 30 s', '单次不到 30 秒'); + longest.textContent = !max ? '' : max < 30 ? t('Up to {max} s', '单次最长 {max} 秒', { max }) : t('Single run: under 30 s', '单次不到 30 秒'); plot.setAttribute('aria-disabled', String(getState().disabled)); highlight(); } @@ -277,7 +280,7 @@ export function createCapabilityView({node, api, t, getState, onPick, onEstimate img.data.set(surfacePixels(surface, width, height)); ctx.putImageData(img, 0, 0); yAxis.replaceChildren(); xAxis.replaceChildren(); for (let s = 0; s <= surface.top; s += surface.top / 3) { - const label = el('span', '', t(`${s} s`, `${s} 秒`)); label.style.top = `${(1 - s / surface.top) * 100}%`; yAxis.append(label); + const label = el('span', '', t('{s} s', '{s} 秒', { s })); label.style.top = `${(1 - s / surface.top) * 100}%`; yAxis.append(label); } surface.sizes.forEach((size, i) => { const label = el('span', 'fv-range-size', `${size.pixels.toFixed(2)} MP`); @@ -409,7 +412,33 @@ export function createCapabilityView({node, api, t, getState, onPick, onEstimate const seconds = tier?.estimate_seconds?.[i]?.[j]; if (!positive(seconds)) return ''; // The suffix stays in one piece so a narrow line moves it whole to the next line. - return aboutTime(seconds, t) + (grid.machine?.compile_owed === true ? t(' · \u2060includes\u00a0first-time\u00a0setup', ' · \u2060含\u2060首\u2060次\u2060准\u2060备') : ''); + return aboutTime(seconds, t) + (grid.machine?.compile_owed === true ? setupNote(t) : ''); + }, fast() { + // The fastest mode at the chosen size and length (capabilities.fast_mode): whether it fits, its time, and where it + // does not, why (the limit past this size's longest length) and the planner's ways out. + const fast = grid?.fast_mode; + // Read from the grid alone: the chart's surface follows the steps of a plain level, which the Fast level has not. + if (!fast?.listed) return null; + const i = grid.sizes.findIndex(s => s.width === Number(value(node, 'width')) && s.height === Number(value(node, 'height'))); + if (i < 0) return null; + // A listed length is read from its cell; any other from the longest request that fits this size (the frames a + // one-run request of these seconds asks for, as the length control counts them). + const asked = Number(value(node, 'seconds')), j = grid.lengths.findIndex(l => l.seconds === asked); + const frames = Math.max(39, 5 + 17 * Math.ceil((24 * asked - 5) / 17)); + const admits = row => { + if (j >= 0 && typeof row?.plan?.[i]?.[j] === 'number') return row.plan[i][j] >= 0; + // No length at all at this size is null in the grid: it does not fit. + const most = row?.max_frames?.[i]; + return most === null ? false : Number.isInteger(most) ? most >= 0 && frames <= most : null; + }; + const fits = admits(fast); + if (fits === null || !positive(asked)) return null; + const seconds = j >= 0 ? fast.estimate_seconds?.[i]?.[j] : null; + return {fits, limit: fast.limit?.[i] ?? null, actions: Array.isArray(fast.actions?.[i]) ? fast.actions[i] : [], + shorten: positive(fast.shorten_seconds?.[i]) ? fast.shorten_seconds[i] : null, + lightFits: admits(grid.tiers?.light) === true, + estimate: fits && positive(seconds) ? aboutTime(seconds, t) + (grid.machine?.compile_owed === true + ? setupNote(t) : '') : ''}; }, warning(steps, twoPass, refine, stepCache = null, upscale = 2) { if (!grid || !surface) return ''; const tier = gridTier(grid, steps, twoPass, refine, stepCache, upscale); diff --git a/web/cast_generate.js b/web/cast_generate.js index c152b558..cb510c46 100644 --- a/web/cast_generate.js +++ b/web/cast_generate.js @@ -7,6 +7,7 @@ import {createImageGenClient, imageGenProgress, imagePackUnavailableMessage, ren IMAGE_GEN_POLL_MS, IMAGE_GEN_INFO_POLL_MS} from './image_generation.js'; import {createImageLoras} from './image_lora.js'; import {createOtherUsageNotice} from './other_usage.js'; +import { translatorFor } from './i18n.js'; export {imageGenerationSupported as castGenerateSupported} from './image_generation.js'; @@ -487,7 +488,7 @@ export function createCastGenerator({client, kind = 'character', views = null, f export function mountCastGenerate({container, api, text, t = text, viewURL, onState = () => {}, onPick = () => {}, fetchApi, client, loras, kind = 'character'}) { const scene = kind === 'setting' || kind === 'prop', names = scene ? SCENE_CANDIDATES : CAST_VIEWS; - const tr = t || ((en) => en); + const tr = t || translatorFor(null, false); const fetcher = fetchApi || (api ? api.fetchApi.bind(api) : globalThis.fetch.bind(globalThis)); client = client || createImageGenClient(fetcher); const url = viewURL || (file => { @@ -523,7 +524,7 @@ export function mountCastGenerate({container, api, text, t = text, viewURL, onSt const grid = el('div', 'fv-cg-views'); const cells = names.map((view, index) => { const cell = el('div', 'fv-cg-view'); - const title = scene ? tr(`Option ${index + 1}`, `方案 ${index + 1}`) : tr(...VIEW_TITLES[view]); + const title = scene ? tr('Option {number}', '方案 {number}', { number: index + 1 }) : tr(...VIEW_TITLES[view]); setTip(cell, {name: title}); cell.setAttribute('aria-label', title); cell.setAttribute('role', scene ? 'button' : 'img'); if (scene) { cell.tabIndex = 0; diff --git a/web/cast_library.js b/web/cast_library.js index a590a99b..9b5d88cf 100644 --- a/web/cast_library.js +++ b/web/cast_library.js @@ -63,7 +63,7 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = () const data = await response.json().catch(() => null); if (!response.ok) { // The dialog only sends pictures, so unreadable media here is always one of them. - const unreadable = data?.error?.code === 'invalid_media' && text('Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'); + const unreadable = data?.error?.code === 'invalid_media' && text('Could not read this image. Please choose another one.', '无法读取这张图片,请换一张。'); const error = new Error(unreadable || data?.error?.message || (typeof data?.error === 'string' && data.error) || data?.message || `HTTP ${response.status} ${response.statusText}`.trim()); error.status = response.status; @@ -83,7 +83,7 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = () avatars.replaceChildren(); // The count covers every kind (a file that cannot be read does not say what it was), so only the first row shows it. const shown = kind === 'character' ? unreadable : 0; - skipped.textContent = shown > 0 ? text(`${shown} ${shown === 1 ? 'item' : 'items'} could not be read`, `另有 ${shown} 项无法读取`) : ''; + skipped.textContent = !(shown > 0) ? '' : shown === 1 ? text('1 item could not be read', '另有 1 项无法读取') : text('{count} items could not be read', '另有 {count} 项无法读取', { count: shown }); skipped.hidden = !shown; for (const row of rows) { const avatar = button('fv-cast-avatar', '', () => openDialog(row.id)); @@ -168,10 +168,10 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = () tipOf(remove, remove.textContent, word(text('Delete this character from the library', '从角色库删除这个角色'), text('Delete this scene from the library', '从角色库删除这个场景'), text('Delete this prop from the library', '从角色库删除这个道具'))); tipOf(cancel, text('Cancel', '取消'), text('Close without saving', '不保存,关闭')); tipOf(save, text('Save', '保存'), text('Keep it in the library to reuse with @', '存进角色库,之后用 @ 引用')); - tipOf(uploadTab, text('Upload images', '上传图片'), views4 && !id ? text('Add your own views. Empty views are made from one picture in its style.', '放入各视角图片,空着的视角按原图风格生成。') - : text('Use pictures from this computer', '用电脑上的图片')); - tipOf(aiTab, text('Generate with AI', 'AI 生成'), views4 ? text('Make the face close-up, front, side and back from a description', '按描述生成脸部特写、正面、侧面和背面') - : text('Make the pictures from a description', '按描述生成图片')); + tipOf(uploadTab, text('Upload images', '上传图片'), views4 && !id ? text('Add your own views. Empty views are made from one image in its style.', '放入各视角图片,空着的视角按原图风格生成。') + : text('Use images from this computer', '用电脑上的图片')); + tipOf(aiTab, text('Generate with AI', 'AI 生成'), views4 ? text('Make the face close-up, front, side and back from a prompt', '按提示词生成脸部特写、正面、侧面和背面') + : text('Make the images from a prompt', '按提示词生成图片')); tipOf(photoTab, text('From a photo', '从照片生成'), text('Make the face close-up, front, side and back from one photo of the person', '用一张人物照片生成脸部特写、正面、侧面和背面')); const issue = issueButton(text, () => ({where: CAST_ISSUE, message: status.textContent})); issue.hidden = true; dialog.append(top, name, tabs, photoPane, uploadPane, imagePane, aiPane, status, issue, actions); tabs.append(photoTab, uploadTab, aiTab); @@ -188,7 +188,7 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = () // What is still missing before Save works ('' when nothing is); the button says so on hover and when pressed. let missing = ''; const missingNow = () => !name.value.trim() ? text('Enter a name first', '先填写名字') - : aiBusy() ? word(text('Wait for the four pictures to finish', '等待四张图生成完成'), text('Wait for the pictures to finish', '等待图片生成完成')) + : aiBusy() ? word(text('Wait for the four images to finish', '等待四张图生成完成'), text('Wait for the images to finish', '等待图片生成完成')) : keyOf(active) ? makerStates[keyOf(active)]?.done ? '' : makerMissing[keyOf(active)] : active === 'upload' || scene ? (frontless ? slots.some(Boolean) : slots[0]) ? '' : frontless ? text('Add an image first', '先添加图片') : text('Add a front image first', '先添加正面图片') : aiState.done ? '' : word(text('Generate the images first', '先生成角色图片'), text('Generate the images first', '先生成场景图片'), text('Generate the images first', '先生成道具图片')); @@ -282,12 +282,12 @@ export function createCastLibrary({api, text, viewURL, uploadOne, onChange = () for (let index = 0; index < SLOTS; index++) { const slot = el('div', 'fv-cast-slot' + (index || scene ? '' : ' fv-cast-front')); const input = el('input'); input.type = 'file'; input.accept = 'image/*'; input.hidden = true; - const label = prop ? text('Image', '图片') : scene ? text(`Image ${index + 1}`, `图片 ${index + 1}`) : index ? text(`View ${index}`, `视角 ${index}`) : text('Front image', '正面图片'); + const label = prop ? text('Image', '图片') : scene ? text('Image {number}', '图片 {number}', { number: index + 1 }) : index ? text('View {number}', '视角 {number}', { number: index }) : text('Front image', '正面图片'); const choose = button('fv-cast-choose', '', () => input.click()); choose.setAttribute('aria-label', label); const remove = button('fv-cast-remove', '×', () => { firstChanged(index); release(index); paint(index); }); remove.setAttribute('aria-label', text('Remove image', '移除图片')); - choose.dataset.fvTipName = label; choose.dataset.fvTipUse = text('Choose a picture, or drop one here', '选择图片,或把图片拖到这里'); - remove.dataset.fvTipName = text('Remove image', '移除图片'); remove.dataset.fvTipUse = text('Take this picture out', '拿掉这张图片'); + choose.dataset.fvTipName = label; choose.dataset.fvTipUse = text('Choose an image, or drop one here', '选择图片,或把图片拖到这里'); + remove.dataset.fvTipName = text('Remove image', '移除图片'); remove.dataset.fvTipUse = text('Take this image out', '拿掉这张图片'); input.onchange = () => { chooseFiles(index, input.files); input.value = ''; }; slot.ondragover = event => { event.preventDefault(); event.stopPropagation(); }; slot.ondrop = event => { event.preventDefault(); event.stopPropagation(); chooseFiles(index, event.dataTransfer.files); }; diff --git a/web/cast_photo.js b/web/cast_photo.js index e2550c88..d1e0901a 100644 --- a/web/cast_photo.js +++ b/web/cast_photo.js @@ -52,18 +52,18 @@ export function photoClient(client, references = new Map(), purpose = () => '') // redraws the rest after the first view changed. function wordsOf(source, tr) { if (source === 'ai') return { - use: tr('Make the face close-up, front, side and back from the description', '按描述生成脸部特写、正面、侧面和背面'), + use: tr('Make the face close-up, front, side and back from the prompt', '按提示词生成脸部特写、正面、侧面和背面'), rest: [tr('Redraw the others to match', '按新正面重画其余三张'), tr('Make the face close-up, side and back again from the new front', '用新的正面重新生成脸部特写、侧面和背面')]}; const image = source === 'image'; return { - slot: image ? [tr('Picture of the character', '角色图片'), tr('Add a picture', '添加图片'), tr('Drop a picture of the character here, or choose one', '把角色图片拖到这里,或点击选择'), - tr('One clear picture of the character, in any style; the views keep its style', '一张清晰的角色图片,任何画风都可以,各视角保持原图风格')] + slot: image ? [tr('Image of the character', '角色图片'), tr('Add an image', '添加图片'), tr('Drop an image of the character here, or choose one', '把角色图片拖到这里,或点击选择'), + tr('One clear image of the character, in any style; the views keep its style', '一张清晰的角色图片,任何画风都可以,各视角保持原图风格')] : [tr('Photo of the person', '人物照片'), tr('Add a photo', '添加照片'), tr('Drop a photo of the person here, or choose one', '把人物照片拖到这里,或点击选择'), tr('One clear photo of the person; the face decides the likeness', '一张清晰的人物照片,长相以脸部为准')], - first: image ? tr('Add a picture first', '先添加图片') : tr('Add a photo first', '先添加照片'), - use: image ? tr('Make the four views from the picture, in its style', '用图片按原图风格生成四个视角') : tr('Make the four views from the photo', '用照片生成四个视角'), - keep: image ? tr('Dress the views as in the picture', '各视角保持图片里的服装') : tr('Dress the views as in the photo', '各视角保持照片里的服装'), - original: image ? [tr('Use the picture', '用原图'), tr('Put the picture itself in as the face close-up', '把原图作为脸部特写')] + first: image ? tr('Add an image first', '先添加图片') : tr('Add a photo first', '先添加照片'), + use: image ? tr('Make the four views from the image, in its style', '用图片按原图风格生成四个视角') : tr('Make the four views from the photo', '用照片生成四个视角'), + keep: image ? tr('Dress the views as in the image', '各视角保持图片里的服装') : tr('Dress the views as in the photo', '各视角保持照片里的服装'), + original: image ? [tr('Use the image', '用原图'), tr('Put the image itself in as the face close-up', '把原图作为脸部特写')] : [tr('Use the photo', '用原照片'), tr('Put the photo itself in as the face close-up', '把原照片作为脸部特写')], rest: [tr('Redraw the others to match', '按新脸重画其余三张'), tr('Make the front, side and back again from the new face', '用新的脸部特写重新生成正面、侧面和背面')]}; } @@ -98,9 +98,9 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { const restore = el('button', 'fv-cp-tool', tr('Restore', '恢复原图')); restore.type = 'button'; const replace = el('button', 'fv-cp-tool', tr('Replace', '更换')); replace.type = 'button'; const remove = el('button', 'fv-cp-tool', tr('Remove', '移除')); remove.type = 'button'; - tip(restore, tr('Restore', '恢复原图'), tr('Put the original picture back', '换回编辑前的原图')); - tip(replace, tr('Replace', '更换'), tr('Choose another picture', '换一张图片')); - tip(remove, tr('Remove', '移除'), tr('Take this picture out', '拿掉这张图片')); + tip(restore, tr('Restore', '恢复原图'), tr('Put the original image back', '换回编辑前的原图')); + tip(replace, tr('Replace', '更换'), tr('Choose another image', '换一张图片')); + tip(remove, tr('Remove', '移除'), tr('Take this image out', '拿掉这张图片')); tools.append(edited, restore, replace, remove); face.append(shown, hint); box.append(face, input, tools); let record = null; @@ -120,7 +120,7 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { const {openImageEditor} = await import('./image_editor.js').catch(error => { loadFailed = true; throw error; }); outcome = await openImageEditor({source: record.original?.url || record.url, name: record.file.name || 'picture.png', edit: record.edit || null, role: 'reference', t: tr, resolve: url => url, upload: async blob => client.upload(blob), imageGenClient: client}); - } catch { attention = loadFailed ? tr('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : tr('This picture could not be read. Choose another picture.', '这张图无法读取。请重新选择一张。'); render(); return; } + } catch { attention = loadFailed ? tr('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : tr('This image could not be read. Choose another image.', '这张图无法读取。请重新选择一张。'); render(); return; } if (!outcome || !record || disposed) return; if (outcome.restore) { back(); return; } if (!outcome.blob) return; @@ -157,15 +157,15 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { // Clothes: as in the picture, as described, or as in a clothes picture (with words for details if wanted). From a // description the clothes are in the description, or in a clothes picture. const wear = el('div', 'fv-cp-wear'); wear.setAttribute('role', 'radiogroup'); wear.setAttribute('aria-label', tr('Clothes', '服装')); - const modes = ai ? [['text', tr('As described', '按描述'), tr('Dress the character as the description says', '按描述里的服装生成')], - ['image', tr('Picture', '上传服装图'), tr('Dress the character in the clothes of a picture', '换上服装图里的衣服')]] + const modes = ai ? [['text', tr('As described', '按描述'), tr('Dress the character as the prompt says', '按提示词里的服装生成')], + ['image', tr('Image', '上传服装图'), tr('Dress the character in the clothes of an image', '换上服装图里的衣服')]] : [['keep', tr('Keep clothes', '保持服装'), words.keep], ['text', tr('Describe', '按描述更换'), tr('Dress the views as described', '各视角按描述更换服装')], - ['image', tr('Picture', '上传服装图'), tr('Dress the views in the clothes of a picture', '各视角换上服装图里的衣服')]]; + ['image', tr('Image', '上传服装图'), tr('Dress the views in the clothes of an image', '各视角换上服装图里的衣服')]]; wear.dataset.count = String(modes.length); const modeButtons = modes.map(([value, name, use]) => { const b = el('button', null, name); b.type = 'button'; b.setAttribute('role', 'radio'); b.dataset.value = value; tip(b, name, use); b.onclick = () => setWear(value); wear.append(b); return b; }); - const outfitSlot = slot({label: tr('Clothes picture', '服装图'), empty: [tr('Add a clothes picture', '添加服装图'), tr('Drop it here, or choose one', '拖到这里,或点击选择')], - use: tr('A picture of the clothes to wear', '要换上的服装图片'), onChange: () => { outfitRef = ''; render(); }}); + const outfitSlot = slot({label: tr('Clothes image', '服装图'), empty: [tr('Add a clothes image', '添加服装图'), tr('Drop it here, or choose one', '拖到这里,或点击选择')], + use: tr('An image of the clothes to wear', '要换上的服装图片'), onChange: () => { outfitRef = ''; render(); }}); outfitSlot.element.classList.add('fv-cp-outfit-slot'); const field = ai ? null : el('textarea', 'fv-cg-text fv-cp-outfit'); if (field) { field.maxLength = 400; field.rows = 2; field.setAttribute('aria-label', tr('Clothes', '服装')); } @@ -217,11 +217,11 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { const usePhoto = view === 'face' && !ai ? tool(words.original[0], words.original[1], () => { if (!photoSlot.get()) return; dropEdit('face'); generator.useOriginal(ORIGINAL); faceChanged = true; render(); }) : null; - const restore = tool(tr('Restore', '恢复原图'), tr('Put the picture back as it was made', '换回生成时的样子'), () => { dropEdit(view); if (leads(view)) faceChanged = true; render(); }); - const mine = canOwn ? tool(tr('Add picture', '添加图片'), tr('Use a picture of your own for this view', '这个视角用自己的图片'), () => choosing(view)) : null; - const clear = canOwn ? tool(tr('Remove', '移除'), tr('Remove this picture. Generate makes this view.', '移除这张图片,生成时补上这个视角。'), () => dropOwn(view)) : null; + const restore = tool(tr('Restore', '恢复原图'), tr('Put the image back as it was made', '换回生成时的样子'), () => { dropEdit(view); if (leads(view)) faceChanged = true; render(); }); + const mine = canOwn ? tool(tr('Add image', '添加图片'), tr('Use an image of your own for this view', '这个视角用自己的图片'), () => choosing(view)) : null; + const clear = canOwn ? tool(tr('Remove', '移除'), tr('Remove this image. Generate makes this view.', '移除这张图片,生成时补上这个视角。'), () => dropOwn(view)) : null; cell.append(image, label, edited, percent, meter, tools); grid.append(cell); - tip(cell, title, canOwn ? tr('Click or drop a picture', '点击或拖入图片') : tr('Click to edit it in the image editor', '点击在图像编辑器中修改')); + tip(cell, title, canOwn ? tr('Click or drop an image', '点击或拖入图片') : tr('Click to edit it in the image editor', '点击在图像编辑器中修改')); const open = () => { if (generator.state().running) return; if (cell.dataset.state === 'done') void editView(view); else if (canOwn && cell.dataset.state === 'empty') choosing(view); }; if (canOwn) { cell.addEventListener('dragover', event => { event.preventDefault(); }); @@ -264,7 +264,7 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { } async function redraw(view) { if (own[view]) return; - try { await ensureOwn(); } catch (error) { attention = error.message || tr('Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'); render(); return; } + try { await ensureOwn(); } catch (error) { attention = error.message || tr('Could not read this image. Please choose another one.', '无法读取这张图片,请换一张。'); render(); return; } dropEdit(view); await generator.redo(make.indexOf(view)); if (view === base && generator.state().pictures[0].file) { faceChanged = true; render(); } @@ -277,7 +277,7 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { const {openImageEditor} = await import('./image_editor.js').catch(error => { loadFailed = true; throw error; }); outcome = await openImageEditor({source: sourceOf(view), name: `${view}.png`, edit: edits[view]?.edit || null, role: 'reference', t: tr, resolve: url => url, upload: async blob => client.upload(blob), imageGenClient: client}); - } catch { attention = loadFailed ? tr('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : tr('This picture could not be read. Choose another picture.', '这张图无法读取。请重新选择一张。'); render(); return; } + } catch { attention = loadFailed ? tr('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : tr('This image could not be read. Choose another image.', '这张图无法读取。请重新选择一张。'); render(); return; } if (!outcome || disposed) return; if (outcome.restore) { dropEdit(view); if (leads(view)) faceChanged = true; render(); return; } if (!outcome.blob) return; @@ -350,8 +350,8 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { : ownCount ? tr('Generate the rest', '生成其余视角') : tr('Generate', '生成'); action.classList.toggle('fv-cp-none', ownCount === SHOW.length); action.dataset.primary = String(!running && !finished); - const why = ai ? (!describe.value.trim() ? tr('Describe the character first', '先描述角色') : mode === 'image' && !outfitSlot.get() ? tr('Add a clothes picture first', '先添加服装图') : '') - : !photoSlot.get() && !own.front && !own.face ? (ownCount ? tr('Add a source picture, or put in the front or face close-up.', '请添加来源图,或放入正面或脸部特写。') : words.first) : mode === 'image' && !outfitSlot.get() ? tr('Add a clothes picture first', '先添加服装图') + const why = ai ? (!describe.value.trim() ? tr('Describe the character first', '先描述角色') : mode === 'image' && !outfitSlot.get() ? tr('Add a clothes image first', '先添加服装图') : '') + : !photoSlot.get() && !own.front && !own.face ? (ownCount ? tr('Add a source image, or put in the front or face close-up.', '请添加来源图,或放入正面或脸部特写。') : words.first) : mode === 'image' && !outfitSlot.get() ? tr('Add a clothes image first', '先添加服装图') : mode === 'text' && !field.value.trim() ? tr('Describe the clothes first', '先描述服装') : ''; if (why && !running) { action.setAttribute('aria-disabled', 'true'); action.dataset.fvTipWhy = why; } else { action.removeAttribute('aria-disabled'); delete action.dataset.fvTipWhy; } tip(action, action.textContent, running ? tr('Stop making the views', '停止生成') : words.use); @@ -367,9 +367,9 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { c.again.disabled = running || (index > 0 && !state.pictures[0].file); if (c.usePhoto) c.usePhoto.hidden = !photoSlot.get() || !!r.original || running; if (c.mine) { - tip(c.cell, c.title, r.file ? tr('Click to edit it in the image editor, or drop a picture to replace it', '点击在图像编辑器中修改,或拖入图片替换') : tr('Click or drop a picture', '点击或拖入图片')); - const name = r.file ? tr('Replace', '更换') : tr('Add picture', '添加图片'); - if (c.mine.textContent !== name) { c.mine.textContent = name; tip(c.mine, name, r.file ? tr('Use another picture of your own for this view', '这个视角换成自己的另一张图片') : tr('Use a picture of your own for this view', '这个视角用自己的图片')); } + tip(c.cell, c.title, r.file ? tr('Click to edit it in the image editor, or drop an image to replace it', '点击在图像编辑器中修改,或拖入图片替换') : tr('Click or drop an image', '点击或拖入图片')); + const name = r.file ? tr('Replace', '更换') : tr('Add image', '添加图片'); + if (c.mine.textContent !== name) { c.mine.textContent = name; tip(c.mine, name, r.file ? tr('Use another image of your own for this view', '这个视角换成自己的另一张图片') : tr('Use an image of your own for this view', '这个视角用自己的图片')); } c.mine.hidden = running; c.clear.hidden = running || !own[view]; } } @@ -416,7 +416,7 @@ export function mountCastPhoto({container, api, text, viewURL, onState = () => { if (!own.face) await closeUpOf(sourceRef, (from || photoSlot.get()).file); } if (mode === 'image' && !outfitRef) outfitRef = await referenceOf(outfitSlot.get()); - } catch (error) { attention = error.message || tr('Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'); render(); return; } + } catch (error) { attention = error.message || tr('Could not read this image. Please choose another one.', '无法读取这张图片,请换一张。'); render(); return; } if (disposed) return; for (const name of [sourceRef, own.face ? '' : closeUp.name, mode === 'image' ? outfitRef : '', ...SHOW.map(view => own[view]?.ref)]) if (name && references.has(name)) references.set(name, true); const outfitImage = mode === 'image' ? outfitRef : ''; diff --git a/web/cast_room.js b/web/cast_room.js index d6520d5d..ca201ef5 100644 --- a/web/cast_room.js +++ b/web/cast_room.js @@ -2,6 +2,7 @@ // one large on the right with its pictures, its voice and what can be done with it. The data and the edit dialog are // the cast library's (cast_library.js); this file only lays them out in the room. import { createCastLibrary } from './cast_library.js'; +import { pageLanguage } from './i18n.js'; import { agentInterfaceState } from './agent_connect.js'; import { agentSend } from './agent_session.js'; import { uploadMedia } from './media_upload.js'; @@ -77,7 +78,7 @@ export function createCastRoom({api, t, viewURL: outputURL}) { searchBox.append(line('search'), search); const create = button('', () => { const kind = KINDS.includes(place) ? place : 'character'; libraries[kind].openNew(); }, 'fv-library-tool fv-cast-new'); create.append(line('plus'), el('span', t('New', '新建'), 'fv-library-tool-label')); - tip(create, t('New', '新建'), t('Add a character, scene or prop from pictures', '用图片新建角色、场景或道具')); + tip(create, t('New', '新建'), t('Add a character, scene or prop from images', '用图片新建角色、场景或道具')); const sortButton = button('', () => { sort = sort === 'new' ? 'name' : 'new'; syncSort(); render(); }, 'fv-library-tool fv-cast-sort'); sortButton.append(line('sort'), el('span', '', 'fv-library-tool-label')); const syncSort = () => { @@ -101,7 +102,7 @@ export function createCastRoom({api, t, viewURL: outputURL}) { const actions = el('div', null, 'fv-actions fv-cast-actions'); const use = button('', () => copyMention(), 'fv-action fv-action-primary'); use.append(line('at'), el('span')); const edit = button('', () => card && libraries[card.kind]?.openEdit(card.id), 'fv-action fv-action-secondary'); edit.append(line('edit'), el('span', t('Edit', '编辑'))); - tip(edit, t('Edit', '编辑'), t('Change the name or pictures', '修改名字或图片')); + tip(edit, t('Edit', '编辑'), t('Change the name or images', '修改名字或图片')); let arm = 0; const remove = button('', () => removeCard(), 'fv-action fv-action-secondary fv-cast-remove-card'); remove.append(line('trash'), el('span', t('Delete', '删除'))); tip(remove, t('Delete', '删除'), t('Delete it from the library', '从角色库里删除')); @@ -126,7 +127,7 @@ export function createCastRoom({api, t, viewURL: outputURL}) { voices.hidden = !rows.some(row => row.voice); shelf.replaceChildren(); const shown = rows.filter(matchesPlace).filter(row => !query || String(row.name || '').toLowerCase().includes(query)); - const ordered = sort === 'name' ? [...shown].sort((a, b) => String(a.name).localeCompare(String(b.name), t('en', 'zh-CN'))) : shown; + const ordered = sort === 'name' ? [...shown].sort((a, b) => String(a.name).localeCompare(String(b.name), pageLanguage())) : shown; for (const kind of KINDS) { const group = ordered.filter(row => row.kind === kind); if (!group.length) continue; @@ -141,7 +142,7 @@ export function createCastRoom({api, t, viewURL: outputURL}) { else if (state === 'error') { message.textContent = t('The character library could not be read. Try Refresh.', '角色库暂时无法读取,请点击刷新。'); message.append(issueButton(t, () => ({where: ['Character library', '角色库'], message: message.firstChild?.textContent || ''}))); } else if (state === 'loading' && !rows.length) message.textContent = t('Loading…', '正在读取…'); else if (!ordered.length) message.textContent = query ? t('No name matches this search.', '没有符合搜索的名称。') - : t('Saved characters, scenes and props appear here. Press New to add one from pictures.', '保存的角色、场景和道具会出现在这里。点“新建”用图片添加。'); + : t('Saved characters, scenes and props appear here. Press New to add one from images.', '保存的角色、场景和道具会出现在这里。点“新建”用图片添加。'); create.disabled = state === 'off'; if (selected && !rows.some(row => row.id === selected)) clearDetail(); else if (!selected && ordered.length && !matchMedia('(max-width: 1180px)').matches) choose(ordered[0], false); @@ -181,15 +182,15 @@ export function createCastRoom({api, t, viewURL: outputURL}) { if (images.length > 1) images.forEach((picture, index) => { const thumb = button('', () => { view = index; paint(); }, 'fv-cast-view-thumb'); thumb.setAttribute('aria-pressed', String(index === view)); const image = el('img'); image.alt = ''; image.src = inputURL(fileOf(picture.media)); thumb.append(image); - const label = picture.label === 'front' ? t('Front', '正面') : t(`Picture ${index + 1}`, `图片 ${index + 1}`); - thumb.setAttribute('aria-label', label); tip(thumb, label, t('Show this picture large', '放大显示这张图片')); + const label = picture.label === 'front' ? t('Front', '正面') : t('Image {number}', '图片 {number}', { number: index + 1 }); + thumb.setAttribute('aria-label', label); tip(thumb, label, t('Show this image large', '放大显示这张图片')); viewsRow.append(thumb); }); nameLine.textContent = card.name || ONE[card.kind]; - metaLine.textContent = [ONE[card.kind], images.length ? t(`${images.length} ${images.length === 1 ? 'picture' : 'pictures'}`, `${images.length} 张图`) : ''].filter(Boolean).join(' · '); - use.lastElementChild.textContent = t(`Copy @${card.name}`, `复制 @${card.name}`); + metaLine.textContent = [ONE[card.kind], !images.length ? '' : images.length === 1 ? t('1 image', '1 张图') : t('{count} images', '{count} 张图', { count: images.length })].filter(Boolean).join(' · '); + use.lastElementChild.textContent = t('Copy @{name}', '复制 @{name}', { name: card.name }); tip(use, t('Copy mention', '复制引用'), t('Paste it in a prompt to use this one', '粘贴到提示词里即可引用')); - hint.textContent = t(`Type @${card.name} in a prompt to use it in a shot.`, `在提示词中输入 @${card.name} 即可在镜头里使用。`); + hint.textContent = t('Type @{name} in a prompt to use it in a shot.', '在提示词中输入 @{name} 即可在镜头里使用。', { name: card.name }); voiceBox.replaceChildren(); if (card.voice?.clip?.file || card.voice?.clip?.url) { voiceBox.append(el('div', t('Voice', '声音'), 'fv-cast-voice-label')); @@ -202,7 +203,7 @@ export function createCastRoom({api, t, viewURL: outputURL}) { if (!card) return; const text = '@' + card.name + ' '; const ok = await copyText(text); - notice.textContent = ok ? t(`Copied @${card.name}. Paste it in a prompt.`, `已复制 @${card.name},粘贴到提示词里使用。`) : t('Could not copy. Type the name after @ in a prompt.', '没能复制。可在提示词中输入 @ 加名字。'); + notice.textContent = ok ? t('Copied @{name}. Paste it in a prompt.', '已复制 @{name},粘贴到提示词里使用。', { name: card.name }) : t('Could not copy. Type the name after @ in a prompt.', '没能复制。可在提示词中输入 @ 加名字。'); } function resetRemove() { clearTimeout(arm); arm = 0; remove.classList.remove('fv-library-arming'); remove.lastElementChild.textContent = t('Delete', '删除'); } async function removeCard() { diff --git a/web/chain_support.js b/web/chain_support.js index 364b35c4..642cb1a2 100644 --- a/web/chain_support.js +++ b/web/chain_support.js @@ -8,18 +8,18 @@ export const chainRoute = (id, action) => '/freevideo/chain' + (id ? '/' + encod export function waitingText(waiting, t) { const ahead = waiting?.ahead, left = waiting?.remaining_seconds; if (!Number.isInteger(ahead) || ahead < 1) return t('Queued', '排队中'); - if (ahead > 1) return t(`Queued · ${ahead} ahead`, `排队中 · 前面还有 ${ahead} 个`); + if (ahead > 1) return t('Queued · {ahead} ahead', '排队中 · 前面还有 {ahead} 个', { ahead }); if (!Number.isFinite(left) || left < 0) return t('Queued · waiting for the previous one', '排队中 · 等前一个完成'); - const time = left < 60 ? t(`about ${Math.max(1, Math.ceil(left))} s`, `约 ${Math.max(1, Math.ceil(left))} 秒`) - : t(`about ${Math.ceil(left / 60)} min`, `约 ${Math.ceil(left / 60)} 分钟`); - return t(`Queued · starts in ${time}`, `排队中 · ${time}后开始`); + const time = left < 60 ? t('about {seconds} s', '约 {seconds} 秒', { seconds: Math.max(1, Math.ceil(left)) }) + : t('about {minutes} min', '约 {minutes} 分钟', { minutes: Math.ceil(left / 60) }); + return t('Queued · starts in {time}', '排队中 · {time}后开始', { time }); } // The line while a long video's parts are joined: which part is being written once that is known. export function joiningText(join, t) { const part = join?.part, count = join?.count; if (!Number.isInteger(part) || !Number.isInteger(count) || count < 2 || part < 1 || part > count) return t('Joining the parts', '正在接合各段'); - return t(`Joining · Part ${part} of ${count}`, `正在接合 · 第 ${part} 段,共 ${count} 段`); + return t('Joining · Part {part} of {count}', '正在接合 · 第 {part} 段,共 {count} 段', { part, count }); } // No overlapping polls and no delivery after disposal, including a slow response. diff --git a/web/chat_attachments.js b/web/chat_attachments.js index a9bcd6fe..7aba1590 100644 --- a/web/chat_attachments.js +++ b/web/chat_attachments.js @@ -3,12 +3,12 @@ import {agentPost, agentUpload} from './agent_session.js'; export const ATTACH = { count: 4, bytes: 10 * 1024 * 1024, types: ['image/png', 'image/jpeg', 'image/webp'], - add: ['Add pictures', '添加图片'], remove: ['Remove', '移除'], - tooMany: ['Up to 4 pictures per message.', '一条消息最多 4 张图片。'], - tooLarge: ['Each picture must be under 10 MB.', '每张图片不能超过 10 MB。'], - notPicture: ['Only pictures can be added.', '只能添加图片。'], - unreadable: ['Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'], - failed: ['Could not upload the picture. Click it to try again.', '图片上传失败,请点击该图片重试。'], + add: ['Add images', '添加图片'], remove: ['Remove', '移除'], + tooMany: ['Up to 4 images per message.', '一条消息最多 4 张图片。'], + tooLarge: ['Each image must be under 10 MB.', '每张图片不能超过 10 MB。'], + notPicture: ['Only images can be added.', '只能添加图片。'], + unreadable: ['Could not read this image. Please choose another one.', '无法读取这张图片,请换一张。'], + failed: ['Could not upload the image. Click it to try again.', '图片上传失败,请点击该图片重试。'], retry: ['Upload again', '重新上传'], icon: 'M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zM4 16l4-4 4 4 3-3 5 5M15 9h.01', }; diff --git a/web/compatibility.js b/web/compatibility.js index 80cc11a3..a85461cb 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -3,6 +3,7 @@ import './fv_select.js'; import './glass/library.js'; import {userMessage} from './user_message.js'; import { isChinese, translator } from './i18n.js'; +import { localized } from './i18n_tables.js'; // FreeVideo's own reason keeps the lead-in that says what failed; browser or program wording becomes a plain sentence. const saveFailure = (error, tt) => { const text = userMessage(error, tt, tt('Could not save. Try again.', '没能保存,请重试。')); @@ -91,7 +92,7 @@ export function compatibilityCard({t: tt = t, api: client0 = api} = {}) { tip(automatic, tt('Raise automatically', '自动提高'), tt('Raise the level after an unexpected interruption', '意外中断后自动提高档位')); const dirty = () => value && (Number(level.value) !== value.level || automatic.checked !== value.automatic); const paint = () => { - const levelName = value?.levels?.[Number(level.value)]?.[cn ? 'zh' : 'en']; + const levelName = localized(value?.levels?.[Number(level.value)], t) || undefined; title.textContent = Number(level.value) ? `${tt('Compatibility level', '兼容档位')} · ${level.selectedOptions[0]?.textContent || ''}` : tt('Compatibility level', '兼容档位'); if (value?.available) line.textContent = levelName || ''; const changed = dirty(); @@ -163,7 +164,7 @@ async function openCompatibilitySheet() { const note = element('p', t('Applies from the next generation. Higher levels have the GPU handle less at a time, so generation is slower and the picture differs slightly; resolution, duration and steps stay the same.', '从下一次生成起生效。档位越高,显卡每次处理的数据越少,生成越慢,画面也会有细微差别;分辨率、时长和步数不变。')); note.className = 'fv-muted'; status.before(name, slider, autoLabel, note); - const render = () => { name.textContent = value.levels[Number(slider.value)][cn ? 'zh' : 'en']; }; render(); + const render = () => { name.textContent = localized(value.levels[Number(slider.value)], t); }; render(); slider.oninput = () => { render(); if (Number(slider.value) === 0) automatic.checked = false; }; let saving = false; panel.addEventListener('cancel', event => { if (saving) event.preventDefault(); }); diff --git a/web/context_fallback.js b/web/context_fallback.js index 5ce01623..bea81c49 100644 --- a/web/context_fallback.js +++ b/web/context_fallback.js @@ -80,7 +80,7 @@ function textItems(field) { none: pair('Select some text first', '先选中文字'), secret: pair('A password is not copied', '密码不能复制'), empty: pair('The box is empty', '框里没有文字'), - paste: pair(`Press ${keyName('Mod+V')} to paste here`, `请按 ${keyName('Mod+V')} 粘贴`), + paste: [...pair('Press {key} to paste here', '请按 {key} 粘贴'), { key: keyName('Mod+V') }], }; return [ {id: 'text-cut', label: pair('Cut', '剪切'), icon: 'scissors', key: 'Mod+X', use: pair('Move the selected text to the clipboard', '把选中的文字移到剪贴板'), @@ -131,7 +131,7 @@ function generalItems() { {id: 'page-reload', label: pair('Reload', '刷新'), icon: 'reload', key: 'Mod+R', use: pair('Load this page again; the view in front comes back', '重新载入页面,回到当前视图'), run: () => location.reload()}, '-', - {id: 'palette-open', label: pair('Command palette', '命令面板'), icon: 'search', key: 'Mod+K', use: pair('Search works and run any action', '搜索作品、提示词并执行操作'), + {id: 'palette-open', label: pair('Command palette', '命令面板'), icon: 'search', key: 'Mod+K', use: pair('Search creations and run any action', '搜索作品、提示词并执行操作'), when: () => Boolean(globalThis.FreeVideoCommands?.openPalette), run: () => globalThis.FreeVideoCommands.openPalette()}, {id: 'shortcuts-open', label: pair('Keyboard shortcuts', '快捷键速查'), icon: 'keyboard', key: '?', use: pair('Every shortcut of every view', '所有视图的快捷键'), when: () => Boolean(command('shortcuts.open')), run: run('shortcuts.open')}, @@ -155,7 +155,7 @@ function itemsFor(target) { const picture = target.closest('img'); const standalone = picture && !picture.closest('button, [role=button], [role=option], [role=tab], a, label'); const source = picture?.currentSrc || picture?.src || ''; - if (standalone && source && !source.startsWith('data:')) items.push({id: 'picture-open', label: pair('Open picture in a new tab', '在新标签页打开图片'), icon: 'image', use: pair('See the picture by itself', '单独查看这张图片'), run: () => window.open(source, '_blank', 'noopener')}); + if (standalone && source && !source.startsWith('data:')) items.push({id: 'picture-open', label: pair('Open image in a new tab', '在新标签页打开图片'), icon: 'image', use: pair('See the image by itself', '单独查看这张图片'), run: () => window.open(source, '_blank', 'noopener')}); if (items.length) return items; return generalItems(); } diff --git a/web/context_menu.js b/web/context_menu.js index 351b0e87..89e20eee 100644 --- a/web/context_menu.js +++ b/web/context_menu.js @@ -8,13 +8,17 @@ // Nothing here runs at import under Node, so the unit tests load it as it is. import { isolateDialogKeys, listenDialogKey } from './dialog_keys.js'; -import { isChinese, translator } from './i18n.js'; +import { isChinese, translator, translatorFor } from './i18n.js'; const browser = typeof document !== 'undefined'; export const CN = isChinese(); export const t = translator(CN); -// [en, zh] pairs, plain strings and functions returning either all read the same way. -export const words = (value, cn = CN) => typeof value === 'function' ? words(value(), cn) : Array.isArray(value) ? String(value[cn ? 1 : 0] ?? value[0] ?? '') : String(value ?? ''); +// [en, zh] pairs (or [en, zh, values] for {name} placeholders), plain strings and functions returning either all read +// the same way. A pair in the page's language goes through t, so a language file reaches it; asked for the other of +// English and Chinese (a search that matches both), it is that text as written. +export const words = (value, cn = CN) => typeof value === 'function' ? words(value(), cn) + : Array.isArray(value) ? String((cn === CN ? t : translatorFor(null, cn))(value[0] ?? '', value[1] ?? value[0] ?? '', value[2]) ?? '') + : String(value ?? ''); export const MAC = /Mac|iPhone|iPad/.test(globalThis.navigator?.platform || globalThis.navigator?.userAgent || ''); // The compatibility view (Settings → 兼容界面, stored as freevideo.glass = solid): solid panels, fewer animations, // and nothing plays until asked. It counts as reduced motion everywhere. @@ -41,7 +45,7 @@ const GESTURES = {click: ['Click', '点击'], drag: ['Drag', '拖动'], wheel: [ export function keyParts(combo, mac = MAC, cn = CN) { return String(combo || '').split('+').map(part => part.trim()).filter(Boolean).map(part => { const low = part.toLowerCase(); - if (GESTURES[low]) return GESTURES[low][cn ? 1 : 0]; + if (GESTURES[low]) return words(GESTURES[low], cn); return (mac ? MAC_KEYS : PC_KEYS)[low] ?? COMMON[low] ?? (part.length === 1 ? part.toUpperCase() : part); }); } @@ -181,12 +185,12 @@ export function placeMenu(at, size, view, margin = 8) { // show their name and key only. Unavailable rows show their `disabled` text, which says why and how to undo it. ── const USE = { open: ['View it large', '打开大图查看'], download: ['Save the file to this computer', '把文件存到这台电脑'], - reuse: ['Fill in its prompt and settings', '填入它的提示词和设置'], reference: ['Use it as a reference picture', '作为参考图放进当前视图'], + reuse: ['Fill in its prompt and settings', '填入它的提示词和设置'], reference: ['Use it as a reference image', '作为参考图放进当前视图'], 'copy-prompt': ['Copy its prompt to paste elsewhere', '复制提示词,可粘贴到别处'], favorite: ['Keep it under Favorites', '加入收藏,方便再找'], tags: ['Group it with a tag', '用标签给它分组'], compare: ['Compare it with another one', '和另一个并排或滑块对比'], folder: ['Show the file in its folder', '在文件夹里找到这个文件'], trash: ['Move it to Recently deleted', '移到最近删除,可恢复'], restore: ['Put it back where it was', '放回原来的位置'], purge: ['Delete it for good; asks first', '永久删除,会先确认'], - 'new-tag': ['Make a new tag for it', '新建一个标签'], extend: ['Continue it into a longer video', '接着生成更长的视频'], + 'new-tag': ['Make a new tag for it', '新建一个标签'], extend: ['Extend it into a longer video', '接着生成更长的视频'], rename: ['Give it another name', '换一个名字'], duplicate: ['Make a copy next to it', '在旁边复制一份'], read: ['Clear its unread dot', '去掉未读标记'], remove: ['Take it off this list', '从列表里移除'], }; diff --git a/web/editor.css b/web/editor.css index b2c06cc4..cc675fdb 100644 --- a/web/editor.css +++ b/web/editor.css @@ -21,8 +21,8 @@ .fv-editor .fv-ed-genbar>.fv-ed-duration.fv-ed-beside-leaving[hidden]{display:block!important;pointer-events:none} .fv-editor button:where(:not(.fv-header button)){height:36px;min-height:0;border-radius:var(--fv-r-sm);font:500 13px/1.4 var(--fv-font);white-space:nowrap} .fv-editor .fv-header{grid-column:1/-1;position:sticky;top:0;z-index:6;background:var(--fv-bg)} -/* The update bar the creative panel brings along is one more grid row below the timeline: as wide as the window and kept at its bottom edge while the view scrolls, never past it. */ -.fv-studio.fv-editor>.fv-pop-holder>.fv-update-notice,.fv-studio.fv-editor>.fv-update-notice{grid-column:1/-1;grid-row:8;position:sticky;bottom:0;z-index:6} +/* The update bar the creative panel brings along is one more grid row below the timeline: as wide as the window and kept at its bottom edge while the view scrolls, never past it. It is never shorter than its own rows (a short window squeezes the grid's last row, and the buttons would hang below the bar and below the window). */ +.fv-studio.fv-editor>.fv-pop-holder>.fv-update-notice,.fv-studio.fv-editor>.fv-update-notice{grid-column:1/-1;grid-row:8;position:sticky;bottom:0;z-index:6;min-height:max-content} /* On a narrow window the name and the close button share the first row and the buttons sit on one row below. */ @media(max-width:680px){.fv-studio.fv-editor>.fv-pop-holder>.fv-update-notice,.fv-studio.fv-editor>.fv-update-notice{padding:8px 14px;justify-content:flex-start}.fv-studio.fv-editor>.fv-pop-holder>.fv-update-notice>span,.fv-studio.fv-editor>.fv-update-notice>span{flex:1 1 calc(100% - 60px);min-width:0;white-space:normal;order:0}.fv-studio.fv-editor>.fv-pop-holder>.fv-update-notice .fv-update-close,.fv-studio.fv-editor>.fv-update-notice .fv-update-close{order:1;margin-left:auto}.fv-studio.fv-editor>.fv-pop-holder>.fv-update-notice>:not(span):not(.fv-update-close),.fv-studio.fv-editor>.fv-update-notice>:not(span):not(.fv-update-close){order:2}} .fv-editor>:not(.fv-header){font-size:13px;line-height:1.4} @@ -638,6 +638,8 @@ .fv-ed-genbar-borrowed>.fv-borrowed{flex:1 1 100%;min-width:0;position:static;display:block;width:auto;height:auto;max-height:none;padding:0;border:0;background:none;box-shadow:none;transform:none;inset:auto} .fv-ed-genbar-borrowed>.fv-borrowed>.fv-body{display:block;position:static;width:auto;height:auto;padding:0} .fv-editor[data-bar-borrowed=true] .fv-ed-genbar-borrowed>.fv-borrowed .fv-controls{position:static;justify-self:stretch;width:auto;max-width:none} +/* The lent bar draws no blur of its own: a backdrop-filter makes the box the containing block of every position:fixed window inside it (the Media, LoRA and Advanced windows), which are placed in window coordinates and would land outside it, clipped by the dialog. The bar lies on the editor's flat ground, so there is nothing for the blur to show. */ +.fv-editor[data-bar-borrowed=true] .fv-ed-genbar-borrowed>.fv-borrowed .fv-controls.fv-glass{-webkit-backdrop-filter:none;backdrop-filter:none} /* While a part is generating, the editor's Cancel (never its Continue, named by its tip) stands on the lent bar's greyed Generate key. On a row of its own under the bar it lay beneath the timeline toolbar, out of the mouse's reach. */ @media(min-width:681px){.fv-ed-genbar-borrowed[data-mode=running][data-voice=false]>button:is([data-fv-tip-name="取消"],[data-fv-tip-name=Cancel]):not([hidden]){position:absolute;z-index:2;right:17px;top:var(--fv-ed-cancel-top,auto);bottom:var(--fv-ed-cancel-bottom,39px);width:140px;height:80px;background:var(--fv-ctl-solid,var(--fv-card));border:1px solid var(--fv-line2,var(--fv-border))}} [data-fv-locked]{opacity:.5} diff --git a/web/editor.js b/web/editor.js index 6c9345b4..7dbb8346 100644 --- a/web/editor.js +++ b/web/editor.js @@ -58,6 +58,7 @@ import {openingChoice} from './editor_opening.js'; import {CN} from './topbar_state.js'; import {setDisabled} from './dom_quiet.js'; import {randomUUID} from './random_id.js'; +import {translator, translatorFor} from './i18n.js'; const editorStyles = Promise.all(['result_actions.css', 'editor.css', 'editor_expand.css', 'editor_tracks.css', 'editor_frame.css', 'editor_adjust.css', 'editor_adjust_picture.css', 'editor_preview_picture.css', 'editor_select.css', 'editor_menu.css', 'editor_text.css', 'editor_notes.css', 'editor_transport.css', 'glass/editor.css', 'editor_touch.css'].map(name => { const style = document.createElement('link'); style.rel = 'stylesheet'; style.href = new URL(name, import.meta.url).href; const ready = 'sheet' in style ? new Promise(resolve => { style.onload = style.onerror = resolve; }) : Promise.resolve(); @@ -72,20 +73,20 @@ const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) // A half of a surrogate pair left by a cut or a paste is dropped; the description limit counts characters, not code units. export const wellFormed = text => typeof text === 'string' ? text.replace(/[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g, pair => pair.length === 2 ? pair : '') : text; export const characters = text => Array.from(text).length; -export const textLongText = (t, limit) => t('The description is too long. Shorten it to %d characters or fewer.', '描述过长,请缩短到 %d 字以内。').replace('%d', limit); +export const textLongText = (t, limit) => t('The prompt is too long. Shorten it to %d characters or fewer.', '提示词过长,请缩短到 %d 字以内。').replace('%d', limit); // The engine's limits on continuing parts, refused before a generation starts; the engine says the same. export const PARTS_LIMIT_CODES = ['chain_too_long', 'chain_part_too_short', 'chain_short_parts', 'chain_source_full']; -export function partsLimitText(code, t = en => en, limit = null) { +export function partsLimitText(code, t = translatorFor(null, false), limit = null) { const {followSeconds: least, fullSeconds: full, maxParts, shortMaxParts} = model.RULES; - if (code === 'chain_source_full') return t('This video already has the maximum of ' + maxParts + '\u00a0parts and cannot be extended.', - '这个视频已达 ' + maxParts + '\u00a0段上限,无法再接着生成。'); - if (code === 'chain_part_too_short') return t(`A part followed by another part must be at least ${least} seconds. Make it longer.`, `后面还接着其他段时,这一段至少 ${least} 秒,请加长这一段。`); - if (code === 'chain_short_parts') { const most = limit ?? shortMaxParts; return t(`With a part shorter than ${full} seconds, one continuous shot can have up to ${most} parts. Make every part at least ${full} seconds long, or use fewer parts.`, - `有短于 ${full} 秒的段时,一个连续镜头最多 ${most} 段。请把每段加长到至少 ${full} 秒,或减少段数。`); } - return t(`One continuous shot can have up to ${limit ?? maxParts} parts. Make it shorter.`, `一个连续镜头最多 ${limit ?? maxParts} 段,请缩短。`); + if (code === 'chain_source_full') return t('This video already has the maximum of {count}\u00a0parts and cannot be extended.', + '这个视频已达 {count}\u00a0段上限,无法再接着生成。', { count: maxParts }); + if (code === 'chain_part_too_short') return t('A part followed by another part must be at least {least} seconds. Make it longer.', '后面还接着其他段时,这一段至少 {least} 秒,请加长这一段。', { least }); + if (code === 'chain_short_parts') { const most = limit ?? shortMaxParts; return t('With a part shorter than {full} seconds, one continuous shot can have up to {most} parts. Make every part at least {full} seconds long, or use fewer parts.', + '有短于 {full} 秒的段时,一个连续镜头最多 {most} 段。请把每段加长到至少 {full} 秒,或减少段数。', { full, most }); } + return t('One continuous shot can have up to {limit} parts. Make it shorter.', '一个连续镜头最多 {limit} 段,请缩短。', { limit: limit ?? maxParts }); } // Shared by error() and actions.reasonText: one sentence naming the failed step. -export function editorErrorText(value, t = en => en) { +export function editorErrorText(value, t = translatorFor(null, false)) { if (isNetworkTypeError(value) || isNetworkTypeError(value?.detail)) return connectionLostText(t); // The worker's own "FreeVideo generation failed (exit 1)" header names nothing the user can act on. const oneLine = value => typeof value === 'string' ? value.trim().split(/[\r\n]+/).find(line => line.trim() && !/^\s*FreeVideo generation failed(?: \(exit -?\d+\))?\s*$/.test(line))?.trim() || '' : ''; @@ -96,16 +97,16 @@ export function editorErrorText(value, t = en => en) { const code = value?.code || detail?.code || value?.reason || detail?.reason || raw; const node = oneLine(detail?.node_type), step = `${value?.phase || ''} ${value?.stage || ''} ${node}`; const part = Number.isInteger(value?.index) ? value.index + 1 : null; - const generating = part ? t(`Generating part ${part}`, `生成第 ${part} 段`) : t('Generation', '生成'); + const generating = part ? t('Generating part {part}', '生成第 {part} 段', { part }) : t('Generation', '生成'); const stage = /encod|编码/i.test(step) ? t('Preparing', '准备生成') : /decod|解码/i.test(step) ? t('Making the video', '合成视频') : /load|model|加载/i.test(step) ? t('Loading the model', '加载模型') : generating; if (code === 'gpu_memory' || /out of memory|cuda.*memory|显存不足|显存不够/i.test(raw)) - return t(`${stage}: not enough GPU memory.`, `${stage}时显存不足。`); + return t('{stage}: not enough GPU memory.', '{stage}时显存不足。', { stage }); const known = { - chain_part_too_short: t(`A part followed by another part must be at least ${model.RULES.followSeconds} seconds.`, `后面还接着其他段时,这一段至少 ${model.RULES.followSeconds} 秒。`), - chain_short_parts: t(`With a part shorter than ${model.RULES.fullSeconds} seconds, one continuous shot can have up to ${model.RULES.shortMaxParts} parts.`, - `有短于 ${model.RULES.fullSeconds} 秒的段时,一个连续镜头最多 ${model.RULES.shortMaxParts} 段。`), - chain_too_long: t(`One continuous shot can have up to ${model.RULES.maxParts} parts.`, `一个连续镜头最多 ${model.RULES.maxParts} 段。`), + chain_part_too_short: t('A part followed by another part must be at least {followSeconds} seconds.', '后面还接着其他段时,这一段至少 {followSeconds} 秒。', { followSeconds: model.RULES.followSeconds }), + chain_short_parts: t('With a part shorter than {fullSeconds} seconds, one continuous shot can have up to {shortMaxParts} parts.', + '有短于 {fullSeconds} 秒的段时,一个连续镜头最多 {shortMaxParts} 段。', { fullSeconds: model.RULES.fullSeconds, shortMaxParts: model.RULES.shortMaxParts }), + chain_too_long: t('One continuous shot can have up to {maxParts} parts.', '一个连续镜头最多 {maxParts} 段。', { maxParts: model.RULES.maxParts }), too_long: t('This part is longer than the maximum length. Shorten it and try again.', '这一段超过了最长时长,请缩短后再试。'), missing_node: t('Generation is not ready. Restart FreeVideo.', '生成功能没有就绪,请重新启动 FreeVideo。'), chain_missing: t('Generation could not start. Choose "Generate" again.', '生成没能开始,请再点“生成”。'), @@ -120,22 +121,25 @@ export function editorErrorText(value, t = en => en) { if (modelTableDamaged(whole)) return t('Some of the model files are missing or damaged. ', '部分模型文件缺失或已损坏。') + t(...repairAction()); if (['model_missing', 'missing_model', 'model_not_found'].includes(code) || /(?:model|checkpoint|模型).*(?:not found|missing|不存在|缺失)/i.test(raw)) - return t(`Loading the model failed: ${raw || code}`, `加载模型时出错:${raw || code}`); + return t('Loading the model failed: {reason}', '加载模型时出错:{reason}', { reason: raw || code }); if (['timeout', 'timed_out', 'generation_timeout'].includes(code) || /timed?\s*out|timeout|超时/i.test(raw)) - return t(`${stage} timed out. Try again.`, `${stage}时等待超时,请再试一次。`); + return t('{stage} timed out. Try again.', '{stage}时等待超时,请再试一次。', { stage }); const received = raw || (/^[a-z_]+$/.test(code) ? '' : code); - if (received) return t(`${generating} failed: ${received}`, `${generating}时出错:${received}`); + if (received) return t('{generating} failed: {received}', '{generating}时出错:{received}', { generating, received }); // No readable text: say what the code names, and where the details are. const named = /^[a-z_]+$/.test(code) ? code : ''; - return t(`${generating} failed. Try again; if it keeps failing, download the report and report the problem.${named ? ` Error code: ${named}` : ''}`, - `${generating}时出错。请重试;仍然失败请下载报告并提交问题。${named ? `错误代码:${named}` : ''}`); + return named + ? t('{generating} failed. Try again; if it keeps failing, download the report and report the problem. Error code: {code}', + '{generating}时出错。请重试;仍然失败请下载报告并提交问题。错误代码:{code}', { generating, code: named }) + : t('{generating} failed. Try again; if it keeps failing, download the report and report the problem.', + '{generating}时出错。请重试;仍然失败请下载报告并提交问题。', { generating }); } function exportErrorText(value, t) { if (isNetworkTypeError(value)) return connectionLostText(t); const message = [value?.response?.error?.message, value?.response?.error, value?.response?.message, value?.message] .find(text => typeof text === 'string' && text.trim() && text !== 'editor_request')?.trim().split(/[\r\n]+/)[0]; // A bare status code means nothing to the user; the server's own words do. - return message ? t(`Export failed: ${message}`, `导出时出错:${message}`) : t('Export failed. Try again.', '导出时出错,请再试一次。'); + return message ? t('Export failed: {message}', '导出时出错:{message}', { message }) : t('Export failed. Try again.', '导出时出错,请再试一次。'); } // The save route's own messages are internal English, so only a full disk is named. function saveErrorText(value, t) { @@ -171,7 +175,7 @@ function restoreGeneration(record, before, prepared) { return next; } const icon = path => { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttribute('viewBox', '0 0 16 16'); svg.setAttribute('aria-hidden', 'true'); svg.classList.add('fv-ed-glyph'); const line = document.createElementNS(svg.namespaceURI, 'path'); line.setAttribute('d', path); svg.append(line); return svg; }; -function basicBlockProgress(clipId, clipElement, t = en => en) { +function basicBlockProgress(clipId, clipElement, t = translatorFor(null, false)) { const element = el('div', 'fv-ed-basic-progress'), water = el('div', 'fv-ed-basic-water'), percent = el('span', 'fv-ed-basic-percent'); element.append(water, percent); let level = 0, run = null; @@ -225,6 +229,8 @@ export function suspendCanvasPointer(canvas) { } // `components` replaces the optional progress module (see loadEditorComponents); tests also pass their generation stand-in here. +// The sampling settings an edit's project keeps (editor_model.js SAMPLING_KEYS). +const EDIT_SAMPLING = ['two_pass', 'base_steps', 'refine_steps', 'step_cache', 'upscale_factor']; export function openEditor({api, app, from = null, panel = {}, components: given = undefined, onView = view => viewChanged(view)}) { // A kept view (hidden when the user went to another view) comes back as it was: no rebuild, no reload. Opening a // work, another node's panel or a new creation panel builds a fresh one instead. @@ -245,7 +251,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given } // The same language as the top bar and the other views, read once when the page opened (the app later drops the // address's query, so reading it again when the editor opened fell back to the browser's language). - const t = (en, zh) => CN ? zh : en; + const t = translator(CN); const returnFocus = document.activeElement; const even = value => Math.max(2, Math.floor(value / 2) * 2); // A new edit opens with an empty second sound track, where music is made. @@ -479,8 +485,8 @@ export function openEditor({api, app, from = null, panel = {}, components: given } if (code === 'timed_text' || code === 'middle_frames') { out(value.say); return {ok: false, reason: code, say: value.say}; } if (PARTS_LIMIT_CODES.includes(code)) { - const [en, zh] = (value.said || []).map(text => typeof text === 'string' && text ? text.slice(0, 200) : null); - const text = en && zh ? t(en, zh) : partsLimitText(code, t, Number.isInteger(value.limit) ? value.limit : null); + const said = (value.said || []).slice(0, 2).map(text => typeof text === 'string' && text ? text.slice(0, 200) : null); + const text = said[0] && said[1] ? t(...said) : partsLimitText(code, t, Number.isInteger(value.limit) ? value.limit : null); // A refused Generate keeps its reason on the bar's own line until the choice or the parts change. if (step === 'generate' && genbar && out === notify) genbar.say(text, false, null, true); else out(text); return {ok: false, reason: code, say: text}; @@ -488,7 +494,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given if (['busy', 'locked', 'text', 'audio_full', 'overlap', 'range', 'no_audio'].includes(code)) { if (['locked', 'audio_full', 'overlap', 'range'].includes(code)) tracks?.flashBlocked?.(value.displayFrame); const said = {busy: t('This part is generating.', '这一段正在生成。'), locked: t('This track is locked.', '这条轨道已锁定。'), - text: t('Write a description first.', '先写一句描述。'), overlap: t('That spot is taken. Use an empty spot.', '这里已经有片段了,请放到空白处。'), + text: t('Write a prompt first.', '先写一句提示词。'), overlap: t('That spot is taken. Use an empty spot.', '这里已经有片段了,请放到空白处。'), audio_full: t('Both audio tracks are full here. Move an audio clip first.', '这里两条声音轨都满了,请先挪开一段声音。'), no_audio: t('This clip has no sound. Please choose one with sound.', '这个素材没有声音,请选一段有声音的。')}[code]; if (said) out(said); @@ -810,7 +816,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given } } if (disposed || closing || epoch !== projectEpoch) return; - if (picture) notify(t('Saved the current frame to Edit image > Generate with AI > Works.', + if (picture) notify(t('Saved the current frame to Edit image > Generate with AI > Creations.', '已保存当前帧,位于“编辑图片 > AI 生成 > 作品库”。')); } catch (value) { if (disposed || epoch !== projectEpoch) return; @@ -818,7 +824,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given range: t('There is no picture at this position. Move the playhead onto a clip.', '这个位置没有画面,请把播放头移到片段上。'), generating: t('This part is still being generated. Save the frame when it is done.', '这一段还在生成,完成后再保存。'), unreadable: t('A source file cannot be read. Import it again from the library.', '有素材读不出来,请在素材库重新导入。'), - not_writable: t('The picture folder cannot be written to. Check that the folder can be written to, then save the frame again.', '图片文件夹不可写。请检查这个文件夹的写入权限后再保存。'), + not_writable: t('The image folder cannot be written to. Check that the folder can be written to, then save the frame again.', '图片文件夹不可写。请检查这个文件夹的写入权限后再保存。'), disk_full: t('The disk is full. Free some space, then save the frame again.', '磁盘空间不足,请清理出空间后再保存。')}[value?.reason]; if (said) notify(said); else error(value, 'frame'); } finally { savingFrame = false; } @@ -831,7 +837,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given exportButton.classList.toggle('fv-primary', !!model.exportFrames(state.record) && !state.selection && !jobActive() && !exportStatus); const running = exportPreparing || ['running', 'queued'].includes(exportStatus?.state); if (['running', 'queued'].includes(exportStatus?.state) && exportStatus.queued) exportButton.textContent = t('Queued', '排队中'); - else if (['running', 'queued'].includes(exportStatus?.state)) exportButton.textContent = t(`Export ${Math.round((exportStatus.fraction || 0) * 100)}%`, `导出 ${Math.round((exportStatus.fraction || 0) * 100)}%`); + else if (['running', 'queued'].includes(exportStatus?.state)) exportButton.textContent = t('Export {percent}%', '导出 {percent}%', { percent: Math.round((exportStatus.fraction || 0) * 100) }); else if (exportPreparing) exportButton.textContent = queue.dirty ? t('Saving changes…', '正在保存改动…') : t('Exporting', '正在导出'); else exportButton.textContent = exportStatus?.state === 'done' && exportMatches() ? t('View', '查看') : t('Export', '导出'); // Never disabled: a press that cannot export says why next to it. @@ -858,8 +864,11 @@ export function openEditor({api, app, from = null, panel = {}, components: given if (!value.node || !value.prompt?.[value.node]) throw new Error('missing_node'); const inputs = value.prompt[value.node].inputs; // With the creation panel's bar in the editor, its values are the request's (the edit's size is its starting point). - if (!panel.barActive) Object.assign(inputs, state.record.settings || {}, capability.generationSize || generationSize(state.record)); - else if (bar?.overrides) for (const [name, setting] of Object.entries(bar.overrides())) if (name in inputs && !Array.isArray(inputs[name])) inputs[name] = setting; + if (!panel.barActive) { + Object.assign(inputs, state.record.settings || {}, capability.generationSize || generationSize(state.record)); + // Its own level is the edit's (its project cannot hold the Fast level): the node's Fast setting does not come with it. + if ('fast_mode' in inputs && EDIT_SAMPLING.some(key => key in (state.record.settings || {}))) inputs.fast_mode = 'none'; + } else if (bar?.overrides) for (const [name, setting] of Object.entries(bar.overrides())) if (name in inputs && !Array.isArray(inputs[name])) inputs[name] = setting; // The first-frame reference is the work's own setting, the one the length limit is worked out from. if (panel.barActive && 'first_frame_reference' in inputs && !Array.isArray(inputs.first_frame_reference)) inputs.first_frame_reference = state.record.settings?.first_frame_reference === true; // The media panel's pictures guide every part (the engine keeps only the references for a part that continues); @@ -1197,7 +1206,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given const rows = listed.filter(row => row.id !== state.record.id && !hiddenEmptyEdit(row, initial())); if (disposed || menu.hidden || !menu.contains(name)) return; if (rows.length || unread) { const line = el('div'); line.setAttribute('role', 'separator'); menu.append(line); } for (const row of rows) { const item = button(row.name || new Date(row.updated_at).toLocaleDateString(), () => switchProject(row.id), 'fv-ed-project'); item.setAttribute('role', 'menuitem'); item.title = item.textContent; menu.append(item); } - if (unread) menu.append(el('p', 'fv-ed-unreadable', t(`${unread} ${unread === 1 ? 'edit' : 'edits'} could not be read`, `另有 ${unread} 个剪辑无法读取`))); + if (unread) menu.append(el('p', 'fv-ed-unreadable', (unread === 1 ? t('1 edit could not be read', '另有 1 个剪辑无法读取') : t('{count} edits could not be read', '另有 {count} 个剪辑无法读取', { count: unread })))); } catch (value) { error(value, null, undefined, 'projects'); } name.focus(); name.select(); } @@ -1328,7 +1337,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given if (ids.length === 1 && music.target({kind: 'clip', ids})) return music.describe(ids[0], text); if (ids.length === 1 && narration.target({kind: 'clip', ids})) return narration.describe(ids[0], text); if (!ids.every(id => editablePart(model.find(state.record, id)))) return false; - try { state.apply(t('Edit description', '修改说明'), record => model.describePlanned(record, ids, text)); return true; } + try { state.apply(t('Edit prompt', '修改提示词'), record => model.describePlanned(record, ids, text)); return true; } catch (value) { if (value instanceof model.EditError) return false; throw value; } }, needsText(selection = state.selection) { @@ -1510,13 +1519,16 @@ export function openEditor({api, app, from = null, panel = {}, components: given Object.assign(frozen.prompt[frozen.node].inputs, follow || {}); // A preview is one part; any other part samples both passes, whatever the panel shows. const inputs = frozen.prompt[frozen.node].inputs, alone = request.blocks.length === 1 && (store.continuationPreview || !beforeKeys.some(Boolean)); + // The Fast level makes one part that continues nothing; any other part samples as the control then says. + if ('fast_mode' in inputs && inputs.fast_mode !== 'none' && (!panel.fastOffered || secondPass || request.blocks.length !== 1 || beforeKeys.some(Boolean))) + Object.assign(inputs, {fast_mode: 'none', two_pass: true, base_steps: 8, refine_steps: 3, step_cache: 'none', upscale_factor: '2'}); if (secondPass) { if (!alone) throw new model.EditError('unsupported'); Object.assign(inputs, {two_pass: true, preview: false, refine_from: secondPass}); } else { // By the steps in this very request: they may have changed on the node since the key was drawn. const stepsFit = beforeKeys.some(Boolean) || typeof inputs.base_steps !== 'number' || inputs.base_steps === 8; - if ('preview' in inputs || previewing) inputs.preview = previewing && alone && stepsFit; + if ('preview' in inputs || previewing) inputs.preview = previewing && alone && stepsFit && (inputs.fast_mode || 'none') === 'none'; if ('refine_from' in inputs) inputs.refine_from = ''; } await followSound(frozen, prepared, ids); @@ -1610,7 +1622,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given selection = state.select(moved); said = t('Moved to the next empty spot.', '已挪到后面的空位。'); genbar?.say(said); } let used = null, texts = null, shown = selection === state.selection; - const before = t('Used the description of the part before.', '沿用了上一段的描述。'), latest = t('Used the latest description.', '沿用了最近一次的描述。'); + const before = t('Used the prompt of the part before.', '沿用了上一段的提示词。'), latest = t('Used the latest prompt.', '沿用了最近一次的提示词。'); let run = partRun(selection); if (run) { // What is in the box is the chosen parts' description; each part goes with its own, and one with @@ -2047,8 +2059,8 @@ export function openEditor({api, app, from = null, panel = {}, components: given {id: 'editor.record', title: ['Record from the microphone', '用麦克风录音'], group: ['Sound', '声音'], run: () => recordTool.click()}, {id: 'editor.adjust', title: ['Adjust the selection', '调整选中的片段'], use: ['Volume, speed, picture and text', '声音、速度、画面和文字'], run: () => adjust.narrow ? adjust.open() : adjustHost.querySelector('[role=tab][aria-selected=true]')?.focus()}, {id: 'editor.import', title: ['Import files', '导入文件'], keywords: ['media', 'library', '素材'], run: press('.fv-ed-library-import')}, - {id: 'editor.history', title: ['Earlier descriptions', '用过的描述'], keywords: ['prompt', 'history', '提示词', '历史'], why: () => genHost.querySelector('.fv-ed-history-button')?.disabled ? t('Choose a part first', '先选中一段') : '', run: press('.fv-ed-history-button')}, - {id: 'editor.frame', title: ['Save the current frame as a picture', '把当前帧存成图片'], run: () => void saveFrame()}, + {id: 'editor.history', title: ['Earlier prompts', '用过的提示词'], keywords: ['prompt', 'history', '提示词', '历史'], why: () => genHost.querySelector('.fv-ed-history-button')?.disabled ? t('Choose a part first', '先选中一段') : '', run: press('.fv-ed-history-button')}, + {id: 'editor.frame', title: ['Save the current frame as an image', '把当前帧存成图片'], run: () => void saveFrame()}, {id: 'editor.new', title: ['New edit', '新建剪辑'], group: ['Edit', '剪辑'], run: () => void switchProject(null)}, {id: 'editor.rename', title: ['Rename or open another edit', '改名或打开其他剪辑'], group: ['Edit', '剪辑'], run: () => void showMenu()}, ]); @@ -2058,7 +2070,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given import('./shortcuts.js').then(module => { if (disposed) return; listeners.push(module.registerShortcuts('editor', [ - {keys: 'Mod+Enter', title: ['Generate (in the description)', '生成(在描述框里)'], group: ['Generate', '生成']}, + {keys: 'Mod+Enter', title: ['Generate (in the prompt box)', '生成(在提示词框里)'], group: ['Generate', '生成']}, {keys: 'Mod+Y', title: ['Redo', '重做'], group: ['Editing', '编辑']}, {keys: 'Shift+← / Shift+→', title: ['Back / forward ten frames', '后退 / 前进 10 帧'], group: ['Playback', '播放']}, ])); @@ -2120,7 +2132,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given previous.disabled = busy || multiple || !clips.some(clip => clip.versions.length); const versioned = clips.find(clip => clip.versions.length), list = versioned ? model.takes(versioned) : []; const position = list.findIndex(item => item.index === -1) + 1; - tip(previous, {name: t('Previous version', '上一版'), use: list.length > 1 ? t(`Step back to an earlier take (now take ${position} of ${list.length})`, `换到更早生成的一版(现在是第 ${position}/${list.length} 版)`) : t('Swap this part back to its earlier take', '把这一段换回之前生成的版本'), + tip(previous, {name: t('Previous version', '上一版'), use: list.length > 1 ? t('Step back to an earlier take (now take {position} of {count})', '换到更早生成的一版(现在是第 {position}/{count} 版)', { position, count: list.length }) : t('Swap this part back to its earlier take', '把这一段换回之前生成的版本'), why: !previous.disabled ? '' : busy ? t('This part is generating', '这一段正在生成') : multiple ? t('Select only one part', '只选一段') : t('This part has no earlier take', '这一段没有更早的版本')}); updateSecondPass(); updateZoom(); diff --git a/web/editor_adjust.js b/web/editor_adjust.js index 1c058969..f92c849d 100644 --- a/web/editor_adjust.js +++ b/web/editor_adjust.js @@ -102,7 +102,7 @@ export function createAdjustPanel(host, {state, t, actions}) { host.hidden = !available.length || (narrow && !overlay); toggleButton.hidden = !available.length || !narrow; toggleButton.setAttribute('aria-expanded', String(narrow && overlay)); closeButton.hidden = !narrow; if (shell) { shell.dataset.adjustOpen = String(narrow && overlay); shell.dataset.adjustAvailable = String(!!available.length); } - status.textContent = context.multiple ? t(`${context.count} parts selected`, `已选 ${context.count} 段`) : ''; + status.textContent = context.multiple ? t('{count} parts selected', '已选 {count} 段', { count: context.count }) : ''; status.hidden = !context.multiple; let shownReason = ''; // Nothing chosen: one quiet line instead of a column of greyed controls; every control is back once a part is chosen. diff --git a/web/editor_adjust_picture.js b/web/editor_adjust_picture.js index df5a5b8a..58a0099d 100644 --- a/web/editor_adjust_picture.js +++ b/web/editor_adjust_picture.js @@ -20,7 +20,7 @@ export function createAdjustPicture({state, sources, t, player, notes = null}) { const submit = event => { if (control.input.dataset.editClip === clip?.id && (control.input.value === '' || !Number.isFinite(Number(control.input.value)) || Number(control.input.value) < min || Number(control.input.value) > max)) { - inputError.textContent = t(`${label}: enter a number from ${min} to ${max}${suffix}.`, `${label}:请输入 ${min} 至 ${max}${suffix}。`); + inputError.textContent = t('{label}: enter a number from {min} to {max}{suffix}.', '{label}:请输入 {min} 至 {max}{suffix}。', { label, min, max, suffix }); inputError.hidden = false; invalidClip = clip?.id; control.input.setAttribute('aria-invalid', 'true'); return; } clearError(); diff --git a/web/editor_audio.js b/web/editor_audio.js index 05f6f3a8..5a8d3873 100644 --- a/web/editor_audio.js +++ b/web/editor_audio.js @@ -9,6 +9,7 @@ import {clickSelection} from './editor_select.js'; import {noteAtPointer, startPointerNotes, seconds as secondsText} from './editor_audio_notes.js'; import {tip} from './editor_tips.js'; import {sourceKey, mediaURL} from './editor_store.js'; +import {translatorFor} from './i18n.js'; const el = (tag, cls, text) => { const node = document.createElement(tag); if (cls) node.className = cls; if (text != null) node.textContent = text; return node; }; let styled = false; function styles() { @@ -25,7 +26,7 @@ const tenths = frames => String(Math.round(frames / 24 * 10) / 10); const selectedAudio = state => state.selection?.kind === 'clip' ? state.record.tracks.filter(track => track.kind === 'audio') .flatMap(track => track.clips).filter(clip => state.selection.ids.includes(clip.id) && clip.source && !['queued', 'running'].includes(clip.pending)) : []; export const AUDIO_SHORTCUTS = Object.freeze([{key: 'delete', action: 'removeCrossfade'}, {key: 'backspace', action: 'removeCrossfade'}, {key: 'escape', action: 'clearCrossfade'}]); -export function createAudioActions(state, {t = en => en, error = () => {}} = {}) { +export function createAudioActions(state, {t = translatorFor(null, false), error = () => {}} = {}) { const apply = (label, change, options, report = false) => { try { return state.apply(label, change, options); } catch (value) { if (report) error(value); return {ok: false, reason: value.code || 'audio'}; } }; return { detachAudio: id => { const result = apply(t('Detach audio', '分离原声'), record => sound.detachAudio(record, id)); if (result && result.ok !== false) state.select({kind: 'clip', ids: [id]}); return result; }, @@ -83,7 +84,7 @@ export function createAudioIntegration({state, player, t, error, adjust, library } return integration; } -export function createAudioPanel(host, {state, player, t = en => en, error = () => {}, context}) { +export function createAudioPanel(host, {state, player, t = translatorFor(null, false), error = () => {}, context}) { styles(); const value = controller(state), actions = createAudioActions(state, {t, error}), mode = replaceMode(state); const panel = el('div', 'fv-ed-audio-panel'), message = el('p', 'fv-ed-audio-message'); const form = el('div', 'fv-ed-audio-form'), cross = el('div', 'fv-ed-audio-cross'); @@ -143,7 +144,7 @@ export function createAudioPanel(host, {state, player, t = en => en, error = () const detach = el('button', 'fv-ed-audio-detach', t('Detach audio', '分离原声')); detach.type = 'button'; form.append(detach); const replace = el('button', 'fv-ed-audio-replace', t('Replace audio', '替换声音')); replace.type = 'button'; form.append(replace); cross.append(el('p', '', t('Crossfade', '交叉淡化'))); - const limitNote = frames => noteAtPointer(t(`At most ${secondsText(frames)} s`, `最多 ${secondsText(frames)} 秒`), panel); + const limitNote = frames => noteAtPointer(t('At most {seconds} s', '最多 {seconds} 秒', { seconds: secondsText(frames) }), panel); const junctionLimit = () => { try { return sound.crossfadeLimit(state.record, value.junction); } catch { return null; } }; const duration = input(cross, 'duration', t('Duration', '时长'), 0, 5, 1 / 24, 'number', { onChange: seconds => { if (value.junction) actions.setCrossfade(value.junction, Math.round(seconds * 24)); render(); }, @@ -178,7 +179,7 @@ export function createAudioPanel(host, {state, player, t = en => en, error = () const clips = selectedAudio(state), selected = context?.clips || (state.selection?.kind === 'clip' ? state.record.tracks.flatMap(track => track.clips).filter(clip => state.selection.ids.includes(clip.id)) : []); const count = context?.count ?? selected.filter(clip => !selected.some(other => other.link === clip.id && sound.trackOf(state.record, other.id).kind === 'video')).length; const ctx = context || {t, single: count === 1, multiple: count > 1, hasAudio: !!clips.length, hasVideo: selected.some(clip => sound.trackOf(state.record, clip.id).kind === 'video'), busy: selected.some(clip => ['queued', 'running'].includes(clip.pending))}; - message.textContent = count > 1 ? t(`${count} parts selected`, `已选 ${count} 段`) : ''; + message.textContent = count > 1 ? t('{count} parts selected', '已选 {count} 段', { count }) : ''; message.hidden = !!context || count === 1; const locked = selected.some(clip => sound.trackOf(state.record, clip.id).locked); const reason = disabledReason(ctx, {needs: 'audio'}) || (locked ? t('This track is locked', '这条轨道已锁定') : ''); @@ -198,7 +199,7 @@ export function createAudioPanel(host, {state, player, t = en => en, error = () show(field, clips.map(clip => clip[name] || 0), frames => { field.value = frames / 24; }); } if (clips.length > 1) { - fadeNote.textContent = t(`At most ${tenths(cap)} s`, `最多 ${tenths(cap)} 秒`); + fadeNote.textContent = t('At most {seconds} s', '最多 {seconds} 秒', { seconds: tenths(cap) }); } else fadeNote.textContent = ''; fadeNote.hidden = !fadeNote.textContent; const video = count === 1 ? selected.find(clip => sound.trackOf(state.record, clip.id).kind === 'video') : null; @@ -223,7 +224,7 @@ export function createAudioPanel(host, {state, player, t = en => en, error = () controls.forEach(control => control.dispose()); detach.onclick = replace.onclick = remove.onclick = null; }}; } const paths = {muted: 'M2 6h3l4-3v10l-4-3H2zM12 5l3 6M15 5l-3 6', solo: 'M5 4h6M5 4v4h6v4H5', locked: 'M4 7h8v7H4zM5 7V4a3 3 0 0 1 6 0v3'}; -export function attachAudioTracks(element, {state, t = en => en, actions = {}}) { +export function attachAudioTracks(element, {state, t = translatorFor(null, false), actions = {}}) { styles(); const value = controller(state), audioActions = createAudioActions(state, {t, error: actions.editError}), mode = replaceMode(state); const notice = el('div', 'fv-ed-audio-notice'); notice.hidden = true; notice.setAttribute('role', 'status'); element.append(notice); let noticeTimer = null; @@ -278,7 +279,7 @@ export function attachAudioTracks(element, {state, t = en => en, actions = {}}) const activate = () => { if (!right.crossfade) { const reach = sound.crossfadeLimit(state.record, right.id); - audioActions.setCrossfade(right.id, 12); if (reach.limit < 12) noteAtPointer(t(`At most ${secondsText(reach.limit)} s`, `最多 ${secondsText(reach.limit)} 秒`), diamond); + audioActions.setCrossfade(right.id, 12); if (reach.limit < 12) noteAtPointer(t('At most {seconds} s', '最多 {seconds} 秒', { seconds: secondsText(reach.limit) }), diamond); return; } state.select({kind: 'clip', ids: [right.id]}); value.junction = right.id; announce(value); render(); }; diamond.onclick = activate; diamond.onkeydown = event => { if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); activate(); } }; diff --git a/web/editor_duration.js b/web/editor_duration.js index a0e64f92..822fc4c5 100644 --- a/web/editor_duration.js +++ b/web/editor_duration.js @@ -113,8 +113,8 @@ export function createDurationField({state, t, actions}) { if (!plan) { input.value = shown(); return; } clearTimeout(hintTimer); hint.hidden = true; if (plan.error) throw plan.error; - if (plan.hint?.least != null) say(t(`At least ${plan.hint.least} s`, `至少 ${plan.hint.least} 秒`)); - else if (plan.hint?.most != null) say(t(`Max ${plan.hint.most} s`, `最长 ${plan.hint.most} 秒`)); + if (plan.hint?.least != null) say(t('At least {least} s', '至少 {least} 秒', { least: plan.hint.least })); + else if (plan.hint?.most != null) say(t('Max {most} s', '最长 {most} 秒', { most: plan.hint.most })); if (plan.change) state.apply(t('Extend', '拉长'), plan.change, {selectionAfter: plan.selectionAfter}); else if (plan.selection) state.select(plan.selection, {history: true}); } catch (error) { diff --git a/web/editor_entry.js b/web/editor_entry.js index 9fe0cb45..936ba4ce 100644 --- a/web/editor_entry.js +++ b/web/editor_entry.js @@ -18,6 +18,8 @@ function editorPanel(node) { get passMode() { return node.freevideoPassMode || null; }, // The creative panel's quality control (levels and steps), shared the same way; null without an open panel. get effort() { return node.freevideoEffort || null; }, + // Whether the planner lists the Fast level on this machine. + get fastOffered() { return node.freevideoFastOffered?.() === true; }, // What a two-pass choice leaves in the panel's sampling settings now. sampling() { const now = read(); @@ -58,7 +60,7 @@ export function openEditorView(node, {studio, work = null, extend = false, onPro return element && !element.hidden && element.getClientRects().length ? element.textContent.replace(/\s+/g, ' ').trim() : ''; }; // The block already shows the overall percentage; the bar keeps only the stage sentence. - const stage = words('.fv-generation-label').replace(/(本步 \d+%)$| \(\d+% of this step\)$/, ''); + const stage = words('.fv-generation-label'); const eta = progressElement.querySelector('.fv-generation-eta'); const shown = eta && !eta.hidden ? eta.dataset : null, left = shown?.seconds != null ? Number(shown.seconds) : null; return {stage, time: words('.fv-generation-status'), stall: words('.fv-generation-stall'), diff --git a/web/editor_expand.js b/web/editor_expand.js index cc8e77cd..1d282084 100644 --- a/web/editor_expand.js +++ b/web/editor_expand.js @@ -1,4 +1,5 @@ import {isolateDialogKeys, listenDialogKey, routeDialogKey} from './dialog_keys.js'; +import {translatorFor} from './i18n.js'; // The creative panel loads this file eagerly, so the hover-help writer is local (the timeline's tips module stays lazy). function setTip(element, {name, use, why = ''}) { for (const [attribute, value] of [['data-fv-tip-name', name], ['data-fv-tip-use', use], ['data-fv-tip-why', why]]) { @@ -25,12 +26,12 @@ const el = (tag, cls, text) => { // The supplied textarea owns the text. Both views use its input handler; callers // changing its value or generation policy programmatically send input or change. -export function createExpandButton({t = en => en, textarea, onGenerate, canGenerate, onDraft = () => {}}) { +export function createExpandButton({t = translatorFor(null, false), textarea, onGenerate, canGenerate, onDraft = () => {}}) { loadStyle(); const element = el('button', 'fv-ed-expand'); element.type = 'button'; // It opens a large box for a long description (it does not zoom anything): named for what it does. element.setAttribute('aria-label', t('Write in a large box', '在大窗口里写')); - setTip(element, {name: t('Expand', '放大编辑'), use: t('Write a long description in a large box', '在大窗口里写长描述')}); + setTip(element, {name: t('Expand', '展开编辑'), use: t('Write a long prompt in a large box', '在大窗口里写长提示词')}); const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttribute('viewBox', '0 0 24 24'); svg.setAttribute('aria-hidden', 'true'); const path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); @@ -75,12 +76,12 @@ export function createExpandButton({t = en => en, textarea, onGenerate, canGener const counted = () => { if (!count) return; const n = Array.from(large.value).length, max = textarea.maxLength > 0 ? textarea.maxLength : 0; - count.textContent = max ? `${n} / ${max}` : t(`${n} characters`, `${n} 字`); + count.textContent = max ? `${n} / ${max}` : t('{n} characters', '{n} 字', { n }); }; function sync() { if (disposed) return; element.disabled = !writable(); - setTip(element, {name: t('Expand', '放大编辑'), use: t('Read or edit the description in a large box', '在大窗口里看或改描述'), + setTip(element, {name: t('Expand', '展开编辑'), use: t('Read or edit the prompt in a large box', '在大窗口里看或改提示词'), why: element.disabled ? t('Select a part or draw a range to describe first', '先选中一段或画出范围,再写描述') : ''}); if (!dialog) return; // The small box changed from outside (another part selected, text restored): the panel follows. @@ -135,8 +136,8 @@ export function createExpandButton({t = en => en, textarea, onGenerate, canGener dialog = el('dialog', 'fv-ed-expand-dialog'); dialog.dataset.fvOwnTab = ''; // Tab cycles its three controls below; a11y.js stands aside dialog.setAttribute('role', 'dialog'); dialog.setAttribute('aria-modal', 'true'); - dialog.setAttribute('aria-label', t('Description', '描述')); - const head = el('div', 'fv-ed-expand-head'), title = el('strong', 'fv-ed-expand-title', t('Description', '描述')); + dialog.setAttribute('aria-label', t('Prompt', '提示词')); + const head = el('div', 'fv-ed-expand-head'), title = el('strong', 'fv-ed-expand-title', t('Prompt', '提示词')); const dismiss = el('button', 'fv-ed-expand-close'); dismiss.type = 'button'; dismiss.onclick = close; dismiss.setAttribute('aria-label', t('Close', '关闭')); setTip(dismiss, {name: t('Close', '关闭'), use: t('Back to the panel; the text is already in it', '回到面板,改动已经在里面')}); @@ -146,7 +147,7 @@ export function createExpandButton({t = en => en, textarea, onGenerate, canGener seen = textarea.value; large = el('textarea', 'fv-ed-expand-text'); large.value = seen; if (textarea.maxLength >= 0) large.maxLength = textarea.maxLength; - large.setAttribute('aria-label', textarea.getAttribute('aria-label') || t('Description', '描述')); + large.setAttribute('aria-label', textarea.getAttribute('aria-label') || t('Prompt', '提示词')); large.placeholder = textarea.placeholder || ''; const body = el('div', 'fv-ed-expand-body'); body.append(large); const foot = el('div', 'fv-ed-expand-foot'); @@ -154,7 +155,7 @@ export function createExpandButton({t = en => en, textarea, onGenerate, canGener notice = el('div', 'fv-ed-expand-note'); notice.setAttribute('role', 'status'); const done = el('button', 'fv-ed-expand-done', t('Done', '完成')); done.type = 'button'; done.onclick = close; const mod = /Mac|iPhone|iPad/.test(navigator.platform || '') ? '⌘' : 'Ctrl+'; - setTip(done, {name: t('Done', '完成'), use: onGenerate ? t(`Close the panel; ${mod}Enter generates`, `关闭面板;${mod}Enter 直接生成`) : t('Close the panel', '关闭面板')}); + setTip(done, {name: t('Done', '完成'), use: onGenerate ? t('Close the panel; {mod}Enter generates', '关闭面板;{mod}Enter 直接生成', { mod }) : t('Close the panel', '关闭面板')}); foot.append(count, notice, done); dialog.append(head, body, foot); large.oninput = () => { diff --git a/web/editor_export_dialog.js b/web/editor_export_dialog.js index 5434e731..ee12d531 100644 --- a/web/editor_export_dialog.js +++ b/web/editor_export_dialog.js @@ -3,6 +3,7 @@ import {clipPictureSize, differentPictureShape} from './editor_frame.js'; import {transportTime} from './editor_player.js'; import {selectedRange} from './editor_transport_model.js'; import {isolateDialogKeys, listenDialogKey, routeDialogKey} from './dialog_keys.js'; +import {translatorFor} from './i18n.js'; export const EXPORT_SETTINGS_KEY = 'freevideo.editor.export-settings'; const defaults = {short: null, quality: 'high', range: 'whole', only: null, sound_format: 'm4a', fps: 24, audio: null}; @@ -86,7 +87,7 @@ function croppedParts(record, sources, range) { && differentPictureShape(clipPictureSize(clip, sources), record)); } -export async function openExportDialog({parent, state, sources, t = en => en, onError = () => {}, fps = false}) { +export async function openExportDialog({parent, state, sources, t = translatorFor(null, false), onError = () => {}, fps = false}) { // Only the first trigger owns confirmation, even while the stylesheet loads. if (active.has(parent)) return null; let resolve; @@ -167,7 +168,7 @@ export async function openExportDialog({parent, state, sources, t = en => en, on const range = chosenRange(), parts = affected(), n = parts.length; const seconds = sound ? 0 : generatingSeconds(state.record, range); pending.hidden = !seconds; - pending.textContent = t(`${seconds} s still generating; that part exports as black.`, `有 ${seconds} 秒还在生成,导出后这部分是黑屏`); + pending.textContent = t('{seconds} s still generating; that part exports as black.', '有 {seconds} 秒还在生成,导出后这部分是黑屏', { seconds }); links.hidden = sound || !n; notices.hidden = links.hidden && pending.hidden; if (dialog.open) fitSegments(); fit.disabled = parts.some(clip => ['queued', 'running'].includes(clip.pending)); diff --git a/web/editor_genbar.js b/web/editor_genbar.js index 17f36b9c..2a2de6f8 100644 --- a/web/editor_genbar.js +++ b/web/editor_genbar.js @@ -1,5 +1,6 @@ // The editor owns its generation controls; progress can use the optional component. import { cutTip } from './cut_tip.js'; +import { pageLanguage } from './i18n.js'; import {createFirstFrameSwitch} from './editor_first_frame.js'; import {createDurationField} from './editor_duration.js'; import {createEditorReferences} from './editor_references.js'; @@ -11,7 +12,7 @@ import {waitingText} from './chain_support.js'; import {showEmptyPrompt} from './empty_prompt_notice.js'; import {segmented} from './editor_adjust.js'; import {createPassMode} from './pass_mode.js'; -import {createSamplingEffort, continuationUpscale, effortFor} from './sampling_effort.js'; +import {createSamplingEffort, continuationUpscale, effortFor, stepsWords} from './sampling_effort.js'; import {createVoicePanel} from './editor_voice.js'; import {createInstallPanel} from './editor_voice_install.js'; import * as dubbing from './editor_voice_model.js'; @@ -25,13 +26,14 @@ function loadEffortSheet() { } const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }; export const timeEstimate = (seconds, t) => seconds == null ? '' : seconds < 60 - ? t(`about ${Math.max(1, Math.ceil(seconds))} s`, `约 ${Math.max(1, Math.ceil(seconds))} 秒`) - : t(`about ${Math.ceil(seconds / 60)} minutes`, `约 ${Math.ceil(seconds / 60)} 分钟`); + ? t('about {seconds} s', '约 {seconds} 秒', { seconds: Math.max(1, Math.ceil(seconds)) }) + : t('about {minutes} minutes', '约 {minutes} 分钟', { minutes: Math.ceil(seconds / 60) }); // A start of a few seconds reads "Starting…"; a longer one counts in the same form as the other waiting lines. export const startingText = (s, t) => { const m = Math.floor(s / 60), r = s % 60; - return s < 3 ? t('Starting…', '正在开始…') : s < 60 ? t(`Starting · ${s} s`, `正在开始 · ${s} 秒`) - : t(`Starting · ${m} min${r ? ` ${r} s` : ''}`, `正在开始 · ${m} 分${r ? ` ${r} 秒` : ''}`); + return s < 3 ? t('Starting…', '正在开始…') : s < 60 ? t('Starting · {s} s', '正在开始 · {s} 秒', { s }) + : r ? t('Starting · {minutes} min {seconds} s', '正在开始 · {minutes} 分 {seconds} 秒', { minutes: m, seconds: r }) + : t('Starting · {minutes} min', '正在开始 · {minutes} 分', { minutes: m }); }; // Provisional copy keys for Iris; decode/save sentences follow Studio's stage vocabulary. export const CLIP_FINALIZATION_COPY = { @@ -105,12 +107,13 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { const passControl = passMenu ? createPassMode({t, onChoose: mode => { actions.choosePass(mode); render(); }, listen: routed}) : null; // The creative panel's quality control (same component, same levels), above the two-pass choice in the same menu. // The steps are told where the control shows its estimate, which an edit has no use for: "8 + 3 steps", "8 steps", "12 steps". - const stepsText = (steps, twoPass, refine) => `${steps}${twoPass ? ' + ' + refine : ''} ${steps === 1 && !twoPass ? t('step', '步') : t('steps', '步')}`; + const stepsText = (steps, twoPass, refine) => stepsWords(t, steps, twoPass, refine); let quality = null, previewing = false, twoPassTitle = null; const effortControl = passMenu && actions.effort ? createSamplingEffort(t, {onChange: tier => { previewing = false; actions.chooseEffort(tier); render(); }, onPreview: tier => { previewing = !!tier; - if (tier) effortControl.setEstimate(stepsText(tier.steps, tier.twoPass, 3)); + // The Fast level's steps are the engine's: no count is shown for it. + if (tier) effortControl.setEstimate(tier.fast ? '' : stepsText(tier.steps, tier.twoPass, 3)); else if (quality) effortControl.setEstimate(stepsText(quality.baseSteps, quality.twoPass, quality.refineSteps)); }, levels: actions.effortLevels?.() || undefined}) : null; @@ -118,8 +121,8 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { let stopPass = null, stopEffort = null; if (passMenu) { const toggle = el('summary'); toggle.setAttribute('aria-label', t('Sampling', '采样')); toggle.append(el('span', 'fv-chevron')); - tip(toggle, {name: t('Sampling', '采样'), use: t('Quality level and the two-pass choice for this part', '这一段的质量档位和二采')}); - const panel = el('div', 'fv-ed-pass-menu'); twoPassTitle = el('strong', 'fv-ed-pass-sub', t('Two-pass', '二采')); + tip(toggle, {name: t('Sampling', '采样'), use: t('Quality level and the second pass choice for this part', '这一段的质量档位和二采')}); + const panel = el('div', 'fv-ed-pass-menu'); twoPassTitle = el('strong', 'fv-ed-pass-sub', t('Second pass', '二采')); panel.append(el('strong', null, t('Sampling', '采样')), ...(effortControl ? [effortControl.element, twoPassTitle] : []), passControl.element); passMenu.append(toggle, panel); passMenu.hidden = true; generate.after(passMenu); stopPass = actions.onPass?.(() => render()) || null; @@ -174,7 +177,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { musicBytes = await music.downloadBytes(); if (disposed) return; } - musicAssets.textContent = musicBytes > 0 ? t(`Downloads before generating: music model ${size(musicBytes)}`, `生成前会先下载:配乐模型 ${size(musicBytes)}`) : ''; + musicAssets.textContent = musicBytes > 0 ? t('Downloads before generating: music model {size}', '生成前会先下载:配乐模型 {size}', { size: size(musicBytes) }) : ''; musicAssets.hidden = !(musicBytes > 0) || host.dataset.mode !== 'selected' || !music.target(); } // A new line said on an empty stretch of the recording track: the voice row above the description, and the dubbing @@ -189,7 +192,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { description.after(duration.element); // Where a narrow English bar starts Generate on a line of its own (editor.css); hidden elsewhere. const lineBreak = el('span', 'fv-ed-genbar-break'); lineBreak.setAttribute('aria-hidden', 'true'); - generate.before(lineBreak); host.lang = t('en', 'zh-CN'); + generate.before(lineBreak); host.lang = pageLanguage(); // Dubbing: the lines of a chosen stretch of speech take the description box's place. const voice = actions.voice || null, voicePanel = voice ? createVoicePanel(host, voice.controller, {t}) : null; if (voicePanel) tray.append(voicePanel.element); @@ -259,7 +262,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { await actions.downloadFailureReport?.(id, {bar: failureBar, anchor: report.hidden ? failureReason : report, t, current: () => !disposed && failureId === id && !failure.hidden}); } catch (value) { - actions.notify?.(t(`Downloading the diagnostic report failed: ${value.message || value}`, `下载诊断报告时出错:${value.message || value}`), ['Editor diagnostic report', '剪辑器诊断报告']); + actions.notify?.(t('Downloading the diagnostic report failed: {reason}', '下载诊断报告时出错:{reason}', { reason: value.message || value }), ['Editor diagnostic report', '剪辑器诊断报告']); } finally { downloading = false; report.disabled = false; } } report.onclick = () => downloadFailure(); @@ -329,7 +332,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { input.placeholder = !writable ? t('Describe the part to generate', '描述要生成的片段') : musical ? t('Describe the music', '描述配乐') : narrated ? t('Write what to say', '写下要说的话') : sound ? t('Describe the picture', '描述画面') : t('Describe this part', '描述这一段'); // The timeline's own stretch carries 'video-empty-range' (drawn on the picture row); the bar has a name of its own. if (sound) host.dataset.tourId = 'sound-range-bar'; else delete host.dataset.tourId; - input.setAttribute('aria-label', t('Description', '描述')); + input.setAttribute('aria-label', t('Prompt', '提示词')); // A video part becomes the next step once it has words: with the box empty Generate stays a secondary key (never // greyed; pressing it still asks whether to go on without a description). const wordless = !voiced && !musical && !narrated && !input.value.trim(); @@ -362,7 +365,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { const left = words?.over ? null : words?.left ?? remaining; const time = finalization ? '' : words?.stall || (words?.over ? t('Taking longer than expected', '比预计久,仍在生成') : words?.time || (left != null ? timeEstimate(left, t) : '')); const stage = finalization ? t(...CLIP_FINALIZATION_COPY[finalization.key]) : words?.stage || (count === 1 && !time ? t('Preparing', '正在准备') : ''); - const spans = [['fv-ed-gen-part', count > 1 ? t(`Part ${number}/${count}`, `第 ${number}/${count} 段`) : ''], + const spans = [['fv-ed-gen-part', count > 1 ? t('Part {number}/{count}', '第 {number}/{count} 段', { number, count }) : ''], ['fv-ed-gen-stage', stage], ['fv-ed-gen-time', time]]; const shown = spans.filter(([, text]) => text).map(([cls, text], index) => [cls, index ? ` · ${text}` : text]); hint.replaceChildren(...shown.map(([cls, text]) => el('span', cls, text))); @@ -410,13 +413,13 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { const medium = effortFor(8, true, 3, null, levels || undefined, Number(factor))?.name === 'Medium'; quality = {baseSteps: 8, refineSteps: 3, twoPass: true, stepCache: null, upscale: Number(factor), disabled: true, reason: lock === 'continuation' - ? (medium ? t('A continuation uses the Medium level.', '接着生成使用标准档。') : t('A continuation uses the Light level.', '接着生成使用轻量档。')) + ? (medium ? t('An extended part uses the Medium level.', '接着生成使用标准档。') : t('An extended part uses the Light level.', '接着生成使用轻量档。')) : (medium ? t('Each part of a video made in parts uses the Medium level.', '分段生成时,每段使用标准档。') : t('Each part of a video made in parts uses the Light level.', '分段生成时,每段使用轻量档。'))}; } effortControl.update(quality); // On the wrapper too: a disabled control may not raise its own hover. effortControl.element.title = lock ? quality.reason : ''; - if (!previewing) effortControl.setEstimate(stepsText(quality.baseSteps, quality.twoPass, quality.refineSteps)); + if (!previewing) effortControl.setEstimate(quality.fast ? '' : stepsText(quality.baseSteps, quality.twoPass, quality.refineSteps)); } if (passMenu.hidden) passMenu.open = false; } @@ -429,9 +432,9 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { resizeDescription(); input.dispatchEvent(new Event('change')); tip(generate, {name: verbText.textContent, key: `${modKey}↵`, - use: downloadText() || (musical ? t('Make music for the chosen stretch', '为选中的范围生成配乐') : narrated ? t('Say the words in the chosen voice', '用选中的音色说出这段话') + use: downloadText() || (musical ? t('Make music for the chosen range', '为选中的范围生成配乐') : narrated ? t('Say the words in the chosen voice', '用选中的音色说出这段话') : voiced ? t('Say the changed lines again', '把改过的台词重新配音') : !selected ? t('Choose a part or drag a range on the timeline first', '先在时间线上选中一段或拖出范围') - : generate.dataset.wordless === 'true' ? t('Write a description first', '先写描述') : t('Make the chosen part from the description', '按描述生成选中的这一段')), + : generate.dataset.wordless === 'true' ? t('Write a prompt first', '先写提示词') : t('Make the chosen part from the prompt', '按提示词生成选中的这一段')), why: !generate.disabled ? '' : busy ? t('This part is generating; Cancel stops it', '这一段正在生成,可按“取消”停止') : previewSelection ? t('Release the range first', '先松开拖动的范围') : !narrated && actions.generationWaiting?.() ? t('Waiting for generation to be ready', '正在等生成服务就绪') @@ -440,14 +443,14 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { tip(cancel, {name: t('Cancel', '取消'), use: t('Stop this part; it stays as a draft', '停止生成,这一段留作草稿')}); tip(resume, {name: t('Continue', '继续'), use: t('Start the stopped parts again', '把停下的段接着生成')}); historyButton.disabled = input.disabled; - tip(historyButton, {name: t('Earlier descriptions', '用过的描述'), use: t('Reuse a description you generated with', '重用以前生成时写过的描述'), why: input.disabled ? t('Choose a part first', '先选中一段') : ''}); - tip(input, {name: t('Description', '描述'), use: t('What this part should show', '写下这一段要生成的内容'), key: `${modKey}↵ ${t('generates', '生成')}`, + tip(historyButton, {name: t('Earlier prompts', '用过的提示词'), use: t('Reuse a prompt you generated with', '重用以前生成时写过的提示词'), why: input.disabled ? t('Choose a part first', '先选中一段') : ''}); + tip(input, {name: t('Prompt', '提示词'), use: t('What this part should show', '写下这一段要生成的内容'), key: `${modKey}↵ ${t('generates', '生成')}`, why: input.disabled ? (busy ? t('This part is generating', '这一段正在生成') : t('Choose a part or drag a range first', '先选中一段或在时间线上拖出范围')) : ''}); if (assets) { if (selected && !busy && !musical && !narrated) assets.refresh(); else assets.element.hidden = true; } showMusicAssets(selected && !busy && musical && !previewSelection); if (sayAssets) { const bytes = narrated && !busy ? narration.downloadBytes() : 0; - sayAssets.textContent = bytes > 0 ? t(`Downloads before generating: dubbing model ${size(bytes)}`, `生成前会先下载:配音模型 ${size(bytes)}`) : ''; + sayAssets.textContent = bytes > 0 ? t('Downloads before generating: dubbing model {size}', '生成前会先下载:配音模型 {size}', { size: size(bytes) }) : ''; sayAssets.hidden = !(bytes > 0); } if (selected && !busy && !voiced && !installing) { @@ -533,7 +536,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { // A large first download (the dubbing model) is asked about in the tray before it starts (E26). const askDownload = el('div', 'fv-ed-gen-ask'); askDownload.hidden = true; askDownload.setAttribute('role', 'alertdialog'); tray.append(askDownload); function confirmDownload(bytes) { - const words = el('span', 'fv-ed-gen-ask-text', t(`The first line downloads the dubbing model (${size(bytes)}) before it is made.`, `第一次配音要先下载配音模型(${size(bytes)}),下载完再生成。`)); + const words = el('span', 'fv-ed-gen-ask-text', t('The first line downloads the dubbing model ({size}) before it is made.', '第一次配音要先下载配音模型({size}),下载完再生成。', { size: size(bytes) })); const go = el('button', 'fv-primary', t('Download and generate', '下载并生成')), no = el('button', null, t('Not now', '先不下载')); go.type = no.type = 'button'; tip(go, {name: t('Download and generate', '下载并生成'), use: t('Fetch the model once, then say the line', '下载一次模型,然后生成这句')}); @@ -549,7 +552,7 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { emptyWatch?.disconnect(); const watch = new ResizeObserver(() => place()); const box = showEmptyPrompt({t, anchor: host.lastElementChild, field: input, onContinue: () => press(true), - text: t('The description is empty.', '描述为空。'), onGone: () => watch.disconnect()}); + text: t('The prompt is empty.', '提示词为空。'), onGone: () => watch.disconnect()}); // The press is still settling (Generate's label, Cancel), so it follows the keys until it is gone. const place = () => { if (!box.isConnected) { watch.disconnect(); return; } @@ -604,16 +607,16 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) { const historyButton = el('button', 'fv-ed-history-button'); historyButton.type = 'button'; historyButton.setAttribute('aria-haspopup', 'menu'); historyButton.setAttribute('aria-expanded', 'false'); { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttribute('viewBox', '0 0 16 16'); svg.setAttribute('aria-hidden', 'true'); svg.classList.add('fv-ed-glyph'); const path = document.createElementNS(svg.namespaceURI, 'path'); path.setAttribute('d', 'M2.5 8a5.5 5.5 0 1 0 1.6-3.9M2.5 2.5v2.6h2.6M8 5v3l2 1.5'); svg.append(path); historyButton.append(svg); } - historyButton.setAttribute('aria-label', t('Earlier descriptions', '用过的描述')); + historyButton.setAttribute('aria-label', t('Earlier prompts', '用过的提示词')); const historyList = el('div', 'fv-ed-history'); historyList.hidden = true; historyList.setAttribute('role', 'menu'); tray.append(historyList); function closeHistory(focus = false) { historyList.hidden = true; historyButton.setAttribute('aria-expanded', 'false'); if (focus) historyButton.focus(); } function openHistory() { const items = readHistory(); - historyList.replaceChildren(el('div', 'fv-ed-history-title', t('Earlier descriptions', '用过的描述'))); - if (!items.length) historyList.append(el('p', 'fv-ed-history-empty', t('Descriptions you generate with show here.', '生成过的描述会出现在这里。'))); + historyList.replaceChildren(el('div', 'fv-ed-history-title', t('Earlier prompts', '用过的提示词'))); + if (!items.length) historyList.append(el('p', 'fv-ed-history-empty', t('Prompts you generate with show here.', '生成过的提示词会出现在这里。'))); for (const text of items) { const item = el('button', 'fv-ed-history-item', text); item.type = 'button'; item.setAttribute('role', 'menuitem'); - tip(item, {name: t('Use this description', '用这段描述'), use: t('Put it in the box; nothing is generated yet', '放进描述框,还不会生成')}); + tip(item, {name: t('Use this prompt', '用这段提示词'), use: t('Put it in the prompt box; nothing is generated yet', '放进提示词框,还不会生成')}); item.onclick = () => { input.value = text; typed(text); closeHistory(); render(); input.focus(); }; historyList.append(item); } diff --git a/web/editor_library.js b/web/editor_library.js index e1002cfe..d8a63d0a 100644 --- a/web/editor_library.js +++ b/web/editor_library.js @@ -186,7 +186,8 @@ export function createEditorLibrary(host, {store, t, actions, state}) { strip.setAttribute('aria-label', t('Delete this clip', '删除这个素材')); const users = asking.users, hint = el('small', asking.failed && !asking.busy ? 'fv-ed-source-confirm-problem' : null, asking.busy ? t('Deleting…', '正在删除…') : asking.failed ? t('Could not delete', '删除失败,请重试') - : users ? t(`Used in ${users} ${users === 1 ? 'edit' : 'edits'}`, `已用于 ${users} 个剪辑`) : t('Original file kept', '原文件保留')); + : !users ? t('Original file kept', '原文件保留') + : users === 1 ? t('Used in 1 edit', '已用于 1 个剪辑') : t('Used in {count} edits', '已用于 {count} 个剪辑', { count: users })); const buttons = el('div', 'fv-ed-source-confirm-actions'); const no = el('button', 'fv-ed-source-confirm-no', t('Cancel', '取消')), yes = el('button', 'fv-ed-source-confirm-yes', t('Delete', '删除')); for (const control of [no, yes]) { control.type = 'button'; control.disabled = asking.busy; } @@ -276,7 +277,8 @@ export function createEditorLibrary(host, {store, t, actions, state}) { if (where) message.append(issueButton(t, () => ({where, message: text}))); } const unread = tab === 'import' ? importUnread : 0; - unreadable.textContent = unread ? t(`${unread} imported ${unread === 1 ? 'file' : 'files'} could not be read`, `另有 ${unread} 个导入的文件无法读取`) : ''; + unreadable.textContent = !unread ? '' : unread === 1 ? t('1 imported file could not be read', '另有 1 个导入的文件无法读取') + : t('{count} imported files could not be read', '另有 {count} 个导入的文件无法读取', { count: unread }); if (!focusAfter && keep) focusAfter = keep.button ? {again: keep} : keep.control ? {control: keep} : keep.card ? {card: keep.card} : {next: null}; if (focusAfter) { const target = focusAfter; focusAfter = null; diff --git a/web/editor_lifecycle.js b/web/editor_lifecycle.js index 483722c9..3173f5da 100644 --- a/web/editor_lifecycle.js +++ b/web/editor_lifecycle.js @@ -20,14 +20,18 @@ export const hiddenEmptyEdit = (row, initial) => row.frames === 0 && !row.keep_e export const deleteEditText = (t, name = '') => ({ item: t('Delete edit', '删除剪辑'), - confirm: t(`Delete "${name}"? This can't be undone.`, `删除“${name}”?删除后无法恢复。`), + confirm: t('Delete "{name}"? This can\'t be undone.', '删除“{name}”?删除后无法恢复。', { name }), remove: t('Delete', '删除'), cancel: t('Cancel', '取消'), also: residue => { - const part = (count, one, many, zh) => count ? [t(`${count} ${count === 1 ? one : many}`, `${count} ${zh}`)] : []; - const items = [...part(residue?.imports?.length, 'imported file', 'imported files', '个导入素材'), ...part(residue?.music?.length, 'music track', 'music tracks', '段配乐'), - ...part(residue?.voice?.length, 'voiceover', 'voiceovers', '段配音'), ...part(residue?.stems?.length, 'stem set', 'stem sets', '组分轨'), - ...part(residue?.sound?.length, 'sound effect', 'sound effects', '段音效')]; - return items.length ? t(`Also deletes media used only by this edit: ${items.join(', ')}.`, `同时删除只在这个剪辑中使用的 ${items.join('、')}。`) : ''; + // Each kind: how many, then its one and its many as whole phrases. + const kinds = [ + [residue?.imports?.length, () => t('1 imported file', '1 个导入素材'), count => t('{count} imported files', '{count} 个导入素材', { count })], + [residue?.music?.length, () => t('1 music track', '1 段配乐'), count => t('{count} music tracks', '{count} 段配乐', { count })], + [residue?.voice?.length, () => t('1 voiceover', '1 段配音'), count => t('{count} voiceovers', '{count} 段配音', { count })], + [residue?.stems?.length, () => t('1 stem set', '1 组分轨'), count => t('{count} stem sets', '{count} 组分轨', { count })], + [residue?.sound?.length, () => t('1 sound effect', '1 段音效'), count => t('{count} sound effects', '{count} 段音效', { count })]]; + const items = kinds.filter(([count]) => count).map(([count, one, many]) => count === 1 ? one() : many(count)); + return items.length ? t('Also deletes media used only by this edit: {items}.', '同时删除只在这个剪辑中使用的 {items}。', { items: items.join(t(', ', '、')) }) : ''; }, project_in_use: t('This edit is open in another window. Close it there first.', '这个剪辑在另一个窗口中打开,请先在那里关闭。'), generation_active: t('This edit is still generating. You can delete it when it finishes.', '正在生成,完成后才能删除。'), diff --git a/web/editor_loader.js b/web/editor_loader.js index 4ad20b43..206fdcb2 100644 --- a/web/editor_loader.js +++ b/web/editor_loader.js @@ -11,8 +11,9 @@ export async function openEditorView(node, options) { if (options?.isCurrent?.() === false) return null; console.warn('FreeVideo edit view:', error); // The page's language as the top bar has it (loaded on demand, so a failure here still reads it). - const cn = await import('./topbar_state.js').then(module => module.CN, () => String(navigator.language || '').toLowerCase().startsWith('zh')); - const detail = cn ? '没有完成,请重试' : 'Could not complete. Try again.'; + const t = await Promise.all([import('./topbar_state.js'), import('./i18n.js')]).then(([state, i18n]) => i18n.translator(state.CN), + () => (en, zh) => String(navigator.language || '').toLowerCase().startsWith('zh') ? zh : en); + const detail = t('Could not complete. Try again.', '没有完成,请重试'); // The native modal is above the host's toast layer. Also use the // workspace's existing failure status so the message stays visible. const status = options?.studio?.querySelector('.fv-status'); diff --git a/web/editor_menu.js b/web/editor_menu.js index e0420b3b..ed27941f 100644 --- a/web/editor_menu.js +++ b/web/editor_menu.js @@ -1,6 +1,7 @@ // Track menus share the selection commands; they never choose an edit's landing position. import * as model from './editor_model.js'; import {clickSelection, createSelectionActions, isTyping, selectedIds, playheadIds} from './editor_select.js'; +import {translatorFor} from './i18n.js'; const registered = new Set(); // Groups appear in first-registration order; matching groups stay together. @@ -14,7 +15,7 @@ export function registerMenuItem(item) { return () => registered.delete(entry); } -export function menuContext({state, commands, t = en => en, actions = {}, clip = null, frame = state.playhead, track = null, +export function menuContext({state, commands, t = translatorFor(null, false), actions = {}, clip = null, frame = state.playhead, track = null, platform = globalThis.navigator?.userAgentData?.platform || globalThis.navigator?.platform || ''}) { const ids = selectedIds(state.record, state.selection), seen = new Set(); let count = 0; @@ -64,7 +65,7 @@ export function menuItems(context) { return [...groups.values()].flat(); } -export function createTrackMenu(host, {state, t = en => en, actions = {}, hitTest, frameAt, trackAt, clipboard, +export function createTrackMenu(host, {state, t = translatorFor(null, false), actions = {}, hitTest, frameAt, trackAt, clipboard, choose = id => state.select(clickSelection(state.record, state.selection, id))} = {}) { const commands = createSelectionActions({state, t, actions, ...(clipboard ? {clipboard} : {})}); const element = document.createElement('div'); @@ -111,7 +112,7 @@ export function createTrackMenu(host, {state, t = en => en, actions = {}, hitTes returnFocus = document.activeElement; if (context.where === 'part' && context.count > 1) { const heading = document.createElement('div'); heading.className = 'fv-ed-menu-count'; - heading.textContent = t(`${context.count} parts selected`, `已选 ${context.count} 段`); element.append(heading); + heading.textContent = t('{count} parts selected', '已选 {count} 段', { count: context.count }); element.append(heading); element.setAttribute('aria-label', heading.textContent); } else element.removeAttribute('aria-label'); let previousGroup; diff --git a/web/editor_music.js b/web/editor_music.js index 417d6de2..83f984d3 100644 --- a/web/editor_music.js +++ b/web/editor_music.js @@ -129,7 +129,7 @@ export function createEditorMusic({state, store, t, completeSources = async () = describe(id, text) { const found = target({kind: 'clip', ids: [id]}); if (!found?.clip || api.running({kind: 'clip', ids: [id]}) || found.clip.text === text) return false; - state.apply(t('Edit description', '修改说明'), record => { + state.apply(t('Edit prompt', '修改提示词'), record => { const next = JSON.parse(JSON.stringify(record)); next.tracks.flatMap(track => track.clips).find(clip => clip.id === id).text = text; return next; diff --git a/web/editor_narration.js b/web/editor_narration.js index abfd6ef8..8966c190 100644 --- a/web/editor_narration.js +++ b/web/editor_narration.js @@ -11,8 +11,11 @@ import {tip} from './editor_tips.js'; const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }; const NBSP = ' '; const SVG = 'http://www.w3.org/2000/svg'; -// A take the recording bar saved: "Recording 2026-11-08 101500.wav" in either language. -const RECORDING = /^(Recording|录音) \d{4}-\d{2}-\d{2} \d{6}\.wav$/; +// A take the recording bar saved (takeName): "Recording 2026-11-08 101500.wav" on an English page, "录音 …" on a Chinese +// one, and the page's own word in any other language. Takes of English and Chinese pages, in either script, are known +// on every page. +const escaped = word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +export const takeNames = t => new RegExp(`^(?:${[...new Set(['Recording', '录音', '錄音', t('Recording', '录音')])].map(escaped).join('|')}) \\d{4}-\\d{2}-\\d{2} \\d{6}\\.wav$`); const clock = seconds => { const whole = Math.max(0, Math.round(seconds)); return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, '0')}`; }; // The bar's pace for this machine: seconds of work per second of line, from the last line made. const PACE_KEY = 'fv-editor-say-pace'; @@ -23,25 +26,25 @@ export function narrationBarStatus(job, t) { if (!job || !['queued', 'running', 'waiting'].includes(job.status)) return null; const stage = job.status !== 'running' ? t('Queued', '排队中') : job.phase === 'recognizing' ? t('Finding the lines', '正在识别台词') - : job.phase === 'dubbing' ? t('Generating the voice', '正在生成配音') : t('Preparing', '正在准备'); + : job.phase === 'dubbing' ? t('Generating the voice', '正在生成旁白') : t('Preparing', '正在准备'); return {state: 'running', blocks: [], music: true, words: {stage}}; } // A failed line's sentence on the bar's failure line. export function narrationFailureText(reason, t) { return { - out_of_memory: t('Not enough memory to generate the voice. Close other programs that use the graphics card, then generate again.', '生成配音时内存不足,请关闭其他占用显卡的程序后重新生成。'), + out_of_memory: t('Not enough memory to generate the voice. Close other programs that use the graphics card, then generate again.', '生成旁白时内存不足,请关闭其他占用显卡的程序后重新生成。'), storage_unavailable: t('The disk is full. Free some space, then generate again.', '磁盘空间不足,请清理出空间后再生成。'), no_speech: t('No speech was heard in this voice. Choose another voice.', '这个音色里没有听到说话声,请换一个音色。'), - no_speech_model: t('The speech model could not be used, so the voice could not be generated.', '语音识别模型无法使用,未能生成配音。'), + no_speech_model: t('The speech model could not be used, so the voice could not be generated.', '语音识别模型无法使用,未能生成旁白。'), voice_model_missing: t('The dubbing model is not fully installed. Generate again to download it.', '配音模型没有装全,重新生成会再下载。'), missing: t('Generation stopped. Generate again.', '生成已中断,请重新生成。'), - }[reason] || t('The voice could not be generated. Generate again; if it keeps failing, report the problem.', '无法生成配音。请重新生成;仍然失败时,请提交问题。'); + }[reason] || t('The voice could not be generated. Generate again; if it keeps failing, report the problem.', '无法生成旁白。请重新生成;仍然失败时,请提交问题。'); } // How much longer than the stretch a line came out, as the bar says it: one decimal, a no-break space before the unit. -const longer = (seconds, t) => { const value = (Math.round(seconds * 10) / 10).toFixed(1); return t(`${value}${NBSP}s`, `${value}${NBSP}秒`); }; -export const placedLongerText = (seconds, t) => t(`${longer(seconds, t)} longer than the selection. Placed at full length.`, `比选区长 ${longer(seconds, t)},已按完整长度放入。`); -export const blockedLongerText = (seconds, t) => t(`${longer(seconds, t)} longer than the selection and would cover the next clip. Shorten the line or extend the selection.`, - `比选区长 ${longer(seconds, t)},会盖住后面的片段。请缩短这句或拉长选区。`); +const longer = (seconds, t) => { const value = (Math.round(seconds * 10) / 10).toFixed(1); return t('{value}{NBSP}s', '{value}{NBSP}秒', { value, NBSP }); }; +export const placedLongerText = (seconds, t) => t('{length} longer than the selection. Placed at full length.', '比选区长 {length},已按完整长度放入。', { length: longer(seconds, t) }); +export const blockedLongerText = (seconds, t) => t('{length} longer than the selection and would cover the next clip. Shorten the line or extend the selection.', + '比选区长 {length},会盖住后面的片段。请缩短这句或拉长选区。', { length: longer(seconds, t) }); /** * state, t: the editor's. store: the dubbing calls (editor_voice_store). sources(): the source metadata map. @@ -98,9 +101,10 @@ export function createEditorNarration({state, store, t, sources = () => new Map( function voices(found = target()) { if (!found) return {speakers: [], clips: [], finding: false}; const entry = hear(found); - const speakers = entry?.phase === 'done' ? said.speakerVoices(entry.lines).map(voice => ({...voice, label: t(`Speaker ${voice.number}`, `说话人 ${voice.number}`)})) : []; + const speakers = entry?.phase === 'done' ? said.speakerVoices(entry.lines).map(voice => ({...voice, label: t('Speaker {number}', '说话人 {number}', { number: voice.number })})) : []; const list = []; let takes = 0; + const RECORDING = takeNames(t); for (const {clip, track} of clips().sort((a, b) => a.clip.start - b.clip.start)) { if (track.kind !== 'audio' || !clip.source || clip.pending || clip.speed || clip.reverse || track.stem) continue; // The sound of a picture, music and lines made here are not voices to choose. @@ -108,14 +112,14 @@ export function createEditorNarration({state, store, t, sources = () => new Map( const name = metaOf(clip)?.name; if (clip.source.kind !== 'import' || typeof name !== 'string' || !name) continue; const take = RECORDING.test(name) ? ++takes : 0; - const label = take ? t(`Recording ${take}`, `录音 ${take}`) : name; + const label = take ? t('Recording {take}', '录音 {take}', { take }) : name; list.push({key: `clip:${clip.id}`, kind: 'clip', recording: Boolean(take), label, reference: {clip_id: clip.id}, listen: {clip: clip.id, start: 0, end: Math.min(clip.frames / FPS, 10)}}); } const picked = pickedClip && state.record.tracks.some(track => track.clips.some(clip => clip.id === pickedClip.id && clip.source)) ? pickedClip : null; if (picked && !list.some(voice => voice.key === `clip:${picked.id}`)) { const clip = clips().find(item => item.clip.id === picked.id).clip; - list.push({key: `clip:${clip.id}`, kind: 'clip', label: metaOf(clip)?.name || t(`Sound at ${clock(clip.start / FPS)}`, `${clock(clip.start / FPS)} 处的声音`), + list.push({key: `clip:${clip.id}`, kind: 'clip', label: metaOf(clip)?.name || t('Sound at {time}', '{time} 处的声音', { time: clock(clip.start / FPS) }), reference: {clip_id: clip.id}, listen: {clip: clip.id, start: 0, end: Math.min(clip.frames / FPS, 10)}}); } return {speakers, clips: list, finding: entry?.phase === 'finding', lines: entry?.lines || []}; @@ -248,7 +252,7 @@ export function createEditorNarration({state, store, t, sources = () => new Map( describe(id, text) { const found = target({kind: 'clip', ids: [id]}); if (!found?.clip || api.running({kind: 'clip', ids: [id]}) || found.clip.text === text || !text.trim()) return false; - state.apply(t('Edit description', '修改说明'), record => said.remakeNarration(record, id, text)); + state.apply(t('Edit prompt', '修改提示词'), record => said.remakeNarration(record, id, text)); return true; }, failure(selection = state.selection) { @@ -280,7 +284,7 @@ export function createEditorNarration({state, store, t, sources = () => new Map( // The same plan made on the same record names the same clip: the undo entry chooses it. const plan = record => said.planNarration(record, {track: found.track, start: found.start, frames: found.frames, text: words}); if (!id) id = plan(state.record).id; - state.apply(t('Narration', '配音'), record => found.id ? said.remakeNarration(record, id, words) : plan(record).record, + state.apply(t('Narration', '旁白'), record => found.id ? said.remakeNarration(record, id, words) : plan(record).record, {selectionAfter: {kind: 'clip', ids: [id]}}); if (!found.id && Number.isFinite(state.step)) planned.set(id, state.step); stopListen(); @@ -317,13 +321,13 @@ export function createEditorNarration({state, store, t, sources = () => new Map( }; // The menu entry on an empty spot of the sound tracks: the recording track (added when missing), or the separated // voice track, is chosen there from the spot clicked. - const unregister = registerMenuItem({where: 'empty', group: 'sound', label: context => context.t('Narration', '配音'), + const unregister = registerMenuItem({where: 'empty', group: 'sound', label: context => context.t('Narration', '旁白'), visible: context => available() && (!context.track || ['a1', 'a2', 'a3', said.narrationTrack(state.record)].includes(context.track)), enabled: context => !!said.narrationStretch(context.record, Math.max(0, context.frame | 0)), run: context => { const stretch = said.narrationStretch(state.record, Math.max(0, context.frame | 0)); if (!stretch) return; - if (!state.record.tracks.some(track => track.id === stretch.track)) state.apply(t('Narration', '配音'), said.withRecordingTrack); + if (!state.record.tracks.some(track => track.id === stretch.track)) state.apply(t('Narration', '旁白'), said.withRecordingTrack); state.select({kind: 'range', tracks: [stretch.track], start: stretch.start, frames: stretch.frames}); }}); return api; diff --git a/web/editor_notes.js b/web/editor_notes.js index acfe113a..1e6667da 100644 --- a/web/editor_notes.js +++ b/web/editor_notes.js @@ -20,19 +20,19 @@ export const describedTrack = track => track.kind === 'video' && track.clips.som const agentWrote = record => record.tracks.some(track => track.clips.some(clip => clip.text_by === 'agent')); // Status words appear only in the hover tip and the panels (Iris 10-11). export function blockStatus(clip, t, fraction = 0, interrupted = false) { - if (clip.pending === 'running') return t(`Generating ${Math.round(fraction * 100)}%`, `生成中 ${Math.round(fraction * 100)}%`); + if (clip.pending === 'running') return t('Generating {percent}%', '生成中 {percent}%', { percent: Math.round(fraction * 100) }); if (clip.pending === 'stopped') return interrupted ? t('Interrupted', '上次中断') : t('Stopped', '已停止'); if (clip.pending === 'failed') return t('Unfinished', '未完成'); if (clip.pending) return t('Not generated', '未生成'); const current = model.takes(clip).find(take => take.index === -1); - return model.takes(clip).length > 1 ? t(`Version ${current.number}`, `第 ${current.number} 版`) : ''; + return model.takes(clip).length > 1 ? t('Version {number}', '第 {number} 版', { number: current.number }) : ''; } let serial = 0; export function createBlockNotes({state, t, actions}) { const element = el('div', 'fv-ed-notes'), head = el('div', 'fv-ed-notes-head'); - const label = el('label', 'fv-ed-adjust-label', t('Description', '说明')); + const label = el('label', 'fv-ed-adjust-label', t('Prompt', '提示词')); const again = button(t('Regenerate', '重新生成'), {onClick: () => regenerate()}); again.classList.add('fv-ed-notes-again'); again.prepend(glyph(AGAIN)); - setTip(again, {name: t('Regenerate', '重新生成'), use: t('Make this block again from its description', '按这一段的说明重新生成')}); + setTip(again, {name: t('Regenerate', '重新生成'), use: t('Make this block again from its prompt', '按这一段的提示词重新生成')}); const box = el('textarea', 'fv-ed-notes-text'); box.id = `fv-ed-notes-${++serial}`; box.rows = 1; label.htmlFor = box.id; const versions = el('div', 'fv-ed-notes-versions'), versionsLabel = el('span', 'fv-ed-adjust-label', t('Version', '版本')); head.append(label, again); element.append(head, box, versions); @@ -49,7 +49,7 @@ export function createBlockNotes({state, t, actions}) { function save(id, text) { const clip = model.find(state.record, id); text = text.trim(); if (!clip || text === clip.text) return; - try { state.apply(t('Edit description', '修改说明'), record => model.describe(record, [id], text)); } catch (value) { actions.editError?.(value); } + try { state.apply(t('Edit prompt', '修改提示词'), record => model.describe(record, [id], text)); } catch (value) { actions.editError?.(value); } } function commit() { const id = editing; editing = null; if (id) save(id, box.value); } box.oninput = () => { editing ||= block?.id || null; grow(); }; @@ -79,7 +79,7 @@ export function createBlockNotes({state, t, actions}) { versions.replaceChildren(versionsLabel, picker); } [...picker.children].forEach((control, index) => { - control.setAttribute('aria-label', t(`Version ${list[index].number}`, `第 ${list[index].number} 版`)); + control.setAttribute('aria-label', t('Version {number}', '第 {number} 版', { number: list[index].number })); control.disabled = off || !list[index].usable; }); picker.value = -1; @@ -144,7 +144,7 @@ export function createBlockNotes({state, t, actions}) { if (!clip || model.pair(state.record, clip.id).some(generating)) return false; event.preventDefault(); hideTip(); closeInline(); if (clip.text.trim().includes('\n')) { box.focus(); return true; } - const input = inline = el('input', 'fv-ed-note-input'); input.value = clip.text; input.setAttribute('aria-label', t('Description', '说明')); + const input = inline = el('input', 'fv-ed-note-input'); input.value = clip.text; input.setAttribute('aria-label', t('Prompt', '提示词')); input.style.left = item.element.style.left; input.style.width = item.element.style.width; let done = false; const finish = keep => { if (done) return; done = true; const text = input.value; closeInline(); if (keep) save(clip.id, text); }; diff --git a/web/editor_record_model.js b/web/editor_record_model.js index 27f3242e..2271ed7f 100644 --- a/web/editor_record_model.js +++ b/web/editor_record_model.js @@ -1,6 +1,7 @@ // Recording from a microphone onto the sound tracks. Pure helpers: where a take starts and stops, // the 16-bit WAV a take is saved as (the server tells sound from picture by file suffix), the level shown while recording. import {FPS} from './editor_model.js'; +import {translatorFor} from './i18n.js'; export const COUNTDOWN_SECONDS = 3; const AUDIO_TRACKS = ['a1', 'a2', 'a3']; @@ -53,7 +54,7 @@ export function takeLedger() { export const secondsOf = frames => frames / FPS; // A take's name in the library: 录音 / Recording and the time it began. -export function takeName(date, t = en => en) { +export function takeName(date, t = translatorFor(null, false)) { const pad = value => String(value).padStart(2, '0'); return `${t('Recording', '录音')} ${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}.wav`; } @@ -97,5 +98,5 @@ export const elapsedText = seconds => `${Math.floor(Math.max(0, seconds) / 60)}: // only an id falls back to the number. export function deviceName(label, number, t) { const name = String(label || '').replace(/^(default|communications)\s*-\s*/i, '').replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i, '').trim(); - return name || t(`Microphone ${number}`, `麦克风 ${number}`); + return name || t('Microphone {number}', '麦克风 {number}', { number }); } diff --git a/web/editor_references.js b/web/editor_references.js index f1a88b61..c1e91bf4 100644 --- a/web/editor_references.js +++ b/web/editor_references.js @@ -45,7 +45,7 @@ export function createEditorReferences({t, source, size = () => null, seconds = const full = () => continuing ? used().length >= CONTINUE_MAX : active().length >= MAX; // On hover without a full stop; in the notice line with one. const waitText = () => t('Available after generation finishes', '生成完成后可改'); - const fullText = () => continuing ? t('Up to 3 images when continuing', '接续时最多 3\u00a0张') : t('Up to 32 images', '最多 32\u00a0张'); + const fullText = () => continuing ? t('Up to 3 images when extending', '接续时最多 3\u00a0张') : t('Up to 32 images', '最多 32\u00a0张'); const sentence = text => text + t('.', '。'); const label = (role, row) => role === 'first' ? t('First frame', '首帧') : role === 'last' ? t('Last frame', '尾帧') : role === 'middle' ? (Number.isFinite(secondsOf(row)) ? middleLabels.chipTitle(secondsOf(row), t) : middleLabels.role(t)) : t('Reference', '参考'); @@ -114,7 +114,7 @@ export function createEditorReferences({t, source, size = () => null, seconds = const result = await source.upload(file); write([...source.rows(), {file: result.file, role: 'reference', enabled: true}]); } - if (skipped && !disposed) notify(t('Could not read this picture. Please choose another one.', '无法读取这张图片,请换一张。'), ['Editor reference images', '剪辑器参考图']); + if (skipped && !disposed) notify(t('Could not read this image. Please choose another one.', '无法读取这张图片,请换一张。'), ['Editor reference images', '剪辑器参考图']); } catch (value) { error(value); } finally { working = uploading = false; picker.value = ''; update(); } } @@ -235,7 +235,7 @@ export function createEditorReferences({t, source, size = () => null, seconds = add.disabled = working; add.dataset.uploading = String(uploading); add.setAttribute('aria-disabled', String(busy || isFull)); - tip(add, {name: t('Reference image', '参考图'), use: t('Guide this part with a picture: first frame, last frame or a person', '用图片指定首帧、尾帧或人物'), + tip(add, {name: t('Reference image', '参考图'), use: t('Guide this part with an image: first frame, last frame or a person', '用图片指定首帧、尾帧或人物'), why: uploading ? t('Uploading reference image…', '正在上传参考图…') : busy ? waitText() : isFull ? fullText() : ''}); chips.replaceChildren(...used().map(entry => { const chip = el('button', 'fv-ed-ref-chip'); chip.type = 'button'; chip.disabled = working; chip.setAttribute('aria-disabled', String(busy)); diff --git a/web/editor_select.js b/web/editor_select.js index 95edc033..05bec06c 100644 --- a/web/editor_select.js +++ b/web/editor_select.js @@ -6,6 +6,7 @@ export {copyContent, pasteContent} from './editor_room.js'; import {transportSnapPoints} from './editor_transport_model.js'; import {unlockedIds} from './editor_audio_model.js'; import {isTextTrack, textDropLocked} from './editor_text_model.js'; +import {translatorFor} from './i18n.js'; const end = clip => clip.start + clip.frames; // Where a moved group lands, to a tenth of a second. @@ -76,7 +77,7 @@ export function createClipboard() { return {read: () => value && structuredClone(value), write: content => { value = structuredClone(content); }}; } const pageClipboard = createClipboard(); -export function createSelectionActions({state, t = en => en, actions = {}, clipboard = pageClipboard}) { +export function createSelectionActions({state, t = translatorFor(null, false), actions = {}, clipboard = pageClipboard}) { function report(error) { if (!(error instanceof model.EditError)) throw error; if (error.code === 'not_generated' && actions.notify) actions.notify(t('Not generated yet', '还没生成')); diff --git a/web/editor_speed.js b/web/editor_speed.js index d61cd270..c9001848 100644 --- a/web/editor_speed.js +++ b/web/editor_speed.js @@ -109,7 +109,7 @@ export function createSpeedPanel(host, {state, t, onError = () => {}, context}) const busy = clips.some(clip => !clip.source || clip.pending), locked = state.record.tracks.some(track => track.locked && track.clips.some(clip => clips.includes(clip))); const disabled = !primary || busy || locked, sounds = clips.filter(clip => clip.volume !== undefined); for (const control of [input, ...buttons, reverse, follows, mute, reset]) control.title = ''; - hint.textContent = groups.length > 1 ? t(`${groups.length} parts selected`, `已选 ${groups.length} 段`) : ''; + hint.textContent = groups.length > 1 ? t('{count} parts selected', '已选 {count} 段', { count: groups.length }) : ''; hint.hidden = !hint.textContent; const sameSpeed = !primary || clips.every(clip => percent(clip) === percent(primary)); speedNumber.value = percent(primary || {}) / 100; if (!sameSpeed) input.value = ''; input.placeholder = sameSpeed ? '' : t('Mixed', '不同'); input.disabled = disabled; @@ -117,7 +117,7 @@ export function createSpeedPanel(host, {state, t, onError = () => {}, context}) const single = groups.length <= 1; reverse.checked = !!primary?.reverse; reverse.disabled = disabled || !single; reverse.title = t('Reverse', '倒放'); - length.textContent = primary && single ? t(`Length ${(sourceFrames(primary) / 24).toFixed(1)} s → ${(primary.frames / 24).toFixed(1)} s`, `时长 ${(sourceFrames(primary) / 24).toFixed(1)} 秒 → ${(primary.frames / 24).toFixed(1)} 秒`) : ''; + length.textContent = primary && single ? t('Length {before} s → {after} s', '时长 {before} 秒 → {after} 秒', { before: (sourceFrames(primary) / 24).toFixed(1), after: (primary.frames / 24).toFixed(1) }) : ''; length.hidden = !length.textContent; for (const button of [follows, mute]) { button.disabled = disabled || !single || !sounds.length; diff --git a/web/editor_stems.js b/web/editor_stems.js index 7f7901cc..9856755a 100644 --- a/web/editor_stems.js +++ b/web/editor_stems.js @@ -38,7 +38,7 @@ export function createStemsIntegration({state, api, queue, store, t, error, noti const detail = (() => { try { return JSON.parse(progress?.detail || 'null'); } catch { return null; } })(); switch (progress?.phase) { case 'downloading': return Number.isFinite(detail?.fraction) - ? t(`Downloading the separation model ${Math.round(detail.fraction * 100)}%`, `正在下载分离模型 ${Math.round(detail.fraction * 100)}%`) + ? t('Downloading the separation model {percent}%', '正在下载分离模型 {percent}%', { percent: Math.round(detail.fraction * 100) }) : t('Downloading the separation model', '正在下载分离模型'); case 'separating': return t('Separating the sound', '正在分离声音'); case 'waiting': return t('Waiting for the video to finish', '等待视频生成完成'); @@ -170,7 +170,7 @@ export function createStemsIntegration({state, api, queue, store, t, error, noti const response = await retryAgentPost(api, `${ROOT}/projects/${encodeURIComponent(state.record.id)}/stems/export`, body); const answer = await response?.json().catch(() => null); if (!response?.ok) { say(answer, 'stems_failed'); return false; } - notify(t(`Saved the tracks to ${answer.folder}`, `分轨已保存到 ${answer.folder}`)); + notify(t('Saved the tracks to {folder}', '分轨已保存到 {folder}', { folder: answer.folder })); return true; } catch (value) { say(value, 'stems_failed'); return false; } } diff --git a/web/editor_text.js b/web/editor_text.js index fcafc552..18dff10a 100644 --- a/web/editor_text.js +++ b/web/editor_text.js @@ -74,7 +74,7 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar, // `need` is what has to be downloaded before the first use, in bytes; the same press downloads it and goes on. const speech={buttons:new Set(),available:false,need:0,busy:false,loading:false,shown:null,job:null,stop:null,run:0}; // Once every byte is in, the download is unpacked; the button says so and keeps the width it had, so it does not jump. - function speechLabel(fraction,phase=null){speech.shown=fraction;const unpacking=fraction!=null&&speech.loading&&phase==='unpack',p=Math.round(Math.min(1,Math.max(0,Number(fraction)||0))*100),size=Math.max(1,Math.round(speech.need/1e6)),text=fraction==null?(speech.need?t(`Auto subtitles · Download ${size} MB`,`自动字幕 · 下载 ${size} MB`):t('Auto subtitles','自动字幕')):unpacking?t('Cancel · Unpacking','取消 · 正在解压'):speech.loading?t(`Cancel · Downloading ${p}%`,`取消 · 下载 ${p}%`):t(`Cancel · ${p}%`,`取消 · ${p}%`);for(const b of speech.buttons){if(unpacking&&!b.style.minWidth&&b.offsetWidth)b.style.minWidth=`min(${b.offsetWidth}px, 100%)`;else if(!unpacking)b.style.minWidth='';b.textContent=text;b.hidden=!(speech.available||speech.need);}} + function speechLabel(fraction,phase=null){speech.shown=fraction;const unpacking=fraction!=null&&speech.loading&&phase==='unpack',p=Math.round(Math.min(1,Math.max(0,Number(fraction)||0))*100),size=Math.max(1,Math.round(speech.need/1e6)),text=fraction==null?(speech.need?t('Auto subtitles · Download {size} MB','自动字幕 · 下载 {size} MB', { size }):t('Auto subtitles','自动字幕')):unpacking?t('Cancel · Unpacking','取消 · 正在解压'):speech.loading?t('Cancel · Downloading {p}%','取消 · 下载 {p}%', { p }):t('Cancel · {p}%','取消 · {p}%', { p });for(const b of speech.buttons){if(unpacking&&!b.style.minWidth&&b.offsetWidth)b.style.minWidth=`min(${b.offsetWidth}px, 100%)`;else if(!unpacking)b.style.minWidth='';b.textContent=text;b.hidden=!(speech.available||speech.need);}} function speechEnd(text,where=null){speech.stop?.();speech.stop=null;speech.job=null;speech.busy=false;speech.loading=false;speechLabel(null);if(text)actions.notify?.(text,where);} const speechFailed=()=>t('Could not create subtitles. Try again; if it keeps failing, report the problem.','没能生成字幕。请重试;仍然失败时,请提交问题。'),speechSilent=()=>t('No speech found','没有听到说话声'); const speechDisk=()=>t('The disk is full. Free some space, then try again.','磁盘空间不足,请清理出空间后重试。'); @@ -190,7 +190,7 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar, }finally{file.value='';} if(apply(t('Import subtitle file','导入字幕文件'),r=>importSRT(r,text))){const missing=projectMissing(state.record);if(missing.length)actions.notify?.(missingHint([...new Set(missing.flatMap(r=>r.chars))],t)); if(result.truncated)actions.notify?.(t('Only the first 500 subtitles were imported.','只导入了前 500 条字幕。')); - else if(result.skipped)actions.notify?.(t(`${result.skipped} subtitles could not be read and were skipped.`,`${result.skipped} 条字幕无法读取,已跳过。`));}}; + else if(result.skipped)actions.notify?.(t('{skipped} subtitles could not be read and were skipped.','{skipped} 条字幕无法读取,已跳过。', { skipped: result.skipped }));}}; // Shown only where this computer can recognise speech. const hear=button(t('Auto subtitles','自动字幕'),{onClick:toggleSpeech});hear.classList.add('fv-ed-auto-subtitles');for(const b of speech.buttons)if(!b.isConnected)speech.buttons.delete(b);speech.buttons.add(hear);speechLabel(speech.busy?speech.shown:null); host.append(importButton,hear,file); @@ -215,7 +215,7 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar, list.forEach((value,index)=>{ const full={...SUBTITLE_DEFAULTS,...value},chip=el('span','fv-ed-preset');chip.dataset.current=String(index===found); const apply_=button('Aa',{onClick:()=>modifyStyle({...SUBTITLE_DEFAULTS,...value})});apply_.classList.add('fv-ed-preset-apply'); - apply_.setAttribute('aria-label',t(`Use style ${index+1}`,`套用样式 ${index+1}`));apply_.title=t(`Use style ${index+1}`,`套用样式 ${index+1}`); + apply_.setAttribute('aria-label',t('Use style {number}','套用样式 {number}', { number: index+1 }));apply_.title=t('Use style {number}','套用样式 {number}', { number: index+1 }); apply_.style.fontFamily=textFontStack(full.font);apply_.style.color=full.color; const light=parseInt(full.color.slice(1,3),16)*.3+parseInt(full.color.slice(3,5),16)*.59+parseInt(full.color.slice(5,7),16)*.11>140; apply_.style.backgroundColor=full.backing==='box'?'#000000':light?'#2a2f38':'#e5e7eb'; @@ -223,9 +223,9 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar, // A deleted look comes back from the notice it leaves (E24: the × deleted at once, with no way back). const remove=button('×',{onClick:()=>{const next=readPresets(),[gone]=next.splice(index,1);writePresets(next);renderPresets(host,current); actions.notify?.(t('Style deleted.','已删除样式。'),null,null,{label:t('Undo','撤销'),use:t('Put the style back','把这套样式放回去'),run:()=>{const list=readPresets();list.splice(Math.min(index,list.length),0,gone);writePresets(list);renderPresets(host,current);}});}}); - remove.classList.add('fv-ed-preset-remove');remove.setAttribute('aria-label',t(`Delete style ${index+1}`,`删除样式 ${index+1}`)); + remove.classList.add('fv-ed-preset-remove');remove.setAttribute('aria-label',t('Delete style {number}','删除样式 {number}', { number: index+1 })); tip(remove,{name:t('Delete style','删除样式'),use:t('Remove this saved look (can be undone)','删掉这套保存的样式(可撤销)')}); - tip(apply_,{name:t(`Style ${index+1}`,`样式 ${index+1}`),use:t('Use this look on every subtitle','把这套样式用到所有字幕')}); + tip(apply_,{name:t('Style {number}','样式 {number}', { number: index+1 }),use:t('Use this look on every subtitle','把这套样式用到所有字幕')}); chip.append(apply_,remove);host.append(chip); }); const save=button(t('Save style','保存样式'),{onClick:()=>{ @@ -410,7 +410,7 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar, const stop=isolateDialogKeys(dialog,(e)=>{if(e.type==='keydown'&&e.key==='Escape'){e.preventDefault();dialog.close();}else if(e.type==='keydown'&&e.key==='Enter'&&!e.target.closest?.('.fv-issue-button')){e.preventDefault();dialog.close();}}); dialog.onclose=()=>{stop();dialog.remove();jumpMissing();};dialog.showModal();close.focus();return false; } - const menuEntries=['empty','part'].map(where=>registerMenuItem({where,group:'text',label:context=>speech.busy?context.t('Stop auto subtitles','停止自动字幕'):speech.need?context.t(`Auto subtitles (downloads ${Math.max(1,Math.round(speech.need/1e6))} MB first)`,`自动字幕(先下载 ${Math.max(1,Math.round(speech.need/1e6))} MB)`):context.t('Auto subtitles','自动字幕'), + const menuEntries=['empty','part'].map(where=>registerMenuItem({where,group:'text',label:context=>speech.busy?context.t('Stop auto subtitles','停止自动字幕'):speech.need?context.t('Auto subtitles (downloads {size} MB first)','自动字幕(先下载 {size} MB)',{size:Math.max(1,Math.round(speech.need/1e6))}):context.t('Auto subtitles','自动字幕'), visible:()=>!disposed&&(speech.available||speech.need>0),enabled:()=>!disposed,run:()=>toggleSpeech()})); return {get ready(){return ensureFonts();},beforeExport,speech(value){speech.available=value?.available===true;speech.need=Number(value?.need)||0;if(!speech.busy)speechLabel(null);},flush(){finishInline();commitDraft();},keyboard(e){ if(isTyping(e.target)||e.ctrlKey||e.metaKey||e.altKey||e.isComposing)return false; diff --git a/web/editor_text_layout.js b/web/editor_text_layout.js index 5c9f2c90..79a4ba4a 100644 --- a/web/editor_text_layout.js +++ b/web/editor_text_layout.js @@ -66,4 +66,4 @@ export function drawText(ctx,entry,width,height) { ctx.restore(); return layout; } export const overTwoHint=t=>t('Over two lines','超过两行'); -export const missingHint=(chars,t)=>chars.length ? t(`This font is missing ${chars.join(' ')}. Choose another font.`,`这款字体缺少:${chars.join(' ')},请换一种字体。`) : ''; +export const missingHint=(chars,t)=>chars.length ? t('This font is missing {chars}. Choose another font.','这款字体缺少:{chars},请换一种字体。', { chars: chars.join(' ') }) : ''; diff --git a/web/editor_tracks.js b/web/editor_tracks.js index f43c39e4..8736626c 100644 --- a/web/editor_tracks.js +++ b/web/editor_tracks.js @@ -19,6 +19,7 @@ import {speedEdited} from './editor_speed_model.js'; import {MUSIC_TRACK, MAX_MUSIC_FRAMES} from './editor_music_model.js'; import {applyTip, switchTip, setTip} from './editor_tracks_tips.js'; import {setAttr, setData, setHidden, setText} from './dom_quiet.js'; +import {translatorFor} from './i18n.js'; // A range drawn on the music track alone: music for that stretch. const musicRange = selection => selection?.kind === 'range' && selection.tracks?.length === 1 && selection.tracks[0] === MUSIC_TRACK; @@ -206,7 +207,7 @@ const icon = kind => { svg.append(path); return svg; }; -export function createTracks(host, {state, sources = {}, t = en => en, actions = {}, blockProgress} = {}) { +export function createTracks(host, {state, sources = {}, t = translatorFor(null, false), actions = {}, blockProgress} = {}) { // The floating task window keeps clear of the tracks (sgf-avoid). // Resolves once the rows, clips and opening zoom are laid out at their final geometry (the view's readiness waits on it). let settleReady = null; @@ -439,9 +440,9 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = if (selection?.kind === 'range' || pending) handles(selectionBox); if (selection?.kind === 'range') { const width = pixels(shape.frames), seconds = Math.round(shape.frames / model.FPS); - const label = create('span', 'fv-ed-planned-label', t(`${seconds} s`, `${seconds} 秒`)); + const label = create('span', 'fv-ed-planned-label', t('{seconds} s', '{seconds} 秒', { seconds })); label.hidden = width < 44; selectionBox.append(label); - if (label.scrollWidth > label.clientWidth) label.textContent = t(`${seconds} s`, `${seconds} 秒`); + if (label.scrollWidth > label.clientWidth) label.textContent = t('{seconds} s', '{seconds} 秒', { seconds }); } plannedLines.replaceChildren(); for (const item of clips.values()) { @@ -450,8 +451,8 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = if (!label) { label = create('span', 'fv-ed-planned-label'); item.element.append(label); } const width = pixels(item.clip.frames), seconds = Math.round(item.clip.frames / model.FPS); label.hidden = width < 44; - label.textContent = t(`${seconds} s`, `${seconds} 秒`); - if (label.scrollWidth > label.clientWidth) label.textContent = t(`${seconds} s`, `${seconds} 秒`); + label.textContent = t('{seconds} s', '{seconds} 秒', { seconds }); + if (label.scrollWidth > label.clientWidth) label.textContent = t('{seconds} s', '{seconds} 秒', { seconds }); } else item.element.querySelector('.fv-ed-planned-label')?.remove(); const neighbor = item.track === 'v1' && plannedNeighbor(item); if (neighbor) { @@ -664,7 +665,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = const order = []; for (const track of tracks) { const name = track.kind === 'text' ? t('Text', '文字') : track.kind === 'subtitle' ? t('Subtitles', '字幕') : track.kind === 'video' ? t('Video', '画面') : track.stem ? STEM_NAMES[track.stem] : track.id === 'a3' - ? t('Voice', '录音') : twoAudio ? t(`Audio ${track.id.slice(1)}`, `声音 ${track.id.slice(1)}`) : t('Audio', '声音'); + ? t('Voice', '录音') : twoAudio ? t('Audio {number}', '声音 {number}', { number: track.id.slice(1) }) : t('Audio', '声音'); let row = rows.get(track.id); if (!row) { const node = create('div', 'fv-ed-track-row'); node.dataset.track = track.id; @@ -740,11 +741,11 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = const seconds = Math.round(clip.frames / model.FPS); // Hover help: which clip it is, and its description (first 24 characters) or its length and state. const said = (clip.text || '').trim(), words = [...said]; - setTip(item.element, {name: t(`${name} · clip ${index + 1}`, `${name} · 第 ${index + 1} 段`), - use: words.length ? (words.length > 24 ? `${words.slice(0, 24).join('')}…` : said) : t(`${seconds} s · ${status}`, `${seconds} 秒 · ${status}`)}); - const seamText = seam === 'continued' ? t(', continues the clip before', ',接续上一段') : seam === 'separate' ? t(', separate shot', ',独立镜头') : ''; - item.element.setAttribute('aria-label', t(`${name}, clip ${index + 1}, ${seconds} s, ${status}${seamText}`, - `${name},第 ${index + 1} 段,${seconds} 秒,${status}${seamText}`)); + setTip(item.element, {name: t('{name} · clip {number}', '{name} · 第 {number} 段', { name, number: index + 1 }), + use: words.length ? (words.length > 24 ? `${words.slice(0, 24).join('')}…` : said) : t('{seconds} s · {status}', '{seconds} 秒 · {status}', { seconds, status })}); + const seamText = seam === 'continued' ? t(', extends the clip before', ',接续上一段') : seam === 'separate' ? t(', separate shot', ',独立镜头') : ''; + item.element.setAttribute('aria-label', t('{name}, clip {number}, {seconds} s, {status}{seamText}', + '{name},第 {number} 段,{seconds} 秒,{status}{seamText}', { name, number: index + 1, seconds, status, seamText })); // Pending replacements can retain their old media; state styling // overlays it until the model reports that the new media is done. // The imported sound under a sound-led range is kept as it is, so its waveform stays in view while the picture is made. @@ -797,9 +798,9 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = const seconds = Math.round(selection.frames / model.FPS); let count = 1; try { count = rangeParts(selection).length; } catch (error) { if (!(error instanceof model.EditError)) throw error; } - const label = limited != null ? t(`Max ${limited} s`, `最长 ${limited} 秒`) + const label = limited != null ? t('Max {limited} s', '最长 {limited} 秒', { limited }) : moving ? `${preciseClock(selection.start)} – ${preciseClock(selection.start + selection.frames)}` - : t(`${extended ? '+' : ''}${seconds} s`, `${extended ? '+' : ''}${seconds} 秒`); + : t('{sign}{seconds} s', '{sign}{seconds} 秒', { sign: extended ? '+' : '', seconds }); tooltip.textContent = label; tooltip.hidden = false; const bounds = element.getBoundingClientRect(); tooltip.style.left = `${clamp(event.clientX - bounds.left + 14, 8, Math.max(8, bounds.width - 300))}px`; @@ -862,7 +863,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = clicked = drawn.find(clip => frame >= clip.start && frame < clip.start + clip.frames) ?? (frame < range.start ? drawn[0] : drawn.at(-1)); if (text) next = model.describe(next, [drawn[0].id], text); } catch (error) { if (error instanceof model.EditError) return; throw error; } - attempt(t('Edit description', '修改说明'), () => next, {selectionAfter: {kind: 'clip', ids: model.pair(next, clicked.id).map(clip => clip.id)}}); + attempt(t('Edit prompt', '修改提示词'), () => next, {selectionAfter: {kind: 'clip', ids: model.pair(next, clicked.id).map(clip => clip.id)}}); } function clickSelection(event) { if (event.range) { choosePart(event); return; } @@ -1176,8 +1177,8 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = if (gesture.edge === 'end' && (growth > 0 || blocked)) { clearTimeout(estimateTimer); estimateToken++; // A length below the shortest continued part shows that rule; release sets it to that length. - tooltip.textContent = blocked ? '' : result.raised ? t(`At least ${result.frames / model.FPS} s`, `至少 ${result.frames / model.FPS} 秒`) - : t(`+${Math.round(growth / model.FPS)} s`, `+${Math.round(growth / model.FPS)} 秒`); + tooltip.textContent = blocked ? '' : result.raised ? t('At least {seconds} s', '至少 {seconds} 秒', { seconds: result.frames / model.FPS }) + : t('+{seconds} s', '+{seconds} 秒', { seconds: Math.round(growth / model.FPS) }); tooltip.hidden = !!blocked; selectionBox.classList.toggle('fv-ed-cannot-drop', !!blocked); } @@ -1239,8 +1240,8 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = if (extendClip(finished.id, frames) && result.raised) { // Say the new length (tenths, rounded down like other durations) so the change is visible. const least = model.RULES.lastSeconds, length = secondsText(result.frames, model.FPS); - actions.notify?.(result.least ? t(`Lengthened to ${length} s. The last part must be at least ${least} seconds.`, `已加长到 ${length} 秒。最后一段至少 ${least} 秒。`) - : t(`Lengthened to ${length} s.`, `已加长到 ${length} 秒。`)); + actions.notify?.(result.least ? t('Lengthened to {length} s. The last part must be at least {least} seconds.', '已加长到 {length} 秒。最后一段至少 {least} 秒。', { length, least }) + : t('Lengthened to {length} s.', '已加长到 {length} 秒。', { length })); } } else attempt(t('Trim', '裁短'), record => model.trim(record, finished.id, finished.edge, result.frame)); renderSelection(); @@ -1378,7 +1379,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions = const preview = model.insertSource(state.record, {...draggedSource, at: frame.frame, targetTrack: audioTargetAt(draggedSource, event)}); const added = previewSourcePlacement(preview), sound = added.find(item => item.track !== 'v1'); const name = sound ? !preview.tracks.some(track => track.id === 'a3') && preview.tracks.length === 3 - ? t(`Audio ${sound.track === 'a1' ? 1 : 2}`, `声音 ${sound.track === 'a1' ? 1 : 2}`) : t('Audio', '声音') : ''; + ? t('Audio {number}', '声音 {number}', { number: sound.track === 'a1' ? 1 : 2 }) : t('Audio', '声音') : ''; dropPoint = {frame: added[0].clip.start, label: `${preciseClock(added[0].clip.start)} – ${preciseClock(added[0].clip.start + draggedSource.frames)}${name ? ` · ${name}` : ''}`}; } catch (error) { if (!(error instanceof model.EditError)) throw error; diff --git a/web/editor_tracks_tips.js b/web/editor_tracks_tips.js index 5c2bc9cd..d4d55be0 100644 --- a/web/editor_tracks_tips.js +++ b/web/editor_tracks_tips.js @@ -4,6 +4,7 @@ export const modKey = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/i.test(navigator.userAgentData?.platform || navigator.platform || '') ? '⌘' : 'Ctrl+'; import {setTip} from './tip_words.js'; +import {translatorFor} from './i18n.js'; export {setTip}; // Each entry: [English name, Chinese name, English purpose (≤ 10 words), Chinese purpose (≤ 20 characters), key]. // Keys use modKey at run time where a modifier is involved. @@ -18,7 +19,7 @@ const COPY = { loop: ['Loop', '循环播放', 'Start over when playback reaches the end', '播到结尾后从头再来', '⇧L'], playRange: ['Play range', '只播范围', 'Play only the selected part or range', '只播选中的片段或范围', '⇧Space'], fullscreen: ['Full screen', '全屏', 'Fill the screen with the picture', '画面铺满整个屏幕', 'F'], - saveFrame: ['Save frame', '保存当前帧', 'Save this frame as a picture', '把这一帧存成图片', ''], + saveFrame: ['Save frame', '保存当前帧', 'Save this frame as an image', '把这一帧存成图片', ''], previewVolume: ['Preview volume', '预览音量', 'Only what you hear here, not the export', '只调这里听到的,不影响导出', ''], previewVolumeSlider: ['Preview volume', '预览音量', 'Drag to set how loud the preview plays', '拖动调整预览的响度', '↑ ↓'], play: ['Play', '播放', 'Play from the playhead', '从播放头开始播放', 'Space'], @@ -62,7 +63,7 @@ const COPY = { export const TIP_KEYS = Object.freeze(Object.keys(COPY)); // The words of one entry in the page language; `t(en, zh)` is the editor's translator. -export function tipCopy(id, t = en => en) { +export function tipCopy(id, t = translatorFor(null, false)) { const row = COPY[id]; if (!row) throw new Error(`Unknown tip ${id}`); const [en, zh, useEn, useZh, key] = row; diff --git a/web/editor_transport.js b/web/editor_transport.js index e3d6d42e..bab36150 100644 --- a/web/editor_transport.js +++ b/web/editor_transport.js @@ -172,7 +172,7 @@ export function createEditorTransport({element, preview, transport, toolbar, edi for (const value of state.record.markers || []) { const mark = previous.get(value.frame) || el('button', 'fv-ed-timeline-marker'); previous.delete(value.frame); mark.type = 'button'; mark.dataset.frame = String(value.frame); mark.style.left = `${value.frame * state.zoom / 24}px`; applyTip(mark, 'timelineMarker', t); - mark.setAttribute('aria-label', t(`Marker at ${Math.floor(value.frame / 24 / 60)}:${String(Math.floor(value.frame / 24) % 60).padStart(2, '0')}`, `标记 ${Math.floor(value.frame / 24 / 60)}:${String(Math.floor(value.frame / 24) % 60).padStart(2, '0')}`)); mark.setAttribute('aria-pressed', String(markerSelection === value.frame)); + mark.setAttribute('aria-label', t('Marker at {minutes}:{seconds}', '标记 {minutes}:{seconds}', { minutes: Math.floor(value.frame / 24 / 60), seconds: String(Math.floor(value.frame / 24) % 60).padStart(2, '0') })); mark.setAttribute('aria-pressed', String(markerSelection === value.frame)); mark.onpointerdown = event => { if (event.button !== 0 || drag) return; event.preventDefault(); event.stopPropagation(); mark.focus({preventScroll: true}); diff --git a/web/editor_voice_install.js b/web/editor_voice_install.js index 7ffa2180..5051ed56 100644 --- a/web/editor_voice_install.js +++ b/web/editor_voice_install.js @@ -20,14 +20,14 @@ export function percent(row) { // Lane-5x 11-22: no version or date is promised. export const laterText = t => t('Dubbing is not available on this computer.', '这台电脑上无法使用配音。'); -export const offerText = (bytes, t) => t(`Voice change needs the dubbing model (about ${sizeText(bytes)}).`, `换人声需要配音模型,约 ${sizeText(bytes)}。`); +export const offerText = (bytes, t) => t('Voice change needs the dubbing model (about {size}).', '换人声需要配音模型,约 {size}。', { size: sizeText(bytes) }); export const progressText = (value, t) => value == null ? t('Downloading the dubbing model', '正在下载配音模型') - : t(`Downloading the dubbing model ${value}%`, `正在下载配音模型 ${value}%`); + : t('Downloading the dubbing model {value}%', '正在下载配音模型 {value}%', { value }); // What a failed download says; the code never reaches the words. `report` is whether the problem can be reported. export function failureText(code, bytes, t) { switch (code) { - case 'disk_space': return {report: true, text: t(`There is not enough disk space. The dubbing model needs about ${sizeText(bytes)}.`, `磁盘空间不足,配音模型需要约 ${sizeText(bytes)}。`)}; + case 'disk_space': return {report: true, text: t('There is not enough disk space. The dubbing model needs about {size}.', '磁盘空间不足,配音模型需要约 {size}。', { size: sizeText(bytes) })}; case 'download_failed': case 'network': return {report: true, text: t('The dubbing model could not be downloaded. Check the connection and try again.', '配音模型下载失败,请检查网络后重试。')}; default: return {report: true, text: t('The dubbing model could not be installed. Try again; if it keeps failing, report the problem.', '配音模型未能安装。请重试;仍然失败时,请提交问题。')}; } diff --git a/web/editor_voice_model.js b/web/editor_voice_model.js index 97467fdd..5a150d4a 100644 --- a/web/editor_voice_model.js +++ b/web/editor_voice_model.js @@ -42,26 +42,26 @@ export const clockText = seconds => { const whole = Math.max(0, Math.floor(secon // The button names what it does; the time is not shown: the figure the service has is the new sentence's length, not the wait. export function redubLabel(count, t) { if (!count) return t('Redub', '重新配音'); - return t(`Redub ${count} ${count === 1 ? 'line' : 'lines'}`, `重新配音 ${count} 句`); + return count === 1 ? t('Redub 1 line', '重新配音 1 句') : t('Redub {count} lines', '重新配音 {count} 句', { count }); } // One line needs no number; the time only once the service has given one. export const dubbingText = (index, count, seconds, t) => { - const time = Number.isFinite(seconds) ? ` · ${t(`about ${Math.max(1, Math.ceil(seconds))}${NBSP}s`, `约 ${Math.max(1, Math.ceil(seconds))}${NBSP}秒`)}` : ''; - return count > 1 ? t(`Dubbing · line ${index} of ${count}${time}`, `正在配音 · 第 ${index}/${count} 句${time}`) - : t(`Dubbing${time}`, `正在配音${time}`); + const time = Number.isFinite(seconds) ? ` · ${t('about {seconds}\u00a0s', '约 {seconds}\u00a0秒', { seconds: Math.max(1, Math.ceil(seconds)) })}` : ''; + return count > 1 ? t('Dubbing · line {index} of {count}{time}', '正在配音 · 第 {index}/{count} 句{time}', { index, count, time }) + : t('Dubbing{time}', '正在配音{time}', { time }); }; // "2.6 s too long. Original voice kept.": one decimal, never "0.0". Without a way to shorten it, the row says what to do. export const overrunText = (seconds, t, canShorten = true) => { const value = Math.max(0.1, Math.round(seconds * 10) / 10).toFixed(1); - return canShorten ? t(`${value}${NBSP}s too long. Original voice kept.`, `超出 ${value}${NBSP}秒,已保留原声`) - : t(`${value}${NBSP}s too long. Original voice kept. Shorten this line.`, `超出 ${value}${NBSP}秒,已保留原声。请缩短这句。`); + return canShorten ? t('{value}{NBSP}s too long. Original voice kept.', '超出 {value}{NBSP}秒,已保留原声', { value, NBSP }) + : t('{value}{NBSP}s too long. Original voice kept. Shorten this line.', '超出 {value}{NBSP}秒,已保留原声。请缩短这句。', { value, NBSP }); }; export const failedText = (count, t) => count === 1 ? t('1 line could not be dubbed. Redub it.', '有 1 句无法配音,请重新配音。') - : t(`${count} lines could not be dubbed. Redub them.`, `有 ${count} 句无法配音,请重新配音。`); + : t('{count} lines could not be dubbed. Redub them.', '有 {count} 句无法配音,请重新配音。', { count }); // What a result says about each line it dubbed: kept the original voice because it did not fit, failed, or placed. export function lineResults(result) { diff --git a/web/engine_exit.js b/web/engine_exit.js index e3a96db4..08b2946c 100644 --- a/web/engine_exit.js +++ b/web/engine_exit.js @@ -1,6 +1,7 @@ // Why the ComfyUI before this one stopped, as far as the launcher saw it end. The page keeps the record it // found when it loaded, so only an exit that happened afterwards is announced; a feedback message carries // the newest record it knows. Only numbers and fixed words arrive from the engine, never log text. +import { translatorFor } from './i18n.js'; let baselineAt, latest = null, watching = null; const clock = at => { @@ -44,9 +45,9 @@ export function knownEngineExit() { } /** One sentence for the status line after the engine started again. The exit status stays in the report. */ -export function engineExitText(record, t = en => en) { - return t(`The engine stopped unexpectedly at ${clock(record.at)} and has been restarted.`, - `引擎于 ${clock(record.at)} 意外停止,已重新启动。`); +export function engineExitText(record, t = translatorFor(null, false)) { + return t('The engine stopped unexpectedly at {time} and has been restarted.', + '引擎于 {time} 意外停止,已重新启动。', { time: clock(record.at) }); } // When the engine's loop was held up: times, lengths and the loop thread's innermost calls, as written by the engine @@ -70,3 +71,19 @@ export function refreshLoopStalls(api) { return loadStalls(api); } /** The newest records this page has read, for a feedback message; empty when there are none. */ export function knownLoopStalls() { return stalls; } + +/** Why FreeVideo stopped, from the launcher's record of it: 'memory' (a Windows out-of-memory status, or SIGKILL while the + * Linux kernel's out-of-memory count rose), 'ended' (the system or another program ended it), 'crashed', or 'unknown' + * (an exit that cannot be told apart: the card says only that FreeVideo stopped unexpectedly). Null without a record. */ +export function exitCause(record) { + if (!record || typeof record !== 'object') return null; + const kind = record.exit_class; + if (kind === 'system_commit_limit' || kind === 'system_no_memory') return 'memory'; + if (kind === 'killed_by_signal' && record.code_text === 'SIGKILL' && record.oom_kills_since_start > 0) return 'memory'; + // SIGTERM while the count rose: systemd stopping the rest of a group after the kernel ended one of it for memory. + // Only ComfyUI's own group's count (oom_scope cgroup): the computer's also counts other programs (dataroot-5x, 11-25). + if (kind === 'killed_by_signal' && record.code_text === 'SIGTERM' && record.oom_scope === 'cgroup' && record.oom_kills_since_start > 0) return 'memory_maybe'; + if (kind === 'killed_by_signal' || kind === 'terminated_externally') return 'ended'; + if (kind === 'native_crash' || kind === 'abort' || kind === 'system_stack_overflow') return 'crashed'; + return 'unknown'; +} diff --git a/web/error_panel.js b/web/error_panel.js index 844289e0..42d2ad29 100644 --- a/web/error_panel.js +++ b/web/error_panel.js @@ -20,40 +20,40 @@ const PLAIN_ERRORS = [ title: ['FreeVideo is busy with another task', 'FreeVideo 正在处理另一个任务'], summary: ['Try again when it finishes. If nothing else is running, close duplicate FreeVideo instances, then try again.', '请在它完成后重试。若没有其他任务在进行,请关闭重复运行的 FreeVideo 后重试。']}, - {key: 'continuation-missing', message: 'The previous video has no usable continuation data. Generate it again with this version of FreeVideo.', - title: ['This video cannot be continued', '这个视频暂时不能接续'], - summary: ['Generate the previous video again, then continue it.', '请重新生成上一段视频,再接续。']}, - {key: 'continuation-short', message: 'The previous video is too short to continue; it needs to be at least 1.7 s long.', + {key: 'continuation-missing', message: 'The previous video lacks the data needed to extend it. Generate it again with this version of FreeVideo.', + title: ['This video cannot be extended', '这个视频暂时不能接续'], + summary: ['Generate the previous video again, then extend it.', '请重新生成上一段视频,再接续。']}, + {key: 'continuation-short', message: 'The previous video is too short to extend; it needs to be at least 1.7 s long.', title: ['The previous video is too short', '上一段视频太短'], summary: ['Choose a video that is at least 1.7 seconds long.', '请选择至少 1.7 秒的视频。']}, {key: 'continuation-unreadable', message: 'The previous video cannot be read.', title: ['The previous video cannot be read', '无法读取上一段视频'], summary: ['Choose an MP4 video that plays normally.', '请选择能正常播放的 MP4 视频。']}, - {key: 'continuation-rate', message: "The previous video's frame rate is too low to continue; it needs at least 10 frames per second.", + {key: 'continuation-rate', message: "The previous video's frame rate is too low to extend; it needs at least 10 frames per second.", title: ["The previous video's frame rate is too low", '上一段视频帧率太低'], summary: ['Choose a video with at least 10 frames per second.', '请选择每秒至少 10 帧的视频。']}, {key: 'continuation-size', message: 'Use the same aspect ratio as the previous video.', title: ['The two videos have different aspect ratios', '两段视频的画面比例不同'], summary: ['Choose a video size with the same aspect ratio as the previous video.', '请选择与上一段视频比例相同的画面大小。']}, - {key: 'continuation-route', message: 'Continue from video cannot be used with these settings. Continuing a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Continue from video".', - title: ['This computer can\'t continue a video', '这台电脑无法接续视频'], - summary: ['Continuing a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Continue from video".', '接续视频需要 NVIDIA 显卡或 Mac。要生成新视频,请清空“接着生成”。']}, - {key: 'continuation-passes', message: 'Continue from video cannot be used with these settings. Turn on "Two-pass acceleration" and turn off the first-pass preview.', - title: ['Continuing needs two-pass acceleration', '接续需要二采加速'], - summary: ['Turn on "Two-pass acceleration" and turn off the first-pass preview.', '请打开“二采加速”,并关闭先出预览。']}, - {key: 'continuation-refine', message: 'Continue from video cannot be used with these settings. Clear either "Second pass of preview" or "Continue from video".', - title: ['A continued part is made in full', '接续会完整生成这一段'], - summary: ['Clear either "Second pass of preview" or "Continue from video".', '请清空“继续二采”或“接着生成”其中一项。']}, - {key: 'continuation-media', message: 'Continue from video cannot be used with these settings. Connect up to 3 pictures as references, and remove video, audio and pre-encoded inputs.', - title: ['A continued part takes picture references only', '接续段只能用图片参考'], - summary: ['Connect up to 3 pictures as references, and remove video, audio and pre-encoded inputs.', '最多接 3 张图片作为参考图,并移除视频、音频参考和预编码输入。']}, + {key: 'continuation-route', message: 'Extend from video cannot be used with these settings. Extending a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Extend from video".', + title: ['This computer can\'t extend a video', '这台电脑无法接续视频'], + summary: ['Extending a video needs an NVIDIA GPU or a Mac. To make a new video, clear "Extend from video".', '接续视频需要 NVIDIA 显卡或 Mac。要生成新视频,请清空“接着生成”。']}, + {key: 'continuation-passes', message: 'Extend from video cannot be used with these settings. Turn on "Faster second pass" and turn off the first-pass preview.', + title: ['Extending needs the faster second pass', '接续需要二采加速'], + summary: ['Turn on "Faster second pass" and turn off the first-pass preview.', '请打开“二采加速”,并关闭先出预览。']}, + {key: 'continuation-refine', message: 'Extend from video cannot be used with these settings. Clear either "Second pass of preview" or "Extend from video".', + title: ['An extended part is made in full', '接续会完整生成这一段'], + summary: ['Clear either "Second pass of preview" or "Extend from video".', '请清空“继续二采”或“接着生成”其中一项。']}, + {key: 'continuation-media', message: 'Extend from video cannot be used with these settings. Connect up to 3 images as references, and remove video, audio and pre-encoded inputs.', + title: ['An extended part takes image references only', '接续段只能用图片参考'], + summary: ['Connect up to 3 images as references, and remove video, audio and pre-encoded inputs.', '最多接 3 张图片作为参考图,并移除视频、音频参考和预编码输入。']}, // Only the Mac engine still refuses keyframes next to references; elsewhere they become still guides. {key: 'media-mixed-layout', message: 'Reference and first/last keyframe layouts cannot be mixed in one request on this Mac; keep one of the two', title: ['Use references or first and last frames', '参考素材与首尾帧请选其一'], summary: ['On a Mac, keep one of the two: turn off the media cards or inputs you are not using, then generate again.', '在 Mac 上请保留其中一种:关闭本次不用的素材卡片或输入,再重新生成。']}, {key: 'audio-original-passes', prefixes: ['audio_original_passes:'], - title: ['This audio needs two-pass acceleration', '这段音频需要二采加速'], - summary: ['Turn on "Two-pass acceleration" or set the audio to "Reference".', '请打开“二采加速”,或把音频改选“参考”。']}, + title: ['This audio needs the faster second pass', '这段音频需要二采加速'], + summary: ['Turn on "Faster second pass" or set the audio to "Reference".', '请打开“二采加速”,或把音频改选“参考”。']}, {key: 'audio-original-route', prefixes: ['audio_original_route:'], title: ['"Use as is" is not available here', '这里还不能用“原样使用”'], summary: ['Set the audio to "Reference".', '请把音频改选“参考”。']}, @@ -280,7 +280,10 @@ function reportRedactor(detail, context) { }; const redact = value => { let text = removeInputs(value); - text = text.replace(/\b(?:https?|wss?|ftp|file):\/\/[^\s<>"']+/gi, '') + // A local file written as a URL first (file:///C:/Users/..., file:/C:/..., file:C:/..., %-escaped): to the end of + // the path like any path, spaces included, so no part of a user name is left after it. + text = text.replace(/(^|[^A-Za-z0-9_\/])file:(?:\/\/[^\/\s<>"']*)?(?:\/+|(?=[A-Za-z]:[\\/]))[^\r\n"'<>;,\)\]]*/gi, '$1') + .replace(/\b(?:https?|wss?|ftp|file):\/\/[^\s<>"']+/gi, '') .replace(/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, '') .replace(/\b(?:hf_|sk-|gh[pousr]_|github_pat_)[A-Za-z0-9_-]{8,}\b/g, '') .replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, '') @@ -452,13 +455,9 @@ export function failureAdvice(value, t, known = knownError(value)) { const available = known.available.filter(i => SAMPLING_EFFORTS[i]?.steps !== known.base_steps || SAMPLING_EFFORTS[i].twoPass !== known.two_pass); // Iris: a level name and its 档 never break apart. The summary is set as text, // so word joiners (U+2060) keep each group on one line instead of markup. - const keep = value => [...value].join('\u2060'); - const join = language => { - const names = available.map(i => language ? `“${levels[i][1]}”` : levels[i][0]); - if (language) names[names.length - 1] += '档'; - const kept = language ? names.map(keep) : names; - return kept.length < 2 ? kept[0] || '' : kept.slice(0, -1).join(language ? '、' : ', ') + (language ? '或' : ' or ') + kept.at(-1); - }; + const keep = value => /[\u4e00-\u9fff]/.test(value) ? [...value].join('\u2060') : value; + const also = available.map((i, at) => keep(at === available.length - 1 ? t('{level}', '“{level}”档', { level: t(...levels[i]) }) : t('{level}', '“{level}”', { level: t(...levels[i]) }))); + const list = also.length < 2 ? also[0] || '' : also.slice(0, -1).join(t(', ', '、')) + t(' or ', '或') + also.at(-1); const bytes = known.missing_bytes; // As launcher_copy.size_text: one decimal for GiB, whole MiB; decimal units on macOS. let size = bytes >= 2**30 ? (bytes / 2**30).toFixed(1) + ' GiB' : Math.floor(bytes / 2**20) + ' MiB'; @@ -468,12 +467,12 @@ export function failureAdvice(value, t, known = knownError(value)) { } // A custom step count is not a quality level: no "档" / "quality level" for it. const title = custom - ? [`Custom (${known.base_steps} steps) is not downloaded yet`, `“自定义(${known.base_steps} 步)”还没下载`] - : [`The ${levels[index][0]} quality level is not downloaded yet`, `${keep(`“${levels[index][1]}”档`)}还没下载`]; - const what = custom ? ['This step count', '这个步数'] : ['This level', '这一档']; - return {...row('sampling-table', title, - [`${what[0]} needs a download (about ${size}) that did not finish this time. Generate again when online and it downloads automatically.${available.length ? ` You can also use ${join(0)} for now.` : ''}`, - `${what[1]}要先下载(约 ${size}),这次没能下载。联网后再生成一次,会自动下载。${available.length ? `也可以先用${join(1)}。` : ''}`], ['', '']), plain: true}; + ? ['Custom ({steps} steps) is not downloaded yet', '“自定义({steps} 步)”还没下载', { steps: known.base_steps }] + : ['The {level} quality level is not downloaded yet', '“\u2060{level}\u2060”\u2060档还没下载', { level: keep(t(...levels[index])) }]; + const summary = custom + ? t('This step count needs a download (about {size}) that did not finish this time. Generate again when online and it downloads automatically.', '这个步数要先下载(约 {size}),这次没能下载。联网后再生成一次,会自动下载。', { size }) + : t('This level needs a download (about {size}) that did not finish this time. Generate again when online and it downloads automatically.', '这一档要先下载(约 {size}),这次没能下载。联网后再生成一次,会自动下载。', { size }); + return {...row('sampling-table', title, ['', ''], ['', '']), summary: summary + (available.length ? t(' You can also use {levels} for now.', '也可以先用{levels}。', { levels: list }) : ''), plain: true}; } // ComfyUI and worker tracebacks carry English exceptions. Translate these // actionable failures through the existing signature/advice path. @@ -498,12 +497,14 @@ export function failureAdvice(value, t, known = knownError(value)) { const fits = [...(/Fits now: ([^\n]+?)\.?(?:\n|$)/.exec(text)?.[1] || '').matchAll(/(\d+)x(\d+) (up to|at) ([\d.]+) s/g)] .map(([, width, height, kind, seconds]) => ({width, height, longest: kind === 'up to', seconds: Number(seconds)})); if (fits.length) { - const en = fits.map(f => f.longest ? `${f.width}\u00a0×\u00a0${f.height} up to ${f.seconds.toFixed(1)}\u00a0s` : `${f.width}\u00a0×\u00a0${f.height} at ${f.seconds.toFixed(1)}\u00a0s`).join(', or '); - const zh = fits.map(f => f.longest ? `${f.width}\u00a0×\u00a0${f.height} 最长 ${f.seconds.toFixed(1)}\u00a0秒` : `${f.width}\u00a0×\u00a0${f.height} 生成 ${f.seconds.toFixed(1)}\u00a0秒`).join(',或 '); + const sizes = fits.map(f => { + const values = { size: `${f.width}\u00a0×\u00a0${f.height}`, seconds: f.seconds.toFixed(1) }; + return f.longest ? t('{size} up to {seconds}\u00a0s', '{size} 最长 {seconds}\u00a0秒', values) : t('{size} at {seconds}\u00a0s', '{size} 生成 {seconds}\u00a0秒', values); + }).join(t(', or ', ',或 ')); return row('resources', ['Not enough GPU memory', '显存不足'], ['Generation needs more GPU memory than is currently available.', '生成所需显存超过当前可用量。'], - [`This computer can make ${en} right now. Change the duration or resolution and generate again; closing other programs that use the GPU also frees memory.`, - `现在可以生成:${zh}。请调整时长或清晰度后重新生成;关闭其他占用显卡的程序也可以腾出显存。`]); + ['This computer can make {sizes} right now. Change the duration or resolution and generate again; closing other programs that use the GPU also frees memory.', + '现在可以生成:{sizes}。请调整时长或清晰度后重新生成;关闭其他占用显卡的程序也可以腾出显存。', { sizes }]); } return row('resources', ['The request exceeds available memory', '当前任务的可用内存不足'], ['Generation did not start because there is not enough available RAM or GPU memory.', '可用内存或显存不足,本次生成未开始。'], @@ -524,8 +525,8 @@ export function failureAdvice(value, t, known = knownError(value)) { // The engine states what it saw ("2.2 GiB of 8.0 GiB is available and 4.0 GiB is required"); an older report has no numbers. const seen = /(\d+(?:\.\d)?) GiB of (\d+(?:\.\d)?) GiB is available and (\d+(?:\.\d)?) GiB is required/.exec(text); return row('unified-memory', ['Not enough unified memory', '统一内存不足'], - seen ? [`This Mac has ${seen[1]}\u00a0GiB of ${seen[2]}\u00a0GiB memory available. A generation needs at least ${seen[3]}\u00a0GiB to start.`, - `这台 Mac 共 ${seen[2]}\u00a0GiB 内存,当前可用 ${seen[1]}\u00a0GiB,开始生成至少需要 ${seen[3]}\u00a0GiB。`] + seen ? ['This Mac has {free}\u00a0GiB of {total}\u00a0GiB memory available. A generation needs at least {needed}\u00a0GiB to start.', + '这台 Mac 共 {total}\u00a0GiB 内存,当前可用 {free}\u00a0GiB,开始生成至少需要 {needed}\u00a0GiB。', { free: seen[1], total: seen[2], needed: seen[3] }] : ['This Mac does not have enough free memory right now to start this generation.', '这台 Mac 当前可用的内存不足以开始这次生成。'], ['Close other memory-heavy applications and retry. Export the report if it still fails.', '请关闭其他占用内存较多的程序后重试。仍然失败时,请导出报告。']); } @@ -602,7 +603,7 @@ export function failureAdvice(value, t, known = knownError(value)) { if (/Not enough disk space to save the 4K video/.test(text)) { const megabytes = /about (\d+) MB is needed/.exec(text)?.[1]; return row('upscale-disk', ['Not enough disk space for the upscaled video', '磁盘空间不足,放大后的视频没能保存'], - megabytes ? [`The upscaled video needs about ${megabytes} MB on the drive of the output folder.`, `放大后的视频需要输出文件夹所在磁盘约 ${megabytes} MB 空间。`] + megabytes ? ['The upscaled video needs about {megabytes} MB on the drive of the output folder.', '放大后的视频需要输出文件夹所在磁盘约 {megabytes} MB 空间。', { megabytes }] : ['The upscaled video needs more space on the drive of the output folder.', '放大后的视频需要输出文件夹所在磁盘更多空间。'], ['Free some space on that drive, then try again.', '请在该磁盘上腾出空间后重试。']); } @@ -614,6 +615,14 @@ export function failureAdvice(value, t, known = knownError(value)) { return row('disk', ['Disk space is insufficient', '磁盘空间不足'], ['FreeVideo could not write a required file.', 'FreeVideo 无法写入所需文件。'], ['Free space on the installation/output drive and retry. Keep model downloads and retained outputs if you want to resume or inspect them.', '清理安装目录或输出目录所在磁盘的空间后重试;保留模型下载和输出文件,便于续传或排查。']); + // freevideo_engine/network.py PackageResolutionError: the versions do not fit this computer, not the download. + if (/Required packages cannot be installed on this computer/.test(text)) { + const names = /Required packages cannot be installed on this computer: ([^\r\n]+?)\.(?:\r?\n|$)/.exec(text); + return row('package-resolution', ['No version of the required packages is available for this computer', '所需的软件包没有适用于这台电脑的版本'], + names ? [names[1], names[1]] : ['', ''], + ['Switching the download source or connection mode gives the same result. Choose "Export report", then "Report a problem", and attach the report.', + '更换下载源或连接方式后结果相同。请先点击“导出报告”,再点击“提交问题”并附上报告。']); + } if (/Model download paused|unexpected-transfer-size|ConnectionError|ConnectTimeout|ReadTimeout|Every download source failed|All Git sources failed|All package sources failed|curl-28/i.test(text)) return row('download', ['Download needs attention', '下载未完成'], ['A transfer failed or its received data did not match the expected file.', '传输中断,或收到的数据与预期文件不一致。'], @@ -631,10 +640,16 @@ export function failureAdvice(value, t, known = knownError(value)) { // The generation process ended without a Python error: it crashed or was ended from outside. The code // names which (freevideo_engine/failure_details.py generation_failure prints "(exit N)"); the number stays in the details. // A "Cause:" line means the process did report an error (a named one that no row above knows): it is not an unexplained exit. + // A process ended from outside keeps its own card below: another level would not help. const exit = /^Cause: /m.test(text) ? null : /FreeVideo generation failed \(exit (-?\d+)\)/.exec(text); + const killed = !!exit && [137, -9, 3221225786].includes(Number(exit[1])); + // Only here, after every more specific card: memory, disk or an output folder are not solved by another level. + if (!killed && /^FreeVideo generation failed(?: \(exit -?\d+\))?$/m.test(text) + && /^FAST_MODE_FAILED: The fastest mode could not run\.$/m.test(text)) + return row('fast-mode-failed', ['The Fast level did not finish', '极\u2060速\u2060档未能完成生成'], + ['Switch to the Light level and generate again.', '请改用轻\u2060量\u2060档后重新生成。'], + ['If it happens again, choose "Report a problem" to send us the report.', '再次出现时,请点击“提交问题”,把报告发给我们。']); if (exit) { - const code = Number(exit[1]); - const killed = code === 137 || code === -9 || code === 3221225786; return row('process-exit', ['Generation stopped unexpectedly', '生成意外中断'], killed ? ['The generation was ended by another program.', '生成已被其他程序结束。'] : ['FreeVideo closed unexpectedly while generating.', '生成过程中 FreeVideo 意外关闭。'], @@ -716,14 +731,14 @@ export function adviceFor(report, t, value) { } // The name comes from the error as it arrived; a card shown again from its report says it without one. const media = advice.kind === 'media-missing' ? missingMedia(value) : null; - if (media) advice.summary = t(`"${media}" could not be found. Upload or select it again, then generate.`, `素材“${media}”已不存在,请重新上传或选择后再生成。`); + if (media) advice.summary = t('"{media}" could not be found. Upload or select it again, then generate.', '素材“{media}”已不存在,请重新上传或选择后再生成。', { media }); // Every failure except a rejected input (which the user fixes in place) has one layout: written title, // Export report / Submit to GitHub, the raw error only inside the technical details. const generated = !['validation', 'media-missing'].includes(advice.kind); // A generation that stopped without a known cause is named by the stage it stopped in. if (generated && advice.kind === 'unknown' && report.stage === 'execution') { const stage = failureStage(report); - advice.title = stage ? t(`Generation did not finish: ${stage[0]}`, `生成未完成:${stage[1]}`) : t('Generation did not finish', '生成未完成'); + advice.title = stage ? t('Generation did not finish: {stage}', '生成未完成:{stage}', { stage: t(...stage.slice(0, 2)) }) : t('Generation did not finish', '生成未完成'); } return {advice, generated}; } diff --git a/web/failure_issue.js b/web/failure_issue.js index 2c70f686..b90a669d 100644 --- a/web/failure_issue.js +++ b/web/failure_issue.js @@ -1,5 +1,6 @@ // What a failure card sends to GitHub: the redacted report's summary, never the report file, // paths or typed text (the report was already cleaned). feedback.js turns it into the address. +import { translatorFor } from './i18n.js'; const PHASES = [ [/download|dependenc/i, ['downloading files', '下载文件']], [/load/i, ['loading the model', '载入模型']], @@ -43,7 +44,7 @@ function cause(report) { /** Title, text and summary for the prefilled issue. `lora` marks a LoRA the check judged wrongly; `engineExit` is the * record of the engine's last unexpected stop, when the launcher saw one. */ -export function failureIssue(report, kind, {lora = false, t = en => en, engineExit = null, loopStalls = []} = {}) { +export function failureIssue(report, kind, {lora = false, t = translatorFor(null, false), engineExit = null, loopStalls = []} = {}) { const stage = failureStage(report); const lines = String(report?.message || '').split(/\r?\n/).filter(line => line.trim()); // A traceback ends with the line that names the error; any other message starts with it. diff --git a/web/fast_pack.js b/web/fast_pack.js new file mode 100644 index 00000000..f2234bcb --- /dev/null +++ b/web/fast_pack.js @@ -0,0 +1,104 @@ +// The Fast level's files, downloaded on request into the model folder (GET/POST /freevideo/fast-pack). +// The level stays listed without them; choosing it offers the download, and the level in use does not change. +const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }; +// As the editor writes a download's size (editor_genbar.js). +const size = bytes => bytes >= 1e9 ? `${(bytes / 1e9).toFixed(1)} GB` : `${Math.max(0, Math.round((bytes || 0) / 1e6))} MB`; +const POLL_MS = 500, DONE_MS = 4000; + +function failureText(reason, t) { + return t(...({ + offline: ['The network is unavailable, so the Fast level could not be downloaded. Connect to the network and try again.', '网络未连接,无法下载极\u2060速\u2060档。请连接网络后重试。'], + source_failed: ['The Fast level did not finish downloading. Check the network and try again.', '极\u2060速\u2060档没有下载完成,请检查网络后重试。'], + integrity_failed: ['The downloaded Fast level did not pass verification. Try again.', '下载的极\u2060速\u2060档未通过校验,请重试。'], + write_failed: ['The Fast level could not be saved to disk. Check the disk and try again.', '极\u2060速\u2060档未能保存到磁盘,请检查磁盘后重试。'], + disk_space: ['Not enough disk space to download the Fast level. Free up space and try again.', '磁盘空间不足,无法下载极\u2060速\u2060档。请释放空间后重试。'], + busy: ['The Fast level is already downloading. Try again shortly.', '极\u2060速\u2060档正在下载,请稍后重试。'], + not_published: ['The Fast level files are not published yet, so they cannot be downloaded. Switched back to Light.', '极\u2060速\u2060档的文件尚未发布,目前无法下载。已改回轻\u2060量\u2060档。'], + }[reason] || ['The Fast level did not finish downloading. Try again.', '极\u2060速\u2060档没有下载完成,请重试。'])); +} + +export function fastPackControl({t, api, onChange = () => {}, onResize = () => {}}) { + // The download line's styles apply inside .fv-swap-on. + const element = el('div', 'fv-swap-on fv-fast-pack'); + const box = el('div', 'fv-swap-download'); box.hidden = true; box.setAttribute('role', 'status'); + const line = el('div', 'fv-swap-download-line'), text = el('span', 'fv-swap-download-text'); + const action = el('button', 'fv-swap-retry'); action.type = 'button'; + const meter = el('div', 'fv-swap-meter'), fill = el('i'); meter.append(fill); + line.append(text, action); box.append(line, meter); element.append(box); + // published: null until the first answer, then whether the files are on the download sources (GET .published). + let install = {state: 'idle'}, present = false, published = null, bytes = 0, asked = false, doneTimer = 0, timer = 0, disposed = false; + // Each request is numbered; a state read before the last Download or Cancel answers an earlier moment and is dropped. + let sent = 0, acted = 0; + const running = () => install.state === 'running'; + const needs = () => bytes ? t('Needs a download of about {size}', '需下载约 {size}', { size: size(bytes) }) : ''; + // The line stands beside another level, so it names this one. + const needsLine = () => bytes ? t('Fast level download: about {size}, one time only.', '极\u2060速\u2060档需下载约 {size},只需下载一次。', { size: size(bytes) }) : ''; + function paint() { + const failed = install.state === 'failed', done = Boolean(doneTimer); + // A failure is the server's state until the next download; it is shown only where this page asked for one. + box.hidden = present ? !done : !(running() || (failed && asked) || (asked && bytes)); + box.dataset.state = install.state; + meter.hidden = !running(); + // Retrying cannot fetch files that are not published. + action.hidden = done || present || (failed && install.reason === 'not_published'); + action.textContent = running() ? t('Cancel', '取消') : failed ? t('Retry', '重试') : t('Download', '下载'); + const total = install.total || 0; + meter.dataset.indeterminate = String(!total); + fill.style.width = total ? `${Math.min(100, 100 * (install.done || 0) / total).toFixed(1)}%` : ''; + text.textContent = done ? t('The Fast level is ready.', '极\u2060速\u2060档已就绪。') + : running() ? (total ? t('Downloading Fast · {done} / {total}', '正在下载极\u2060速\u2060档 · {done} / {total}', { done: size(install.done), total: size(total) }) + : t('Downloading Fast…', '正在下载极\u2060速\u2060档…')) + : failed ? failureText(install.reason, t) : needsLine(); + onResize(); // the line changes the height of the window it sits in + } + function take(value) { + const before = install.state; + install = value?.install || {state: 'idle'}; + present = value?.present === true; bytes = value?.bytes ?? bytes; // what is still missing, from the catalog + published = value?.published !== false; + if (install.state === 'cancelled') install = {state: 'idle'}; + if (install.state === 'done' && before === 'running') { + clearTimeout(doneTimer); doneTimer = setTimeout(() => { doneTimer = 0; asked = false; paint(); }, DONE_MS); + } + paint(); onChange(); + clearTimeout(timer); + if (running() && !disposed) timer = setTimeout(poll, POLL_MS); + } + async function call(options) { + const response = await api.fetchApi('/freevideo/fast-pack', {cache: 'no-store', ...options}); + if (!response.ok) throw new Error(response.statusText); + return response.json(); + } + const post = body => call({method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(body)}); + async function poll() { + if (disposed) return; + const n = ++sent; + try { const value = await call(); if (!disposed && n > acted) take(value); } + catch { + if (disposed || n <= acted) return; + if (running()) timer = setTimeout(poll, POLL_MS * 4); + // Without an answer the files are not known to be here: the page does not send the level. + else { present = false; onChange(); } + } + } + action.onclick = async () => { + acted = ++sent; asked = true; + if (running()) { try { const value = await post({action: 'cancel'}); acted = ++sent; if (!disposed) take(value); } catch {} return; } + install = {state: 'running', done: 0, total: 0}; paint(); + try { const value = await post({action: 'install'}); acted = ++sent; if (!disposed) take(value); } + catch { if (!disposed) { install = {state: 'failed', reason: 'failed'}; paint(); } } + }; + return { + element, + get present() { return present; }, + get published() { return published; }, + // What the level's option says now: its download while the files are missing. + needs: () => present ? '' : needs(), + refresh: poll, + // The level was chosen without its files: show the download; nothing starts until it is pressed. + ask() { asked = true; paint(); }, + // Another level was chosen: the download line and a failure are no longer about what is in use. + forget() { if (!asked || running()) return; asked = false; paint(); }, + dispose() { disposed = true; clearTimeout(timer); clearTimeout(doneTimer); }, + }; +} diff --git a/web/feature_tour.js b/web/feature_tour.js index 2cac9be3..834990f2 100644 --- a/web/feature_tour.js +++ b/web/feature_tour.js @@ -3,7 +3,8 @@ import {readGuideRecord, saveGuideRecord, guideRecord, CARDS_OFF} from './first_ import './glass/library.js'; import {openAnchor, anchorOpen, closeAnchor} from './feature_tour_layer.js'; import {reducedMotion} from './context_menu.js'; -import { isChinese } from './i18n.js'; +import { isChinese, translator, fill } from './i18n.js'; +import { localized } from './i18n_tables.js'; export const TOUR_TEXT = { en: {examples: 'Feature examples', use: 'Use example', next: 'Next', goto: 'Take me there', noView: 'Could not open the Edit view. Choose "Edit" at the top.', noTarget: 'This item is not available here. Follow the steps above.', noHidden: 'The timeline has no clip with sound yet. Import or generate one first.', book: 'Read the tutorial', done: 'Done', close: 'Close', gotIt: 'Got it', @@ -108,7 +109,7 @@ export async function openFeatureTour({api = contextFor()?.api, cn = contextFor( // A card that comes by itself on entering a view needs its control on screen; it waits (unseen) otherwise. // The cards of an update without a control on screen are centred. if (trigger && !cardTarget(loaded[0].card, owner?.isConnected ? owner : document)) { release(loaded); return false; } - return openAnchorCard({api, cn, loaded, owner, badge: version ? CARD_TEXT[cn ? 'zh' : 'en'].newIn(version) : ''}); + return openAnchorCard({api, cn, loaded, owner, badge: version ? fill(localized(CARD_TEXT, translator(cn)).newIn, { version }) : ''}); } return false; } finally { opening = false; } @@ -167,11 +168,12 @@ function icon(name) { svg.setAttribute('class', `fv-tour-i${name === 'play' || name === 'pause' ? ' is-solid' : ''}`); const path = document.createElementNS(SVG_NS, 'path'); path.setAttribute('d', ICONS[name]); svg.append(path); return svg; } +// i18n-table const CARD_TEXT = { - en: {gotIt: 'Got it', next: 'Next', close: 'Close', book: 'Read the tutorial', tryIt: 'Try it', play: 'Play with sound', pause: 'Pause', newIn: v => `New in ${v}`, + en: {gotIt: 'Got it', next: 'Next', close: 'Close', book: 'Read the tutorial', tryIt: 'Try it', play: 'Play with sound', pause: 'Pause', newIn: 'New in {version}', xUse: 'Hide this; nothing else changes', gotItUse: 'Hide it; it will not show again', bookUse: 'Open the chapter about this', nextUse: 'See the next one', tryUse: 'Fill in this example to generate', playUse: 'Play this example with sound', segUse: 'Play this version with sound', key: 'Space'}, - zh: {gotIt: '知道了', next: '下一张', close: '关闭', book: '看教程', tryIt: '试一试', play: '播放声音', pause: '暂停', newIn: v => `${v} 新功能`, + zh: {gotIt: '知道了', next: '下一张', close: '关闭', book: '看教程', tryIt: '试一试', play: '播放声音', pause: '暂停', newIn: '{version} 新功能', xUse: '收起说明,不影响当前操作', gotItUse: '收起,下次不再出现', bookUse: '打开讲这个功能的那一章', nextUse: '看下一个功能', tryUse: '把示例的描述和素材填进去', playUse: '有声播放这段示例', segUse: '有声播放这一版', key: '空格'}, }; @@ -182,12 +184,12 @@ const button = (text, kind, [name, use, key = '']) => { // The card's example: one muted loop (or four for the quality levels); a card about sound shows the waveform and plays // with sound from one button; versions of the same example are a segmented choice that plays the chosen one with sound. -function cardMedia(card, videos, lang, text, reduced) { +function cardMedia(card, videos, t, text, reduced) { const box = el('div', 'fv-tour-mediabox'); - const loop = video => { video.muted = true; video.loop = true; video.hidden = false; video.tabIndex = -1; video.removeAttribute('role'); video.onclick = null; video.onkeydown = null; video.setAttribute('aria-label', card.title[lang]); return video; }; + const loop = video => { video.muted = true; video.loop = true; video.hidden = false; video.tabIndex = -1; video.removeAttribute('role'); video.onclick = null; video.onkeydown = null; video.setAttribute('aria-label', localized(card.title, t)); return video; }; if (card.quality) { const quad = el('div', 'fv-tour-quad'); - card.quality.forEach((preview, i) => { const cell = el('figure'); cell.append(loop(videos[i]), el('figcaption', null, preview.label[lang])); quad.append(cell); }); + card.quality.forEach((preview, i) => { const cell = el('figure'); cell.append(loop(videos[i]), el('figcaption', null, localized(preview.label, t))); quad.append(cell); }); box.append(quad); return {box, playing: () => videos.slice(0, card.quality.length)}; } @@ -196,7 +198,7 @@ function cardMedia(card, videos, lang, text, reduced) { const labelled = card.sequence?.filter(item => item.label) || []; let shown = 0, sound = false; const playButton = el('button', 'fv-tour-play'); playButton.type = 'button'; - const setPlay = () => { playButton.replaceChildren(icon(sound ? 'pause' : 'play'), document.createTextNode(sound ? text.pause : labelled.length === 1 ? labelled[0].label[lang] : text.play)); }; + const setPlay = () => { playButton.replaceChildren(icon(sound ? 'pause' : 'play'), document.createTextNode(sound ? text.pause : labelled.length === 1 ? localized(labelled[0].label, t) : text.play)); }; const all = (card.sequence ? videos.slice(0, card.sequence.length) : [videos[0]]).map(loop); all.forEach((video, i) => { video.hidden = i !== shown; figure.append(video); }); let waveImage = null; @@ -219,9 +221,9 @@ function cardMedia(card, videos, lang, text, reduced) { } box.append(figure); if (labelled.length > 1) { - const group = el('div', 'fv-tour-seg'); group.setAttribute('role', 'group'); group.setAttribute('aria-label', card.title[lang]); + const group = el('div', 'fv-tour-seg'); group.setAttribute('role', 'group'); group.setAttribute('aria-label', localized(card.title, t)); card.sequence.forEach((item, i) => { - const segment = el('button', null, item.label[lang]); segment.type = 'button'; tip(segment, item.label[lang], text.segUse); + const label = localized(item.label, t), segment = el('button', null, label); segment.type = 'button'; tip(segment, label, text.segUse); segment.setAttribute('aria-pressed', String(i === 0)); segment.onclick = () => show(i, true); segments.push(segment); group.append(segment); }); box.append(group); @@ -236,7 +238,7 @@ function cardMedia(card, videos, lang, text, reduced) { * it does not take focus, and closing it counts as seen. Returns false when nothing could be shown. */ function openAnchorCard({api, cn, loaded, owner, automatic = true, badge = ''}) { - const lang = cn ? 'zh' : 'en', text = CARD_TEXT[lang], reduced = reducedMotion(); + const t = translator(cn), text = localized(CARD_TEXT, t), reduced = reducedMotion(); const scope = owner?.isConnected ? owner : document; let index = 0, media = null, layer = null, finished = false; const stopAll = () => { media?.stop?.(); for (const {videos} of loaded) for (const video of videos) video.pause(); }; @@ -249,14 +251,14 @@ function openAnchorCard({api, cn, loaded, owner, automatic = true, badge = ''}) stopAll(); const {card, videos} = loaded[index]; const found = cardTarget(card, scope); - media = cardMedia(card, videos, lang, text, reduced); + media = cardMedia(card, videos, t, text, reduced); const body = el('div', 'fv-tour-body'); if (badge) { const eyebrow = el('div', 'fv-tour-eyebrow'); eyebrow.append(el('span', 'fv-tour-badge', badge)); body.append(eyebrow); } - const head = el('div', 'fv-tour-head'), title = el('h3', null, card.title[lang]); title.id = 'fv-tour-card-title'; + const head = el('div', 'fv-tour-head'), title = el('h3', null, localized(card.title, t)); title.id = 'fv-tour-card-title'; const x = el('button', 'fv-tour-x'); x.type = 'button'; x.setAttribute('aria-label', text.close); x.append(icon('x')); tip(x, text.close, text.xUse, 'Esc'); x.onclick = () => layer?.close('fade', 'dismiss'); head.append(title, x); - const live = el('span', 'fv-tour-live', card.title[lang]); live.setAttribute('aria-live', 'polite'); + const live = el('span', 'fv-tour-live', localized(card.title, t)); live.setAttribute('aria-live', 'polite'); const foot = el('div', 'fv-tour-foot'); const chapter = BOOK_CHAPTER[card.id]; if (chapter) { @@ -281,7 +283,7 @@ function openAnchorCard({api, cn, loaded, owner, automatic = true, badge = ''}) const done = button(text.gotIt, 'fill', [text.gotIt, text.gotItUse, 'Esc']); done.dataset.fvTourPrimary = ''; done.onclick = () => layer?.close('fade', 'dismiss'); foot.append(done); } - body.append(head, el('p', 'fv-tour-text', card.line[lang]), live, foot); + body.append(head, el('p', 'fv-tour-text', localized(card.line, t)), live, foot); const keep = found?.keep || []; layer = openAnchor({owner, target: found ? (TARGETS[card.target] || found.node) : null, keep, level: 2, shapes: card.quality ? ['stand'] : ['stand', 'wide'], content: [media.box, body], ghost: card.target === 'sound-range', focus, label: title.id, onClose: finish}); diff --git a/web/feature_tour_content.js b/web/feature_tour_content.js index e6df1f30..db85de93 100644 --- a/web/feature_tour_content.js +++ b/web/feature_tour_content.js @@ -6,7 +6,7 @@ const clip = name => ({mp4: `${name}.mp4`, poster: `${name}.webp`}); export const CASTLE_PROMPT = ['A white stone castle rises above the mist as the camera slowly moves closer in daylight.', '白石城堡耸立在薄雾之上,日光下镜头缓缓推近。']; const card = (id, title, line, input, preview, tryit, extra = {}) => ({id, added: '0.4.21', title, line, input, clip: preview, tryit, ...extra}); export const FEATURE_TOUR = [ - card('text-to-video', copy('Text to video', '文字生成视频'), copy('Write a description and get a video.', '写一段描述,生成一段视频。'), + card('text-to-video', copy('Text to video', '文字生成视频'), copy('Write a prompt and get a video.', '写一段提示词,生成一段视频。'), [{text: copy(...CASTLE_PROMPT)}], clip('c1-s2'), {assets: [], prompt: CASTLE_PROMPT, settings: {quality: 'High', width: 1344, height: 768, seconds: 5}}, {target: ['prompt-box']}), card('first-last-frame', copy('First and last frame', '首帧和尾帧'), copy('Set the opening and closing frames, and the motion in between is generated.', '给出开头和结尾,生成中间的画面。'), [{text: copy('First frame + last frame', '首帧 + 尾帧')}], clip('c3-s1'), {status: 'pending-assets'}, {trigger: 'media', target: ['[data-fv-guide="media"]', 'prompt-box']}), @@ -20,32 +20,32 @@ export const FEATURE_TOUR = [ {assets: [{file: 'fox-sheet.webp', role: 'reference'}], prompt: ['The fox in {image1} walks through a sunlit forest.', '{image1} 中的狐狸走过洒满阳光的森林。'], settings: {}}, {target: ['[data-fv-guide="media"]', 'prompt-box'], sequence: [clip('c5-forest-s1'), clip('c5-snow-s1')]}), card('replace-person', copy('Replace person', '替换人物'), copy('Put the person from an image into a video.', '把视频里的人换成图中的人物。'), [{src: 'c10-source.webp'}, {src: 'c10-person.webp'}], clip('c10-s1'), {status: 'pending-assets'}, {trigger: 'media', added: '0.4.28', target: ['replace-person', '[data-fv-guide="media"]']}), - card('first-video', copy('Make your first video', '做出第一条视频'), copy('Write a description, generate, and find the video in Creations.', '写一段描述,生成,再到作品中找到它。'), + card('first-video', copy('Make your first video', '做出第一条视频'), copy('Write a prompt, generate, and find the video in Creations.', '写一段提示词,生成,再到作品中找到它。'), [{text: copy(...CASTLE_PROMPT)}], clip('c11-s1'), {assets: [], prompt: CASTLE_PROMPT, settings: {}}, {added: '0.5.0', goto: ['prompt-box', 'generate-btn', 'works-entry']}), - card('character', copy('Characters', '角色'), copy('Save a character once, then mention it with @ in any description.', '角色保存一次,之后在任意描述中用 @ 引用。'), + card('character', copy('Characters', '角色'), copy('Save a character once, then mention it with @ in any prompt.', '角色保存一次,之后在任意提示词中用 @ 引用。'), [{text: copy('@Leo walks along the shore.', '@小林 走在海边。')}], clip('c12-s1'), {status: 'pending-assets'}, {trigger: 'media', added: '0.5.0', goto: ['cast-add', 'prompt-box']}), card('edit-view', copy('Edit view', '剪辑视图'), copy('Arrange clips on the timeline and adjust picture, sound and speed.', '在时间线上排列片段,调整画面、声音和速度。'), [{src: 'c12-s1.webp'}], clip('c13-s1'), {status: 'pending-assets', view: 'editor'}, {trigger: 'editor', added: '0.5.0', goto: ['editor-timeline', 'editor-inspector'], target: ['editor-timeline']}), card('separate-sound', copy('Separate and replace sound', '分离与替换声音'), copy('Split the sound into dialogue, music and ambience, then replace each one.', '把声音分成人声、音乐和环境声,再分别替换。'), [{src: 'cb-source.webp'}], clip('cb-source'), {status: 'pending-assets', view: 'editor'}, {trigger: 'editor', added: '0.5.0', goto: ['audio-track-button'], select: '.fv-ed-clip[data-track=a1]', sequence: [['source', 'Original', '原声'], ['dialogue', 'Dialogue', '人声'], ['music', 'Music', '音乐'], ['ambience', 'Ambience', '环境声']].map(([name, en, zh]) => ({...clip(`cb-${name}`), label: copy(en, zh)}))}), - card('add-sound', copy('Add sound to a video', '给视频加声音'), copy('Drag a range on the sound track and add music, a voice-over or a recording.', '在声音轨上拖一段,加配乐、配音,或录一段声音。'), + card('add-sound', copy('Add sound to a video', '给视频加声音'), copy('Drag a range on the sound track and add music, a voice-over or a recording.', '在声音轨上拖一段,加配乐、旁白,或录一段声音。'), [{src: 'ca-music-wave.webp'}], clip('ca-music'), {status: 'pending-assets', view: 'editor'}, - {trigger: 'editor', added: '0.5.0', goto: ['audio-a2-track'], sequence: [['music', 'Music', '配乐'], ['dub', 'Voice-over', '配音'], ['record', 'Recording', '录音']].map(([name, en, zh]) => ({...clip(`ca-${name}`), wave: `ca-${name}-wave.webp`, label: copy(en, zh)}))}), - card('narration', copy('Add a spoken line', '为一句话配音'), copy('Right-click an empty spot on a sound track, choose "Narration", write a line and choose "Generate".', '在声音轨的空白处点右键,选“配音”,写下一句话,点“生成”。'), + {trigger: 'editor', added: '0.5.0', goto: ['audio-a2-track'], sequence: [['music', 'Music', '配乐'], ['dub', 'Voice-over', '旁白'], ['record', 'Recording', '录音']].map(([name, en, zh]) => ({...clip(`ca-${name}`), wave: `ca-${name}-wave.webp`, label: copy(en, zh)}))}), + card('narration', copy('Add a spoken line', '为一句话添加旁白'), copy('Right-click an empty spot on a sound track, choose "Narration", write a line and choose "Generate".', '在声音轨的空白处点右键,选“旁白”,写下一句话,点“生成”。'), [{src: 'cd-narration-wave.webp'}], clip('cd-narration'), {status: 'pending-assets', view: 'editor'}, {trigger: 'editor', added: '0.5.0', goto: ['editor-timeline'], target: ['audio-a2-track', 'audio-a1-track'], sequence: [{...clip('cd-narration'), label: copy('Pick a voice and generate', '选音色并生成')}]}), - card('sound-to-picture', copy('Generate a picture from sound', '按声音生成画面'), copy('Drag an empty range on the video track above a sound, and the picture follows it.', '在有声音的区间上方的视频轨拖出一段空白,画面随声音生成。'), + card('sound-to-picture', copy('Generate video from sound', '按声音生成画面'), copy('Drag an empty range on the video track above a sound, and the picture follows it.', '在有声音的区间上方的视频轨拖出一段空白,画面随声音生成。'), [{src: 'cc-speech-wave.webp'}], clip('cc-speech'), {status: 'pending-assets', view: 'editor'}, {trigger: 'editor', added: '0.5.0', goto: ['video-empty-range'], target: 'sound-range', sequence: [{...clip('cc-speech'), label: copy('Play with sound', '播放声音')}]}), - card('segment-prompt', copy('Describe each part', '逐段描述'), copy('Each part of a longer shot has its own description.', '较长镜头的每一段,各有各的描述。'), + card('segment-prompt', copy('Describe each part', '逐段描述'), copy('Each part of a longer shot has its own prompt.', '较长镜头的每一段,各有各的提示词。'), [{text: copy('Part 1: A fox walks through a sunlit forest.', '第 1 段:狐狸走过洒满阳光的森林。')}, {text: copy('Part 2: A fox walks through snow.', '第 2 段:狐狸走过雪地。')}], clip('c5-forest-s1'), {status: 'pending-assets', view: 'editor'}, {trigger: 'editor', added: '0.5.0', goto: ['segment-prompt'], sequence: [['forest', 'Part 1', '第 1 段'], ['snow', 'Part 2', '第 2 段']].map(([name, en, zh]) => ({...clip(`c5-${name}-s1`), label: copy(en, zh)}))}), - card('library-reuse', copy('Reuse settings', '复用设置'), copy('Fill the prompt, size, duration and seed of an earlier video back in.', '把以前一条视频的描述、尺寸、时长和种子填回来。'), + card('library-reuse', copy('Reuse settings', '复用设置'), copy('Fill the prompt, size, duration and seed of an earlier video back in.', '把以前一条视频的提示词、尺寸、时长和种子填回来。'), [{text: copy(...CASTLE_PROMPT)}], clip('c1-s2'), {status: 'pending-assets'}, {added: '0.5.0', goto: ['library-reuse', 'works-entry']}), - card('extend', copy('Extend', '接着生成'), copy('Continue from where the last clip ends.', '从上一段的结尾接着生成下一段。'), + card('extend', copy('Extend', '接着生成'), copy('Extend from where the last clip ends.', '从上一段的结尾接着生成下一段。'), [{src: 'c6-s1.webp'}], clip('c6-s1'), {startClip: {file: 'c1-s2.mp4'}, view: 'editor'}, {trigger: 'editor', previewRange: [2, 8], target: ['.fv-ed-clip[data-track="v1"]']}), - card('two-pass', copy('Two-pass', '二采'), copy('The first pass sets the composition; the second adds detail. Choose "Preview first" to see a half-size preview, then "Run second pass" when it looks right.', '第一遍定构图,第二遍补细节。选“先出预览”,可先看半分辨率预览,满意后点“继续二采”。'), + card('two-pass', copy('Second pass', '二采'), copy('The first pass sets the composition; the second adds detail. Choose "Preview first" to see a half-size preview, then "Run second pass" when it looks right.', '第一遍定构图,第二遍补细节。选“先出预览”,可先看半分辨率预览,满意后点“继续二采”。'), [{...clip('c7-src-s1')}], clip('c7-s1'), {assets: [], prompt: ['A dark castle emerges from the mist as the camera slowly moves closer.', '深色城堡从薄雾中显现,镜头缓缓推近。'], settings: {two_pass: true}}, {target: ['pass-mode', 'generate-btn']}), card('edit-image', copy('Edit image', '编辑图片'), copy('Change only the selected area and keep the rest.', '只改选中的区域,其余保持不变。'), [{src: 'c8-original.webp'}, {text: copy('Make the sneaker red.', '把球鞋改成红色。')}], clip('c8-s1'), {status: 'pending-assets'}), diff --git a/web/field_note.js b/web/field_note.js index 8789825e..38b60958 100644 --- a/web/field_note.js +++ b/web/field_note.js @@ -40,9 +40,9 @@ export function nearestAllowed(input) { export function fieldNote(input, {t = (en, zh) => en, place = null, limits = {}, className = ''} = {}) { let line = null; const words = { - max: n => t(`At most ${n}`, `最多 ${n}`), - min: n => t(`At least ${n}`, `最少 ${n}`), - step: n => t(`Changed to ${n}`, `已改为 ${n}`), + max: n => t('At most {n}', '最多 {n}', { n }), + min: n => t('At least {n}', '最少 {n}', { n }), + step: n => t('Changed to {n}', '已改为 {n}', { n }), ...limits, }; function say(text) { diff --git a/web/first_run_guide.js b/web/first_run_guide.js index 005dcd2d..454e6eda 100644 --- a/web/first_run_guide.js +++ b/web/first_run_guide.js @@ -1,6 +1,8 @@ import {SHOWCASE_TEXT, showcaseChapter, loadShowcaseImage} from './entry_showcase.js'; import './glass/library.js'; import {openAnchor} from './feature_tour_layer.js'; +import {translator} from './i18n.js'; +import {localized, promptText} from './i18n_tables.js'; const FILE = '/userdata/' + encodeURIComponent('freevideo/guide.json'); const attempted = new Set(); @@ -21,14 +23,14 @@ export const REPLAY_TEXT = { // It never starts by itself; Settings › Getting started and the tutorial replay it in the view in front. export const CHAPTERS = [ {id: 'describe', anchor: '[data-fv-guide="describe"]', added: false, title: ['Write one sentence', '写一句描述'], - en: 'Say who is where, doing what. Type @ to use added pictures and videos.', + en: 'Say who is where, doing what. Type @ to use added images and videos.', zh: '说清谁在哪里做什么。输入 @ 可引用添加的图片和视频。'}, {id: 'generate', anchor: '[data-fv-guide="generate"]', added: false, title: ['Generate', '生成'], en: 'Shape, length and quality are on this row; progress shows on the picture.', zh: '画幅、时长和质量在这一行;进度显示在画面上。'}, {id: 'longer', anchor: '[data-view="editor"]', target: dialog => tabsOrLength(dialog), added: true, title: ['Longer and more', '更长、更完整'], - en: 'A longer duration is made in parts; continue part by part in Edit, or let Autopilot film it.', + en: 'A longer duration is made in parts; extend part by part in Edit, or let Autopilot film it.', zh: '填更长的时长会自动分段;也可以到剪辑视图逐段接续,或交给 AI 全自动拍完。'}, {id: 'editor-timeline', group: 'editor', anchor: '[data-fv-guide="editor-timeline"]', added: true, title: ['Drag it in', '拖进来'], en: 'Drag a video here.', zh: '把视频拖到这里。'}, @@ -40,11 +42,23 @@ export const CHAPTERS = [ ]; // "Longer and more" points at the Edit and Autopilot tabs that are on screen, or at the length on a phone. +// An anchor in a settings or works column folded to its rail (a window narrower than 1280 px) is not a missing target: it stands +// as that rail until the step is shown, and showing the step (reveal) opens the column as a drawer. Asking whether a step exists +// opens nothing, so a person who has seen the guide is never given a drawer. +const foldedPanel = node => node?.closest?.('.fv-body [data-collapsed=true]') || null; +const atRail = (panel, node, reveal = null) => { + const box = (panel.querySelector(':scope > .fv-iv-rail') || panel).getBoundingClientRect(), shell = panel.closest('.fv-body')?.studioPanels; + return {node, folded: true, rect: {left: box.left, top: box.top, right: box.right, bottom: box.bottom, width: box.width, height: box.height}, + reveal: () => { shell?.setPanel(panel.matches('.fv-work-column') ? 'right' : 'left', true); reveal?.(); }}; +}; function tabsOrLength(dialog) { const shown = node => node?.isConnected && !node.closest('[hidden]') && node.getClientRects().length && node.getBoundingClientRect().width > 0; const tabs = [...dialog.querySelectorAll(':scope > .fv-header .fv-view-switch [data-view="editor"], :scope > .fv-header .fv-view-switch [data-view="autopilot"]')].filter(shown); const nodes = tabs.length ? tabs : [dialog.querySelector('[data-fv-guide="seconds"]')].filter(shown); - if (!nodes.length) return null; + if (!nodes.length) { + const field = dialog.querySelector('[data-fv-guide="seconds"]'), panel = field && !shown(field) ? foldedPanel(field) : null; + return panel ? atRail(panel, field) : null; + } const rects = nodes.map(node => node.getBoundingClientRect()); const left = Math.min(...rects.map(r => r.left)), top = Math.min(...rects.map(r => r.top)), right = Math.max(...rects.map(r => r.right)), bottom = Math.max(...rects.map(r => r.bottom)); return {node: nodes[0], rect: {left, top, right, bottom, width: right - left, height: bottom - top}}; @@ -159,7 +173,7 @@ const ROW_ICONS = {flag: 'M4 13.5V3M4 3.5h7.5l-1.5 2.5 1.5 2.5H4', play: 'M5 3.2 const rowIcon = name => { const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttribute('viewBox', '0 0 16 16'); svg.setAttribute('aria-hidden', 'true'); const path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); path.setAttribute('d', ROW_ICONS[name]); svg.append(path); return svg; }; export function createGuideReplayEntry({dialog, cn, api, openWorkspace, replay = replayInFront}) { - const text = key => REPLAY_TEXT[key][cn ? 1 : 0], t = (en, zh) => cn ? zh : en; + const t = translator(cn), text = key => t(...REPLAY_TEXT[key]); const tipped = (node, name, use) => { node.dataset.fvTipName = name; node.dataset.fvTipUse = use; return node; }; const section = el('section', null, 'fv-guide-replay'), row = el('div', null, 'fv-guide-replay-row'), rows = el('div', null, 'fv-guide-rows'); const line = (icon, name, small, control) => { const item = el('div', null, 'fv-guide-row'), words = el('span'); words.append(el('b', name), el('small', small)); item.append(rowIcon(icon), words, control); return item; }; @@ -245,9 +259,15 @@ export function createGuideReplayEntry({dialog, cn, api, openWorkspace, replay = // Custom targets return viewport rectangles on every layout pass. They never // insert hit targets or change the editor's pointer handling. export function guideTarget(dialog, chapter, targets = {}) { - if (chapter.target) return chapter.target(dialog); - if (targets[chapter.id]) return targets[chapter.id](); + const customFn = chapter.target ? () => chapter.target(dialog) : targets[chapter.id]; + if (customFn) { + const custom = customFn(); + const panel = custom && !visible(custom.node) ? foldedPanel(custom.node) : null; + return panel ? atRail(panel, custom.node, custom.reveal) : custom; + } const nodes = (chapter.anchors || [chapter.anchor]).map(selector => dialog.querySelector(selector)); + const folded = nodes.map(node => (node && !visible(node) ? foldedPanel(node) : null)).find(Boolean); + if (folded && nodes.every(node => node && (visible(node) || foldedPanel(node)))) return atRail(folded, nodes[0]); if (nodes.some(node => !visible(node))) return null; const rects = nodes.map(node => node.getBoundingClientRect()); const left = Math.min(...rects.map(r => r.left)), top = Math.min(...rects.map(r => r.top)); @@ -256,7 +276,7 @@ export function guideTarget(dialog, chapter, targets = {}) { } export function createFirstRunGuide({dialog, api, cn, isBusy = () => false, group = 'studio', targets = {}, onShowcaseTry = null}) { - const t = (en, zh) => cn ? zh : en; + const t = translator(cn); const automatic = !attempted.has(group), editor = group === 'editor'; const chapters = chaptersFor(group); if (!document.querySelector('link[data-fv-first-run-guide]')) { @@ -271,7 +291,7 @@ export function createFirstRunGuide({dialog, api, cn, isBusy = () => false, grou const heldKeys = new Set(); const resolved = chapter => { const value = guideTarget(dialog, chapter, targets); - return value && visible(value.node) && value.rect.width > 0 && value.rect.height > 0 ? value : null; + return value && (value.folded || visible(value.node)) && value.rect.width > 0 && value.rect.height > 0 ? value : null; }; const available = () => chapters.filter(c => resolved(c)).map(c => c.id); const shown = step => resolved(step) || (step.image && touring); @@ -335,7 +355,7 @@ export function createFirstRunGuide({dialog, api, cn, isBusy = () => false, grou head.append(title, close); const foot = el('div', null, 'fv-tour-foot'); foot.append(el('span', null, 'fv-tour-grow')); const next = button(t(...SHOWCASE_TEXT.try), 'primary', t(...SHOWCASE_TEXT.try), t('Fill this example in Autopilot', '在 AI 全自动里填好这个示例')); - next.dataset.fvTourPrimary = ''; next.onclick = () => { finish(); onShowcaseTry(t(...SHOWCASE_TEXT.example)); }; + next.dataset.fvTourPrimary = ''; next.onclick = () => { finish(); onShowcaseTry(promptText(SHOWCASE_TEXT.example, cn)); }; foot.append(next); body.append(head, foot); const media = el('div', null, 'fv-tour-mediabox'), figure = el('figure', null, 'fv-tour-media fv-showcase-media'); figure.append(showcase.image); media.append(figure); anchor = openAnchor({owner: dialog, target: null, level: 2, shapes: ['stand'], content: [media, body], focus: true, label: title.id, @@ -362,7 +382,7 @@ export function createFirstRunGuide({dialog, api, cn, isBusy = () => false, grou const head = el('div', null, 'fv-tour-head'), title = el('h3', touring ? tourTitle || t('Walkthrough', '演示') : t(...(step.title || ['Getting started', '新手指引']))); title.id = 'fv-guide-title'; head.append(title); - const message = el('p', cn ? step.zh : step.en, 'fv-tour-text fv-guide-message'); message.id = 'fv-guide-message'; + const message = el('p', localized(step, t), 'fv-tour-text fv-guide-message'); message.id = 'fv-guide-message'; message.setAttribute('aria-live', 'polite'); message.setAttribute('aria-atomic', 'true'); const foot = el('div', null, 'fv-tour-foot'); if (count > 1) { @@ -561,7 +581,7 @@ export const FIRST_RUN_TEXT = { generate: ['Generate video', '生成视频'], hint: ['Click "Generate video" to get your first video.', '点“生成视频”,得到第一段视频。'], close: ['Close', '关闭'], - next: ['Continue this video', '接着生成这条视频'], + next: ['Extend this video', '接着生成这条视频'], longer: ['Extend', '接着生成'], edit: ['Edit', '剪辑'], }; @@ -596,7 +616,7 @@ export async function openFirstNextLonger() { export function createFirstStart({dialog, api, cn, prompt, onPrefill, onGenerate, onEdit, onLonger = openFirstNextLonger, isBusy = () => false}) { - const text = key => FIRST_RUN_TEXT[key][cn ? 1 : 0]; + const t = translator(cn), text = key => key === 'prompt' ? promptText(FIRST_RUN_TEXT.prompt, cn) : t(...FIRST_RUN_TEXT[key]); let disposed = false, hint = null, next = null, timer = null, pending = null, showing = false; const hideBubble = () => { const shown = hint; hint = null; shown?.close('fade', 'replace'); }; const tipped = (node, name, use, key = '') => { node.dataset.fvTipName = name; node.dataset.fvTipUse = use; if (key) node.dataset.fvTipKey = key; return node; }; @@ -628,14 +648,14 @@ export function createFirstStart({dialog, api, cn, prompt, onPrefill, onGenerate const body = el('div', null, 'fv-tour-body'), head = el('div', null, 'fv-tour-head'), title = el('h3', text('next')); title.id = 'fv-next-title'; const close = el('button', null, 'fv-tour-x'); close.type = 'button'; close.setAttribute('aria-label', text('close')); close.innerHTML = ''; - tipped(close, text('close'), cn ? '收起说明,不影响当前操作' : 'Hide this; nothing else changes', 'Esc'); + tipped(close, text('close'), t('Hide this; nothing else changes', '收起说明,不影响当前操作'), 'Esc'); head.append(title, close); const foot = el('div', null, 'fv-tour-foot'); foot.append(el('span', null, 'fv-tour-grow')); - const edit = tipped(el('button', text('edit'), 'fv-tour-btn'), text('edit'), cn ? '放进剪辑视图继续改' : 'Open it in Edit'); - const longer = tipped(el('button', text('longer'), 'fv-tour-btn fv-primary'), text('longer'), cn ? '从结尾生成下一段' : 'Make the next part from the end'); + const edit = tipped(el('button', text('edit'), 'fv-tour-btn'), text('edit'), t('Open it in Edit', '放进剪辑视图继续改')); + const longer = tipped(el('button', text('longer'), 'fv-tour-btn fv-primary'), text('longer'), t('Make the next part from the end', '从结尾生成下一段')); edit.type = longer.type = 'button'; edit.dataset.kind = 'fill'; longer.dataset.kind = 'primary'; longer.dataset.fvTourPrimary = ''; foot.append(edit, longer); - body.append(head, el('p', cn ? '从结尾继续下一段,或到剪辑视图里排列。' : 'Continue from the end, or arrange it in Edit.', 'fv-tour-text'), foot); + body.append(head, el('p', t('Extend from the end, or arrange it in Edit.', '从结尾继续下一段,或到剪辑视图里排列。'), 'fv-tour-text'), foot); const leave = async action => { next?.close('now', 'replace'); next = null; await action(); }; // The real result button continues the clip directly; the tutorial is the fallback when it is not on screen. longer.onclick = () => leave(() => { const real = dialog.querySelector('.fv-action-extend'); return real && !real.disabled ? real.click() : onLonger(); }); diff --git a/web/freevideo.js b/web/freevideo.js index 573256fd..10931e4c 100644 --- a/web/freevideo.js +++ b/web/freevideo.js @@ -47,7 +47,7 @@ import { issueButton } from './issue_button.js'; import { createPlayBar } from './fv_player.js'; import { userMessage } from './user_message.js'; import { AUDIO_USE, usesOriginal, checkOriginal, checkedLength, failureText, multipleText, createUseSwitch, originalBlocked, stuckText, liftBlock } from './audio_original.js'; -import { isChinese, translator } from './i18n.js'; +import { isChinese, translator, LANGUAGE, pageLanguage } from './i18n.js'; const cn = isChinese(); const text = translator(cn); @@ -83,36 +83,57 @@ style.textContent = ` `; document.head.append(style); -// The node view in Chinese: socket names, and the values of lists, in Chinese words; switches show no words (their +// The node view in the page's language: socket names, and the values of lists, in words; switches show no words (their // knob says on or off). Display only: the saved values stay what the engine reads. Set again after a workflow loads, -// since a saved workflow carries the names of the language it was saved in. -const SLOT_ZH = {first: '首帧', 'First frame': '首帧', last: '尾帧', 'Last frame': '尾帧', references: '参考图', loras: 'LoRA', LoRAs: 'LoRA', - conditioning: '条件输入', media: '素材', text: '描述', reference_audio: '参考音频', 'Reference audio': '参考音频', video: '视频', report: '报告', 'Report JSON': '报告'}; -const VALUE_ZH = { - control_after_generate: {fixed: '保持固定', increment: '递增', decrement: '递减', randomize: '每次随机'}, - step_cache: {none: '关', 'easycache-av': '音画缓存', fbcache: '首块缓存'}, - audio_use: {reference: '参考', original: '原样使用'}, +// since a saved workflow carries the names of the language it was saved in. In English it keeps ComfyUI's own names. +const SLOT_WORDS = {first: ['First frame', '首帧'], 'First frame': ['First frame', '首帧'], last: ['Last frame', '尾帧'], 'Last frame': ['Last frame', '尾帧'], + references: ['Reference images', '参考图'], loras: ['LoRA', 'LoRA'], LoRAs: ['LoRA', 'LoRA'], conditioning: ['Conditioning', '条件输入'], media: ['Media', '素材'], + text: ['Prompt', '提示词'], reference_audio: ['Reference audio', '参考音频'], 'Reference audio': ['Reference audio', '参考音频'], video: ['Video', '视频'], + report: ['Report', '报告'], 'Report JSON': ['Report', '报告']}; +const VALUE_WORDS = { + control_after_generate: {fixed: ['Keep fixed', '保持固定'], increment: ['Increment', '递增'], decrement: ['Decrement', '递减'], randomize: ['New each run', '每次随机']}, + step_cache: {none: ['Off', '关'], 'easycache-av': ['Audio and video cache', '音画缓存'], fbcache: ['First-block cache', '首块缓存']}, + audio_use: {reference: ['Reference', '参考'], original: ['Use as is', '原样使用']}, }; -const LABEL_ZH = {audio_use: '音频用途'}; -// Node titles in Chinese, shown on the canvas and in search only: the saved title stays as it is, and a title the user -// typed is shown as typed. -const TITLE_ZH = {'FreeVideo · Generate & Preview': 'FreeVideo · 生成与预览', 'FreeVideo · Video + Audio': 'FreeVideo · 视频 + 音频', - 'FreeVideo · Media': 'FreeVideo · 素材', 'FreeVideo · LoRA': 'FreeVideo · LoRA', 'FreeVideo · LoRAs': 'FreeVideo · LoRA', - 'FreeVideo · First / Last Frame': 'FreeVideo · 首尾帧', 'FreeVideo · Reference (experimental)': 'FreeVideo · 参考(实验)'}; +const LABEL_WORDS = {audio_use: ['Audio use', '音频用途']}; +// Node titles in the page's language, shown on the canvas and in search only: the saved title stays as it is, and a +// title the user typed is shown as typed. +const TITLE_WORDS = {'FreeVideo · Generate & Preview': ['FreeVideo · Generate & Preview', 'FreeVideo · 生成与预览'], 'FreeVideo · Video + Audio': ['FreeVideo · Video + Audio', 'FreeVideo · 视频 + 音频'], + 'FreeVideo · Media': ['FreeVideo · Media', 'FreeVideo · 素材'], 'FreeVideo · LoRA': ['FreeVideo · LoRA', 'FreeVideo · LoRA'], 'FreeVideo · LoRAs': ['FreeVideo · LoRA', 'FreeVideo · LoRA'], + 'FreeVideo · First / Last Frame': ['FreeVideo · First / Last Frame', 'FreeVideo · 首尾帧'], 'FreeVideo · Reference (experimental)': ['FreeVideo · Reference (experimental)', 'FreeVideo · 参考(实验)']}; +// The generate node's inputs: the English is the name and tip the node itself has (freevideo_engine/comfy_nodes.py). +const INPUT_WORDS = [ + ['width', ['Width', '宽度']], + ['height', ['Height', '高度']], + ['seconds', ['Duration (s)', '时长(秒)']], + ['seed', ['Seed', '种子']], + ['force_regenerate', ['Force regeneration', '重新生成'], ['Generate again even when an identical completed video is saved locally.', '跳过已保存结果的缓存。']], + ['preview', ['Preview first', '先出预览'], ['Part of the faster second pass: pause after the half-resolution first pass and save it as a preview. Run the second pass from the result when it looks right; it continues from the same latents.', '先出低分辨率预览,满意后在结果里点“继续二采”,成片与直接生成一致。']], + ['refine_from', ['Second pass of preview', '继续二采'], ["Set by the Run second pass button: the preview video to continue. The second pass uses the preview's own prompt, seed, size and inputs.", '从这个预览继续生成全分辨率视频。']], + ['continue_from', ['Extend from video', '接着生成']], + ['frames', ['Total frames', '帧数']], + ['first_frame_reference', ['First-frame reference', '首帧参考'], ['Reduces drift.', '减小漂移']], + ['voice_reference', ['Voice reference', '声音参考'], ['Keeps the opening voice consistent in extended dialogue.', '接着生成对白时,沿用原视频开头的声音,让前后声音一致。']], + ['hide_tail', ['Hide dialogue tail', '隐藏对白尾段'], ['Generates and discards 17 extra frames to keep dialogue moving between parts.', '多生成 17 帧后丢弃,让对白在前后两段之间连贯。']], + ['step_cache', ['Step cache', '步间缓存'], ['Reuses work between similar sampling steps to finish sooner, with a small change to the result.', '复用相近采样步之间的计算,更快完成,结果会有细微变化。']], + ['upscale_factor', ['Upscale factor', '放大倍数'], ['Second pass only: a smaller factor starts from a larger first pass, for more detail and a longer run.', '二采时成片相对一采的放大倍数。']], + ['allow_empty_prompt', ['Allow empty prompt', '允许空提示词'], ['Generates from an empty prompt instead of asking for one.', '提示词为空时直接生成,不再提示。']], +]; +const ENGLISH = LANGUAGE === 'en' && !cn; function localizeNode(node) { - if (!cn) return; + if (ENGLISH) return; for (const slot of [...(node.inputs || []), ...(node.outputs || [])]) { // A widget's socket (shown while a link is dragged) reads like its widget. - const name = SLOT_ZH[slot.name] || (slot.widget?.name && node.widgets?.find(widget => widget.name === slot.widget.name)?.label); + const name = (SLOT_WORDS[slot.name] && text(...SLOT_WORDS[slot.name])) || (slot.widget?.name && node.widgets?.find(widget => widget.name === slot.widget.name)?.label); if (name) slot.localized_name = name; } for (const widget of node.widgets || []) { - const names = VALUE_ZH[widget.name]; - if (names) { widget.options ||= {}; widget.options.getOptionLabel = value => names[value] ?? value; } + const names = VALUE_WORDS[widget.name]; + if (names) { widget.options ||= {}; widget.options.getOptionLabel = value => names[value] ? text(...names[value]) : value; } if (widget.type === 'toggle') { widget.options ||= {}; widget.options.on = widget.options.off = ' '; } - if (LABEL_ZH[widget.name]) widget.label = LABEL_ZH[widget.name]; + if (LABEL_WORDS[widget.name]) widget.label = text(...LABEL_WORDS[widget.name]); // The empty prompt box says what goes in it (ComfyUI puts the input's name there). - if (widget.name === 'text' && widget.inputEl) widget.inputEl.placeholder = '描述画面'; + if (widget.name === 'text' && widget.inputEl) widget.inputEl.placeholder = text('Describe the scene', '描述画面'); } node.setDirtyCanvas?.(true, true); } @@ -151,12 +172,14 @@ function mediaKind(name) { function skippedNote(names) { const found = [...new Set(names.map(extensionOf).filter(Boolean).map(ext => "." + ext))], kinds = found.slice(0, 3); const more = found.length > 3, n = names.length; - return text(`Skipped ${n} unsupported file${n === 1 ? "" : "s"}${kinds.length ? ` (${kinds.join(", ")}${more ? " and more" : ""})` : ""}`, - `已跳过 ${n} 个不支持的文件${kinds.length ? `(${kinds.join("、")}${more ? " 等" : ""})` : ""}`); + const list = kinds.join(text(', ', '、')), types = more ? text('{types} and more', '{types} 等', { types: list }) : list; + if (!kinds.length) return n === 1 ? text('Skipped 1 unsupported file', '已跳过 1 个不支持的文件') : text('Skipped {count} unsupported files', '已跳过 {count} 个不支持的文件', { count: n }); + return n === 1 ? text('Skipped 1 unsupported file ({types})', '已跳过 1 个不支持的文件({types})', { types }) + : text('Skipped {count} unsupported files ({types})', '已跳过 {count} 个不支持的文件({types})', { count: n, types }); } const referenceHelp = () => text('Each reference image counts as one media item.', '每张参考图片各占一个素材名额。'); -const referenceLabel = index => text(`Reference image ${index + 1}`, `参考图片 ${index + 1}`); +const referenceLabel = index => text('Reference image {number}', '参考图片 {number}', { number: index + 1 }); // Socket names follow the interface language, like the panel's chips (localizeNode). const referenceSocket = referenceLabel; @@ -434,7 +457,7 @@ function mediaPanel(node, mount = null) { } const middleProblem = middleNotice(active, {first, last, references: refs, seconds: videoSeconds()}, text); const audioUnlinked = node.widgets?.find(w => w.name === 'audio_use')?.value === 'original' && !linked('reference_audio'); - message(audioUnlinked ? text('Connect audio to "Reference audio", or set "Audio use" to "reference", before generating.', '请连接“参考音频”,或把“音频用途”改为“参考”后再生成。') : refs > 32 ? text('There are more than 32 references; remove some before generating.', '参考素材超过 32 个,可移除部分后再生成。') : continuing && active.filter(row => row.role === 'reference' && mediaKind(row.file) === 'image').length > 3 ? text('When continuing, only the first 3 images are used.', '接续时只用前 3\u00a0张图片。') : (first || last || middle.length) && continuing ? (middle.length ? middleLabels.continuing(text) : text("When continuing a video, the first and last frames are used as references.", "接续视频时,首尾帧会用作参考图。")) : first > 1 || last > 1 ? text("Keep only one first frame and one last frame enabled.", "首帧和尾帧各只能启用一张图片。") : middleProblem ? middleProblem : middleInfo(active, videoSeconds(), text) ? middleInfo(active, videoSeconds(), text) : "", Boolean(audioUnlinked || refs > 32 || first > 1 || last > 1 || middleProblem && !continuing)); + message(audioUnlinked ? text('Connect audio to "Reference audio", or set "Audio use" to "reference", before generating.', '请连接“参考音频”,或把“音频用途”改为“参考”后再生成。') : refs > 32 ? text('There are more than 32 references; remove some before generating.', '参考素材超过 32 个,可移除部分后再生成。') : continuing && active.filter(row => row.role === 'reference' && mediaKind(row.file) === 'image').length > 3 ? text('When extending, only the first 3 images are used.', '接续时只用前 3\u00a0张图片。') : (first || last || middle.length) && continuing ? (middle.length ? middleLabels.continuing(text) : text("When extending a video, the first and last frames are used as references.", "接续视频时,首尾帧会用作参考图。")) : first > 1 || last > 1 ? text("Keep only one first frame and one last frame enabled.", "首帧和尾帧各只能启用一张图片。") : middleProblem ? middleProblem : middleInfo(active, videoSeconds(), text) ? middleInfo(active, videoSeconds(), text) : "", Boolean(audioUnlinked || refs > 32 || first > 1 || last > 1 || middleProblem && !continuing)); if (!rows.length && !connections.childElementCount) cards.append(el("div", text("Drop images or video here", "拖入图片或视频"), "fv-empty")); if (!rows.length && connections.childElementCount) cards.append(el('div', text('Media comes from the connected inputs; no upload is needed.', '素材来自已连接的输入,无需上传。'), 'fv-connected-card')); rows.forEach((row, index) => { @@ -532,8 +555,8 @@ function mediaPanel(node, mount = null) { showLength = () => { const long = preview.duration > 15.05 && Number.isFinite(preview.duration); length.hidden = !long || row.sound === false || rows[index]?.sound === false || usesOriginal(row); - if (long) length.textContent = text(`Audio length: ${preview.duration.toFixed(1)} s; uses up to the first 15 s within the video length.`, - `音频长 ${preview.duration.toFixed(1)} 秒,最多取前 15 秒且不超过视频时长。`); + if (long) length.textContent = text('Audio length: {seconds} s; uses up to the first 15 s within the video length.', + '音频长 {seconds} 秒,最多取前 15 秒且不超过视频时长。', { seconds: preview.duration.toFixed(1) }); }; preview.onloadedmetadata = () => showLength(); } @@ -969,15 +992,15 @@ app.registerExtension({ void notifyCompatibility({inFront}); }, async beforeRegisterNodeDef(nodeType, nodeData) { - if (cn && String(nodeData.name).startsWith('FreeVideo')) { + if (!ENGLISH && String(nodeData.name).startsWith('FreeVideo')) { const title = nodeType.prototype.getTitle; nodeType.prototype.getTitle = function (...args) { const shown = title ? title.apply(this, args) : this.title || this.constructor.title; - return TITLE_ZH[shown] || shown; + return TITLE_WORDS[shown] ? text(...TITLE_WORDS[shown]) : shown; }; } if (nodeData.name === 'FreeVideoMedia') { - nodeData.description = text(nodeData.description, + nodeData.description = text('Connect IMAGE or AUDIO outputs from generation, editing or loading nodes, or upload files. Several reference images can be connected; uploaded references come first, then connected images from top to bottom. Choose first/last frames or experimental references. Empty media means text to video.', '连接图片、音频或上传文件。可以连接多张参考图片,上传的素材排在前面,连接的图片按从上到下的顺序排在后面。选择首尾帧或实验性参考生成,留空则为文生视频。'); for (const name of referenceInputs) { const input = nodeData.input?.optional?.[name]; @@ -1035,43 +1058,23 @@ app.registerExtension({ } const quality = this.widgets?.find(w => w.name === 'two_pass'); if (quality) { - quality.label = text('Two-pass acceleration', '二采加速'); + quality.label = text('Faster second pass', '二采加速'); quality.tooltip = text('Usually faster: generates at a lower resolution, then upscales and refines.', '通常更快:先用低分辨率生成,再放大细化。'); } // The same names as the creation panel's Advanced tray. - for (const [name, en, zh] of [['base_steps', 'First-pass steps', '一采步数'], ['refine_steps', 'Second-pass steps', '二采步数']]) { + for (const [name, ...words] of [['base_steps', 'First-pass steps', '一采步数'], ['refine_steps', 'Second-pass steps', '二采步数']]) { const steps = this.widgets?.find(w => w.name === name); if (steps) { - steps.label = text(en, zh); + steps.label = text(...words); steps.tooltip = text('Changing steps may lower quality. Default: 8 first-pass and 3 second-pass steps. With other first-pass steps the video is made in one pass. Second-pass steps other than 3 must be fewer than first-pass steps.', '改步数可能降低质量。默认一采 8 步、二采 3 步;一采不是 8 步时只生成一遍;二采步数不是 3 时需少于一采步数。'); } } - if (cn) { - // Reuse product wording; leave untranslated names with no established Chinese copy. - for (const [name, label, tooltip] of [ - ['width', '宽度'], - ['height', '高度'], - ['seconds', '时长(秒)'], - ['seed', '种子'], - ['force_regenerate', '重新生成', '跳过已保存结果的缓存。'], - ['preview', '先出预览', '先出低分辨率预览,满意后在结果里点“继续二采”,成片与直接生成一致。'], - ['refine_from', '继续二采', '从这个预览继续生成全分辨率视频。'], - ['continue_from', '接着生成'], - ['frames', '帧数'], - ['first_frame_reference', '首帧参考', '减小漂移'], - ['voice_reference', '声音参考', '接着生成对白时,沿用原视频开头的声音,让前后声音一致。'], - ['hide_tail', '隐藏对白尾段', '多生成 17 帧后丢弃,让对白在前后两段之间连贯。'], - ['step_cache', '步间缓存', '复用相近采样步之间的计算,更快完成,结果会有细微变化。'], - ['upscale_factor', '放大倍数', '二采时成片相对一采的放大倍数。'], - ['allow_empty_prompt', '允许空描述', '描述为空时直接生成,不再提示。'], - ]) { - const widget = this.widgets?.find(w => w.name === name); - if (widget) { - widget.label = label; - if (tooltip) widget.tooltip = tooltip; - } - } + if (!ENGLISH) for (const [name, label, tooltip] of INPUT_WORDS) { + const widget = this.widgets?.find(w => w.name === name); + if (!widget) continue; + widget.label = text(...label); + if (tooltip) widget.tooltip = text(...tooltip); } for (const widget of this.widgets || []) { // Node and creation-panel edits use the same named draft. @@ -1172,7 +1175,7 @@ api.addEventListener('freevideo_prewarm', event => { if (value) app.graph?.getNodeById(value.node)?.freevideoShowPrewarm?.(value); }); -installTranslateGuard({chinese: cn}); +installTranslateGuard({lang: pageLanguage()}); installNativeErrorGuard({api, app, describe: detail => { const {advice} = adviceFor(createErrorReport(detail, {stage: 'execution', graph: app.graph}), text); return [advice.title, advice.summary].filter(Boolean).join('\n'); diff --git a/web/fv_player.css b/web/fv_player.css index 5e714beb..c272cdcf 100644 --- a/web/fv_player.css +++ b/web/fv_player.css @@ -16,6 +16,6 @@ video.fv-player-video{cursor:pointer} .fv-player-over[hidden]{display:none} .fv-player-over .fv-player-time{color:#ffffffcc} .fv-player-over .fv-player-rail{background:#ffffff40} -audio:has(+ .fv-player-bar){display:none} +audio.fv-player-audio{display:none} /* Too narrow for a progress bar that can be seen or dragged (a short clip's card): leave the keys and the time, not a lone dot. */ @container (max-width:210px){.fv-player-track{display:none}.fv-player-time{margin-left:auto}} diff --git a/web/fv_player.js b/web/fv_player.js index a3cff580..f65dfcc4 100644 --- a/web/fv_player.js +++ b/web/fv_player.js @@ -1,3 +1,4 @@ +import { translatorFor } from './i18n.js'; // Our own play bar for a video or audio element in place of the browser's: a play/pause key, a progress bar that can be // dragged, and the time. Video also plays and pauses on a click. Every part is at least 44 px to hit. // Loaded at once so the first bar is never drawn bare; a page without a document (the module checks, the page check) skips it. @@ -13,7 +14,7 @@ const LOUD = ''; const PAUSE = ''; -export function createPlayBar(media, t = (en) => en) { +export function createPlayBar(media, t = translatorFor(null, false)) { const bar = document.createElement('div'); bar.className = 'fv-player-bar'; const key = document.createElement('button'); key.type = 'button'; key.className = 'fv-player-key'; const track = document.createElement('div'); track.className = 'fv-player-track'; track.tabIndex = 0; track.setAttribute('role', 'slider'); @@ -60,5 +61,7 @@ export function createPlayBar(media, t = (en) => en) { events.forEach(name => media.addEventListener(name, paint)); paint(); const click = () => toggle(); if (media.tagName === 'VIDEO') { media.addEventListener('click', click); media.classList.add('fv-player-video'); } - return {bar, destroy() { events.forEach(name => media.removeEventListener(name, paint)); media.removeEventListener('click', click); bar.remove(); }}; + // A sound has nothing to show but its bar (fv_player.css hides the browser's own). + if (media.tagName === 'AUDIO') media.classList.add('fv-player-audio'); + return {bar, destroy() { events.forEach(name => media.removeEventListener(name, paint)); media.removeEventListener('click', click); media.classList.remove('fv-player-audio'); bar.remove(); }}; } diff --git a/web/generation_progress.js b/web/generation_progress.js index f8fc92d2..3db0cae0 100644 --- a/web/generation_progress.js +++ b/web/generation_progress.js @@ -1,4 +1,5 @@ // One whole-video estimate and the same five rows in Studio and the node view. +import { pageLanguage } from './i18n.js'; import { saveReport, reportIssue, showReportTip, focusReportTip, REPORT_GONE, reportFetchError } from './report_issue.js'; import { issueButton } from './issue_button.js'; import { previewStyle, loadPreviewStyle, onPreviewStyle, hintWanted, markHintSeen, sheetLayout } from './preview_style.js'; @@ -67,12 +68,12 @@ function subactivity(message, activity, t) { // Only a download name needs the fallback frame; every other activity already reads as a sentence. const named = activity && activity.key !== 'prepare' ? activity.text : ''; return {key: `other:${activity?.key || 'prepare'}`, sampling, - text: !named ? t(...ACTIVITY.prepare) : activity.key === 'download' ? t(`Still working: ${named}`, `仍在进行:${named}`) : named}; + text: !named ? t(...ACTIVITY.prepare) : activity.key === 'download' ? t('Still working: {named}', '仍在进行:{named}', { named }) : named}; } const waitDuration = (seconds, t) => { const n = Math.floor(Math.max(0, seconds)), minutes = Math.floor(n / 60), rest = n % 60; return minutes ? t(`${minutes} min${rest ? ` ${rest} s` : ''}`, rest ? `${minutes} 分 ${rest} 秒` : `${minutes} 分钟`) - : t(`${rest} s`, `${rest} 秒`); + : t('{rest} s', '{rest} 秒', { rest }); }; // Only our status sentences, scoped to a request; no prompt or engine log. // A reopened Studio/tab must not announce the replayed explanation again. @@ -109,7 +110,7 @@ const STALL_SECONDS_BY_PHASE = Object.freeze({ // Stage words the product already uses: settings say 一采 / 二采, results say 解码. const ACTIVITY = { prepare: ['Preparing', '正在准备'], - describe: ['Writing part descriptions', '正在写各段描述'], + describe: ['Writing part prompts', '正在写各段提示词'], prompt: ['Processing the prompt', '正在处理提示词'], combined: ['Processing the prompt and references', '正在处理提示词和参考素材'], load: ['Loading the video model', '正在载入视频模型'], @@ -152,7 +153,9 @@ const DOWNLOADS = { // Stages whose engine counts are real completed work inside one long step. const COUNTED_STAGES = new Set(['video', 'media', 'weight_pin', 'weight_read', 'encoder_device_load', 'encoder_compute', 'encoder_compute_reference', 'media_encode_audio', 'media_prepare']); -const COUNT_UNITS = {frames: ['frames', '帧'], layers: ['layers', '层'], files: ['files', '个文件'], chunks: ['parts', '段']}; +// Whole sentences with both numbers: a language whose nouns change with the number writes plural forms for them. +const COUNT_UNITS = {frames: ['{done} / {total} frames', '{done} / {total} 帧'], layers: ['{done} / {total} layers', '{done} / {total} 层'], + files: ['{done} / {total} files', '{done} / {total} 个文件'], chunks: ['{done} / {total} parts', '{done} / {total} 段']}; const size = (bytes, unit) => (bytes / (unit === 'GiB' ? 2**30 : 2**20)).toFixed(1); // Asked for two passes with a first pass other than 8 steps: the engine ran one pass. const ranOnePass = plan => plan.requested === true && plan.enabled === false && plan.preview !== true @@ -168,8 +171,7 @@ function activityLabel(message, t, plan = {}, secondPass = false, references = f const unit = message.total >= 2**30 ? 'GiB' : 'MiB'; detail = `${size(done, unit)} / ${size(message.total, unit)} ${unit}`; } else if (COUNT_UNITS[message.unit]) { - const [en, zh] = COUNT_UNITS[message.unit]; - detail = t(`${done} / ${message.total} ${en}`, `${done} / ${message.total} ${zh}`); + detail = t(...COUNT_UNITS[message.unit], {done, total: message.total}); } else return result; return {...result, text: `${result.text} · ${detail}`, parts: [...result.parts || [result.text], detail]}; } @@ -190,31 +192,32 @@ function baseActivityLabel(message, t, plan = {}, secondPass = false, references } } // The sentence, then its size and speed: the parts the stage line keeps whole (see renderLabel). - const parts = [t(download[0], download[1]), ...detail]; + const parts = [t(...download), ...detail]; return {key: 'download', text: parts.join(' · '), parts}; } const steps = (key, name, step, total) => { - const [en, zh, enSteps, zhSteps] = SAMPLING_NAME[name]; + const words = SAMPLING_NAME[name], stepWords = t(...words.slice(2, 4)); const pass = SAMPLING_PASS[name]; return {key, text: Number.isInteger(step) && Number.isInteger(total) && total > 0 - ? t(`${enSteps} ${step} of ${total}${pass ? ` (${pass[0]})` : ''}`, `${zhSteps}${step} / ${total} 步${pass ? `(${pass[1]})` : ''}`) - : t(en, zh)}; + ? (pass ? t('{steps} {step} of {total} ({pass})', '{steps}{step} / {total} 步({pass})', { steps: stepWords, step, total, pass: t(...pass) }) + : t('{steps} {step} of {total}', '{steps}{step} / {total} 步', { steps: stepWords, step, total })) + : t(...words.slice(0, 2))}; }; const base = Number.isInteger(plan.base_steps) && plan.base_steps > 0 ? plan.base_steps : null; const second = plan.second || plan.upscale_target; if (message.prediction || message.sampling_plan) { if (!ranOnePass(plan)) return named('prepare'); const n = plan.base_steps; - return {key: 'prepare', text: t(`Two-pass acceleration needs 8 first-pass steps. This video uses a single ${n}-step pass.`, - `只有一采为 8 步时才会使用二采加速,这次按 ${n} 步只采样一遍。`)}; + return {key: 'prepare', text: t('The faster second pass needs 8 first-pass steps. This video uses a single {n}-step pass.', + '只有一采为 8 步时才会使用二采加速,这次按 {n} 步只采样一遍。', { n })}; } if (phase === 'recovery') return message.retry?.reuse_sampling === true ? named('decode') : message.retry?.reuse_first_pass === true ? steps('pass2', 'pass2') : named('prepare'); if (phase === 'sample_finalize') return named('decode'); if (message.stage === 'latent_upscale' || phase === 'latent_upscale') return {key: 'upscale', text: Number.isInteger(second?.width) && Number.isInteger(second?.height) - ? t(`Second pass · upscaling to ${second.width} × ${second.height}`, - `二采 · 放大到 ${second.width} × ${second.height}`) + ? t('Second pass · upscaling to {width} × {height}', + '二采 · 放大到 {width} × {height}', { width: second.width, height: second.height }) : t('Second pass · upscaling', '二采 · 放大')}; if (phase === 'sampling' || phase === 'refinement' || message.stage === 'preview_mismatch') { const done = Number.isInteger(message.done) ? message.done : null; @@ -230,7 +233,7 @@ function baseActivityLabel(message, t, plan = {}, secondPass = false, references if (twoPass && plan.preview) return steps('preview', 'preview', step, count); const sampling = steps('pass1', twoPass ? 'first' : 'single', step, count); if (!twoPass && ranOnePass(plan)) - sampling.text += t(' (single pass; two-pass acceleration needs 8 first-pass steps)', '(只采样一遍;二采加速需一采 8 步)'); + sampling.text += t(' (single pass; the faster second pass needs 8 first-pass steps)', '(只采样一遍;二采加速需一采 8 步)'); return sampling; } const key = labelActivities.get(message.label) || { @@ -256,11 +259,12 @@ function retryText(retry, t) { const reason = {gpu_oom: ['Out of GPU memory', '显存不足'], ram_pressure: ['Out of RAM', '内存不足'], unified_memory: ['Out of RAM', '内存不足']}[retry.kind] || ['Previous attempt did not finish', '上一次尝试没有完成']; - if (retry.reuse_sampling === true) return t(`${reason[0]}; the generated result is kept, and a retry is in progress.`, - `${reason[1]},已保留生成结果,正在重试。`); + const values = { reason: t(...reason) }; + if (retry.reuse_sampling === true) return t('{reason}; the generated result is kept, and a retry is in progress.', '{reason},已保留生成结果,正在重试。', values); const fallback = !['gpu_oom', 'ram_pressure', 'unified_memory'].includes(retry.kind); - return fallback ? t(`${reason[0]}; retrying in another mode.`, `${reason[1]},正在换一种运行方式重试。`) - : t(`${reason[0]}; retrying in a mode that uses less memory.`, `${reason[1]},正在换一种更省${retry.kind === 'gpu_oom' ? '显存' : '内存'}的运行方式重试。`); + return fallback ? t('{reason}; retrying in another mode.', '{reason},正在换一种运行方式重试。', values) + : retry.kind === 'gpu_oom' ? t('{reason}; retrying in a mode that uses less memory.', '{reason},正在换一种更省显存的运行方式重试。', values) + : t('{reason}; retrying in a mode that uses less memory.', '{reason},正在换一种更省内存的运行方式重试。', values); } function trimStatus(rows, t) { @@ -268,11 +272,17 @@ function trimStatus(rows, t) { const kinds = new Set(rows.map(row => row.kind)); const video = kinds.size === 1 && kinds.has('video'), audio = kinds.size === 1 && kinds.has('audio'); const many = rows.length > 1; - const noun = video ? (many ? 'reference videos' : 'reference video') : audio ? 'reference audio' : 'reference media'; - const zh = video ? '参考视频' : audio ? '参考音频' : '参考素材'; - const used = Number(rows[0].used_seconds).toFixed(1); - return t(`The ${noun} ${video && !many || audio ? 'is' : 'are'} longer than the output, so only ${many ? `the first ${used}\u00a0s of each is used` : `its first ${used}\u00a0s is used`}.`, - `${zh}比生成的视频长,只使用了${many ? '每段的' : ''}前 ${used}\u00a0秒。`); + const values = { seconds: Number(rows[0].used_seconds).toFixed(1) }; + // Each case whole: which material, one or several. + if (video) return many + ? t('The reference videos are longer than the output, so only the first {seconds}\u00a0s of each is used.', '参考视频比生成的视频长,只使用了每段的前 {seconds}\u00a0秒。', values) + : t('The reference video is longer than the output, so only its first {seconds}\u00a0s is used.', '参考视频比生成的视频长,只使用了前 {seconds}\u00a0秒。', values); + if (audio) return many + ? t('The reference audio is longer than the output, so only the first {seconds}\u00a0s of each is used.', '参考音频比生成的视频长,只使用了每段的前 {seconds}\u00a0秒。', values) + : t('The reference audio is longer than the output, so only its first {seconds}\u00a0s is used.', '参考音频比生成的视频长,只使用了前 {seconds}\u00a0秒。', values); + return many + ? t('The reference media are longer than the output, so only the first {seconds}\u00a0s of each is used.', '参考素材比生成的视频长,只使用了每段的前 {seconds}\u00a0秒。', values) + : t('The reference media are longer than the output, so only its first {seconds}\u00a0s is used.', '参考素材比生成的视频长,只使用了前 {seconds}\u00a0秒。', values); } // A reference clip longer than the video being generated is cut to the same @@ -281,9 +291,12 @@ function trimStatus(rows, t) { export function thermalText(thermal, t) { const share = thermal.sm_clock_max_mhz ? Math.round(100 * thermal.sm_clock_mean_mhz / thermal.sm_clock_max_mhz) : null; const heat = Number.isFinite(thermal.temperature_mean_c) ? Math.round(thermal.temperature_mean_c) : null; - const detail = [heat !== null ? `${heat}\u00a0°C` : '', share !== null ? t(`${share}% of its peak clock`, `频率只有峰值的 ${share}%`) : ''].filter(Boolean).join(t(', ', ',')); - return t(`The GPU spent most of this video in thermal slowdown${detail ? ` (${detail})` : ''}, so it took much longer than usual. Improve cooling; on a laptop, plug in and choose a high-performance power mode.`, - `生成这段视频时,显卡大部分时间因过热降频${detail ? `(${detail})` : ''},所以比平时慢很多。请改善散热;笔记本请接通电源并选择高性能模式。`); + const detail = [heat !== null ? `${heat}\u00a0°C` : '', share !== null ? t('{share}% of its peak clock', '频率只有峰值的 {share}%', { share }) : ''].filter(Boolean).join(t(', ', ',')); + return detail + ? t('The GPU spent most of this video in thermal slowdown ({detail}), so it took much longer than usual. Improve cooling; on a laptop, plug in and choose a high-performance power mode.', + '生成这段视频时,显卡大部分时间因过热降频({detail}),所以比平时慢很多。请改善散热;笔记本请接通电源并选择高性能模式。', { detail }) + : t('The GPU spent most of this video in thermal slowdown, so it took much longer than usual. Improve cooling; on a laptop, plug in and choose a high-performance power mode.', + '生成这段视频时,显卡大部分时间因过热降频,所以比平时慢很多。请改善散热;笔记本请接通电源并选择高性能模式。'); } // Other programs held a substantial share of the GPU during this run (summary.shared_gpu). @@ -292,8 +305,8 @@ export function sharedGpuText(shared, t) { const mean = shared?.other_mean_percent; if (typeof mean !== 'number' || !Number.isFinite(mean)) return ''; const percent = Math.min(95, Math.round(mean / 5) * 5); - return t(`Other programs were using about ${percent}% of the GPU.`, - `其他程序占用了约 ${percent}% 的显卡。`); + return t('Other programs were using about {percent}% of the GPU.', + '其他程序占用了约 {percent}% 的显卡。', { percent }); } // Replace person: the source video's sound was asked for and could not be put into the video. @@ -311,8 +324,8 @@ export function encoderFileText(file, t) { if (file.offline_installation === true) { const target = encoderFilePath(file) ? t('the file below', '下面这个文件') : t('this file', '这个文件'); message += t( - ` This offline-package installation cannot switch back in one step yet. Close FreeVideo, move or rename ${target}, then import the Prompt model package (FreeVideo-文本编码器.zip) again on the Installation page of the launcher.`, - `离线包安装暂时不能一键换回。请先关闭 FreeVideo,把${target}移走或改名,再在启动器的“安装”页重新导入“提示词模型(FreeVideo-文本编码器.zip)”包。`); + ' This offline-package installation cannot switch back in one step yet. Close FreeVideo, move or rename {target}, then import the Prompt model package (FreeVideo-文本编码器.zip) again on the Installation page of the launcher.', + '离线包安装暂时不能一键换回。请先关闭 FreeVideo,把{target}移走或改名,再在启动器的“安装”页重新导入“提示词模型(FreeVideo-文本编码器.zip)”包。', { target }); } else if (file.launcher === true) message += t( ' Select "Repair" in the launcher under Settings > Environment to restore the tested file; the current file is kept.', '可在启动器“设置 → 环境”中点“修复”恢复已验证的文件,原文件会保留。'); @@ -328,10 +341,10 @@ export function referenceTrimText(row, t) { const used = Number(row?.used_seconds).toFixed(1); const rule = t('(references are cut to the generated length, up to 15 s)', '(参考素材只取与生成视频等长的部分,最长 15 秒)'); return valid(row?.seconds) - ? t(`${name} is ${Number(row.seconds).toFixed(1)} s: only its first ${used} s were used ${rule}`, - `${name} 时长 ${Number(row.seconds).toFixed(1)} 秒,已截取前 ${used} 秒${rule}`) - : t(`${name} is longer than this video: only its first ${used} s were used ${rule}`, - `${name} 比生成的视频长,已截取前 ${used} 秒${rule}`); + ? t('{name} is {seconds} s: only its first {used} s were used {rule}', + '{name} 时长 {seconds} 秒,已截取前 {used} 秒{rule}', { name, seconds: Number(row.seconds).toFixed(1), used, rule }) + : t('{name} is longer than this video: only its first {used} s were used {rule}', + '{name} 比生成的视频长,已截取前 {used} 秒{rule}', { name, used, rule }); } // The time left on show `dt` seconds on, given the engine's newest estimate (null when it sent none). Once measured, an @@ -470,7 +483,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = f const element = el('section', 'fv-generation-progress'); element.hidden = true; if (compact) element.classList.add('fv-generation-compact'); // Chinese lines break between phrases, not inside a word (see the CSS). - element.lang = t('en', 'zh-CN'); + element.lang = pageLanguage(); const heading = el('div', 'fv-generation-heading'); const label = el('div', 'fv-generation-label'), count = el('strong', 'fv-generation-count'); const mini = el('div', 'fv-generation-mini'), miniFill = el('div', 'fv-generation-mini-fill'); @@ -934,9 +947,9 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = f const elapsed = waitDuration((now() - segmentStartedAt) / 1000, t); const typical = segmentTypical(), usual = valid(typical) && typical > 0 ? waitDuration(typical, t) : ''; const similar = overall.typical_source === 'similar'; - pauseText = t(`${elapsed} so far`, `已进行 ${elapsed}`); - if (usual) pauseText += similar ? t(` (about ${usual} on similar hardware)`, `(相近配置约 ${usual})`) - : t(` (usually about ${usual})`, `(通常约 ${usual})`); + pauseText = t('{elapsed} so far', '已进行 {elapsed}', { elapsed }); + if (usual) pauseText += similar ? t(' (about {usual} on similar hardware)', '(相近配置约 {usual})', { usual }) + : t(' (usually about {usual})', '(通常约 {usual})', { usual }); } // Only an available engine estimate can supply this long-decode fallback. const remainingEstimate = rawRemaining(); @@ -946,7 +959,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = f decodeMinutes = minutes; decodeMinutesAt = now(); } } else { decodeMinutes = null; decodeMinutesAt = -Infinity; } - const decodeEta = decodeMinutes === null ? '' : t(`About ${decodeMinutes} min left`, `还需约 ${decodeMinutes} 分钟`); + const decodeEta = decodeMinutes === null ? '' : t('About {decodeMinutes} min left', '还需约 {decodeMinutes} 分钟', { decodeMinutes }); const progressText = [paused ? pauseText : '', decodeEta].filter(Boolean).join(t(' · ', ',')); const level = ended ? '' : recovery ? 'retry' : paused ? 'pause' : lowMemory ? 'memory' : memoryTight ? 'unified-memory' : automatic ? 'automatic' @@ -969,8 +982,8 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = f automatic: compatibilityText, notice: trimStatus([...trims.values()], t), // A long video whose part descriptions could not be written: the server's own words stay in the report. - split: splitFailed === 'model_missing' ? t('Prompt model not installed. The description is split across the parts by sentence.', '未安装提示词模型,描述按句子顺序分到各段') - : t('The description is split across the parts by sentence.', '描述按句子顺序分到各段')}[level] || (!ended ? progressText : ''); + split: splitFailed === 'model_missing' ? t('Prompt model not installed. The prompt is split across the parts by sentence.', '未安装提示词模型,提示词按句子顺序分到各段') + : t('The prompt is split across the parts by sentence.', '提示词按句子顺序分到各段')}[level] || (!ended ? progressText : ''); if (status.textContent !== explanation) status.textContent = explanation; status.hidden = !explanation; status.dataset.level = level; const announcements = []; @@ -1067,7 +1080,7 @@ export function createGenerationProgress(t, now = () => Date.now(), {compact = f late.hidden = !(remainingSeconds === null && remainingRetired && !ended); late.textContent = late.hidden ? '' : t('Taking longer than expected', '比预计久,仍在生成'); const etaText = remainingSeconds === null ? '' : remainingSeconds >= 60 - ? t(`About ${Math.ceil(remainingSeconds / 60)}\u00a0min left`, `预计还需约 ${Math.ceil(remainingSeconds / 60)}\u00a0分钟`) + ? t('About {minutes}\u00a0min left', '预计还需约 {minutes}\u00a0分钟', { minutes: Math.ceil(remainingSeconds / 60) }) : t('Less than a minute left', '预计还需不到 1\u00a0分钟'); const initial = remainingSeconds !== null && estimateSource === 'similar'; // While it follows the bridge, the shown minutes change at most every 5 s. diff --git a/web/glass/advanced_tray.js b/web/glass/advanced_tray.js index f87fd248..22189a1b 100644 --- a/web/glass/advanced_tray.js +++ b/web/glass/advanced_tray.js @@ -9,10 +9,11 @@ import {TIPS} from '../tooltip_copy.js'; import {randomSeed} from '../studio_queue.js'; import './tray_pop.js'; +import { translator } from '../i18n.js'; const make = (tag, cls, text) => { const element = document.createElement(tag); if (cls) element.className = cls; if (text != null) element.textContent = text; return element; }; -const say = (tray, en, zh) => tray.fvAtChinese ? zh : en; -const pick = (tray, pair) => (tray.fvAtChinese ? pair?.[1] : pair?.[0]) || ''; +const say = (tray, en, zh, values) => translator(tray.fvAtChinese)(en, zh, values); +const pick = (tray, pair) => (pair && say(tray, ...pair)) || ''; const tipOn = (element, name, use = '', why = '') => { element.dataset.fvTipName = name; if (use) element.dataset.fvTipUse = use; else delete element.dataset.fvTipUse; @@ -191,8 +192,8 @@ function paintLength(tray, dialog) { // the longest part. A duration that fits in one part leaves the field greyed and says nothing. let count = 0; if (!one && block && seconds > 0 && each > 0) { - const shown = (dialog.querySelector('.fvs-key-eta')?.textContent || '').match(/分\s*(\d+)\s*段|(\d+)\s*parts/); - count = shown ? Number(shown[1] || shown[2]) : seconds <= each ? 1 : Math.ceil(seconds / each); + const shown = Number(dialog.querySelector('.fvs-key-eta')?.dataset.parts); + count = shown > 1 ? shown : seconds <= each ? 1 : Math.ceil(seconds / each); } // An emptied box on a duration that needs parts stays editable, so it can be filled in. const idle = !one && count <= 1 && !(block?.value === '' && block.dataset.fvPartsNeeded === 'true'); @@ -204,7 +205,7 @@ function paintLength(tray, dialog) { const time = Number.isInteger(seconds) ? String(seconds) : seconds.toFixed(1); // More than eight parts is refused by the planner, which says so itself (below, as the problem line). const text = !one && block && !block.disabled && count > 1 && count <= 8 - ? say(tray, `${time} s this time · made in ${count} parts and joined`, `这次 ${time} 秒 · 分 ${count} 段生成后接起来`) : ''; + ? say(tray, '{seconds} s this time · made in {count} parts and joined', '这次 {seconds} 秒 · 分 {count} 段生成后接起来', { seconds: time, count }) : ''; if (plan.textContent !== text) plan.textContent = text; toggle(plan, 'fv-at-gone', !text); } @@ -212,8 +213,10 @@ function paintLength(tray, dialog) { const refusal = dialog.querySelector('.fv-length-plan:not([hidden])'), said = refusal ? (refusal.firstChild?.textContent || refusal.textContent || '').trim() : ''; const problem = section.querySelector('.fv-at-problem'); if (problem) { if (problem.textContent !== said) problem.textContent = said; toggle(problem, 'fv-at-gone', !said); } - toggle(part, 'fv-at-bad', Boolean(said) && /每段时长|每段最长|part length/i.test(said)); - toggle(section.querySelector('.fv-at-segments[data-at=length]'), 'fv-at-bad', Boolean(said) && /单次|single run/i.test(said)); + // Which rows the refusal is about: the part length, or the single run (in Chinese also the one that says what one run allows). + const code = said ? refusal.dataset.fvLengthError || '' : ''; + toggle(part, 'fv-at-bad', code.startsWith('block_')); + toggle(section.querySelector('.fv-at-segments[data-at=length]'), 'fv-at-bad', code === 'single_unavailable' || code === 'block_too_long' && Boolean(tray.fvAtChinese)); } // ── Reset to defaults: shown only while something differs; it presses the panel's own controls. ── @@ -222,15 +225,16 @@ function state(tray, dialog) { const single = tray.querySelector('.fv-at-group[data-at=length] input[type=checkbox]'); const unset = tray.querySelector('.fv-at-unset'); const seedMode = tray.querySelector('.fv-at-group[data-at=seed] select'); - // The Quality key in the console's row says Custom while the steps are set by hand (its small window, or the older tray chip). - const quality = (dialog.querySelector(`.fvs-chips .fvp-chip[aria-label="${say(tray, 'Quality', '质量')}"] .fvp-chip-label`) - || dialog.querySelector('.fvs-chip[data-chip=quality] .fvs-chip-label'))?.textContent.trim() || ''; + // The studio's Quality levels strip says so itself while the steps are set by hand (data-custom), wherever it stands: in the + // Quality window beside its key (closed or open), or in the Quality section of the three-column panel, which has no such key. + // The tray may be lent to the editor's bar, a dialog other than the one it was made in: look where it stands now. + const custom = (tray.closest('dialog') || dialog).querySelector('.fv-effort[data-fv-studio-effort][data-custom=true]'); return { mode: mode !== 'single', single: Boolean(single && single.checked && !single.disabled), length: Boolean(unset && !unset.hidden && !unset.disabled), seed: Boolean(seedMode && !seedMode.disabled && seedMode.value !== 'randomize'), - steps: /^(Custom|自定义)$/.test(quality), + steps: Boolean(custom), }; } function paintReset(tray, dialog) { diff --git a/web/glass/frame_picker.js b/web/glass/frame_picker.js index b214983e..330b6a65 100644 --- a/web/glass/frame_picker.js +++ b/web/glass/frame_picker.js @@ -22,6 +22,7 @@ // 'dimensions' with side 'width' | 'height', 'lock'); the caller applies it and calls set() with what it accepted. // onPreview({ratio, width, height} | null) while an option is pointed at or focused, and when it is left. The views show // the next generation's empty frame at that shape (nextFrame below gives its box), not an outline over a work. +import { translatorFor } from '../i18n.js'; const SVG = 'http://www.w3.org/2000/svg'; let styled = false; @@ -70,7 +71,7 @@ export function nextFrame(room, ratio, pad = 0) { return {width, height, left: (room.width - width) / 2, top: (room.height - height) / 2}; } -export function createFramePicker({t = en => en, shapes = [], sizes = [], sizeFor = (ratio, pixels) => frameSize(ratio, pixels), custom = null, +export function createFramePicker({t = translatorFor(null, false), shapes = [], sizes = [], sizeFor = (ratio, pixels) => frameSize(ratio, pixels), custom = null, onChange = () => {}, onPreview = () => {}, onPaint = () => {}} = {}) { loadStyle(); shapes = shapes.filter(shape => shape.id !== 'custom'); sizes = sizes.filter(size => !size.more); @@ -196,7 +197,7 @@ export function createFramePicker({t = en => en, shapes = [], sizes = [], sizeFo // Generate stopped on an empty side (the caller sets ask): the panel covers the studio's status line, so it asks here. if (!state.empty) state.ask = false; const ask = state.ask && (state.empty === 'height' ? t('Fill in the height.', '请填写高度。') : t('Fill in the width.', '请填写宽度。')); - const said = state.capped ? t(`The largest on this computer is ${state.capped}; that size is used.`, `本机最大 ${state.capped},已按最大生成。`) : ask || limit?.note || ''; + const said = state.capped ? t('The largest on this computer is {capped}; that size is used.', '本机最大 {capped},已按最大生成。', { capped: state.capped }) : ask || limit?.note || ''; status.textContent = said; status.hidden = !said; status.toggleAttribute('data-capped', Boolean(state.capped || ask)); } onPaint(); @@ -390,7 +391,7 @@ export function createPopChip({host = null, name = '', icon = '', placement = 'a // area: () => {left, top, width, height} in the stage's own box, the part not covered (by an open tray); the frame // is fitted and centred there, whole. Outside the frame the stage is dimmed; inside it stays as it is. -export function createFrameGhost(stage, {t = en => en, area = null} = {}) { +export function createFrameGhost(stage, {t = translatorFor(null, false), area = null} = {}) { loadStyle(); const ghost = el('div', 'fvp-ghost'), label = el('span', 'fvp-ghost-label'); ghost.append(label); ghost.setAttribute('aria-hidden', 'true'); stage.append(ghost); diff --git a/web/glass/look_lux.css b/web/glass/look_lux.css index 599f848f..4b1ed941 100644 --- a/web/glass/look_lux.css +++ b/web/glass/look_lux.css @@ -11,7 +11,7 @@ the glass becomes solid under data-glass=solid, .lite or reduced transparency. */ /* ── 1. Blacks and glass values ─────────────────────────────────────────────────────────────────────────────── */ -html[data-fv-lux]:root dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot), +html[data-fv-lux]:root :is(dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot),dialog.fv-set), html[data-fv-lux]:root :is(.fvp.fvp-pop,.fv-select-menu){ --lx-l0:#06080c; --lx-g1:rgb(22 25 33 / .60); --lx-g2:rgb(27 30 39 / .94); --lx-l3:#1c1f27; @@ -27,7 +27,7 @@ html[data-fv-lux]:root :is(.fvp.fvp-pop,.fv-select-menu){ --lx-key-glow:0 10px 28px -12px rgb(27 148 252 / .55); --lx-ease:cubic-bezier(.2,.8,.2,1); } -html[data-fv-lux][data-theme=light]:root dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot), +html[data-fv-lux][data-theme=light]:root :is(dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot),dialog.fv-set), html[data-fv-lux][data-theme=light]:root :is(.fvp.fvp-pop,.fv-select-menu){ --lx-l0:#eef1f5; --lx-g1:rgb(255 255 255 / .62); --lx-g2:rgb(255 255 255 / .94); --lx-l3:#ffffff; @@ -79,19 +79,23 @@ html[data-fv-lux]:root dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-a /* ── 3. Top bar ─────────────────────────────────────────────────────────────────────────────────────────────── */ html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch, -html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar .fv-tb-cap{ +html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar .fv-tb-cap, +html[data-fv-lux]:not([data-glass=solid],.lite):root body dialog.fv-set .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch, +html[data-fv-lux]:not([data-glass=solid],.lite):root body dialog.fv-set .fv-topbar .fv-tb-cap{ background:var(--lx-g1)!important; box-shadow:inset 0 0 0 1px var(--lx-edge),inset 0 1px 0 var(--lx-hi),var(--fv-sh1)!important; -webkit-backdrop-filter:var(--lx-blur1)!important;backdrop-filter:var(--lx-blur1)!important; } /* The chosen view: a raised block with a short blue line of light on its lower edge. */ -html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before{ +html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before, +html[data-fv-lux]:not([data-glass=solid],.lite):root body dialog.fv-set .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before{ background: radial-gradient(ellipse 34px 1.5px at var(--lx-ink-x,50%) 100%,rgb(102 182 255 / .9),transparent 100%), linear-gradient(180deg,rgb(255 255 255 / .11),rgb(255 255 255 / .06)); box-shadow:inset 0 1px 0 rgb(255 255 255 / .16); } -html[data-fv-lux][data-theme=light]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before{ +html[data-fv-lux][data-theme=light]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before, +html[data-fv-lux][data-theme=light]:not([data-glass=solid],.lite):root body dialog.fv-set .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before{ background:linear-gradient(180deg,#fff,rgb(255 255 255 / .82)); box-shadow:inset 0 0 0 1px rgb(20 24 32 / .05),0 1px 2px rgb(30 40 60 / .1); } @@ -196,6 +200,7 @@ html[data-fv-lux]:root dialog.fv-studio.fv-create .fvs-tray :is(textarea,select, /* ── 8. The works rail and the image view's panels: L1 glass ────────────────────────────────────────────────── */ html[data-fv-lux]:root dialog.fv-studio.fv-create :is(.fv-recent,.fvs-rail), +html[data-fv-lux]:root dialog.fv-studio.fv-create .fv-body[data-cols="3"]>:is(.fv-controls,.fv-work-column), html[data-fv-lux]:root dialog.fv-studio.fv-image .fv-iv-panel{ background:var(--lx-g1)!important;border-color:var(--lx-edge)!important; box-shadow:inset 0 1px 0 var(--lx-hi),var(--fv-sh1)!important; @@ -233,11 +238,21 @@ html[data-fv-lux][data-theme=light]:root dialog.fv-studio.fv-create .fv-stage{bo :is(html[data-glass=solid],html.lite)[data-fv-lux]:root :is(dialog.fv-studio .fvs-tray[open],dialog.fv-studio .fvs-info-panel,.fvp.fvp-pop){ -webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--lx-s2)!important; } +/* The top bar's two pieces are coloured by a longer rule (section 3), so their opaque form is one as long. In light the pill + sits a step below the chosen tab's white, so the tab still shows which it is. */ +html[data-fv-lux]:root dialog.fv-studio{--lx-s0:var(--lx-s1)} +html[data-fv-lux][data-theme=light]:root dialog.fv-studio{--lx-s0:#e4e8ee} +:is(html[data-glass=solid],html.lite)[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch, +:is(html[data-glass=solid],html.lite)[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar .fv-tb-cap{ + -webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--lx-s0)!important; +} /* Glass off also means a weak machine: the light stays, and stays still. */ :is(html[data-glass=solid],html.lite)[data-fv-lux]{--lx-in-play:paused!important} @media (prefers-reduced-transparency:reduce){ + html[data-fv-lux]:not([data-glass=solid],.lite):root body dialog.fv-set .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch,html[data-fv-lux]:not([data-glass=solid],.lite):root body dialog.fv-set .fv-topbar .fv-tb-cap{-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:rgb(var(--fv-solid1))!important} html[data-fv-lux]:root dialog.fv-studio :is(.fvs-console,.fv-recent,.fvs-rail,.fv-iv-panel,.fv-view-switch,.fv-tb-cap,.fv-ed-library,.fv-ed-adjust-host,.fv-ed-genbar,.fv-chat-rail,.fv-chat-side){-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--lx-s1)!important} html[data-fv-lux]:root :is(dialog.fv-studio .fvs-tray[open],dialog.fv-studio .fvs-info-panel,.fvp.fvp-pop){-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--lx-s2)!important} + html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch,html[data-fv-lux]:root body dialog.fv-studio:is(.fv-create,.fv-image,.fv-editor,.fv-autopilot) .fv-topbar .fv-tb-cap{-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--lx-s0)!important} } @media (prefers-reduced-motion:reduce){ html[data-fv-lux]{--lx-in-play:paused!important} diff --git a/web/glass/media_tray.js b/web/glass/media_tray.js index 466a9718..d3f8b715 100644 --- a/web/glass/media_tray.js +++ b/web/glass/media_tray.js @@ -11,6 +11,7 @@ import './tray_pop.js'; import { mediaQueue } from '../work_media.js'; import {setHidden} from '../dom_quiet.js'; +import { translator } from '../i18n.js'; const CARD_KEYS = {'↑': 'fv-mt-up', '↓': 'fv-mt-down'}; // How many saved works the works page lists (newest first, pictures and videos together). @@ -81,7 +82,7 @@ function mediaOf(panel) { const shown = [...panel.querySelectorAll('.fv-mt-cards > .fv-card .fv-file')].map(label => label.title).join('\n'); return (nodes.find(node => { try { return node.freevideoMedia.rows().map(row => row.file).join('\n') === shown; } catch { return false; } }) || nodes[0]).freevideoMedia; } -const say = (panel, en, zh) => panel.fvMtChinese ? zh : en; +const say = (panel, en, zh, values) => translator(panel.fvMtChinese)(en, zh, values); const make = (tag, cls, text) => { const element = document.createElement(tag); if (cls) element.className = cls; if (text != null) element.textContent = text; return element; }; const FRAME = role => role === 'first' || role === 'last' || role === 'middle'; const rowsOf = media => { try { return media ? media.rows() : []; } catch { return []; } }; @@ -98,11 +99,11 @@ function emptySlot(panel, role) { const name = role === 'first' ? say(panel, 'First frame', '首帧') : say(panel, 'Last frame', '尾帧'); slot.setAttribute('aria-label', name); // Two small picture keys, named in their hover cards: this computer, and the saved works. - const computer = make('button', 'fv-mt-slot-key fv-mt-computer', say(panel, 'Computer', '电脑')), saved = make('button', 'fv-mt-slot-key fv-mt-saved', say(panel, 'Works', '作品库')); - computer.setAttribute('aria-label', `${name}: ${say(panel, 'from this computer', '从电脑选择')}`); saved.setAttribute('aria-label', `${name}: ${say(panel, 'from the works', '从作品库选择')}`); + const computer = make('button', 'fv-mt-slot-key fv-mt-computer', say(panel, 'Computer', '电脑')), saved = make('button', 'fv-mt-slot-key fv-mt-saved', say(panel, 'Creations', '作品库')); + computer.setAttribute('aria-label', `${name}: ${say(panel, 'from this computer', '从电脑选择')}`); saved.setAttribute('aria-label', `${name}: ${say(panel, 'from the creations', '从作品库选择')}`); computer.type = saved.type = 'button'; - computer.dataset.fvTipName = say(panel, 'From this computer', '从电脑选择'); computer.dataset.fvTipUse = say(panel, `A picture as the ${name.toLowerCase()}`, `选一张图片作${name}`); - saved.dataset.fvTipName = say(panel, 'From the works', '从作品库选择'); saved.dataset.fvTipUse = say(panel, `A saved picture as the ${name.toLowerCase()}`, `选一张作品作${name}`); + computer.dataset.fvTipName = say(panel, 'From this computer', '从电脑选择'); computer.dataset.fvTipUse = role === 'first' ? say(panel, 'An image as the first frame', '选一张图片作首帧') : say(panel, 'An image as the last frame', '选一张图片作尾帧'); + saved.dataset.fvTipName = say(panel, 'From the creations', '从作品库选择'); saved.dataset.fvTipUse = role === 'first' ? say(panel, 'A saved image as the first frame', '选一张作品作首帧') : say(panel, 'A saved image as the last frame', '选一张作品作尾帧'); const picker = make('input'); picker.type = 'file'; picker.accept = 'image/*'; picker.hidden = true; picker.onchange = () => { if (picker.files?.length) media?.upload([picker.files[0]], {role}); picker.value = ''; }; computer.onclick = () => picker.click(); @@ -127,7 +128,7 @@ function worksPage(panel) { back.onclick = () => showPage(panel, 'media', true); const filter = make('div', 'fv-mt-filter'); filter.setAttribute('role', 'radiogroup'); filter.setAttribute('aria-label', say(panel, 'Show', '显示')); const glide = make('span', 'fv-mt-glide'); glide.setAttribute('aria-hidden', 'true'); filter.append(glide); - for (const [kind, en, zh] of [['all', 'All', '全部'], ['video', 'Videos', '视频'], ['image', 'Pictures', '图片']]) { + for (const [kind, en, zh] of [['all', 'All', '全部'], ['video', 'Videos', '视频'], ['image', 'Images', '图片']]) { const key = make('button', '', say(panel, en, zh)); key.type = 'button'; key.dataset.kind = kind; key.setAttribute('role', 'radio'); key.onclick = () => { if (key.disabled) return; panel.fvMtFilter = kind; drawWorks(panel); }; filter.append(key); @@ -169,7 +170,7 @@ function drawWorks(panel) { const media = mediaOf(panel), armed = panel.fvMtArmed, rows = rowsOf(media); const full = !media || rows.length >= media.limit; page.querySelector('.fv-mt-works-title').textContent = armed === 'first' ? say(panel, 'Choose the first frame', '选一张作首帧') - : armed === 'last' ? say(panel, 'Choose the last frame', '选一张作尾帧') : say(panel, 'Works', '作品库'); + : armed === 'last' ? say(panel, 'Choose the last frame', '选一张作尾帧') : say(panel, 'Creations', '作品库'); page.dataset.armed = armed || ''; const filter = armed ? 'image' : panel.fvMtFilter || 'all'; for (const key of page.querySelectorAll('.fv-mt-filter > button')) { @@ -190,7 +191,7 @@ function drawWorks(panel) { if (picture.complete && picture.naturalWidth) { key.dataset.shown = 'true'; queueMicrotask(() => sharpen(key, item)); } keys.set(item.id, key); } - const video = item.kind === 'video', name = item.name || (video ? say(panel, 'Video', '视频') : say(panel, 'Picture', '图片')); + const video = item.kind === 'video', name = item.name || (video ? say(panel, 'Video', '视频') : say(panel, 'Image', '图片')); const here = !video && used.has(item.file); key.disabled = full || here || Boolean(media?.busy()); key.toggleAttribute('data-used', here); @@ -203,7 +204,7 @@ function drawWorks(panel) { const empty = page.querySelector('.fv-mt-works-empty'); empty.hidden = Boolean(items.length) || !panel.fvMtLoaded; empty.textContent = filter === 'video' ? say(panel, 'No saved videos yet.', '作品库里还没有视频。') - : filter === 'image' ? say(panel, 'No saved pictures yet.', '作品库里还没有图片。') : say(panel, 'No saved works yet.', '作品库里还没有作品。'); + : filter === 'image' ? say(panel, 'No saved images yet.', '作品库里还没有图片。') : say(panel, 'No saved creations yet.', '作品库里还没有作品。'); page.dataset.loading = String(!panel.fvMtLoaded); glideTo(page.querySelector('.fv-mt-filter')); } @@ -301,13 +302,13 @@ function markKeys(panel, toolbar) { const [add, generate, audio] = toolbar.querySelectorAll(':scope > button'); if (add && !add.classList.contains('fv-mt-add-key')) { add.classList.add('fv-mt-add-key'); - add.dataset.fvMtHint = say(panel, 'Drop or choose pictures, video or audio', '拖入或选择图片、视频、音频'); + add.dataset.fvMtHint = say(panel, 'Drop or choose images, video or audio', '拖入或选择图片、视频、音频'); const picker = toolbar.querySelector(':scope > input[type=file]'); if (picker) add.onclick = () => picker.click(); - add.dataset.fvTipName = say(panel, 'Add', '添加'); add.dataset.fvTipUse = say(panel, 'Pictures, video or audio from this computer', '从电脑添加图片、视频或音频'); + add.dataset.fvTipName = say(panel, 'Add', '添加'); add.dataset.fvTipUse = say(panel, 'Images, video or audio from this computer', '从电脑添加图片、视频或音频'); } generate?.classList.add('fv-mt-ai'); audio?.classList.add('fv-mt-audio'); - for (const [key, use] of [[generate, say(panel, 'Make a reference picture from words', '用一句话生成一张参考图')], [audio, audio?.title]]) { + for (const [key, use] of [[generate, say(panel, 'Make a reference image from words', '用一句话生成一张参考图')], [audio, audio?.title]]) { if (!key || key.dataset.fvTipName) continue; key.dataset.fvTipName = key.textContent.trim(); if (use) key.dataset.fvTipUse = use; if (!key.getAttribute('aria-label')) key.setAttribute('aria-label', key.textContent.trim()); @@ -350,8 +351,10 @@ function markNow(panel) { if (!panel.fvMtActions) { const line = panel.fvMtActions = make('div', 'fv-mt-actions'); const browse = make('button', 'fv-mt-browse'); browse.type = 'button'; - browse.append(make('span', 'fv-mt-browse-name', say(panel, 'Choose from works', '从作品库选择'))); - browse.dataset.fvTipName = say(panel, 'Choose from works', '从作品库选择'); browse.dataset.fvTipUse = say(panel, 'Add a saved video or picture', '加入作品库里的视频或图片'); + // Its shown name is short (Lane 11-25) so the line keeps the AI and audio keys in a 268 px column; the hover card says + // the whole action. + browse.append(make('span', 'fv-mt-browse-name', say(panel, 'From creations', '从作品库选择'))); + browse.dataset.fvTipName = say(panel, 'Choose from creations', '从作品库选择'); browse.dataset.fvTipUse = say(panel, 'Add a saved video or image', '加入作品库里的视频或图片'); browse.onclick = () => openWorks(panel); line.append(browse, make('span', 'fv-mt-actions-gap')); panel.append(line); diff --git a/web/glass/settings.css b/web/glass/settings.css index b8275084..0576a6cd 100644 --- a/web/glass/settings.css +++ b/web/glass/settings.css @@ -119,7 +119,7 @@ dialog.fv-set .st-ic{width:var(--fv-sp-32);height:var(--fv-sp-32);border-radius: dialog.fv-set .st-ic.is-ok{background:var(--fv-ok-soft);color:var(--fv-ok)} dialog.fv-set .st-rt{min-width:0} dialog.fv-set .st-rt b{display:block;font-size:var(--fv-fs-2);line-height:var(--fv-lh-2);font-weight:var(--fv-fw-2);color:var(--fv-fg)} -dialog.fv-set .st-rt span{display:block;font-size:var(--fv-fs-1);line-height:var(--fv-lh-1);color:var(--fv-fg3);margin-top:var(--fv-sp-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +dialog.fv-set .st-rt span{display:block;font-size:var(--fv-fs-1);line-height:var(--fv-lh-1);color:var(--fv-fg3);margin-top:var(--fv-sp-2);overflow-wrap:anywhere;text-wrap:pretty} dialog.fv-set .st-rt .is-warn{color:var(--fv-warn);white-space:normal} dialog.fv-set .st-rt .is-caution{color:var(--fv-caution)} dialog.fv-set .st-rt .is-ok{color:var(--fv-ok)} @@ -488,3 +488,39 @@ dialog.fv-set .st-search input:focus-visible{outline:none} @media (max-width:719px){dialog.fv-set .st-facts3 dt{flex:none;white-space:nowrap}dialog.fv-set .st-facts3 dd{min-width:0}} /* Tablets: the search field takes a finger (buttons and switches already reach 44 through their ::after). */ @media (pointer:coarse){dialog.fv-set .st-search{height:var(--fv-touch)}} + +/* Interface language (language_picker.js): a button with the globe and the language's own name, and its list. + Sizes and colours from Iris's visual final (review/i18n/language-switch.md, 11-24); the launcher uses the same. */ +dialog.fv-set .st-lang{position:relative;flex:none} +dialog.fv-set .st-lang-btn{display:inline-flex;align-items:center;gap:var(--fv-sp-8);height:32px;padding:0 var(--fv-sp-12); + border:0;border-radius:8px;background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);color:var(--fv-fg);font:inherit;cursor:pointer} +dialog.fv-set .st-lang-btn .fv-i{width:16px;height:16px} +dialog.fv-set .st-lang-btn .fv-i:last-child{width:12px;height:12px;opacity:.7} +dialog.fv-set .st-lang-btn:hover{background:var(--fv-ctl-hover,rgb(255 255 255 / .1))} +dialog.fv-set .st-lang-btn:disabled{opacity:.6;cursor:default} +dialog.fv-set .st-lang-pop{position:absolute;right:0;top:calc(100% + 6px);z-index:20;box-sizing:border-box;width:264px;padding:4px; + border-radius:var(--fv-r-md);background:rgb(var(--fv-solid3));box-shadow:0 0 0 1px var(--fv-line2),0 14px 36px rgb(0 0 0 / .45)} +dialog.fv-set .st-lang-pop.is-up{top:auto;bottom:calc(100% + 6px)} +dialog.fv-set .st-lang-search{position:relative;display:block;margin-bottom:4px} +dialog.fv-set .st-lang-search[hidden]{display:none} +dialog.fv-set .st-lang-glass{position:absolute;left:9px;top:9px;width:14px;height:14px;opacity:.6;pointer-events:none} +dialog.fv-set .st-lang-find{display:block;box-sizing:border-box;width:100%;height:32px;padding:0 var(--fv-sp-12) 0 32px;-webkit-appearance:none;appearance:none; + border:1px solid var(--fv-line2);border-radius:var(--fv-r-sm);background:transparent;color:var(--fv-fg);font:inherit;outline:none;box-shadow:none} +dialog.fv-set .st-lang-find:focus,dialog.fv-set .st-lang-find:focus-visible{border-color:var(--fv-accent-ink);outline:none!important;box-shadow:none!important} +dialog.fv-set .st-lang-list{position:relative;overflow-y:auto;outline:none} +/* The page draws the list's scroll bar (st-lang-track), so it shows on every system; the system one is hidden. */ +dialog.fv-set .st-lang-list{scrollbar-width:none} +dialog.fv-set .st-lang-list::-webkit-scrollbar{display:none} +dialog.fv-set .st-lang-track{position:absolute;right:3px;width:4px;pointer-events:none} +dialog.fv-set .st-lang-track>i{display:block;width:4px;border-radius:2px;background:rgb(255 255 255 / .3)} +:root[data-theme=light] dialog.fv-set .st-lang-track>i{background:rgb(30 40 60 / .3)} +dialog.fv-set .st-lang-opt{display:flex;align-items:center;gap:var(--fv-sp-8);height:32px;padding:0 var(--fv-sp-12) 0 var(--fv-sp-8); + border-radius:var(--fv-r-sm);color:var(--fv-fg);font-weight:400;cursor:pointer;white-space:nowrap} +dialog.fv-set .st-lang-opt .st-lang-mark{flex:none;width:16px;height:16px;visibility:hidden} +dialog.fv-set .st-lang-opt.is-auto{position:relative;margin-bottom:9px} +dialog.fv-set .st-lang-opt.is-auto::after{content:'';position:absolute;left:0;right:0;bottom:-5px;height:1px;background:var(--fv-line2)} +dialog.fv-set .st-lang-opt.is-active{background:var(--fv-ctl-hover,rgb(255 255 255 / .08))} +dialog.fv-set .st-lang-opt[aria-selected=true]{background:var(--fv-accent-soft);font-weight:600} +dialog.fv-set .st-lang-opt[aria-selected=true] .st-lang-mark{visibility:visible} +dialog.fv-set .st-lang-none{padding:var(--fv-sp-8) 0;color:var(--fv-fg3);text-align:center} +:root[data-theme=light] dialog.fv-set .st-lang-pop{box-shadow:0 0 0 1px var(--fv-line2),0 14px 36px rgb(30 40 60 / .18)} diff --git a/web/glass/studio.css b/web/glass/studio.css index 8e876f2c..e5c9d380 100644 --- a/web/glass/studio.css +++ b/web/glass/studio.css @@ -108,6 +108,9 @@ .fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-primary{padding:0 var(--fv-sp-16);background:var(--fv-accent-fill);color:#fff;font-weight:600;box-shadow:inset 0 1px 0 rgb(255 255 255 / .2)} .fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-primary:hover{background:#1078df;color:#fff} .fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-icon{width:var(--fv-ctl);padding:0} +/* the favourite key under the picture: lit and filled once the video is a favourite */ +.fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-favorite[aria-pressed=true]{color:var(--fv-accent-ink)} +.fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-favorite[aria-pressed=true] svg{fill:currentColor} .fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-icon:not([data-state])>span:last-child:not(.fv-icon){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap} .fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-icon[data-state]{width:auto;padding:0 var(--fv-sp-12)} .fv-studio.fv-create .fv-actions[data-layout=stage] .fv-action-more[open]>summary{background:var(--fv-ctl-hover);color:var(--fv-fg)} @@ -173,6 +176,9 @@ overflow:hidden;font-size:var(--fv-fs-1);line-height:20px;color:var(--fv-fg3);pointer-events:none} .fvs-console-status>*{pointer-events:auto;min-width:0;margin:0!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .fvs-console-status>[hidden]{display:none!important} +/* A tray or a small window over the line: its glass would let the words show through faintly, so the line goes clear + under it (studio.js coverBand); it stays in the page and is still read out. */ +.fv-studio.fv-create .fv-controls[data-status-covered=true] .fvs-console-status{opacity:0} /* The run's status takes no room in the line while it says nothing, so a note beside it (a rewrite's failure and its report key) reads whole. */ .fvs-console-status>.fv-status:empty{display:none!important} @@ -841,6 +847,22 @@ html body .fv-studio.fv-create .fvs-console :is(.fvs-console-prompt,.fv-section, /* LoRA tray: an empty list is just a left-aligned Add; no standing note; the tray is as tall as what it holds. */ .fv-studio.fv-create .fvs-tray .fv-lora-add{justify-content:flex-start} .fv-studio.fv-create .fvs-tray :is(.fv-lora-note,.fv-lora-list):empty{display:none} +/* A row short of room folds its chips (web/studio_console.js fitRow; Iris 11-24): Media and LoRA keep their icon and + count, styled and placed as when open (no badge); without a count they are square (as wide as they are tall, like + @). Then Enhance keeps its star, square, its on state unchanged. The words stay for screen readers. */ +.fv-studio.fv-create .fvs-chips[data-fold] :is(.fvs-chip[data-chip=media],.fvs-chip[data-chip=lora]) .fvs-chip-label, +.fv-studio.fv-create .fvs-chips:is([data-fold="2"],[data-fold="3"]) .fv-enhance-chip>span{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0} +.fv-studio.fv-create .fvs-chips[data-fold] :is(.fvs-chip[data-chip=media],.fvs-chip[data-chip=lora]){padding:0 10px} +.fv-studio.fv-create .fvs-chips[data-fold] :is(.fvs-chip[data-chip=media],.fvs-chip[data-chip=lora])[data-empty], +.fv-studio.fv-create .fvs-chips:is([data-fold="2"],[data-fold="3"]) .fv-enhance-chip{width:auto;min-width:0;aspect-ratio:1;padding:0;justify-content:center} +/* Third step (Lane 11-24): the phone's compact keys below (520 px): the duration shows its number (its name and hover + card keep the unit), the size and quality keys drop their drawings. */ +.fv-studio.fv-create .fvs-console .fvs-chips[data-fold="3"]>.fvs-stepper{padding:0 var(--fv-sp-2)} +.fv-studio.fv-create .fvs-console .fvs-chips[data-fold="3"] .fvs-stepper .fvs-step{width:32px;min-width:32px} +.fv-studio.fv-create .fvs-console .fvs-chips[data-fold="3"] .fvs-stepper .fvs-step-value{min-width:28px;padding:0 var(--fv-sp-4)} +.fv-studio.fv-create .fvs-console .fvs-chips[data-fold="3"] .fvs-stepper .fvs-step-unit{display:none} +.fv-studio.fv-create .fvs-console .fvs-chips[data-fold="3"]>.fvp-chip{padding:0 var(--fv-sp-8);gap:var(--fv-sp-4)} +.fv-studio.fv-create .fvs-console .fvs-chips[data-fold="3"]>.fvp-chip>.fvp-chip-glyph{display:none} /* Narrow windows: the chips wrap inside the console (nothing scrolls out of sight); LoRA and Advanced sit together at the right end of the last line. */ @media(max-width:760px){ diff --git a/web/global_search.js b/web/global_search.js index c304c003..1ea2def0 100644 --- a/web/global_search.js +++ b/web/global_search.js @@ -54,7 +54,8 @@ const dateWords = (value, cn = CN) => { const date = new Date(value); if (Number.isNaN(date.getTime())) return ''; const today = new Date(), sameDay = date.toDateString() === today.toDateString(); const time = `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`; - if (sameDay) return cn ? `今天 ${time}` : `Today ${time}`; + if (sameDay) return words(['Today {time}', '今天 {time}', { time }], cn); + // A date format, not a sentence (11月24日, Nov 24); left for the per-language date formats. return cn ? `${date.getMonth() + 1}月${date.getDate()}日 ${time}` : `${date.toLocaleString('en-US', {month: 'short', day: 'numeric'})} ${time}`; }; // The engine names pictures image-YYYYMMDD-HHMMSS-NN. @@ -119,23 +120,23 @@ export function createSearch({fetchVideos, fetchPrompt, fetchPictures, pictureMe const label = clean(row.agent?.label || ''); const file = String(row.video || row.id || ''); const g = row.geometry || {}, seconds = g.seconds || (g.frames && g.frames / (g.fps || 24)); - const kind = cn ? '视频' : 'Video'; + const kind = words(['Video', '视频'], cn); return {kind: 'video', key: 'video:' + (row.id || file), time: Date.parse(row.created_at) || 0, fields: [prompt || label, label, file], prompt, - fallback: label || kind, sub: [kind, seconds ? (cn ? `${Math.round(seconds)} 秒` : `${Math.round(seconds)} s`) : '', dateWords(row.created_at, cn)].filter(Boolean).join(' · '), - badge: seconds ? `${Math.round(seconds)} s` : '', thumb: urls.video?.(row) || '', icon: 'film', use: cn ? '在作品库里打开' : 'Open in Creations', open: () => open.video?.(row)}; + fallback: label || kind, sub: [kind, seconds ? words(['{seconds} s', '{seconds} 秒', { seconds: Math.round(seconds) }], cn) : '', dateWords(row.created_at, cn)].filter(Boolean).join(' · '), + badge: seconds ? `${Math.round(seconds)} s` : '', thumb: urls.video?.(row) || '', icon: 'film', use: words(['Open in Creations', '在作品库里打开'], cn), open: () => open.video?.(row)}; }; const pictureRow = row => { const meta = pictureMeta(row.file) || {}; const time = meta.at || pictureTime(row.name || row.file); - const kind = cn ? '图像' : 'Picture', size = meta.width && meta.height ? `${meta.width} × ${meta.height}` : ''; + const kind = words(['Image', '图像'], cn), size = meta.width && meta.height ? `${meta.width} × ${meta.height}` : ''; return {kind: 'image', key: 'image:' + row.file, time, fields: [clean(meta.prompt || ''), '', String(row.name || row.file)], prompt: clean(meta.prompt || ''), fallback: String(row.name || row.file), sub: [kind, size, dateWords(time, cn)].filter(Boolean).join(' · '), badge: '', thumb: urls.picture?.(row) || '', icon: 'image', - use: cn ? '在图像视图里打开' : 'Open in Images', open: () => open.picture?.(row)}; + use: words(['Open in Images', '在图像视图里打开'], cn), open: () => open.picture?.(row)}; }; const KIND_WORDS = {character: ['Character', '角色'], setting: ['Scene', '场景'], prop: ['Prop', '道具']}; const castRow = row => ({kind: 'cast', key: 'cast:' + row.id, time: 0, fields: [clean(row.name), clean(row.description || ''), ''], round: true, - fallback: clean(row.name), sub: `${words(KIND_WORDS[row.kind] || KIND_WORDS.character, cn)} · ${cn ? `在描述里输入 @${clean(row.name)}` : `type @${clean(row.name)} in a prompt`}`, - thumb: row.thumbnail?.file ? urls.cast?.(row) || '' : '', icon: 'person', use: cn ? '打开这个角色' : 'Open this cast member', open: () => open.cast?.(row)}); + fallback: clean(row.name), sub: `${words(KIND_WORDS[row.kind] || KIND_WORDS.character, cn)} · ${words(['type @{name} in a prompt', '在提示词里输入 @{name}', { name: clean(row.name) }], cn)}`, + thumb: row.thumbnail?.file ? urls.cast?.(row) || '' : '', icon: 'person', use: words(['Open this cast member', '打开这个角色'], cn), open: () => open.cast?.(row)}); // Every prompt used here once, newest use first, with how often it was used. const promptRows = () => { const seen = new Map(); @@ -146,8 +147,8 @@ export function createSearch({fetchVideos, fetchPrompt, fetchPictures, pictureMe seen.set(key, {prompt: row.prompt, time: row.time, kind: row.kind, count: 1}); } return [...seen.values()].map(item => ({kind: 'prompt', key: 'prompt:' + fold(item.prompt).slice(0, 80), time: item.time, fields: [item.prompt, '', ''], fallback: item.prompt, - sub: [item.count > 1 ? (cn ? `用过 ${item.count} 次` : `Used ${item.count} times`) : dateWords(item.time, cn), cn ? '填入描述框' : 'fills the prompt'].join(' · '), - thumb: '', icon: 'clock', use: cn ? '把这段描述填进当前视图' : 'Put this prompt in the view in front', open: () => open.prompt?.(item.prompt, item.kind)})); + sub: [item.count > 1 ? words(['Used {count} times', '用过 {count} 次', { count: item.count }], cn) : dateWords(item.time, cn), words(['fills the prompt box', '填入提示词框'], cn)].join(' · '), + thumb: '', icon: 'clock', use: words(['Put this prompt in the view in front', '把这段提示词填进当前视图'], cn), open: () => open.prompt?.(item.prompt, item.kind)})); }; function present(row, hit) { @@ -287,10 +288,10 @@ export async function fillPrompt(text, {view = null, fallbackView = 'studio'} = const setter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(box), 'value')?.set; if (setter) setter.call(box, text); else box.value = text; box.dispatchEvent(new Event('input', {bubbles: true})); box.dispatchEvent(new Event('change', {bubbles: true})); - toast(t('The prompt is in. Press Ctrl+Enter to generate.', '描述已填入,按 Ctrl+回车 生成。').replace('Ctrl', /Mac/.test(navigator.platform) ? '⌘' : 'Ctrl'), {tone: 'ok'}); + toast(t('The prompt is in. Press Ctrl+Enter to generate.', '提示词已填入,按 Ctrl+回车 生成。').replace('Ctrl', /Mac/.test(navigator.platform) ? '⌘' : 'Ctrl'), {tone: 'ok'}); return true; } - if (await copyText(text)) toast(t('Prompt copied. Paste it into the prompt box.', '已复制提示词,请粘贴到输入框。'), {icon: 'copy'}); + if (await copyText(text)) toast(t('Prompt copied. Paste it into the prompt box.', '已复制提示词,请粘贴到提示词框。'), {icon: 'copy'}); else toast(t('Could not fill in the prompt. Try again.', '未能填入提示词,请重试。'), {tone: 'warn'}); return false; } diff --git a/web/has_mirror.js b/web/has_mirror.js index b71f7e28..a3890c07 100644 --- a/web/has_mirror.js +++ b/web/has_mirror.js @@ -33,7 +33,9 @@ const RULES = [ ['pass', '.fv-ed-generate', host => !!host.nextElementSibling?.matches('.fv-ed-pass-options:not([hidden])')], ['nodev', '.fv-ed-record-side', host => shown(host, '.fv-ed-record-device[hidden]')], ['rec', '.fv-editor', host => shown(host, '.fv-ed-record:not([hidden])')], - ['pop', '.fv-body,:root', host => shown(host, '.fvs-tray[data-fv-pop][open]')], + // (A tray the column keeps open on its own, data-pinned, is no floating pop-up: it must not hide the hover tips and move the dock.) + // (A tray inside the settings column, pinned or the inline Media tray, is no floating pop-up either.) + ['pop', '.fv-body,:root', host => [...host.querySelectorAll('.fvs-tray[data-fv-pop][open]')].some(tray => !tray.dataset.pinned && !tray.closest('.fv-sc-section'))], ['fp', ':root', host => shown(host, '.fvp-pop[data-open=true]')], ['sec', '.fvp-pop-body section,.fvp-pop-body .fv-section,.fvp-pop-body .fv-sampling-settings', host => kid(host, c => !c.matches('[hidden],.fv-label,.fvs-size-fields,.fv-shapes,:empty'))], @@ -84,6 +86,8 @@ const RULES = [ ['miss', '.fv-iv-pic', host => shown(host, '.fv-iv-picture[data-missing=true]')], ['btn1', '.fv-iv-pic', host => kid(host, c => c.matches('button'))], ['es', '.fv-mt-cards', host => kid(host, c => c.matches('.fv-mt-slot-empty'))], + ['wcol', '.fv-body', host => kid(host, c => c.matches('.fv-work-column:not([hidden])'))], + ['rst', '.fvs-tray-head', host => shown(host, '.fv-at-reset:not([hidden])')], ['sw2', 'label.fv-check', host => kid(host, c => c.matches('input[role=switch]'))], ]; const set = (host, id, on) => { if (host.hasAttribute('data-hx-' + id) !== on) host.toggleAttribute('data-hx-' + id, on); }; @@ -103,6 +107,9 @@ const scan = (root, found) => { } }; const focusState = event => { + // The Quality slider's rail answers the keys without being seen: a ring shows round the four names while it has keyboard focus. + const effort = event.target.closest?.('.fv-effort'); + if (effort) effort.toggleAttribute('data-hx-rail', event.type === 'focusin' && event.target.matches('.fv-effort-rail:focus-visible')); const console = event.target.closest?.('.fvs-console'); if (!console) return; const on = event.type === 'focusin'; @@ -152,7 +159,7 @@ export function installHasMirror(doc = document) { doc.addEventListener('focusin', focusState, true); doc.addEventListener('focusout', focusState, true); doc.addEventListener('pointerover', event => { - const inside = !!event.target.closest?.('.fvs-tray[data-fv-pop][open]'); + const inside = !!event.target.closest?.('.fvs-tray[data-fv-pop][open]:not([data-pinned])') && !event.target.closest?.('.fv-sc-section'); if (doc.documentElement.hasAttribute('data-hx-pophover') !== inside) doc.documentElement.toggleAttribute('data-hx-pophover', inside); }, true); } diff --git a/web/health.js b/web/health.js index 534c0e82..1875aea6 100644 --- a/web/health.js +++ b/web/health.js @@ -10,27 +10,29 @@ const query = new URLSearchParams(location.search); // The language rule of web/i18n.js, written out here because this file imports nothing at load: it must still run and // report when i18n.js itself fails to load. tests/i18n_runtime.mjs checks that the two agree. const language = query.get('freevideo_lang'); -const cn = language === 'zh' || (language !== 'en' && String(navigator.language || '').toLowerCase().startsWith('zh')); +const cn = /^zh([-_]|$)/i.test(language || '') || (!language && String(navigator.language || '').toLowerCase().startsWith('zh')); const t = (en, zh) => cn ? zh : en; +// t for the other modules' texts, which hold {name} placeholders. +const filled = (en, zh, values) => (cn ? zh : en).replace(/\{(\w+)\}/g, (whole, name) => values && Object.hasOwn(values, name) ? String(values[name]) : whole); // launcher.js removes this flag during setup; read it before that. const launchVisit = query.get('freevideo') === 'launch'; // Every script this folder ships; a test keeps the list in step with web/*.js. export const MODULES = ['fv_player.js', 'audio_original.js', 'chat_data.js', 'phone_model.js', 'phone.js', 'lan_access.js', 'monitor_panel.js', 'qrcodegen.js', 'agent_activity.js', 'agent_tasks.js', 'agent_confirm_settings.js', 'private_pin.js', 'private_settings.js', 'agent_connect.js', 'agent_session.js', 'autopilot.js', 'autopilot_chat.js', 'chat_attachments.js', 'autopilot_conversations.js', 'browser_extension.js', 'caret_rect.js', 'chain_support.js', 'chain_rules.js', 'timed_prompt.js', 'capability_view.js', 'cast_generate.js', 'cast_mention.js', 'cast_overlay.js', 'cast_source.js', 'compatibility.js', 'entry_showcase.js', 'engine_exit.js', 'error_panel.js', 'first_run_guide.js', 'fonts.js', 'freevideo.js', 'generation_progress.js', 'editor.js', 'editor_actions.js', 'editor_lifecycle.js', 'editor_adjust.js', 'editor_adjust_picture.js', 'editor_picture_fields.js', 'editor_picture_session.js', 'editor_preview_picture.js', 'editor_entry.js', 'editor_expand.js', 'editor_export_dialog.js', 'editor_first_frame.js', 'editor_media_references.js', 'editor_references.js', 'middle_frames.js', 'editor_genbar.js', 'editor_duration.js', 'editor_geometry.js', 'editor_library.js', 'editor_menu.js', 'editor_stems.js', 'editor_record.js', 'editor_record_model.js', 'editor_voice.js', 'editor_voice_install.js', 'editor_voice_model.js', 'editor_voice_store.js', 'editor_model.js', 'editor_frame.js', 'editor_player.js', 'editor_room.js', 'editor_select.js', 'editor_state.js', 'editor_store.js', 'editor_tracks.js', 'editor_generation.js', 'editor_transport.js', 'editor_transport_model.js', 'editor_audio.js', 'editor_audio_model.js', 'editor_audio_notes.js', 'editor_audio_replace.js', 'editor_audio_rules.js', 'editor_music.js', 'editor_music_model.js', 'editor_speed.js', 'editor_speed_model.js', 'editor_failure.js', 'editor_header_fit.js', 'studio_header_fit.js', - 'editor_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_toolbar_more.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'dom_quiet.js', 'done_notify.js', 'file_failure.js', 'has_mirror.js', 'failure_issue.js', 'feedback.js', 'frame_sizes.js', 'health.js', 'i18n.js', 'image_commands.js', 'random_id.js', 'clipboard_text.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'image_lora.js', 'image_view.js', 'launch_visit.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'lora_check.js', 'library.js', 'motion.js', 'native_errors.js', 'translate_guard.js', 'output_download.js', 'port_notice.js', 'preview_scene.js', + 'editor_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_toolbar_more.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'dom_quiet.js', 'done_notify.js', 'file_failure.js', 'has_mirror.js', 'failure_issue.js', 'feedback.js', 'frame_sizes.js', 'health.js', 'i18n.js', 'image_commands.js', 'random_id.js', 'clipboard_text.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'image_lora.js', 'image_view.js', 'launch_visit.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'lora_check.js', 'library.js', 'motion.js', 'native_errors.js', 'translate_guard.js', 'output_download.js', 'port_notice.js', 'preview_scene.js', 'panel_shell.js', 'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'prompt_sections.js', 'prompt_terms.js', 'request_assets.js', 'repair_hint.js', 'report_issue.js', 'issue_button.js', 'studio_recent.js', 'media_queue.js', 'work_media.js', 'task_groups.js', 'result_actions.js', 'result_reuse.js', 'sampling_effort.js', 'pass_mode.js','setup.js', 'share.js', 'share_layout.js', 'studio.js', 'studio_chain.js', 'studio_extend.js', 'studio_length.js', 'first_frame_row.js', 'replace_person.js', 'replace_state.js', 'optional_inputs.js', 'other_usage.js', 'studio_queue.js', 'studio_size.js', 'toolbar_position.js', 'updates.js', 'video_model.js', 'view_navigation.js', 'whatsnew.js', 'whatsnew_pages.js', 'whatsnew_peaks.js', 'wordmark.js', 'workspace_restore.js', 'cast_library.js', 'media_upload.js', 'whitebox_encode.js', 'whitebox_mp4.js', 'whitebox_recording.js', 'whitebox_render.js', 'whitebox_scenes.js', 'whitebox_worker.js', - 'empty_prompt_notice.js', 'feature_tour.js', 'feature_tour_content.js', 'howto.js', 'swap_lora.js', 'sound_bubble.js', 'tour_goto.js', 'tour_try.js', 'tutorial_book.js', 'tutorial_book_content.js', + 'empty_prompt_notice.js', 'feature_tour.js', 'feature_tour_content.js', 'i18n_tables.js', 'howto.js', 'swap_lora.js', 'fast_pack.js', 'sound_bubble.js', 'tour_goto.js', 'tour_try.js', 'tutorial_book.js', 'tutorial_book_content.js', 'shell.js', 'tooltip.js', 'tooltip_copy.js', 'library_meta.js', 'cast_room.js', 'editor_tracks_tips.js', 'tip_words.js', 'cut_tip.js', 'field_note.js', 'image_view_layout.js', 'task_store.js', 'task_float.js', - 'image_view_ui.js', 'image_view_size.js', 'image_view_models.js', 'image_view_history.js', 'image_view_prompts.js', 'image_view_compare.js', 'image_view_queue.js', 'image_view_mentions.js', 'image_view_warm.js', 'image_view_viewer.js', 'image_view_lora.js', + 'image_view_ui.js', 'studio_columns.js', 'image_view_size.js', 'image_view_models.js', 'image_view_history.js', 'image_view_prompts.js', 'image_view_compare.js', 'image_view_queue.js', 'image_view_mentions.js', 'image_view_warm.js', 'image_view_viewer.js', 'image_view_lora.js', 'work_column.js', 'picture_url.js', 'studio_right_column.js', 'studio_works.js', 'palette.js', 'picture_zoom.js', 'global_search.js', 'notifications.js', 'shortcuts.js', 'context_menu.js', 'studio_console.js', 'studio_stage.js', 'prompt_library.js', 'autopilot_panels.js', 'autopilot_tips.js', 'autopilot_history.js', 'a11y.js', 'topbar.js', 'view_switch_place.js', 'view_navigation_fit.js', 'editor_tips.js', 'editor_narration.js', 'editor_narration_model.js', 'editor_beats_model.js', 'empty_frame.js', 'studio_compare.js', 'image_library.js', 'fv_select.js', 'preview_style.js', - 'feature_tour_layer.js', 'settings_room.js', 'settings_kit.js', 'settings_words.js', + 'feature_tour_layer.js', 'settings_room.js', 'settings_kit.js', 'settings_words.js', 'language_picker.js', 'image_works.js', 'cast_photo.js', 'editor_opening.js', 'editor_poster.js', 'topbar_state.js', 'preload_setting.js', 'private_offers.js', 'cast_face_crop.js', 'context_fallback.js', 'studio_warm.js', 'pose_body.js', 'pose_props.js', 'pose_stage.js', 'pose_tool.js', 'release_media.js', 'ui_speed.js', 'lora_menu.js', 'upscale_offer.js', 'user_message.js', 'workflow_drafts.js', 'comfy_templates.js']; @@ -497,7 +499,7 @@ function extensionProblem(problem) { // Preserve the same known engine causes as the execution/queue cards. // A missing error-panel module must not disable this page check itself. if (problem.advice !== 'blocked' && errorUI) { - const cause = errorUI.failureAdvice(errorUI.errorText(problem.error || problem.text), t, + const cause = errorUI.failureAdvice(errorUI.errorText(problem.error || problem.text), filled, problem.error?.known_error ?? errorUI.createErrorReport(problem.error || problem.text).known_error); if (cause.kind !== 'unknown') return null; } @@ -562,6 +564,8 @@ function details(problems) { // fail to load, so it builds the address itself (no shared module) and removes places and addresses. const ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new'; const forgetPlaces = text => String(text) + // A local file written as a URL (file:///C:/Users/..., file://localhost/..., %-escaped) is a place too. + .replace(/(^|[^A-Za-z0-9_\/])file:(?:\/\/[^\/\s'"<>]*)?(?:\/+|(?=[A-Za-z]:[\\/]))[^'"<>|\r\n]*/gi, '$1') .replace(/https?:\/\/[^\s'"<>)]+/g, '') .replace(/\b\d{1,3}(?:\.\d{1,3}){3}(?::\d+)?\b/g, '
') .replace(/(?:[A-Za-z]:[\\/]|\\\\|~[\\/])[^'"<>|\r\n]+/g, '') @@ -631,7 +635,7 @@ function show(problems, asked = false) { font: '13px/1.55 "Segoe UI","FreeVideo Quotes","Microsoft YaHei UI","Noto Sans CJK SC","Noto Sans SC",system-ui,sans-serif'}); const title = document.createElement('div'); const extension = problems.map(extensionProblem).find(Boolean); - const extensionAdvice = extension && extensionUI.browserExtensionAdvice(extension, t, + const extensionAdvice = extension && extensionUI.browserExtensionAdvice(extension, filled, {blocked: problems.some(p => p.advice === 'blocked')}); // Only what the user just asked for failed (opening from the menu): the page itself loaded. title.textContent = extensionAdvice?.title || (problems.every(p => p.asked) ? t('FreeVideo ran into a problem', 'FreeVideo 出错了') diff --git a/web/howto.js b/web/howto.js index c8df5442..77ed3312 100644 --- a/web/howto.js +++ b/web/howto.js @@ -1,4 +1,5 @@ import {showHowTo} from './first_run_guide.js'; +import {translator} from './i18n.js'; // Short walk-throughs played over the live interface (the shared anchored layer, as the first-run guide uses). // A step names its control; when that control is not on screen (nothing generated yet, say) `image` stands in for it. @@ -38,9 +39,9 @@ const HOWTOS = [ {id: 'media', target: mediaSection, en: 'Add images here and set each one as a reference, first frame, or last frame.', zh: '在此添加图片,每张可设为参\u2060考、首\u2060帧或尾\u2060帧。'}, {id: 'describe', prepare: putMediaAway, anchor: '[data-fv-guide="describe"]', en: 'Type @ in the prompt and choose an image, then say what it does in the scene.', - zh: '在描述中输入 @ 选择图片,并写明它在画面中的作用。'}, + zh: '在提示词中输入 @ 选择图片,并写明它在画面中的作用。'}, {id: 'media-av', target: mediaSection, en: 'Videos and audio can be references too: add them the same way with "Add" and mention them in the prompt with @.', - zh: '视频和音频也可作为参考:同样点“添\u2060加”,在描述中输入 @ 引用。'}, + zh: '视频和音频也可作为参考:同样点“添\u2060加”,在提示词中输入 @ 引用。'}, {id: 'generate', prepare: putMediaAway, anchor: '[data-fv-guide="generate"]', en: 'Choose "Generate video".', zh: '点“生成视频”。'}]}, {id: 'long-video', view: 'studio', needsParts: true, title: ['Make a longer video', '连续的长视频'], steps: [ @@ -48,12 +49,12 @@ const HOWTOS = [ zh: '填写更长的时长,会自动分段生成。'}, {id: 'generate', anchor: '[data-fv-guide="generate"]', en: 'Choose "Generate video".', zh: '点“生成视频”。'}, {id: 'extend', anchor: '.fv-action-extend', image: 'extend-button', - en: 'Choose "Extend" below a finished video to continue it. Each continued part is at least 5 seconds, and the last one can be as short as 2 seconds. With a part shorter than 10 seconds, one video has at most 4 parts.', + en: 'Choose "Extend" below a finished video to add the next part. Each added part is at least 5 seconds, and the last one can be as short as 2 seconds. With a part shorter than 10 seconds, one video has at most 4 parts.', zh: '在生成好的视频下方点“接着生成”,继续下一段。接着生成的每一段至少 5 秒,最后一段可短至 2 秒。有短于 10 秒的段时,一条视频最多 4 段。'}, {id: 'longer', anchor: '[data-view="editor"]', en: 'Parts can also be added one by one in "Edit".', zh: '也可在“剪辑视图”中逐段接续。'}]}, {id: 'editor-extend-refs', view: 'editor', title: ['Add reference images when extending in Edit', '在剪辑视图延长时加参考图'], steps: [ - {id: 'editor-timeline', target: selectedPart, en: 'Select the part to continue.', zh: '选中要接续的一段。'}, + {id: 'editor-timeline', target: selectedPart, en: 'Select the part to extend.', zh: '选中要接续的一段。'}, {id: 'editor-refs', anchor: '[data-fv-guide="editor-refs"]', image: 'editor-refs', prefer: ['below', 'left', 'right', 'above'], en: 'Choose "Media" to upload or generate images.', zh: '点“素材”,上传或生成图片。'}, {id: 'editor-describe', anchor: '[data-fv-guide="editor-describe"]', en: 'Describe it, then choose "Generate".', zh: '填写描述,然后点“生成”。'}]}, @@ -73,7 +74,7 @@ const HOWTOS = [ {id: 'voice-generate', anchor: '[data-fv-guide="editor-generate"]', en: 'Choose "Redub" to speak the changed lines again.', zh: '点“重新配音”,只重配改过的句子。'}]} ]; -export const howToList = cn => HOWTOS.map(({id, title}) => ({id, title: title[cn ? 1 : 0]})); +export const howToList = cn => HOWTOS.map(({id, title}) => ({id, title: translator(cn)(...title)})); // Devices that cannot make longer videos in parts have no Extend button, so that how-to is not offered. // An unreadable answer keeps it, as the length field's own line does. @@ -90,7 +91,7 @@ export async function howToAvailable(id) { } export async function availableHowToList(cn) { const parts = await canMakeParts(); - return HOWTOS.filter(item => parts || !item.needsParts).map(({id, title}) => ({id, title: title[cn ? 1 : 0]})); + return HOWTOS.filter(item => parts || !item.needsParts).map(({id, title}) => ({id, title: translator(cn)(...title)})); } const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/web/i18n.js b/web/i18n.js index c9b1e4e2..aa1730d0 100644 --- a/web/i18n.js +++ b/web/i18n.js @@ -1,7 +1,12 @@ -// The page's interface language, read one way for every module. The launcher passes its language in the address as -// freevideo_lang=zh or freevideo_lang=en; without it the browser's language decides (Chinese when it starts with "zh"). +// The page's interface language, read one way for every module. The launcher passes its language in the address: +// freevideo_lang=zh for Simplified Chinese, en for English, a language file's tag for any other language (zh-Hant, +// pt-BR, ...); without it (a page not opened by the launcher) the browser's language decides (Chinese when it starts +// with "zh"). English and Simplified +// Chinese are written in the code as t(en, zh); any other language is read from web/locales/.json before the +// modules that use this one run, and a language whose file cannot be read shows as English (Simplified for zh-*). // Each module still decides when it reads: most read once when they load, the tour and the tutorial when they open. -// No imports and no DOM, so Node tests load it as they load the modules that use it. +// No imports, and the DOM only to mark a page in a third language (data-fv-language on , for its fonts in +// theme.css), so Node tests load it as they load the modules that use it. export const LANGUAGE_PARAM = 'freevideo_lang'; export const KEY_SEPARATOR = '␟'; @@ -10,13 +15,135 @@ export function askedLanguage(search = globalThis.location?.search) { try { return new URLSearchParams(search || '').get(LANGUAGE_PARAM); } catch { return null; } } -// Whether the page shows Chinese: the address decides when it says zh or en, otherwise the browser's language. +// Whether the page shows Chinese: the address decides when it names a language (zh, zh-Hant: yes; en, pt-BR: no), +// otherwise the browser's language. export function isChinese(asked = askedLanguage(), browserLanguage = globalThis.navigator?.language) { - return asked === 'zh' || (asked !== 'en' && String(browserLanguage || '').toLowerCase().startsWith('zh')); + return /^zh([-_]|$)/i.test(asked || '') || (!asked && String(browserLanguage || '').toLowerCase().startsWith('zh')); } +const BUILT_IN = /^(en|zh|zh[-_]hans)$/i; +const TAG = /^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$/; + +// The language file the address asks for: a tag other than English and Simplified Chinese, or null. +export function fileLanguage(asked = askedLanguage()) { + const tag = String(asked || '').replace(/_/g, '-'); + return TAG.test(tag) && !BUILT_IN.test(tag) ? tag : null; +} + +// How long the page waits for its language file before it opens as it would without one (a slow network must not keep +// the whole page blank). +export const CATALOG_WAIT_MS = 3000; + +// The tag each loaded language file was read for: its plural rules are that language's. +const catalogTags = new WeakMap(); + +// A language file as an object of texts, or null when it cannot be read within the wait. +export async function loadCatalog(tag, base = import.meta.url, fetcher = globalThis.fetch, wait = CATALOG_WAIT_MS) { + const stop = typeof AbortController === 'function' ? new AbortController() : null; + let timer; + const late = new Promise(resolve => { timer = setTimeout(() => { stop?.abort(); resolve(null); }, wait); }); + const read = (async () => { + try { + const response = await fetcher(new URL(`./locales/${tag}.json`, base), stop ? {signal: stop.signal} : undefined); + if (!response.ok) return null; + const catalog = await response.json(); + if (!catalog || typeof catalog !== 'object' || Array.isArray(catalog)) return null; + catalogTags.set(catalog, tag); + return catalog; + } catch { return null; } + })(); + try { return await Promise.race([read, late]); } finally { clearTimeout(timer); } +} + +const wanted = fileLanguage(); +// The texts of the page's language when it is neither English nor Simplified Chinese, otherwise null. +export const CATALOG = wanted && typeof globalThis.fetch === 'function' ? await loadCatalog(wanted) : null; +// The language the page shows, as a language file's tag. +export const LANGUAGE = CATALOG ? wanted : isChinese() ? 'zh-Hans' : 'en'; +if (CATALOG && globalThis.document?.documentElement) globalThis.document.documentElement.dataset.fvLanguage = LANGUAGE; +// The page's language as an element's lang attribute (zh-CN, en, zh-Hant, ja, ...): the browser picks its characters' +// shapes and its line-breaking rules by it. +export const pageLanguage = () => LANGUAGE === 'zh-Hans' ? 'zh-CN' : LANGUAGE; + +// t(en, zh, values) for a catalog (null: the text written in the code) and the language the module read. +export const translatorFor = (catalog, chinese) => catalog + ? (en, zh, values) => lookup(catalog, en, zh, values) + : (en, zh, values) => values ? fill(chinese ? zh : en, values) : chinese ? zh : en; + // A module's t(en, zh) for the language it read. -export const translator = chinese => (en, zh) => chinese ? zh : en; +export const translator = chinese => translatorFor(CATALOG, chinese); + +// Words the page reads back from text: what a person types ("Cut:", "@Image2", "Subject 1") and what the page wrote itself +// in its own language. A language file names its own in _meta.keywords, e.g. {"cut": ["Corte"], "subject": ["Sujeto"], +// "image": ["Imagen"]}; the page then reads those and the built-in words alike (English and Chinese, Simplified and +// Traditional, always work). Adding a language is still adding one file. freevideo_engine/i18n.py has the same rule for +// the words; tests/i18n_keywords_cases.json holds the cases both must pass. A word of the language's own that names an +// image or a subject is also read only where it stands on its own (see keywordSource); the built-in words are read as always. +export const KEYWORD_KINDS = ['cut', 'subject', 'image']; +export const BUILT_IN_KEYWORDS = Object.freeze({ + // Chinese first: the collector (scripts/i18n_extract.py) reads an English text followed by a Chinese one as a pair to translate. + cut: Object.freeze(['切', 'cut', 'CUT', 'Cut']), + subject: Object.freeze(['主体', '主體', 'Subject']), + image: Object.freeze(['图', '圖', 'Image']), +}); +export const MAX_KEYWORDS = 8; +const MAX_KEYWORD_LENGTH = 24; +// A keyword is read before a number or a colon, so it holds no colon, digit, mark of a mention or tag, or line break. +const validKeyword = word => typeof word === 'string' && word.length >= 1 && word.length <= MAX_KEYWORD_LENGTH + && !/[::@<>\d\r\n\t]|^\s|\s$|\s{2,}/.test(word); + +// A list of words as the page reads it: the valid ones, once each, at most MAX_KEYWORDS. +export const keywordList = list => Array.isArray(list) ? [...new Set(list.filter(validKeyword))].slice(0, MAX_KEYWORDS) : []; + +// The words a language file names, {cut: [...], subject: [...], image: [...]}; a kind it does not name has none. +export function keywordsIn(catalog) { + const given = catalog?._meta?.keywords, own = given && typeof given === 'object' && !Array.isArray(given) ? given : {}; + return Object.fromEntries(KEYWORD_KINDS.map(kind => [kind, Object.prototype.hasOwnProperty.call(own, kind) ? keywordList(own[kind]) : []])); +} + +// The page's own words (those of the language it shows). +export const KEYWORDS = keywordsIn(CATALOG); + +// A word as typed in capitals or with a capital first letter, and for "cut" in lower case too ("cut:" is a line's first word, +// before a colon). An image or subject word is not read in lower case unless the language file wrote it so: the built-in +// "Image" is read only with its capital, because "image 4" and "una imagen 4K" are ordinary sentences. +const spellings = (word, kind) => [...new Set(kind === 'cut' ? [word, word.toLowerCase(), word.toUpperCase(), word.charAt(0).toUpperCase() + word.slice(1)] + : [word, word.toUpperCase(), word.charAt(0).toUpperCase() + word.slice(1)])]; +const CJK_END = /[぀-ヿ㐀-鿿가-힯]$/; + +// Every word of a kind that is read: the built-in ones, then the language's own (in the spellings above), longest first. +export function keywordWords(kind, own = KEYWORDS[kind]) { + const words = [...BUILT_IN_KEYWORDS[kind], ...keywordList(own).flatMap(word => spellings(word, kind))]; + return [...new Set(words)].sort((a, b) => b.length - a.length || (a < b ? -1 : a > b ? 1 : 0)); +} + +const escapeRegExp = text => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + +// What may not stand before a word of the language's own: a letter or a digit, and for a word written in Han characters, +// kana or Hangul, a character of that script ("動画像2" is not "画像2", "この画像2" is). A Han word after other Han +// characters is not read ("参考画像2": a file that writes it so names "参考画像" itself). +const LEFT_EDGES = [[/^\p{Script=Han}/u, '\\p{Script=Han}'], [/^\p{Script=Hiragana}/u, '\\p{Script=Hiragana}'], + [/^\p{Script=Katakana}/u, '\\p{Script=Katakana}ー'], [/^\p{Script=Hangul}/u, '\\p{Script=Hangul}']]; +// A browser that cannot read a lookbehind (Safari before 16.4) reads such a word without the limit rather than failing to load. +const LOOKBEHIND = (() => { try { return new RegExp('(? LOOKBEHIND ? '(? first.test(word))?.[1] ?? '\\p{L}\\p{N}') + '])' : ''; +// A number that is a quantity, not a picture number: "4K", "3rd", "3.5", "3,5" (letters of the alphabets written with spaces; +// "画像2を" and "이미지2를" are numbers). A full stop or comma after the number ends a sentence unless a digit follows. +const QUANTITY = '\\d+(?!\\d)(?:[A-Za-z\\u00C0-\\u024F\\u0370-\\u04FF]|[.,]\\d)'; + +// A regular expression source that matches any word of a kind; build the expression with the `u` flag. With `separators` +// ({latin, cjk}) each word is followed by the separator for its script: a word written in letters needs a space before +// the number ("Subject 2"), one written in Chinese, Japanese or Korean characters may have none ("主体2"). +// A subject or image word of the language's own must stand on its own: not after a letter or digit ("Vorbild 3" is not +// "Bild 3") and not before a quantity ("Imagen 4K"). The built-in words are matched as they always were, and so are the +// words of a cut, which a line's start and colon already bound. +export function keywordSource(kind, own = KEYWORDS[kind], separators = null) { + const builtIn = new Set(BUILT_IN_KEYWORDS[kind]); + return '(?:' + keywordWords(kind, own).map(word => { + const text = escapeRegExp(word) + (separators ? (CJK_END.test(word) ? separators.cjk : separators.latin) : ''); + return kind === 'cut' || builtIn.has(word) ? text : leftEdge(word) + text + `(?!${separators ? '' : ' ?'}${QUANTITY})`; + }).join('|') + ')'; +} // The address that opens this page in a language (Settings, the command palette, reloading into an update). export function languageUrl(href, language) { @@ -29,12 +156,81 @@ export function languageUrl(href, language) { // one meaning), then for the English alone, then the English itself. {name} placeholders are filled from values. // Not used by the pages yet: English and Chinese are written in the code, and other languages come later. A missing // entry falls back to English, so Simplified Chinese is never read through it: its text is the zh in the code. +// A file whose _meta.fallback is zh-Hans (Traditional Chinese) shows text it does not hold, such as a sentence the code +// builds with a number in it, as the code's Simplified Chinese in its own characters (_meta.chars: pairs of a Simplified +// character and the one it becomes), not as English. export function lookup(catalog, en, zh, values) { - const own = key => catalog && Object.prototype.hasOwnProperty.call(catalog, key) && typeof catalog[key] === 'string' ? catalog[key] : null; - const text = own(en + KEY_SEPARATOR + zh) ?? own(en) ?? en; + const own = key => { + if (!catalog || !Object.prototype.hasOwnProperty.call(catalog, key)) return null; + const value = catalog[key]; + return typeof value === 'string' ? value : pluralText(value, values, catalogLanguage(catalog)); + }; + const text = own(en + KEY_SEPARATOR + zh) ?? own(en) ?? (catalog?._meta?.fallback === 'zh-Hans' ? fromSimplified(catalog, zh) : en); return values ? fill(text, values) : text; } +// The language whose plural rules a file follows: the tag it was loaded for, else its _meta.tag, else the page's. +export const catalogLanguage = catalog => catalogTags.get(catalog) ?? catalog?._meta?.tag ?? LANGUAGE; + +const PLURAL_FORMS = ['zero', 'one', 'two', 'few', 'many', 'other']; + +// An entry written as plural forms ({"one": ..., "few": ..., "many": ..., "other": ...}) as the text for the number in +// values: the placeholder its "_by" names, else n, else count. The language's plural rules pick the form; a form the +// entry lacks, or no number, gives "other". Null when the entry is neither a string nor such an object. +export function pluralText(entry, values, language) { + if (typeof entry === 'string') return entry; + if (!entry || typeof entry !== 'object' || Array.isArray(entry) || typeof entry.other !== 'string') return null; + const name = typeof entry._by === 'string' ? entry._by : ['n', 'count'].find(key => values && Object.prototype.hasOwnProperty.call(values, key)); + const number = name && values ? Number(values[name]) : NaN; + let form = 'other'; + if (Number.isFinite(number)) { + try { form = new Intl.PluralRules(language || undefined).select(number); } catch { form = 'other'; } + } + return PLURAL_FORMS.includes(form) && typeof entry[form] === 'string' ? entry[form] : entry.other; +} + +const charTables = new WeakMap(); + +// Simplified Chinese text in the characters of a file's _meta.chars; the text itself when the file has none. +export function fromSimplified(catalog, text) { + let table = charTables.get(catalog); + if (!table) { + const pairs = [...String(catalog?._meta?.chars || '')]; + table = new Map(); + for (let i = 0; i + 1 < pairs.length; i += 2) table.set(pairs[i], pairs[i + 1]); + charTables.set(catalog, table); + } + return table.size ? [...String(text)].map(ch => table.get(ch) ?? ch).join('') : String(text); +} + +// The language file to use for a list of wanted languages (the system's or the browser's, most wanted first), from the +// files there are (their tags, e.g. ['en', 'zh-Hans', 'zh-Hant', 'pt-BR']). For each wanted language in turn: the same +// tag; for Chinese, the script (Taiwan, Hong Kong and Macau read Traditional, everything else Simplified); a shorter +// form of the tag (es-419 -> es); then any file of the same language (pt-PT -> pt-BR). Nothing matches: English. +// freevideo_engine/i18n.py has the same rule; tests/i18n_negotiate_cases.json holds the cases both must pass. +export function negotiate(requested, available, fallback = 'en') { + const have = new Map([...available].sort().map(tag => [tag.toLowerCase(), tag])); + // A single tag (the launcher's "zh-TW") counts as a list of one. Only ASCII spaces are taken off, as in Python. + for (const raw of typeof requested === 'string' ? [requested] : requested || []) { + const tag = String(raw ?? '').replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, '').replace(/_/g, '-').toLowerCase(); + if (!tag) continue; + if (have.has(tag)) return have.get(tag); + const parts = tag.split('-'); + if (parts[0] === 'zh') { + const traditional = parts.includes('hant') || (!parts.includes('hans') && ['tw', 'hk', 'mo'].includes(parts[parts.length - 1])); + const script = traditional ? 'zh-hant' : 'zh-hans'; + if (have.has(script)) return have.get(script); + } + for (let n = parts.length - 1; n >= 1; n--) { + const shorter = parts.slice(0, n).join('-'); + if (have.has(shorter)) return have.get(shorter); + } + const same = [...have.keys()].find(key => key.split('-')[0] === parts[0]); + if (same) return have.get(same); + } + return fallback; +} + export function fill(text, values) { return String(text).replace(/\{(\w+)\}/g, (whole, name) => Object.prototype.hasOwnProperty.call(values, name) ? String(values[name]) : whole); } diff --git a/web/i18n_tables.js b/web/i18n_tables.js new file mode 100644 index 00000000..c3d6fd0e --- /dev/null +++ b/web/i18n_tables.js @@ -0,0 +1,38 @@ +// Text tables that hold English and Chinese as two matching trees, {en: …, zh: …}: a text, a list of texts, or an object +// of them (the tutorial, the tour cards). A table marked with a line "// i18n-table" is collected for the language files +// by scripts/i18n_extract.py, which fails when its two trees do not match. +import * as i18n from './i18n.js'; + +const walk = (en, zh, t) => typeof en === 'string' ? t(en, typeof zh === 'string' ? zh : en) + : Array.isArray(en) ? en.map((item, i) => walk(item, zh?.[i], t)) + : en && typeof en === 'object' ? Object.fromEntries(Object.entries(en).map(([key, item]) => [key, walk(item, zh?.[key], t)])) : en; + +// The same tree in the page's language: each text is t(en, zh). Nothing there: ''. +export const localized = (value, t) => walk(value?.en, value?.zh, t) ?? ''; + +// An example's prompt: what the models read and people may edit, so it is not translated. Chinese on a Chinese page +// (in Traditional characters on a Traditional one), English on every other. cn: what the caller read, as isChinese(). +export function promptText(pair, cn = i18n.isChinese()) { + const [en, zh] = Array.isArray(pair) ? pair : [pair?.en, pair?.zh]; + if (!cn || !zh) return en ?? ''; + return /^zh-hant/i.test(i18n.LANGUAGE || '') && i18n.fromSimplified ? i18n.fromSimplified(i18n.CATALOG, zh) : zh; +} + +// The English texts a shown text can stand for on a page of a language file (a label is matched against patterns written +// for English and Chinese); none on an English or a Chinese page. +let meanings = null; +export function englishOf(text, catalog = i18n.CATALOG) { + if (!catalog || !text) return []; + if (!meanings || meanings.catalog !== catalog) { + const map = new Map(); + for (const [key, shown] of Object.entries(catalog)) if (key !== '_meta' && typeof shown === 'string') { + const english = key.split(i18n.KEY_SEPARATOR)[0], list = map.get(shown); + if (!list) map.set(shown, [english]); else if (!list.includes(english)) list.push(english); + } + meanings = {catalog, map}; + } + return meanings.map.get(text) || []; +} + +// The page's language as an element's lang attribute: the browser picks its characters' shapes by it. +export const pageLang = i18n.pageLanguage; diff --git a/web/image_editor.js b/web/image_editor.js index dd3a87d2..cf056b3f 100644 --- a/web/image_editor.js +++ b/web/image_editor.js @@ -670,7 +670,7 @@ async function openImageEditorNow({source = null, name = source || '', target = hint.textContent = text; hint.hidden = !text; } const ratioLabel = id => ({ - video: target ? t(`Video ${target.width} × ${target.height}`, `视频 ${target.width} × ${target.height}`) : t('Video', '视频'), + video: target ? t('Video {width} × {height}', '视频 {width} × {height}', { width: target.width, height: target.height }) : t('Video', '视频'), original: t('Original', '原图比例'), free: t('Free', '自由'), })[id] || id; function renderOptions() { @@ -731,7 +731,7 @@ async function openImageEditorNow({source = null, name = source || '', target = if (pointInfo && !pointInfo.ready) { const running = install?.state === 'running'; const share = install?.total > 0 ? Math.min(100, Math.round(100 * (install.done || 0) / install.total)) : 0; - const b = running ? button(t(`Downloading ${share}%`, `正在下载 ${share}%`), null, () => {}, 'fv-ie-button fv-ie-point-download') + const b = running ? button(t('Downloading {share}%', '正在下载 {share}%', { share }), null, () => {}, 'fv-ie-button fv-ie-point-download') : button(t('Download click-select model', '下载点选模型'), install?.state === 'failed' ? t(install.message_en, install.message_zh) : null, async () => { try { pointInfo = {...pointInfo, install: (await genClient.segmentInstall()).install}; } catch { /* the next refresh shows it */ } void refreshPoint(); renderOptions(); }, 'fv-ie-button fv-ie-point-download'); if (running) b.disabled = true; @@ -757,11 +757,11 @@ async function openImageEditorNow({source = null, name = source || '', target = const o = opts.heal; add(sizeSlider(o), segmented([['all', t('Whole stroke', '整个涂抹区域')], ['text', t('Captions only', '只去字幕')]], o.text ? 'text' : 'all', v => { o.text = v === 'text'; renderOptions(); }, t('Heal', '修复范围')).group, - note(o.text ? t('Paint over a caption. Only the white letters and outline are removed; the picture between them stays.', '涂过字幕,只去掉白字和描边,字间的画面保留。') + note(o.text ? t('Paint over a caption. Only the white letters and outline are removed; the image between them stays.', '涂过字幕,只去掉白字和描边,字间的画面保留。') : t('Paint over the whole mark in one stroke; it is filled with texture from around it.', '一笔涂满要去掉的部分,松开后用周围的纹理补上。'))); } else if (tool === 'clone') { const o = opts.clone; - const pick = button(o.picking ? t('Click the source…', '点击取样位置…') : t('Set source', '设置取样点'), t('Or Alt-click the picture', '也可以按住 Alt 点击画面'), + const pick = button(o.picking ? t('Click the source…', '点击取样位置…') : t('Set source', '设置取样点'), t('Or Alt-click the image', '也可以按住 Alt 点击画面'), () => { o.picking = !o.picking; renderOptions(); }, 'fv-ie-button' + (o.picking ? ' fv-ie-active' : '')); add(sizeSlider(o), pct(o, 'hardness', t('Hardness', '硬度')), pct(o, 'opacity', t('Opacity', '不透明度')), pick); } else if (tool === 'blur') { @@ -770,9 +770,9 @@ async function openImageEditorNow({source = null, name = source || '', target = const o = opts.gradient; add(segmented([['linear', t('Linear', '线性')], ['radial', t('Radial', '径向')]], o.shape, v => { o.shape = v; }, t('Type', '类型')).group, segmented([['bg', t('To background color', '到背景色')], ['clear', t('To transparent', '到透明')]], o.end, v => { o.end = v; }, t('End', '终点')).group, - note(t('Drag across the picture.', '在画面上拖动。'))); + note(t('Drag across the image.', '在画面上拖动。'))); } else if (tool === 'text') { - add(note(t('Click the picture to add text; click text to edit it.', '点击画面添加文字;点击已有文字进行编辑。'))); + add(note(t('Click the image to add text; click text to edit it.', '点击画面添加文字;点击已有文字进行编辑。'))); } else if (tool === 'shape') { const o = opts.shape; add(segmented([['rect', t('Rectangle', '矩形')], ['ellipse', t('Ellipse', '椭圆')], ['line', t('Line', '直线')]], o.type, v => { o.type = v; }, t('Shape', '形状')).group, @@ -1138,7 +1138,7 @@ async function openImageEditorNow({source = null, name = source || '', target = function commitInserted(next) { maskTarget = false; commit(next); } function addPaintLayer() { const n = doc.layers.filter(l => l.kind === 'paint').length + 1; - commitInserted(commands.addPaintLayer(doc, t(`Paint ${n}`, `绘画 ${n}`))); + commitInserted(commands.addPaintLayer(doc, t('Paint {n}', '绘画 {n}', { n }))); } async function addImageLayer(file, label, {keepTool = false} = {}) { try { @@ -1163,7 +1163,7 @@ async function openImageEditorNow({source = null, name = source || '', target = function duplicateLayer() { const layer = active(); if (!layer) return; - commitInserted(commands.duplicateLayer(doc, layer.id, t(`${layer.name} copy`, `${layer.name} 副本`))); + commitInserted(commands.duplicateLayer(doc, layer.id, t('{name} copy', '{name} 副本', { name: layer.name }))); } function deleteLayer() { const layer = active(); if (!layer || layer.locked || doc.layers.length === 1) return; @@ -1227,7 +1227,7 @@ async function openImageEditorNow({source = null, name = source || '', target = } const color = el('input'); color.type = 'color'; color.value = e.color || bg; color.id = 'fv-ie-pad-color'; const buttons = el('div', null, 'fv-ie-row fv-ie-end'); - const advice = t(`The picture is ${ow} × ${oh} px. Add space on each side:`, `画面 ${ow} × ${oh} 像素,在四周补充空间:`); + const advice = t('The image is {ow} × {oh} px. Add space on each side:', '画面 {ow} × {oh} 像素,在四周补充空间:', { ow, oh }); const reason = t('Enter whole numbers from 1 to 20000 for width and height.', '宽和高请填 1 到 20000 的整数。'); const note = el('p', advice, 'fv-ie-opt-note'); const values = () => Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, input.value.trim() ? Number(input.value) : NaN])); @@ -1273,7 +1273,7 @@ async function openImageEditorNow({source = null, name = source || '', target = // [id, label, size or null when it would not make the picture smaller, why not] const presets = [ ...(target ? [['video', t('Video size', '视频尺寸'), video < 1 ? sized(video) : null, - t('The picture is no larger than the video', '图片已经不比视频大')]] : []), + t('The image is no larger than the video', '图片已经不比视频大')]] : []), ['half', '50%', sized(.5), ''], ['long', t('Long side 2048', '长边 2048'), long > 2048 ? sized(2048 / long) : null, t('The long side is already 2048 px or less', '长边已经不超过 2048 像素')], @@ -1302,7 +1302,7 @@ async function openImageEditorNow({source = null, name = source || '', target = const dims = el('div', null, 'fv-ie-dims'); dims.append(field(t('Width (px)', '宽(px)'), width), chain, field(t('Height (px)', '高(px)'), height)); const notes = el('div', null, 'fv-ie-notes'), result = el('p', '', 'fv-ie-opt-note'); - const stretch = el('p', t('With the proportions changed, pictures and shapes stretch; text keeps its shape.', '比例改变后,图片和形状会拉伸,文字保持原样。'), 'fv-ie-opt-note'); + const stretch = el('p', t('With the proportions changed, images and shapes stretch; text keeps its shape.', '比例改变后,图片和形状会拉伸,文字保持原样。'), 'fv-ie-opt-note'); const vector = doc.layers.some(l => l.kind === 'text' || l.kind === 'shape'); const texts = doc.layers.some(l => l.kind === 'text'); const scales = el('p', t('Text and shape layers scale too and stay editable.', '文字和形状图层会一起缩放,仍然可以编辑。'), 'fv-ie-opt-note'); @@ -1317,9 +1317,10 @@ async function openImageEditorNow({source = null, name = source || '', target = // Proportions unchanged when the other side is the rounded one (either way round). same = Math.abs(h - Math.round(w * ch / cw)) <= 1 || Math.abs(w - Math.round(h * cw / ch)) <= 1; const k = Math.max(kx, ky), pct = v => `${Math.round(v * 100)}%`; - // How big against the original; verb is the Chinese 缩到 or 放大到. - const share = verb => same ? t(`${pct(k)} of the original`, `${verb}原来的 ${pct(k)}`) - : t(`Width ${pct(kx)} and height ${pct(ky)} of the original`, `宽为原来的 ${pct(kx)}、高为原来的 ${pct(ky)}`); + // How big against the original: enlarged or reduced (Chinese says 放大到 or 缩到). + const share = enlarged => same ? (enlarged ? t('{size} of the original', '放大到原来的 {size}', { size: pct(k) }) + : t('{size} of the original', '缩到原来的 {size}', { size: pct(k) })) + : t('Width {width} and height {height} of the original', '宽为原来的 {width}、高为原来的 {height}', { width: pct(kx), height: pct(ky) }); let text, warn = false; const {allowed, reason} = commands.imageSizeCheck(doc, w, h, target); if (reason === 'dimensions') { text = t('Enter whole numbers from 1 to 20000.', '请输入 1 到 20000 的整数。'); warn = true; } @@ -1327,12 +1328,12 @@ async function openImageEditorNow({source = null, name = source || '', target = else if (reason === 'pixels') { text = t('Up to 64 megapixels; reduce the width or height.', '最多 6400 万像素,请减小宽或高。'); warn = true; } else if (reason === 'unchanged') { text = t('The same size as now.', '和现在一样大。'); } else if (kx > 1 + 1e-9 || ky > 1 + 1e-9) { - text = t(`${share()}; enlarging makes the picture softer.`, `${share('放大到')},画面会变模糊。`); warn = true; + text = t('{size}; enlarging makes the image softer.', '{size},画面会变模糊。', { size: share(true) }); warn = true; } else if (target && presets[0][2] && w === presets[0][2][0] && h === presets[0][2][1]) { - text = t(`${share()}; fills a ${vsize} video.`, `${share('缩到')},刚好铺满 ${vsize} 的视频。`); + text = t('{size}; fills a {vsize} video.', '{size},刚好铺满 {vsize} 的视频。', { size: share(false), vsize }); } else if (target && Math.max(target.width / w, target.height / h) > 1 + 1e-9) { - text = t(`Smaller than the ${vsize} video; the result will look softer.`, `比 ${vsize} 的视频小,生成的画面会变模糊。`); warn = true; - } else text = t(`${share()}.`, `${share('缩到')}。`); + text = t('Smaller than the {vsize} video; the result will look softer.', '比 {vsize} 的视频小,生成的画面会变模糊。', { vsize }); warn = true; + } else text = t('{size}.', '{size}。', { size: share(false) }); result.textContent = text; result.classList.toggle('fv-ie-note-warn', warn); // With the proportions changed, the stretch note says what happens to each kind of layer. stretch.hidden = same || !texts || !valid(w) || !valid(h); @@ -1349,7 +1350,7 @@ async function openImageEditorNow({source = null, name = source || '', target = } sizeKeys(box, apply); box.append(el('h3', t('Image size', '图像大小')), - el('p', t(`Now ${now[0]} × ${now[1]} px`, `现在 ${now[0]} × ${now[1]} 像素`), 'fv-ie-opt-note'), + el('p', t('Now {width} × {height} px', '现在 {width} × {height} 像素', { width: now[0], height: now[1] }), 'fv-ie-opt-note'), choice.group, dims, notes, buttons); update(); stage.append(box); width.focus(); width.select(); @@ -1395,7 +1396,7 @@ async function openImageEditorNow({source = null, name = source || '', target = } function copyToLayer() { const layer = pixelLayer(); if (!layer) return; - const next = commands.copyToLayer(doc, layer.id, selection, t(`${layer.name} part`, `${layer.name} 局部`)); + const next = commands.copyToLayer(doc, layer.id, selection, t('{name} part', '{name} 局部', { name: layer.name })); deselectQuiet(); commitInserted(next); select('move'); } function maskFromSelection() { @@ -1512,7 +1513,7 @@ async function openImageEditorNow({source = null, name = source || '', target = if (px[3] < 16) { message(t('Nothing to pick here: this part is transparent.', '这里是透明的,没有可吸取的颜色。')); return null; } const hex = '#' + [px[0], px[1], px[2]].map(v => v.toString(16).padStart(2, '0')).join(''); if (event.altKey) { bg = hex; bgInput.value = hex; } else { fg = hex; fgInput.value = hex; } - message(t(`Picked ${hex}.`, `已吸取 ${hex}。`)); + message(t('Picked {hex}.', '已吸取 {hex}。', { hex })); return null; } if (use === 'text') { @@ -1537,7 +1538,7 @@ async function openImageEditorNow({source = null, name = source || '', target = if (reuse) { target = reuse; base = commands.setActive(doc, reuse.id); } else { const n = doc.layers.filter(l => l.kind === 'paint').length + 1; - base = commands.addPaintLayer(doc, use === 'gradient' ? t('Gradient', '渐变') : t(`Paint ${n}`, `绘画 ${n}`)); + base = commands.addPaintLayer(doc, use === 'gradient' ? t('Gradient', '渐变') : t('Paint {n}', '绘画 {n}', { n })); target = base.layers.find(l => l.id === base.active); } } else if (!rasterKinds.has(layer.kind)) { message(t('Pick an image or paint layer to work on its pixels.', '请选择图片图层或绘画图层再处理像素。')); return null; } @@ -1804,7 +1805,7 @@ async function openImageEditorNow({source = null, name = source || '', target = return null; } message(t('Copied the original. Changes go on the copy.', '已复制原图,改动在副本上。')); - return commands.duplicateLayer(doc, layer.id, t(`${layer.name} copy`, `${layer.name} 副本`)); + return commands.duplicateLayer(doc, layer.id, t('{name} copy', '{name} 副本', { name: layer.name })); } function cover(layer) { const r = rect(), centre = toD([r.x + r.w / 2, r.y + r.h / 2]); @@ -1925,8 +1926,9 @@ async function openImageEditorNow({source = null, name = source || '', target = status.textContent = t(en, zh); status.append(time); const show = () => { const s = Math.floor((performance.now() - since) / 1000), m = Math.floor(s / 60), r = s % 60; - time.textContent = s < 1 ? '…' : s < 60 ? t(` · ${s} s`, ` · ${s} 秒`) - : t(` · ${m} min${r ? ` ${r} s` : ''}`, ` · ${m} 分${r ? ` ${r} 秒` : ''}`); + time.textContent = s < 1 ? '…' : s < 60 ? t(' · {s} s', ' · {s} 秒', { s }) + : r ? t(' · {minutes} min {seconds} s', ' · {minutes} 分 {seconds} 秒', { minutes: m, seconds: r }) + : t(' · {minutes} min', ' · {minutes} 分', { minutes: m }); }; show(); const timer = workingTimer = setInterval(show, 1000); diff --git a/web/image_generation.js b/web/image_generation.js index a0ae1f26..be1a795a 100644 --- a/web/image_generation.js +++ b/web/image_generation.js @@ -32,9 +32,9 @@ export function imageGenerationSupported() { return true; } // On a Mac the GPU's memory is the machine's: the same notes without the graphics card. -function memoryWords([en, zh], unified) { +function memoryWords([en, zh, values], unified) { return unified ? [en.replace('GPU memory', 'memory').replace(' using the GPU', ''), - zh.replace('显存', '内存').replace('占用显卡的程序', '程序')] : [en, zh]; + zh.replace('显存', '内存').replace('占用显卡的程序', '程序'), values] : [en, zh, values]; } // The preset a canvas of this size has exactly, or null. export function presetRatio(width, height) { @@ -194,7 +194,7 @@ export function imagePackMessage(info, t) { // A non-breaking space keeps the number and its unit on one line. const size = (info?.pack_size || (bytes > 0 ? (bytes / 2 ** 30).toFixed(1) + ' GiB' : '17.3 GB')) .replace(/ (?=[KMGT]i?B$)/, '\u00a0'); - return t(`Download "${name}" in the launcher first, ${size}.`, `先在启动器里下载“${name}”,${size}。`); + return t('Download "{name}" in the launcher first, {size}.', '先在启动器里下载“{name}”,{size}。', { name, size }); } // What the page offers while the image models are missing: one button, one muted line, and the bar once loading. export function packView(info, t) { @@ -213,10 +213,10 @@ export function packView(info, t) { // While a setup, update or cleanup holds the installation the download cannot go on at the user's request: no button, only the note. return {loading: true, waiting, noButton: waiting && install.reason === 'busy_setup', button: waiting ? t('Continue download', '继续下载') : t('Pause', '暂停'), fraction: total > 0 ? Math.min(1, (install.done || 0) / total) : 0, note: waiting ? (install.reason === 'busy_video' ? t('Paused while a video generates', '视频生成中,已暂停') - : install.reason === 'busy_picture' ? t('Paused while a picture is made', '正在出图,已暂停') + : install.reason === 'busy_picture' ? t('Paused while an image is made', '正在出图,已暂停') : install.reason === 'busy_setup' ? t('Paused while FreeVideo installs, updates or cleans up', 'FreeVideo 正在安装、更新或清理,已暂停') : t('Paused while FreeVideo uses the graphics card for another task', 'FreeVideo 正在用显卡做别的任务,已暂停')) - : t(`Downloading · ${gb(install.done || 0)}\u00a0GB / ${size}${time}`, `正在下载 · ${gb(install.done || 0)}\u00a0GB / ${size}${time}`)}; + : t('Downloading · {done}\u00a0GB / {size}{time}', '正在下载 · {done}\u00a0GB / {size}{time}', { done: gb(install.done || 0), size, time })}; } const resume = install.state === 'failed' || install.state === 'cancelled' || install.done > 0; const reason = install.state === 'failed' ? t(install.message_en, install.message_zh) : ''; @@ -224,21 +224,54 @@ export function packView(info, t) { // (named in the note) is the way on, so no button is offered here. if (install.state === 'failed' && install.reason === 'shared_mismatch' && reason) return {loading: false, fraction: null, reason: true, button: '', note: reason}; return {loading: false, fraction: null, reason: !!reason, button: resume ? t('Resume download', '继续下载') : t('Download image generation models', '下载图像生成模型'), - note: reason || (resume ? t(`${gb(install.done || 0)}\u00a0GB / ${size}${time}`, `${gb(install.done || 0)}\u00a0GB / ${size}${time}`) : size + time)}; + note: reason || (resume ? t('{done}\u00a0GB / {size}{time}', '{done}\u00a0GB / {size}{time}', { done: gb(install.done || 0), size, time }) : size + time)}; } +// FreeVideo went away while a picture was being made (#1121): why, as far as the launcher saw it end, and what next. The +// page's cause (task_store, engine_exit.js exitCause) picks the row; a restart without a record reads as quitting +// unexpectedly. Lane, review/engine-closed-reason copy_lane. +const LOST_ENGINE = { + engine_restarted: { + memory: [["The system closed FreeVideo, most likely because the computer ran out of memory. FreeVideo has restarted.", "FreeVideo 被系统关闭,很可能是因为电脑内存不足。FreeVideo 已重新启动。"], ["Use a smaller size, or close other programs that use memory, then generate again.", "请缩小尺寸,或关闭其他占用内存的程序后重新生成。"]], + // Lane 11-25 (copy_lane_memory_maybe_0613). + memory_maybe: [["The system ended FreeVideo, possibly because the computer ran out of memory. FreeVideo has restarted.", "FreeVideo 被系统结束,可能是因为电脑内存不足。FreeVideo 已重新启动。"], ["Use a smaller size, or close other programs that use memory, then generate again.", "请缩小尺寸,或关闭其他占用内存的程序后重新生成。"]], + ended: [["The system or another program ended FreeVideo. It has restarted.", "FreeVideo 被系统或其他程序结束,已重新启动。"], ["Generate again.", "请重新生成。"]], + crashed: [["FreeVideo crashed. It has restarted.", "FreeVideo 意外崩溃,已重新启动。"], ["Generate again. If it happens again, choose \"Report a problem\".", "请重新生成。再次出现时,请点击“提交问题”。"]], + unknown: [["FreeVideo quit unexpectedly. It has restarted.", "FreeVideo 意外退出,已重新启动。"], ["Generate again. If it happens again, choose \"Report a problem\".", "请重新生成。再次出现时,请点击“提交问题”。"]], + }, + engine_closed: { + unreachable: [["The connection to FreeVideo was lost and did not come back within 2 minutes.", "与 FreeVideo 的连接中断,2 分钟内没有恢复。"], ["Open the launcher, make sure FreeVideo is running, then generate again.", "请打开启动器,确认 FreeVideo 正在运行后重新生成。"]], + stopped_waiting: [["Stopped waiting for FreeVideo to reconnect.", "已停止等待 FreeVideo 恢复连接。"], ["Open the launcher, make sure FreeVideo is running, then generate again.", "请打开启动器,确认 FreeVideo 正在运行后重新生成。"]], + }, +}; +const LOST_DEFAULT = {engine_restarted: 'unknown', engine_closed: 'unreachable'}; +/** [cause, next step] of a picture that FreeVideo's going away ended, or null for any other code. */ +export function lostEngineText(code, cause, t) { + if (typeof code !== 'string' || !Object.hasOwn(LOST_ENGINE, code)) return null; + const rows = LOST_ENGINE[code]; + const [said, next] = rows[typeof cause === 'string' && Object.hasOwn(rows, cause) ? cause : LOST_DEFAULT[code]]; + return [t(...said), t(...next)]; +} +/** While the page waits for FreeVideo to come back: the line and the button that stops waiting. */ +export const WAITING_TEXT = {status: ["Lost the connection to FreeVideo. Waiting for it to come back…", "与 FreeVideo 的连接中断,正在等待恢复…"], stop: ["Stop waiting", "停止等待"], + short: ["Reconnecting…", "等待恢复连接…"]}; + export function imageGenError(code, info, t) { + const lost = lostEngineText(code, info?.cause, t); + if (lost) return lost.join(t(' ', '')); const reasons = { invalid_loras: ['The LoRA selection is invalid. Choose the files again.', 'LoRA 设置有误,请重新选择文件。'], invalid_lora_strength: ['LoRA strength must be between -2 and 2.', 'LoRA 强度必须在 -2 到 2 之间。'], duplicate_lora: ['Select each LoRA only once. Remove the duplicate.', '同一个 LoRA 只能选择一次,请移除重复项。'], - too_many_loras: ['Use at most eight LoRAs per picture.', '一张图片最多使用 8 个 LoRA,请减少数量。'], + too_many_loras: ['Use at most eight LoRAs per image.', '一张图片最多使用 8 个 LoRA,请减少数量。'], lora_not_found: ['The LoRA file could not be found. Choose it again.', 'LoRA 文件找不到,请重新选择。'], - invalid_lora_model: ['This LoRA cannot be used for pictures. Choose another one.', '此 LoRA 不适用于图片生成,请换一个。'], + invalid_lora_model: ['This LoRA cannot be used for images. Choose another one.', '此 LoRA 不适用于图片生成,请换一个。'], no_memory: ['Not enough GPU memory, even at the smallest size. Close other apps using the GPU, then try again.', '显存不足,最小尺寸也无法生成。请关闭其他占用显卡的程序后重试。'], busy_video: ['A video is generating. Try again when it finishes.', '视频正在生成,完成后再试。'], - busy: ['An image is already being generated. Try again when it finishes.', '已有一张图在生成,完成后再试。'], - model_unavailable: ['This computer does not support the chosen picture model. Use Qwen-Image 2.1.', '这台电脑不支持所选的图片模型。请改用 Qwen-Image 2.1。'], + busy: ['The image queue is full. Wait for the earlier images to finish, then try again.', '等待生成的图片已满,请等前面的图片完成后再试。'], + model_unavailable: ['This computer does not support the chosen image model. Use Qwen-Image 2.1.', '这台电脑不支持所选的图片模型。请改用 Qwen-Image 2.1。'], + // Lane 11-25 (image-prompt-read-failure-reason copy_lane_gpu_kernels). + gpu_kernels_failed: ["The graphics card's computation check did not pass. Update the graphics card driver, then restart FreeVideo. If the check still does not pass, download the report and report the problem.", "\u663e\u5361\u7684\u8ba1\u7b97\u68c0\u67e5\u672a\u901a\u8fc7\u3002\u8bf7\u66f4\u65b0\u663e\u5361\u9a71\u52a8\u540e\u91cd\u65b0\u542f\u52a8 FreeVideo\uff1b\u5982\u4ecd\u672a\u901a\u8fc7\uff0c\u8bf7\u4e0b\u8f7d\u62a5\u544a\u5e76\u63d0\u4ea4\u95ee\u9898\u3002"], model_unreadable: ['The image generation model files could not be read. Repair them in the launcher and try again.', '图像生成模型的文件读不出来。在启动器里修复后再试。'], device_unavailable: ['The graphics card is not available right now. Try again later.', '显卡暂时用不了,稍后再试。'], @@ -247,28 +280,29 @@ export function imageGenError(code, info, t) { disk_full: ['Saving the image failed: the disk is full. Free some space, then generate again.', '保存图片时出错:磁盘空间不够,空出空间后再生成。'], cancelled: ['Image generation was cancelled.', '已取消图像生成。'], invalid_request: ['The image settings are invalid. Adjust them and try again.', '图片设置有误,请调整后重试。'], - invalid_prompt: ['The prompt is empty, or longer than 2,000 characters once the picture references are counted. Shorten it and try again.', + invalid_prompt: ['The prompt is empty, or longer than 2,000 characters once the image references are counted. Shorten it and try again.', '提示词为空,或加上图片引用后超过 2000 字。请缩短提示词后重试。'], invalid_dimensions: ['The image size is outside what the chosen model supports. Change the size and try again.', '图片尺寸超出所选模型支持的范围。请调整尺寸后重试。'], invalid_seed: ['The seed is not valid. Clear it or use a smaller whole number, then try again.', '随机种子无效。请清空种子或改用较小的整数后重试。'], too_many_images: ['There are more reference images than the chosen model supports. Remove some and try again.', '参考图超过所选模型支持的数量。请减少参考图后重试。'], - output_unwritable: ['The folder that keeps the pictures cannot be written (freevideo-image in the ComfyUI input folder). Check that it exists, is writable and has no file of the same name, then try again.', + output_unwritable: ['The folder that keeps the images cannot be written (freevideo-image in the ComfyUI input folder). Check that it exists, is writable and has no file of the same name, then try again.', '无法写入保存图片的文件夹(ComfyUI 的 input 目录下的 freevideo-image)。请确认该目录存在、可写,且没有同名文件,然后重试。'], invalid_layout: ['A layout box cannot be used. Draw it larger or change its words, then generate again.', '有一个布局框用不了。请把它画大一些或改一下文字,再生成。'], too_many_boxes: ['A layout takes at most 8 boxes. Delete one, then generate again.', '布局最多 8 个框。请删掉一个,再生成。'], layout_too_long: ['The words in the layout are too long. Shorten the lines in the boxes, then generate again.', '布局里的文字太长。请把框里的话写短一些,再生成。'], - invalid_media: ['The reference image cannot be read. Choose another image.', '参考图读不出来,请换一张图。'], + invalid_media: ['This image cannot be read or is larger than 4096×4096 pixels. Choose another image.', '这张图片读不出来,或超过 4096×4096 像素。请换一张图片。'], + invalid_points: ['Choose 1 to 16 points inside the image, with at least one to select (1 selects, 0 excludes).', + '请在图片内选 1 到 16 个点,其中至少一个是选中点(1 表示选中,0 表示排除)。'], + segment_not_installed: ['The click-select model is not installed. Download it first.', '点选模型尚未安装,请先下载点选模型。'], reload: ['Image generation was interrupted. Try again.', '图片生成中途被打断,请重试。'], engine_error: ['The image engine returned an unreadable answer. Try again; if it keeps failing, report the problem.', '图像引擎返回了无法读取的结果。请重试;仍然失败请提交问题。'], connection_lost: ['Lost the connection to FreeVideo. Try again once it is back.', '与 FreeVideo 的连接已断开,恢复后请重试。'], - engine_closed: ['FreeVideo stopped answering while this picture was being made. Start FreeVideo again, then generate again.', '生成过程中 FreeVideo 停止了响应。重新启动 FreeVideo 后再生成一次。'], - engine_restarted: ['FreeVideo restarted while this picture was being made, so it did not finish. Generate it again.', 'FreeVideo 在生成过程中重新启动,这张图没有完成。请再生成一次。'], generation_failed: ['Image generation ran into an error. Try again.', '图像生成出错了,请再试一次。'], - small_memory: ['This Mac has less than 16 GB of memory and cannot generate pictures.', + small_memory: ['This Mac has less than 16 GB of memory and cannot generate images.', '这台 Mac 的内存不足 16 GB,无法生成图片。'], }; const fact = ['no_memory', 'small_memory'].includes(code) ? otherUsageText(info?.other_usage, t, true) : ''; - const say = (en, zh) => t(...memoryWords([en, zh], info?.unified)) + (fact ? t(' ', '') + fact : ''); + const say = (en, zh, values) => t(...memoryWords([en, zh, values], info?.unified)) + (fact ? t(' ', '') + fact : ''); if (code === 'pack_missing') return imagePackUnavailableMessage(info, t); if (code === 'no_memory' && info?.memory === 'host') return t('Not enough virtual memory to load the image model. Close other apps, or increase virtual memory in system settings, then try again.', @@ -284,15 +318,14 @@ export function imageGenError(code, info, t) { return say('Not enough GPU memory to load the model. Close other apps using the GPU, then try again.', '显存不足,无法载入模型。请关闭其他占用显卡的程序后重试。'); if (size?.width && size?.height) - return say(`Not enough GPU memory, even at ${size.width}\u00a0×\u00a0${size.height}. Close other apps using the GPU, then try again.`, - `显存不足,${size.width}\u00a0×\u00a0${size.height} 也无法生成。请关闭其他占用显卡的程序后重试。`); + return say('Not enough GPU memory, even at {width}\u00a0×\u00a0{height}. Close other apps using the GPU, then try again.', + '显存不足,{width}\u00a0×\u00a0{height} 也无法生成。请关闭其他占用显卡的程序后重试。', { width: size.width, height: size.height }); } const known = Object.hasOwn(reasons, code) ? code : 'generation_failed'; // An unnamed error still says which step it stopped at; a page with its own // Retry button does not repeat "try again" in the sentence. if (known === 'generation_failed' && Object.hasOwn(FAILED_AT, info?.stage)) { - const [en, zh] = FAILED_AT[info.stage]; - return info?.retried ? say(en, zh) : say(`${en} Try again.`, `${zh}请再试一次。`); + return info?.retried ? say(...FAILED_AT[info.stage]) : say('{failure} Try again.', '{failure}请再试一次。', { failure: t(...FAILED_AT[info.stage]) }); } return say(...(info?.retried && Object.hasOwn(RETRIED, known) ? RETRIED[known] : reasons[known])); } @@ -319,8 +352,8 @@ export const QUEUE_LABELS = Object.freeze({ image: ['Added to the queue. It starts when the previous one finishes.', '已加入队列,前面的完成后自动开始。'], video: ['Queued. It starts when the video finishes.', '已排队,视频生成完后自动开始。'], }); -export const fittedNote = (size, t, unified = false) => t(...memoryWords([`Not enough GPU memory. Made at ${size.width}\u00a0×\u00a0${size.height} instead.`, - `显存不足,已改为 ${size.width}\u00a0×\u00a0${size.height} 生成。`], unified)); +export const fittedNote = (size, t, unified = false) => t(...memoryWords(['Not enough GPU memory. Made at {width}\u00a0×\u00a0{height} instead.', + '显存不足,已改为 {width}\u00a0×\u00a0{height} 生成。', { width: size.width, height: size.height }], unified)); export const REPORT_LABELS = Object.freeze({ download: ['Download report', '下载报告'], description: ['Diagnostic report: hardware, settings and timings', '诊断报告:硬件、设置和耗时'], @@ -374,7 +407,16 @@ export function imageReportBar(card, report_id, t, {productVersion = () => null, // Shared by the editor and the other image entry points. Only the opaque report // ID goes in the request; raw service messages are never shown in the page. -export function renderImageFailure(host, {error, report_id, stage, step, fitted, info, memory, other_usage} = {}, t, +// The failures the person fixes by changing a setting or making room (image_gen/failure.py NO_REPORT; a test keeps the two +// equal): the engine makes no report for them and the card offers no "Report a problem". +export const NO_REPORT = new Set([ + 'busy', 'cancelled', 'disk_full', 'duplicate_lora', 'invalid_dimensions', 'invalid_lora_model', + 'invalid_lora_strength', 'invalid_loras', 'invalid_media', 'invalid_points', 'invalid_prompt', 'invalid_request', + 'invalid_seed', 'lora_not_found', 'output_unwritable', 'segment_not_installed', 'small_memory', + 'too_many_images', 'too_many_loras' +]); + +export function renderImageFailure(host, {error, report_id, stage, step, fitted, info, memory, other_usage, cause, misses} = {}, t, {productVersion = () => null, fetchApi = globalThis.fetch.bind(globalThis), retry = null, retried = Boolean(retry)} = {}) { // `retry` ({label: [en, zh], onClick}) puts the page's Retry first in the card's own action row; // `retried` alone says the caller shows a Retry of its own elsewhere. @@ -387,7 +429,7 @@ export function renderImageFailure(host, {error, report_id, stage, step, fitted, } const card = doc.createElement('div'); card.className = 'fv-result-links'; const reason = doc.createElement('div'); reason.className = 'fv-image-failure-reason'; - reason.setAttribute('role', 'status'); reason.textContent = imageGenError(error, {stage, fitted, memory, unified: info?.unified_memory, other_usage, retried}, t); + reason.setAttribute('role', 'status'); reason.textContent = imageGenError(error, {stage, fitted, memory, unified: info?.unified_memory, other_usage, retried, cause}, t); card.append(reason); host.append(card); let again = null; if (retry) { @@ -395,17 +437,22 @@ export function renderImageFailure(host, {error, report_id, stage, step, fitted, again.className = 'fv-action fv-action-primary fv-image-retry'; again.textContent = t(...retry.label); again.onclick = () => retry.onClick(); } - // The card always has a way to report: the diagnostic report (with its own technical details) when the engine made one, - // else a form that carries the code and stage, and the same facts under a details fold. + // A failure the engine reports has a way to report it: the diagnostic report (with its own technical details) when the + // engine made one, else a form that carries the code and stage. The same facts stay under a details fold either way. let bar; if (report_id) ({bar} = imageReportBar(card, report_id, t, {productVersion, fetchApi})); else { - const facts = [[['Error code', '错误码'], error], [['Stage', '阶段'], stage], [['Step', '步骤'], step || (stage ? '' : 'unreported')], [['Memory', '内存'], memory]].filter(([, v]) => v); + // A picture FreeVideo's going away ended (#1121) names why (fixed words) and the last asks that failed. + const facts = [[['Error code', '错误码'], error], [['Stage', '阶段'], stage], [['Step', '步骤'], step || (stage || cause ? '' : 'unreported')], + [['Cause', '原因'], cause], [['Last attempts', '最后几次请求'], Array.isArray(misses) ? misses.slice(-3).map(miss => typeof miss === 'string' && /^[a-z][a-z0-9_]{0,31}$/.test(miss) ? miss : 'other').join(', ') : ''], [['Memory', '内存'], memory]].filter(([, v]) => v); bar = doc.createElement('div'); bar.className = 'fv-actions'; // Drawn as the card's other actions (Retry, Download report): their border, focus ring and press. - bar.append(issueButton(t, () => ({where: ['Image generation', '图像生成'], message: facts.map(([[en, zh], v]) => `${t(en, zh)}: ${v}`).join('\n')}), {className: 'fv-action'})); + const reportable = !NO_REPORT.has(error); + if (reportable) + bar.append(issueButton(t, () => ({where: ['Image generation', '图像生成'], message: facts.map(([[en, zh], v]) => `${t(en, zh)}: ${v}`).join('\n')}), {className: 'fv-action'})); if (again) bar.prepend(again); - card.append(bar); + // The row is shown when it holds Retry or the report button (decided from them, not by counting its children). + if (again || reportable) card.append(bar); const details = doc.createElement('details'); details.className = 'fv-image-failure-details'; const summary = doc.createElement('summary'); summary.textContent = t('Technical details', '技术详情'); details.append(summary); for (const [[en, zh], v] of facts) { const row = doc.createElement('div'); row.textContent = `${t(en, zh)}: ${v}`; details.append(row); } @@ -576,7 +623,7 @@ export function imageGenProgress(stage, fraction, withImages = false, overall = // Seconds left as the service predicts them, in the video's words; null while there is none. export function imageRemainingText(seconds, t) { if (!Number.isFinite(seconds)) return ''; - return seconds >= 60 ? t(`About ${Math.ceil(seconds / 60)}\u00a0min left`, `预计还需约 ${Math.ceil(seconds / 60)}\u00a0分钟`) + return seconds >= 60 ? t('About {minutes}\u00a0min left', '预计还需约 {minutes}\u00a0分钟', { minutes: Math.ceil(seconds / 60) }) : t('Less than a minute left', '预计还需不到 1\u00a0分钟'); } @@ -994,9 +1041,9 @@ export function createImageGeneration({client, renderer, t, getDoc, getSelection // on the canvas, or used as a reference of this edit; deleting, choosing several and the folder are in the picker too. function worksButton() { const open = el('button', null, 'fv-ie-button fv-ie-gen-works'); open.type = 'button'; - open.innerHTML = icon('image', 16); open.append(el('span', t('Works', '作品库'))); - open.dataset.fvTipName = t('Works', '作品库'); - open.dataset.fvTipUse = t('Place a picture from the works, or use it as a reference', '从作品库放入一张图,或用作参考图'); + open.innerHTML = icon('image', 16); open.append(el('span', t('Creations', '作品库'))); + open.dataset.fvTipName = t('Creations', '作品库'); + open.dataset.fvTipUse = t('Place an image from the creations, or use it as a reference', '从作品库放入一张图,或用作参考图'); open.setAttribute('aria-haspopup', 'dialog'); open.setAttribute('aria-expanded', 'false'); let picker = null; open.onclick = async () => { @@ -1047,7 +1094,7 @@ export function createImageGeneration({client, renderer, t, getDoc, getSelection if (wantFocus && !disabled) { wantFocus = false; input.focus({preventScroll: true}); } if (loras) { if (state.running) loras.element.setAttribute('inert', ''); else loras.element.removeAttribute('inert'); } renderReferences(refs, disabled); - input.placeholder = mode === 'edit' ? getSelection() ? t('What to change in the selection', '要改选区里的什么') : t('What to change', '要改什么') : t('Describe the picture', '描述画面'); + input.placeholder = mode === 'edit' ? getSelection() ? t('What to change in the selection', '要改选区里的什么') : t('What to change', '要改什么') : t('Describe the image', '描述画面'); input.setAttribute('aria-label', input.placeholder); const pack = missing ? packView(state.info, t) : null; action.textContent = pack ? pack.button : state.running ? state.stopping ? t('Stopping', '正在停止') : t('Stop', '停止') : t('Generate', '生成'); @@ -1068,11 +1115,11 @@ export function createImageGeneration({client, renderer, t, getDoc, getSelection : missing ? imagePackUnavailableMessage(state.info, t) // A trigger word a LoRA adds in front can take the prompt past what the engine accepts. : promptRequired ? (prompt.length > 2000 - ? t(`The prompt is over 2,000 characters. Shorten it by ${prompt.length - 2000} and try again.`, `提示词超过 2000 字。请缩短 ${prompt.length - 2000} 字后重试。`) + ? t('The prompt is over 2,000 characters. Shorten it by {count} and try again.', '提示词超过 2000 字。请缩短 {count} 字后重试。', { count: prompt.length - 2000 }) : t('Enter a prompt first.', '请先填写提示词。')) : state.running && state.waiting ? t(...(QUEUE_LABELS[state.waiting] || QUEUE_LABELS.image)) - : state.running && state.fitted ? t(...memoryWords([`Not enough GPU memory. Retrying at ${state.fitted.width}\u00a0×\u00a0${state.fitted.height}`, - `显存不足,改用 ${state.fitted.width}\u00a0×\u00a0${state.fitted.height} 重试`], state.info?.unified_memory)) + ' · ' + percent + : state.running && state.fitted ? t(...memoryWords(['Not enough GPU memory. Retrying at {width}\u00a0×\u00a0{height}', + '显存不足,改用 {width}\u00a0×\u00a0{height} 重试', { width: state.fitted.width, height: state.fitted.height }], state.info?.unified_memory)) + ' · ' + percent : state.running && state.stage === 'upload' ? t('Uploading reference images', '正在上传参考图') : state.running ? (state.stage === 'load' ? t('Loading the model', '加载模型') + ' ' : state.stage === 'encode' ? t('Reading reference images', '读取参考图') + ' ' : '') + percent diff --git a/web/image_library.js b/web/image_library.js index d1e7baef..107cff57 100644 --- a/web/image_library.js +++ b/web/image_library.js @@ -23,7 +23,7 @@ export async function saveGeneratedImage(api, {url, file, prompt = ''}) { media = (await uploadMedia(api, new File([blob], 'picture.' + ((blob.type.split('/')[1] || 'png').replace('jpeg', 'jpg')), {type: blob.type || 'image/png'}))).file; } const typed = Array.from(String(prompt).replace(/\s+/g, ' ').trim()).slice(0, 16).join('').trim(); - const name = typed || t(`Image ${(await imageCards(api)).length + 1}`, `图片 ${(await imageCards(api)).length + 1}`); + const name = typed || t('Image {number}', '图片 {number}', { number: (await imageCards(api)).length + 1 }); const answer = await agentPost(api, '/freevideo/agent/cast', {kind: 'image', name, description: file, images: [{media, label: 'other'}]}); if (!answer.ok) throw new Error('save_failed'); return answer.json(); @@ -104,12 +104,12 @@ const GLYPH = { // `over`: a side column the picker sits over (the editor's panel), so it never covers the picture; else under the anchor. export function openWorksPicker({anchor, t: tr = t, host = anchor.closest('dialog') || document.body, canReference = () => false, onPlace, onReference, onOpenLibrary = null, onClose = () => {}, over = null}) { - const box = el('div', 'fv-works'); box.setAttribute('role', 'dialog'); box.setAttribute('aria-label', tr('Works', '作品库')); box.dataset.fvTipScope = ''; - const head = el('div', 'fv-works-head'), title = el('b', 'fv-works-title', tr('Works', '作品库')), count = el('span', 'fv-works-count'); + const box = el('div', 'fv-works'); box.setAttribute('role', 'dialog'); box.setAttribute('aria-label', tr('Creations', '作品库')); box.dataset.fvTipScope = ''; + const head = el('div', 'fv-works-head'), title = el('b', 'fv-works-title', tr('Creations', '作品库')), count = el('span', 'fv-works-count'); head.append(title, count); if (onOpenLibrary) { - const open = el('button', 'fv-works-link'); open.type = 'button'; open.innerHTML = GLYPH.open; open.append(el('span', null, tr('Open works library', '打开作品库'))); - tip(open, tr('Open works library', '打开作品库'), tr('See every picture and video, with their details', '查看全部图片和视频及其信息')); + const open = el('button', 'fv-works-link'); open.type = 'button'; open.innerHTML = GLYPH.open; open.append(el('span', null, tr('Open creations library', '打开作品库'))); + tip(open, tr('Open creations library', '打开作品库'), tr('See every image and video, with their details', '查看全部图片和视频及其信息')); open.onclick = () => { close(); onOpenLibrary(); }; head.append(open); } @@ -158,7 +158,7 @@ export function openWorksPicker({anchor, t: tr = t, host = anchor.closest('dialo if (closed) return; const {worksThumbnailURL} = cached; count.textContent = rows.length ? String(rows.length) : ''; - empty.textContent = cached.failed ? tr('The works could not be read. Try again.', '没能读取作品,请再试一次。') : tr('No pictures yet', '还没有图片'); + empty.textContent = cached.failed ? tr('The creations could not be read. Try again.', '没能读取作品,请再试一次。') : tr('No images yet', '还没有图片'); empty.hidden = !!rows.length || !cached.loaded; const reference = !selecting && canReference(); const keep = new Set(rows.map(row => row.file)); @@ -177,7 +177,7 @@ export function openWorksPicker({anchor, t: tr = t, host = anchor.closest('dialo const action = (label, run, cls = '') => { const b = el('button', 'fv-works-btn' + (cls ? ' ' + cls : ''), label); b.type = 'button'; b.onclick = run; return b; }; if (selecting) { const all = chosen.size === rows.length && rows.length > 0; - const del = action(tr(`Delete ${chosen.size}`, `删除 ${chosen.size} 张`), () => { if (chosen.size) void remove([...chosen]); }, 'fv-works-danger'); + const del = action(tr('Delete {count}', '删除 {count} 张', { count: chosen.size }), () => { if (chosen.size) void remove([...chosen]); }, 'fv-works-danger'); del.disabled = !chosen.size; tip(del, del.textContent, tr('Can be undone for 10 seconds', '10 秒内可以撤销')); foot.append(action(all ? tr('Deselect all', '全不选') : tr('Select all', '全选'), () => { if (all) chosen.clear(); else for (const row of rows) chosen.add(row.file); draw(); }), el('span', 'fv-works-grow'), action(tr('Cancel', '取消'), () => { selecting = false; chosen.clear(); draw(); }), del); diff --git a/web/image_lora.js b/web/image_lora.js index 8b4e2f64..f56524c4 100644 --- a/web/image_lora.js +++ b/web/image_lora.js @@ -89,7 +89,7 @@ export function createImageLoras({t, fetchApi, el = domEl, getPrompt = () => '', if (verdict?.usable !== false) return ''; return verdict.reason === 'unreadable' ? t('The file could not be read. It may be incomplete; download it again.', '文件无法读取,可能未下载完整,请重新下载。') - : t('This LoRA cannot be used for pictures.', '此 LoRA 不适用于图片生成。'); + : t('This LoRA cannot be used for images.', '此 LoRA 不适用于图片生成。'); } function render() { @@ -127,7 +127,7 @@ export function createImageLoras({t, fetchApi, el = domEl, getPrompt = () => '', strength.onchange = () => { if (!strengthNote.settle()) { if (strength.value !== '') return; - const kept = row.strength ?? 1; strength.value = String(kept); strengthNote.say(t(`Back to ${kept}`, `已恢复为 ${kept}`)); return; + const kept = row.strength ?? 1; strength.value = String(kept); strengthNote.say(t('Back to {kept}', '已恢复为 {kept}', { kept })); return; } row.strength = Number(strength.value); changed(); }; @@ -149,7 +149,8 @@ export function createImageLoras({t, fetchApi, el = domEl, getPrompt = () => '', }); add.disabled = rows.length >= IMAGE_LORA_LIMIT; if (!note.textContent || !rows.some(r => drafts.has(r.name))) note.textContent = skipped - ? t(`${skipped} other LoRA file${skipped === 1 ? '' : 's'} in the folder ${skipped === 1 ? 'is' : 'are'} not in .safetensors format and not listed.`, `文件夹中另有 ${skipped} 个 LoRA 文件不是 .safetensors 格式,未列出。`) : ''; + ? (skipped === 1 ? t('1 other LoRA file in the folder is not in .safetensors format and not listed.', '文件夹中另有 1 个 LoRA 文件不是 .safetensors 格式,未列出。') + : t('{count} other LoRA files in the folder are not in .safetensors format and not listed.', '文件夹中另有 {count} 个 LoRA 文件不是 .safetensors 格式,未列出。', { count: skipped })) : ''; drawSummary(); } @@ -170,7 +171,7 @@ export function createImageLoras({t, fetchApi, el = domEl, getPrompt = () => '', } add.onclick = async () => { await refresh(); - if (rows.length >= IMAGE_LORA_LIMIT) { note.textContent = t(`Use at most ${IMAGE_LORA_LIMIT} LoRAs`, `最多使用 ${IMAGE_LORA_LIMIT} 个 LoRA`); return; } + if (rows.length >= IMAGE_LORA_LIMIT) { note.textContent = t('Use at most {IMAGE_LORA_LIMIT} LoRAs', '最多使用 {IMAGE_LORA_LIMIT} 个 LoRA', { IMAGE_LORA_LIMIT }); return; } if (!names?.length) { note.textContent = t('Put LoRA files (.safetensors) in the models/loras folder, then choose "Add".', '把 LoRA 文件(.safetensors)放进 models/loras 文件夹,再点“添加”。'); return; } rows.push({name: names.find(n => !rows.some(r => r.name === n)) ?? names[0], strength: 1, enabled: true}); render(); changed(); diff --git a/web/image_view.css b/web/image_view.css index e12d8792..60090ed4 100644 --- a/web/image_view.css +++ b/web/image_view.css @@ -10,20 +10,20 @@ /* Kept between visits (image_view.js): closed, it takes no room and draws nothing, as the editor and the AI view. */ dialog.fv-studio.fv-image:not([open]){display:none!important} :root[data-theme=light] .fv-image{color-scheme:light;--iv-well:rgb(20 24 32 / .045);--iv-pic-sh:0 2px 6px rgb(30 40 60 / .1),0 30px 60px -30px rgb(30 40 60 / .3);--iv-hair:rgb(0 0 0 / .06)} -.fv-iv [hidden]{display:none!important} +:is(.fv-iv,.fv-work-column) [hidden]{display:none!important} /* the studio's own button and field faces stop at this page; its controls draw themselves */ -.fv-iv button,.fv-iv a{min-height:0;border:0;border-radius:0;background:none;padding:0;color:inherit;font-weight:inherit;gap:0;box-shadow:none} +:is(.fv-iv,.fv-work-column) button,:is(.fv-iv,.fv-work-column) a{min-height:0;border:0;border-radius:0;background:none;padding:0;color:inherit;font-weight:inherit;gap:0;box-shadow:none} .fv-iv{position:relative;flex:1;min-height:0;overflow:hidden;background:var(--fv-shell-bg);color:var(--fv-fg);font-size:var(--fv-fs-2,13px);line-height:1.45; -webkit-user-select:none;user-select:none; - --iv-gut:12px;--iv-sbar:32px;--iv-lw:320px;--iv-rw:320px;--iv-rail:56px;--iv-l:var(--iv-lw);--iv-r:var(--iv-rw); + --iv-gut:12px;--iv-sbar:32px;--iv-lw:var(--fv-col-w,300px);--iv-rw:var(--fv-col-w,300px);--iv-rail:56px;--iv-l:var(--iv-lw);--iv-r:var(--iv-rw); --iv-side:calc(max(var(--iv-l),var(--iv-r)) + var(--iv-gut) * 2);--iv-dur:var(--fv-dur-2,200ms);--iv-ease:var(--fv-ease-out,cubic-bezier(.2,.8,.2,1))} .fv-iv[data-left=rail]{--iv-l:var(--iv-rail)} .fv-iv[data-right=rail]{--iv-r:var(--iv-rail)} -.fv-iv :is(input,textarea){-webkit-user-select:text;user-select:text} -.fv-iv img{-webkit-user-drag:none} -.fv-iv button{font:inherit;color:inherit} -.fv-iv .fv-iv-icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round} -.fv-iv .fv-iv-grow{flex:1;min-width:0} +:is(.fv-iv,.fv-work-column) :is(input,textarea){-webkit-user-select:text;user-select:text} +:is(.fv-iv,.fv-work-column) img{-webkit-user-drag:none} +:is(.fv-iv,.fv-work-column) button{font:inherit;color:inherit} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-grow{flex:1;min-width:0} /* ── panels: hug the window edges; the stage is symmetric about the window centre whatever they do ── */ .fv-iv .fv-iv-panel{position:absolute;top:var(--iv-gut);bottom:calc(var(--iv-gut) + var(--iv-sbar));z-index:2;display:flex;flex-direction:column;min-width:0;border-radius:var(--fv-rad-dock,20px);overflow:hidden; @@ -33,35 +33,35 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-stage{position:absolute;top:0;bottom:var(--iv-sbar);left:var(--iv-side);right:var(--iv-side);z-index:1;display:flex;flex-direction:column;min-width:0;transition:left var(--iv-dur) var(--iv-ease),right var(--iv-dur) var(--iv-ease)} .fv-iv .fv-iv-panel>:not(.fv-iv-rail){transition:opacity 160ms linear} .fv-iv .fv-iv-panel[data-collapsed=true]>:not(.fv-iv-rail){opacity:0;pointer-events:none;visibility:hidden} -.fv-iv .fv-iv-rail{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;gap:4px;padding:12px 0;opacity:0;pointer-events:none;transition:opacity var(--iv-dur) var(--iv-ease)} -.fv-iv .fv-iv-panel[data-collapsed=true]>.fv-iv-rail{opacity:1;pointer-events:auto} -.fv-iv .fv-iv-rail .fv-iv-icon-btn{width:var(--fv-h,36px);height:var(--fv-h,36px)} -.fv-iv .fv-iv-rail-sep{width:24px;height:1px;background:var(--fv-line2);margin:4px 0} -.fv-iv .fv-iv-rail-go{color:#fff;background:var(--fv-accent-fill)} -.fv-iv .fv-iv-rail-go:hover{background:var(--fv-accent-fill);filter:brightness(1.08);color:#fff} -.fv-iv .fv-iv-rail-thumbs{display:flex;flex-direction:column;gap:8px;overflow:hidden} -.fv-iv .fv-iv-rail-thumb{width:40px;height:40px;padding:0;border:0;border-radius:var(--fv-rad-ctl,12px);overflow:hidden;cursor:pointer;background:rgb(var(--fv-tint))} -.fv-iv .fv-iv-rail-thumb img{width:100%;height:100%;object-fit:cover;display:block} -.fv-iv .fv-iv-rail-thumb.fv-iv-current{box-shadow:0 0 0 2px var(--fv-accent-ink)} -.fv-iv .fv-iv-rail-run{display:grid;place-items:center;background:#161a22} -.fv-iv .fv-iv-rail-run .fv-iv-ring{width:24px;height:24px;-webkit-mask:radial-gradient(circle,transparent 8px,#000 9px);mask:radial-gradient(circle,transparent 8px,#000 9px)} -.fv-iv .fv-iv-panel-head{flex:none;display:flex;align-items:center;gap:4px;height:52px;padding:0 8px 0 16px} -.fv-iv .fv-iv-panel-title{margin:0;font-size:var(--fv-fs-3,16px);font-weight:600;color:var(--fv-fg);white-space:nowrap} -.fv-iv .fv-iv-count{margin-left:8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-rail{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;gap:4px;padding:12px 0;opacity:0;pointer-events:none;transition:opacity var(--iv-dur) var(--iv-ease)} +:is(.fv-iv,.fv-work-column) .fv-iv-panel[data-collapsed=true]>.fv-iv-rail{opacity:1;pointer-events:auto} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-rail .fv-iv-icon-btn{width:var(--fv-h,36px);height:var(--fv-h,36px)} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-sep{width:24px;height:1px;background:var(--fv-line2);margin:4px 0} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-go{color:#fff;background:var(--fv-accent-fill)} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-go:hover{background:var(--fv-accent-fill);filter:brightness(1.08);color:#fff} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-thumbs{display:flex;flex-direction:column;gap:8px;overflow:hidden} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-thumb{width:40px;height:40px;padding:0;border:0;border-radius:var(--fv-rad-ctl,12px);overflow:hidden;cursor:pointer;background:rgb(var(--fv-tint))} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-thumb img{width:100%;height:100%;object-fit:cover;display:block} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-thumb.fv-iv-current{box-shadow:0 0 0 2px var(--fv-accent-ink)} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-run{display:grid;place-items:center;background:#161a22} +:is(.fv-iv,.fv-work-column) .fv-iv-rail-run .fv-iv-ring{width:24px;height:24px;-webkit-mask:radial-gradient(circle,transparent 8px,#000 9px);mask:radial-gradient(circle,transparent 8px,#000 9px)} +:is(.fv-iv,.fv-work-column) .fv-iv-panel-head{flex:none;display:flex;align-items:center;gap:4px;height:52px;padding:0 8px 0 16px} +:is(.fv-iv,.fv-work-column) .fv-iv-panel-title{margin:0;font-size:var(--fv-fs-3,16px);font-weight:600;color:var(--fv-fg);white-space:nowrap} +:is(.fv-iv,.fv-work-column) .fv-iv-count{margin-left:8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} .fv-iv .fv-iv-panel-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--fv-line2) transparent} /* The create column never scrolls sideways: its rows shrink, wrap or keep icons only. */ .fv-iv .fv-iv-left .fv-iv-panel-scroll{overflow-x:hidden} -.fv-iv .fv-iv-panel-foot{flex:none;padding:8px 16px 16px;border-top:1px solid var(--fv-line)} +:is(.fv-iv,.fv-work-column) .fv-iv-panel-foot{flex:none;padding:8px 16px 16px;border-top:1px solid var(--fv-line)} @media(min-width:721px){.fv-iv .fv-iv-panel-scroll>.fv-iv-gen-foot{position:sticky;bottom:0;z-index:2;border-top:0;padding-top:0;background:linear-gradient(transparent,rgb(var(--fv-tint) / var(--fv-a2)) 8px)} :is(:root[data-glass=solid],:root.lite) .fv-iv .fv-iv-panel-scroll>.fv-iv-gen-foot{background:rgb(var(--fv-solid2))}} /* buttons */ -.fv-iv .fv-iv-btn,.fv-iv .fv-iv-icon-btn,.fv-iv .fv-iv-text-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;background:transparent;color:var(--fv-fg2);cursor:pointer; +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-btn,:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-icon-btn,:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-text-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;background:transparent;color:var(--fv-fg2);cursor:pointer; border-radius:var(--fv-rad-ctl,12px);font-size:var(--fv-fs-2,13px);font-weight:500;white-space:nowrap;text-decoration:none;-webkit-tap-highlight-color:transparent; transition:background-color var(--fv-dur-1,160ms),color var(--fv-dur-1,160ms),transform 90ms var(--iv-ease)} -.fv-iv .fv-iv-icon-btn{width:32px;height:32px;padding:0;flex:none} -.fv-iv .fv-iv-text-btn{height:32px;padding:0 12px} -.fv-iv .fv-iv-text-btn .fv-iv-icon{width:16px;height:16px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-icon-btn{width:32px;height:32px;padding:0;flex:none} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-text-btn{height:32px;padding:0 12px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-text-btn .fv-iv-icon{width:16px;height:16px} :is(.fv-iv-btn,.fv-iv-icon-btn,.fv-iv-text-btn):hover{background:var(--fv-ctl-hover);color:var(--fv-fg)} :is(.fv-iv-btn,.fv-iv-icon-btn,.fv-iv-text-btn):active{transform:scale(.96);transition-duration:0s} :is(.fv-iv-btn,.fv-iv-icon-btn,.fv-iv-text-btn)[aria-pressed=true]{background:var(--fv-accent-soft);color:var(--fv-accent-ink)} @@ -70,49 +70,49 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-danger,.fv-iv .fv-iv-danger:hover{color:var(--fv-warn)} .fv-iv .fv-iv-accent{color:var(--fv-accent-ink)} .fv-iv .fv-iv-sep{width:1px;height:18px;background:var(--fv-line2);margin:0 4px;flex:none} -.fv-iv :focus-visible{outline:2px solid var(--fv-accent-line);outline-offset:2px} +:is(.fv-iv,.fv-work-column) :focus-visible{outline:2px solid var(--fv-accent-line);outline-offset:2px} /* segmented: one shape for every either/or */ -.fv-iv .fv-iv-seg{display:flex;gap:4px;padding:4px;border-radius:var(--fv-r-md);background:var(--fv-ctl-bg)} -.fv-iv .fv-iv-seg>button{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;height:28px;padding:0 12px;border:0;border-radius:var(--fv-r-sm);background:transparent; +:is(.fv-iv,.fv-work-column) .fv-iv-seg{display:flex;gap:4px;padding:4px;border-radius:var(--fv-r-md);background:var(--fv-ctl-bg)} +:is(.fv-iv,.fv-work-column) .fv-iv-seg>button{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;height:28px;padding:0 12px;border:0;border-radius:var(--fv-r-sm);background:transparent; color:var(--fv-fg2);font-size:var(--fv-fs-2,13px);white-space:nowrap;cursor:pointer;transition:color var(--fv-dur-1,160ms),background-color var(--fv-dur-1,160ms)} -.fv-iv .fv-iv-seg>button .fv-iv-icon{width:16px;height:16px} -.fv-iv .fv-iv-seg>button:hover{color:var(--fv-fg)} -.fv-iv .fv-iv-seg>button[aria-pressed=true]{color:var(--fv-fg);font-weight:600;background:rgb(var(--fv-tint) / .92);box-shadow:0 1px 2px rgb(0 0 0 / .2),inset 0 1px 0 var(--fv-edge-hi)} -:root[data-theme=light] .fv-iv .fv-iv-seg>button[aria-pressed=true]{background:#fff;box-shadow:0 1px 2px rgb(20 30 50 / .14)} -.fv-iv .fv-iv-seg>button[aria-disabled=true]{opacity:.42;cursor:default} -.fv-iv .fv-iv-chip{height:28px;padding:0 12px;border-radius:var(--fv-r-pill);background:var(--fv-ctl-bg);font-size:var(--fv-fs-1,12px)} -.fv-iv .fv-iv-chip[aria-pressed=true]{background:var(--fv-accent-soft);color:var(--fv-accent-ink);font-weight:600} -.fv-iv .fv-iv-chip-n{color:var(--fv-fg3);font-weight:400}.fv-iv .fv-iv-chip[aria-pressed=true] .fv-iv-chip-n{color:inherit;opacity:.8} -.fv-iv .fv-iv-chip-n:empty{display:none} +:is(.fv-iv,.fv-work-column) .fv-iv-seg>button .fv-iv-icon{width:16px;height:16px} +:is(.fv-iv,.fv-work-column) .fv-iv-seg>button:hover{color:var(--fv-fg)} +:is(.fv-iv,.fv-work-column) .fv-iv-seg>button[aria-pressed=true]{color:var(--fv-fg);font-weight:600;background:rgb(var(--fv-tint) / .92);box-shadow:0 1px 2px rgb(0 0 0 / .2),inset 0 1px 0 var(--fv-edge-hi)} +:root[data-theme=light] :is(.fv-iv,.fv-work-column) .fv-iv-seg>button[aria-pressed=true]{background:#fff;box-shadow:0 1px 2px rgb(20 30 50 / .14)} +:is(.fv-iv,.fv-work-column) .fv-iv-seg>button[aria-disabled=true]{opacity:.42;cursor:default} +:is(.fv-iv,.fv-work-column) .fv-iv-chip{height:28px;padding:0 12px;border-radius:var(--fv-r-pill);background:var(--fv-ctl-bg);font-size:var(--fv-fs-1,12px)} +:is(.fv-iv,.fv-work-column) .fv-iv-chip[aria-pressed=true]{background:var(--fv-accent-soft);color:var(--fv-accent-ink);font-weight:600} +:is(.fv-iv,.fv-work-column) .fv-iv-chip-n{color:var(--fv-fg3);font-weight:400}:is(.fv-iv,.fv-work-column) .fv-iv-chip[aria-pressed=true] .fv-iv-chip-n{color:inherit;opacity:.8} +:is(.fv-iv,.fv-work-column) .fv-iv-chip-n:empty{display:none} /* ── groups ── */ .fv-image-inputs{display:block} -.fv-iv .fv-iv-sec{padding:0 16px 12px;border-top:1px solid var(--fv-line)} -.fv-iv .fv-iv-sec:first-child{border-top:0} -.fv-iv .fv-iv-sec[data-open=false]{padding-bottom:0} -.fv-iv .fv-iv-sec-head{display:flex;align-items:center;gap:4px;height:36px} -.fv-iv .fv-iv-sec-toggle{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:32px;margin:0 -8px;padding:0 8px;border:0;border-radius:var(--fv-r-sm);background:transparent;color:var(--fv-fg3);cursor:pointer;text-align:left} -.fv-iv .fv-iv-sec-toggle:hover{background:var(--fv-ctl-bg);color:var(--fv-fg2)} -.fv-iv .fv-iv-sec[data-fixed=true] .fv-iv-sec-toggle{cursor:default} -.fv-iv .fv-iv-sec[data-fixed=true] .fv-iv-sec-toggle:hover{background:transparent} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec{padding:0 16px 12px;border-top:1px solid var(--fv-line)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec:first-child{border-top:0} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-open=false]{padding-bottom:0} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-head{display:flex;align-items:center;gap:4px;height:36px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-toggle{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:32px;margin:0 -8px;padding:0 8px;border:0;border-radius:var(--fv-r-sm);background:transparent;color:var(--fv-fg3);cursor:pointer;text-align:left} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-toggle:hover{background:var(--fv-ctl-bg);color:var(--fv-fg2)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-fixed=true] .fv-iv-sec-toggle{cursor:default} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-fixed=true] .fv-iv-sec-toggle:hover{background:transparent} /* the stage's row: the menu's actions inline where there is room; the menu only on a phone */ .fv-iv .fv-iv-cap-inline{display:flex;align-items:center;gap:4px} .fv-iv .fv-iv-cap-inline>[hidden]{display:none} .fv-iv .fv-iv-cap-actions>.fv-iv-more-host{display:none} @media(max-width:719px){.fv-iv .fv-iv-cap-inline{display:none}.fv-iv .fv-iv-cap-actions>.fv-iv-more-host{display:inline-flex}} -.fv-iv .fv-iv-sec-toggle h3{margin:0;font-size:var(--fv-fs-1,12px);font-weight:600;color:var(--fv-fg2);letter-spacing:.02em;white-space:nowrap} -.fv-iv .fv-iv-sec-icon{width:16px;height:16px} -.fv-iv .fv-iv-sec-meta{flex:1;text-align:right;min-width:0;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums} -.fv-iv .fv-iv-sec-chev{width:16px;height:16px;transition:transform var(--iv-dur) var(--iv-ease)} -.fv-iv .fv-iv-sec[data-open=false] .fv-iv-sec-chev{transform:rotate(-90deg)} -.fv-iv .fv-iv-sec-tools:empty{display:none} -.fv-iv .fv-iv-sec-tools{display:flex;align-items:center} -.fv-iv .fv-iv-sec-add{width:28px;height:28px;color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-toggle h3{margin:0;font-size:var(--fv-fs-1,12px);font-weight:600;color:var(--fv-fg2);letter-spacing:.02em;white-space:nowrap} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-icon{width:16px;height:16px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-meta{flex:1;text-align:right;min-width:0;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-chev{width:16px;height:16px;transition:transform var(--iv-dur) var(--iv-ease)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-open=false] .fv-iv-sec-chev{transform:rotate(-90deg)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-tools:empty{display:none} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-tools{display:flex;align-items:center} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-add{width:28px;height:28px;color:var(--fv-fg3)} .fv-iv .fv-iv-instant .fv-iv-sec-body,.fv-iv .fv-iv-instant .fv-iv-sec-inner,.fv-iv .fv-iv-instant .fv-iv-sec-chev{transition:none!important} -.fv-iv .fv-iv-sec-body{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--iv-dur) var(--iv-ease)} -.fv-iv .fv-iv-sec[data-open=false] .fv-iv-sec-body{grid-template-rows:0fr} -.fv-iv .fv-iv-sec-inner{min-width:0;min-height:0;overflow:clip;padding:4px;margin:-4px} -.fv-iv .fv-iv-sec[data-open=false] .fv-iv-sec-inner{visibility:hidden;transition:visibility 0s var(--iv-dur)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-body{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--iv-dur) var(--iv-ease)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-open=false] .fv-iv-sec-body{grid-template-rows:0fr} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-inner{min-width:0;min-height:0;overflow:clip;padding:4px;margin:-4px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-open=false] .fv-iv-sec-inner{visibility:hidden;transition:visibility 0s var(--iv-dur)} .fv-iv .fv-iv-note{margin:8px 0 0;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} /* model cards: both, always */ @@ -129,9 +129,9 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-model:is([data-state=missing],[data-state=failed],[data-state=downloading]) .fv-iv-model-pick{padding-bottom:40px} .fv-iv .fv-iv-model-status{display:flex;align-items:center;gap:4px;min-width:0;max-width:100%;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);white-space:nowrap} .fv-iv .fv-iv-model-status span{overflow:hidden;text-overflow:ellipsis} -.fv-iv .fv-iv-model-status .fv-iv-icon{width:13px;height:13px} +:is(.fv-iv,.fv-work-column) .fv-iv-model-status .fv-iv-icon{width:13px;height:13px} .fv-iv .fv-iv-model[data-state=ready] .fv-iv-model-status{color:var(--fv-fg2)} -.fv-iv .fv-iv-model[data-state=ready] .fv-iv-model-status .fv-iv-icon{color:var(--fv-ok,#4fd39a)} +:is(.fv-iv,.fv-work-column) .fv-iv-model[data-state=ready] .fv-iv-model-status .fv-iv-icon{color:var(--fv-ok,#4fd39a)} .fv-iv .fv-iv-model[data-state=failed] .fv-iv-model-status{color:var(--fv-warn)} .fv-iv .fv-iv-model[data-state=downloading] .fv-iv-model-status{color:var(--fv-accent-ink)} .fv-iv .fv-iv-model-bar{position:relative;flex:none;width:100%;margin-top:4px;height:4px;border-radius:var(--fv-r-xs);background:var(--fv-line2);overflow:hidden} @@ -153,11 +153,11 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} and shows only while one of them is there. */ .fv-iv .fv-image-enhance .fv-enhance-bar>.fv-enhance-toggle{display:none} .fv-iv .fv-image-enhance .fv-enhance-bar:not([data-hx-enh]){display:none} -.fv-iv .fv-iv-prompt-bar .fv-iv-enhance-tool svg{flex:none} -.fv-iv .fv-iv-prompt-bar .fv-iv-enhance-tool[aria-pressed=true]{color:var(--fv-accent-ink)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-iv-enhance-tool svg{flex:none} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-iv-enhance-tool[aria-pressed=true]{color:var(--fv-accent-ink)} /* While the count shows (from 1600 characters) the row's keys keep their icons only (their hover cards name them), so the count, Clear and Expand fit on the row's one line. */ -.fv-iv .fv-iv-prompt-bar:is([data-compact=true],[data-hx-cnt]) .fv-iv-text-btn .fv-iv-btn-label{display:none} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar:is([data-compact=true],[data-hx-cnt]) .fv-iv-text-btn .fv-iv-btn-label{display:none} .fv-iv .fv-image-enhance .fv-iv-prompt:focus-visible{box-shadow:inset 0 0 0 1.5px var(--fv-accent-line)} /* the helper's status line (with its report button) only while the helper is on */ .fv-iv .fv-image-enhance:not([data-hx-chk],[data-reverse=true]) .fv-enhance-status{display:none} @@ -167,16 +167,16 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} transition:box-shadow var(--fv-dur-1,160ms)} /* the shared focus ring (a11y.css) draws the caret field's edge */ .fv-studio .fv-iv .fv-iv-prompt::placeholder{color:var(--fv-fg3)} -.fv-iv .fv-iv-prompt-bar{display:flex;align-items:center;gap:4px;min-width:0;height:28px;margin-top:4px} -.fv-iv .fv-iv-prompt-bar .fv-ed-expand{position:static;right:auto;bottom:auto;flex:none;width:28px;height:28px;min-width:28px;min-height:28px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar{display:flex;align-items:center;gap:4px;min-width:0;height:28px;margin-top:4px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-ed-expand{position:static;right:auto;bottom:auto;flex:none;width:28px;height:28px;min-width:28px;min-height:28px} /* Expand is one of the row's keys: the same clear ground, ink, corners and hover, press and focus as References, Sketch and Enhance (not the page colour the shared key brings, which reads as a dark square). */ -.fv-iv .fv-iv-prompt-bar .fv-ed-expand{border-radius:var(--fv-rad-ctl,12px);background:transparent;color:var(--fv-fg2);cursor:pointer; +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-ed-expand{border-radius:var(--fv-rad-ctl,12px);background:transparent;color:var(--fv-fg2);cursor:pointer; transition:background-color var(--fv-dur-1,160ms),color var(--fv-dur-1,160ms),transform 90ms var(--iv-ease)} -.fv-iv .fv-iv-prompt-bar .fv-ed-expand:hover{background:var(--fv-ctl-hover);color:var(--fv-fg)} -.fv-iv .fv-iv-prompt-bar .fv-ed-expand:active{transform:scale(.96);transition-duration:0s} -.fv-iv .fv-iv-prompt-bar .fv-iv-enhance-tool:not([aria-pressed=true]){color:var(--fv-fg2)} -.fv-iv .fv-iv-prompt-bar .fv-iv-text-btn{height:28px;padding:0 8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-ed-expand:hover{background:var(--fv-ctl-hover);color:var(--fv-fg)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-ed-expand:active{transform:scale(.96);transition-duration:0s} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-iv-enhance-tool:not([aria-pressed=true]){color:var(--fv-fg2)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-iv-text-btn{height:28px;padding:0 8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} /* The count (shown from 1600 characters) stays on one line at its full width; the empty space before it gives way first. */ .fv-iv .fv-iv-prompt-count{flex:none;white-space:nowrap;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);font-variant-numeric:tabular-nums} @@ -188,15 +188,15 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-ref img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block} .fv-iv .fv-iv-ref b{position:absolute;left:2px;bottom:2px;box-sizing:border-box;min-width:16px;height:16px;padding:0 4px;border-radius:var(--fv-r-pill);display:flex;align-items:center;justify-content:center;font-size:var(--fv-fs-1,12px);font-weight:600;font-variant-numeric:tabular-nums;color:#fff;background:rgb(0 0 0 / .55);white-space:nowrap} .fv-studio .fv-iv .fv-image-reference-remove{position:absolute;right:2px;top:2px;width:20px;height:20px;min-height:0;padding:0;border:0;border-radius:var(--fv-r-pill);display:grid;place-items:center;color:#fff;background:rgb(0 0 0 / .55);opacity:0;cursor:pointer;transition:opacity var(--fv-dur-1,160ms)} -.fv-studio .fv-iv .fv-image-reference-remove .fv-iv-icon{width:12px;height:12px} +.fv-studio :is(.fv-iv,.fv-work-column) .fv-image-reference-remove .fv-iv-icon{width:12px;height:12px} .fv-iv .fv-iv-ref:hover .fv-image-reference-remove,.fv-iv .fv-iv-ref:focus-within .fv-image-reference-remove{opacity:1} @media(hover:none){.fv-studio .fv-iv .fv-image-reference-remove{opacity:1}} .fv-iv .fv-iv-ref[data-over=true] img{filter:grayscale(1) brightness(.6)} /* edited here: a mark at the corner; pointing at the picture turns it into the way back to the original */ .fv-iv .fv-iv-ref-mark{position:absolute;left:4px;top:4px;width:16px;height:16px;border-radius:var(--fv-r-pill);display:grid;place-items:center;background:var(--fv-accent-fill);color:#fff;pointer-events:none;transition:opacity var(--fv-dur-1,160ms)} -.fv-iv .fv-iv-ref-mark .fv-iv-icon{width:10px;height:10px;stroke-width:2.2} +:is(.fv-iv,.fv-work-column) .fv-iv-ref-mark .fv-iv-icon{width:10px;height:10px;stroke-width:2.2} .fv-studio .fv-iv .fv-iv-ref-restore{position:absolute;left:2px;top:2px;width:20px;height:20px;min-height:0;padding:0;border:0;border-radius:var(--fv-r-pill);display:grid;place-items:center;color:#fff;background:rgb(0 0 0 / .55);opacity:0;cursor:pointer;transition:opacity var(--fv-dur-1,160ms)} -.fv-iv .fv-iv-ref-restore .fv-iv-icon{width:12px;height:12px} +:is(.fv-iv,.fv-work-column) .fv-iv-ref-restore .fv-iv-icon{width:12px;height:12px} .fv-iv .fv-iv-ref:is(:hover,:focus-within) .fv-iv-ref-restore{opacity:1} .fv-iv .fv-iv-ref:is(:hover,:focus-within) .fv-iv-ref-mark{opacity:0} @media(hover:none){.fv-studio .fv-iv .fv-iv-ref-restore{opacity:1}.fv-iv .fv-iv-ref-mark{opacity:0}} @@ -221,7 +221,7 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-studio .fv-iv .fv-iv-ref-add{display:grid;place-items:center;min-height:0;padding:0;border:0;background:none;color:var(--fv-fg3);box-shadow:inset 0 0 0 1.5px var(--fv-line2);cursor:pointer} .fv-studio .fv-iv .fv-iv-ref-add:hover{color:var(--fv-fg);background:var(--fv-ctl-bg)} .fv-studio .fv-iv .fv-iv-ref-wide{grid-column:1 / -1;aspect-ratio:auto;height:52px;display:flex;align-items:center;justify-content:center;gap:8px;font-size:var(--fv-fs-2,13px)} -.fv-iv .fv-iv-sec[data-drop=true] .fv-iv-ref-add{box-shadow:inset 0 0 0 1.5px var(--fv-accent-line);background:var(--fv-accent-soft);color:var(--fv-accent-ink)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-drop=true] .fv-iv-ref-add{box-shadow:inset 0 0 0 1.5px var(--fv-accent-line);background:var(--fv-accent-soft);color:var(--fv-accent-ink)} /* shape and size: the shared frame picker (glass/frame_picker.css) lays itself out by this panel's width */ .fv-iv .fv-iv-field{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:32px;padding:0 12px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);color:var(--fv-fg3)} @@ -232,11 +232,11 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-field input::placeholder{color:var(--fv-fg3)} .fv-iv .fv-iv-field input:disabled{opacity:.6} .fv-iv .fv-iv-field-wide{flex:none;width:100%;padding-right:2px} -.fv-iv .fv-iv-field-wide .fv-iv-icon-btn{width:28px;height:28px} +:is(.fv-iv,.fv-work-column) .fv-iv-field-wide .fv-iv-icon-btn{width:28px;height:28px} /* history and presets */ .fv-iv .fv-iv-library{min-width:0} -.fv-iv .fv-iv-library .fv-iv-seg{margin-bottom:8px} +:is(.fv-iv,.fv-work-column) .fv-iv-library .fv-iv-seg{margin-bottom:8px} .fv-iv .fv-iv-library-clear{margin-top:4px;height:28px;padding:0 8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} .fv-iv .fv-iv-library-clear[hidden]{display:none} .fv-iv .fv-iv-library-list{display:flex;flex-direction:column;gap:4px;max-height:280px;overflow:auto;overscroll-behavior:contain} @@ -249,22 +249,22 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-li-end{display:flex;opacity:0;transition:opacity var(--fv-dur-1,160ms);padding-right:4px} .fv-iv .fv-iv-li:hover .fv-iv-li-end,.fv-iv .fv-iv-li:focus-within .fv-iv-li-end{opacity:1} @media(hover:none){.fv-iv .fv-iv-li-end{opacity:1}} -.fv-iv .fv-iv-li-end .fv-iv-icon-btn{width:28px;height:28px;color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-li-end .fv-iv-icon-btn{width:28px;height:28px;color:var(--fv-fg3)} .fv-iv .fv-iv-pin[aria-pressed=true]{background:transparent;color:#e9b43a!important} -.fv-iv .fv-iv-pin[aria-pressed=true] .fv-iv-icon{fill:currentColor} +:is(.fv-iv,.fv-work-column) .fv-iv-pin[aria-pressed=true] .fv-iv-icon{fill:currentColor} .fv-iv .fv-iv-li[data-hx-pin] .fv-iv-li-end{opacity:1} .fv-iv .fv-iv-preset-save{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px} .fv-studio .fv-iv .fv-iv-preset-save input:not([type=checkbox]){flex:1;min-width:0;height:32px;padding:0 12px;border:0;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);color:var(--fv-fg);font:inherit} .fv-studio .fv-iv .fv-iv-preset-save input:not([type=checkbox]):focus{box-shadow:inset 0 0 0 1.5px var(--fv-accent-line)} .fv-iv .fv-iv-check{display:flex;align-items:center;gap:8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg2);cursor:pointer} -.fv-iv .fv-iv-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:32px 12px;color:var(--fv-fg3);font-size:var(--fv-fs-2,13px);text-align:center} -.fv-iv .fv-iv-empty .fv-iv-icon{width:28px;height:28px;stroke-width:1.4;opacity:.8} -.fv-iv .fv-iv-empty-small{padding:16px 8px;font-size:var(--fv-fs-1,12px)} -.fv-iv .fv-iv-empty-small .fv-iv-icon{width:20px;height:20px} +:is(.fv-iv,.fv-work-column) .fv-iv-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:32px 12px;color:var(--fv-fg3);font-size:var(--fv-fs-2,13px);text-align:center} +:is(.fv-iv,.fv-work-column) .fv-iv-empty .fv-iv-icon{width:28px;height:28px;stroke-width:1.4;opacity:.8} +:is(.fv-iv,.fv-work-column) .fv-iv-empty-small{padding:16px 8px;font-size:var(--fv-fs-1,12px)} +:is(.fv-iv,.fv-work-column) .fv-iv-empty-small .fv-iv-icon{width:20px;height:20px} /* status slot and Generate */ .fv-iv .fv-iv-slot{display:flex;align-items:center;gap:8px;height:40px;padding:0 4px 0 8px;margin-bottom:8px;border-radius:var(--fv-rad-ctl,12px);font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);overflow:hidden} -.fv-iv .fv-iv-slot .fv-iv-icon{width:15px;height:15px} +:is(.fv-iv,.fv-work-column) .fv-iv-slot .fv-iv-icon{width:15px;height:15px} .fv-iv .fv-iv-slot-tx{flex:1;min-width:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:16px} .fv-iv .fv-iv-slot[data-whole]{height:auto;min-height:40px;padding-top:8px;padding-bottom:8px;align-items:flex-start} .fv-iv .fv-iv-slot[data-whole] .fv-iv-slot-tx{display:block;-webkit-line-clamp:unset;-webkit-user-select:text;user-select:text} @@ -314,6 +314,10 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-frame .fv-image-block-low .fv-image-progress{color:rgb(255 255 255 / .85);text-shadow:0 1px 3px rgb(7 10 16 / .9)} .fv-iv .fv-iv-frame .fv-image-block-low .fv-image-progress b{color:#fff} .fv-iv .fv-iv-frame .fv-image-run-report{position:relative} +/* Waiting for FreeVideo to come back (#1121): the one button on the progress overlay, light on the dark frame. */ +.fv-iv .fv-iv-frame .fv-image-progress .fv-image-stop-waiting{justify-self:center;margin-top:4px;min-height:var(--fv-h-sm,32px);padding:4px 16px;border:1px solid rgb(255 255 255 / .32);border-radius:var(--fv-r-sm,8px);background:rgb(255 255 255 / .08);color:#fff;font:inherit;font-weight:var(--fv-medium,500);text-shadow:none;cursor:pointer} +.fv-iv .fv-iv-frame .fv-image-progress .fv-image-stop-waiting:hover{background:rgb(255 255 255 / .16)} +.fv-iv .fv-iv-frame .fv-image-progress .fv-image-stop-waiting:focus-visible{outline:2px solid var(--fv-focus,#7ab8ff);outline-offset:2px} .fv-iv .fv-iv-meter{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--fv-line2);opacity:0;transition:opacity var(--iv-dur)} .fv-iv .fv-iv-meter::after{content:"";position:absolute;inset:0;background:var(--fv-accent-ink);transform-origin:0 50%;transform:scaleX(var(--p,0));transition:transform .4s var(--iv-ease)} .fv-iv .fv-iv-frame[data-state=running] .fv-iv-meter{opacity:1} @@ -352,37 +356,37 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-cap-info>span:not(.fv-image-done-report){min-width:0;overflow:hidden;text-overflow:ellipsis} .fv-iv .fv-iv-cap-actions{display:flex;align-items:center;gap:4px;flex:none} .fv-iv .fv-iv-cap{position:relative} -.fv-iv .fv-iv-info-btn{margin-left:-8px} -.fv-iv .fv-iv-info-pop{left:0;bottom:48px;width:min(360px,100cqw);max-height:min(360px,calc(100cqh - 120px));overflow:auto;padding:12px 16px;gap:8px;-webkit-user-select:text;user-select:text} -.fv-iv .fv-iv-info-prompt{margin:0 0 4px;font-size:var(--fv-fs-2,13px);line-height:1.6;color:var(--fv-fg)} -.fv-iv .fv-iv-info-row{display:flex;gap:12px;font-size:var(--fv-fs-1,12px);line-height:1.5} -.fv-iv .fv-iv-info-k{flex:none;width:48px;color:var(--fv-fg3)} -.fv-iv .fv-iv-info-v{min-width:0;color:var(--fv-fg2);overflow-wrap:anywhere;font-variant-numeric:tabular-nums} -.fv-studio .fv-iv .fv-iv-info-src{display:inline-flex;align-items:center;gap:8px;min-width:0;max-width:100%;height:32px;min-height:0;padding:0 8px 0 4px;border:0;border-radius:var(--fv-r-sm); +:is(.fv-iv,.fv-work-column) .fv-iv-info-btn{margin-left:-8px} +:is(.fv-iv,.fv-work-column) .fv-iv-info-pop{left:0;bottom:48px;width:min(360px,100cqw);max-height:min(360px,calc(100cqh - 120px));overflow:auto;padding:12px 16px;gap:8px;-webkit-user-select:text;user-select:text} +:is(.fv-iv,.fv-work-column) .fv-iv-info-prompt{margin:0 0 4px;font-size:var(--fv-fs-2,13px);line-height:1.6;color:var(--fv-fg)} +:is(.fv-iv,.fv-work-column) .fv-iv-info-row{display:flex;gap:12px;font-size:var(--fv-fs-1,12px);line-height:1.5} +:is(.fv-iv,.fv-work-column) .fv-iv-info-k{flex:none;width:48px;color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-info-v{min-width:0;color:var(--fv-fg2);overflow-wrap:anywhere;font-variant-numeric:tabular-nums} +.fv-studio :is(.fv-iv,.fv-work-column) .fv-iv-info-src{display:inline-flex;align-items:center;gap:8px;min-width:0;max-width:100%;height:32px;min-height:0;padding:0 8px 0 4px;border:0;border-radius:var(--fv-r-sm); background:var(--fv-ctl-bg);color:var(--fv-fg2);font:inherit;cursor:pointer} .fv-studio .fv-iv .fv-iv-info-src:hover:not(:disabled){background:var(--fv-ctl-hover);color:var(--fv-fg)} -.fv-studio .fv-iv .fv-iv-info-src:disabled{cursor:default;padding-left:8px;color:var(--fv-fg3)} -.fv-iv .fv-iv-info-row-src{align-items:center} -.fv-iv .fv-iv-info-src img{width:24px;height:24px;flex:none;object-fit:cover;border-radius:var(--fv-r-xs)} -.fv-iv .fv-iv-info-src span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} -.fv-iv .fv-iv-info-none{margin:4px 0 0;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} +.fv-studio :is(.fv-iv,.fv-work-column) .fv-iv-info-src:disabled{cursor:default;padding-left:8px;color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-info-row-src{align-items:center} +:is(.fv-iv,.fv-work-column) .fv-iv-info-src img{width:24px;height:24px;flex:none;object-fit:cover;border-radius:var(--fv-r-xs)} +:is(.fv-iv,.fv-work-column) .fv-iv-info-src span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} +:is(.fv-iv,.fv-work-column) .fv-iv-info-none{margin:4px 0 0;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} .fv-iv .fv-copyable{-webkit-user-select:text;user-select:text;cursor:text} -.fv-iv .fv-iv-cap .fv-iv-fav-btn[aria-pressed=true]{background:transparent;color:#e9b43a} -.fv-iv .fv-iv-cap .fv-iv-fav-btn[aria-pressed=true] .fv-iv-icon{fill:currentColor} +:is(.fv-iv,.fv-work-column) .fv-iv-cap .fv-iv-fav-btn[aria-pressed=true]{background:transparent;color:#e9b43a} +:is(.fv-iv,.fv-work-column) .fv-iv-cap .fv-iv-fav-btn[aria-pressed=true] .fv-iv-icon{fill:currentColor} .fv-iv .fv-image-done-report .fv-actions{display:inline-flex} .fv-iv .fv-action.fv-image-report-quiet{height:auto;min-height:0;padding:0 4px;border:0;border-radius:var(--fv-r-sm);background:transparent;color:var(--fv-fg3);font:inherit;font-size:var(--fv-fs-1,12px);font-weight:400;text-decoration:underline;text-underline-offset:2px;cursor:pointer} .fv-iv .fv-action.fv-image-report-quiet:hover:not(:disabled){color:var(--fv-fg)} .fv-iv .fv-iv-more-host{position:relative} -.fv-iv .fv-iv-menu{position:absolute;z-index:20;min-width:200px;padding:8px;border-radius:var(--fv-rad-pop,16px);display:grid;gap:4px;animation:fv-iv-pop 180ms var(--iv-ease)} +:is(.fv-iv,.fv-work-column) .fv-iv-menu{position:absolute;z-index:20;min-width:200px;padding:8px;border-radius:var(--fv-rad-pop,16px);display:grid;gap:4px;animation:fv-iv-pop 180ms var(--iv-ease)} @keyframes fv-iv-pop{from{opacity:0;transform:translateY(4px)}} .fv-iv .fv-iv-more-host .fv-iv-menu{right:0;top:40px} .fv-iv .fv-iv-more-host .fv-iv-menu[data-up]{top:auto;bottom:40px} -.fv-iv .fv-iv-menu-item{display:flex;align-items:center;gap:12px;width:100%;height:34px;padding:0 12px;border:0;border-radius:var(--fv-r-sm);background:transparent;color:var(--fv-fg);font-size:var(--fv-fs-2,13px);text-align:left;white-space:nowrap;cursor:pointer} -.fv-iv .fv-iv-menu-item:hover,.fv-iv .fv-iv-menu-item:focus-visible{background:var(--fv-ctl-hover)} -.fv-iv .fv-iv-menu-item .fv-iv-icon{width:16px;height:16px;color:var(--fv-fg2)} -.fv-iv .fv-iv-menu-item.fv-iv-danger,.fv-iv .fv-iv-menu-item.fv-iv-danger .fv-iv-icon{color:var(--fv-warn)} -.fv-iv .fv-iv-menu-mark{visibility:hidden;color:var(--fv-accent-ink)} -.fv-iv .fv-iv-menu-item[aria-checked=true] .fv-iv-menu-mark{visibility:visible} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-item{display:flex;align-items:center;gap:12px;width:100%;height:34px;padding:0 12px;border:0;border-radius:var(--fv-r-sm);background:transparent;color:var(--fv-fg);font-size:var(--fv-fs-2,13px);text-align:left;white-space:nowrap;cursor:pointer} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-item:hover,:is(.fv-iv,.fv-work-column) .fv-iv-menu-item:focus-visible{background:var(--fv-ctl-hover)} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-item .fv-iv-icon{width:16px;height:16px;color:var(--fv-fg2)} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-item.fv-iv-danger,:is(.fv-iv,.fv-work-column) .fv-iv-menu-item.fv-iv-danger .fv-iv-icon{color:var(--fv-warn)} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-mark{visibility:hidden;color:var(--fv-accent-ink)} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-item[aria-checked=true] .fv-iv-menu-mark{visibility:visible} .fv-iv .fv-iv-shot{transition:opacity 200ms var(--iv-ease),visibility 0s,padding-left 200ms var(--iv-ease)} .fv-iv .fv-iv-stage[data-mode=compare] .fv-iv-shot{opacity:0;visibility:hidden;transition:opacity 200ms var(--iv-ease),visibility 0s 200ms} @@ -410,49 +414,49 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-cs-b{clip-path:inset(0 0 0 var(--cut,50%))} .fv-iv .fv-iv-cs-handle{position:absolute;top:0;bottom:0;left:var(--cut,50%);width:2px;margin-left:-1px;background:#fff;box-shadow:0 0 0 1px rgb(0 0 0 / .25);outline:none} .fv-iv .fv-iv-cs-handle b{display:none} -.fv-iv .fv-iv-cs-handle .fv-iv-icon{position:absolute;top:50%;left:50%;width:36px;height:36px;transform:translate(-50%,-50%);padding:8px;border-radius:var(--fv-r-sm);background:#fff;color:#1a1d24;box-shadow:0 4px 14px rgb(0 0 0 / .35)} -.fv-iv .fv-iv-cs-handle:focus-visible .fv-iv-icon{box-shadow:0 0 0 3px var(--fv-accent-line),0 4px 14px rgb(0 0 0 / .35)} +:is(.fv-iv,.fv-work-column) .fv-iv-cs-handle .fv-iv-icon{position:absolute;top:50%;left:50%;width:36px;height:36px;transform:translate(-50%,-50%);padding:8px;border-radius:var(--fv-r-sm);background:#fff;color:#1a1d24;box-shadow:0 4px 14px rgb(0 0 0 / .35)} +:is(.fv-iv,.fv-work-column) .fv-iv-cs-handle:focus-visible .fv-iv-icon{box-shadow:0 0 0 3px var(--fv-accent-line),0 4px 14px rgb(0 0 0 / .35)} .fv-iv .fv-iv-cl-b{left:auto;right:8px} .fv-iv .fv-iv-cnum{display:grid;place-items:center;min-width:16px;height:16px;padding:0 4px;box-sizing:border-box;border-radius:var(--fv-r-pill);background:#fff;color:#1a1d24;font-weight:600;font-variant-numeric:tabular-nums} .fv-studio .fv-iv .fv-iv-clabel-btn{pointer-events:auto;min-height:0;border:0;font-family:inherit;cursor:pointer} .fv-studio .fv-iv .fv-iv-clabel-btn:hover{background:rgb(0 0 0 / .7)} /* ── works ── */ -.fv-iv .fv-iv-works{flex:1;min-height:0;display:flex;flex-direction:column;position:relative} -.fv-iv .fv-iv-works-tools{flex:none;display:flex;align-items:center;gap:4px;padding:0 12px 8px} -.fv-iv .fv-iv-search{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:32px;margin:0;padding:0 12px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);color:var(--fv-fg3)} -.fv-iv .fv-iv-search:focus-within{box-shadow:inset 0 0 0 1.5px var(--fv-accent-line)} -.fv-iv .fv-iv-search .fv-iv-icon{width:16px;height:16px} -.fv-studio .fv-iv .fv-iv-search input{flex:1;min-width:0;height:100%;padding:0;border:0;background:none;color:var(--fv-fg);font:inherit} -.fv-iv .fv-iv-search input::-webkit-search-cancel-button{-webkit-appearance:none} -.fv-iv .fv-iv-chips{flex:none;display:flex;flex-wrap:wrap;gap:4px 8px;padding:0 12px 8px} -.fv-iv .fv-iv-chips::-webkit-scrollbar{display:none} -.fv-iv .fv-iv-works>.fv-iv-menu{right:48px;top:92px} -.fv-iv .fv-iv-works-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:auto;overscroll-behavior:contain;padding:0 12px 12px;scrollbar-width:thin;scrollbar-color:var(--fv-line2) transparent} -.fv-iv .fv-iv-day{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:8px;height:32px;margin:0 -12px;padding:0 12px;font-size:var(--fv-fs-1,12px);font-weight:600;color:var(--fv-fg3); +:is(.fv-iv,.fv-work-column) .fv-iv-works{flex:1;min-height:0;display:flex;flex-direction:column;position:relative} +:is(.fv-iv,.fv-work-column) .fv-iv-works-tools{flex:none;display:flex;align-items:center;gap:4px;padding:0 12px 8px} +:is(.fv-iv,.fv-work-column) .fv-iv-search{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:32px;margin:0;padding:0 12px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-search:focus-within{box-shadow:inset 0 0 0 1.5px var(--fv-accent-line)} +:is(.fv-iv,.fv-work-column) .fv-iv-search .fv-iv-icon{width:16px;height:16px} +.fv-studio :is(.fv-iv,.fv-work-column) .fv-iv-search input{flex:1;min-width:0;height:100%;padding:0;border:0;background:none;color:var(--fv-fg);font:inherit} +:is(.fv-iv,.fv-work-column) .fv-iv-search input::-webkit-search-cancel-button{-webkit-appearance:none} +:is(.fv-iv,.fv-work-column) .fv-iv-chips{flex:none;display:flex;flex-wrap:wrap;gap:4px 8px;padding:0 12px 8px} +:is(.fv-iv,.fv-work-column) .fv-iv-chips::-webkit-scrollbar{display:none} +:is(.fv-iv,.fv-work-column) .fv-iv-works>.fv-iv-menu{right:48px;top:92px} +:is(.fv-iv,.fv-work-column) .fv-iv-works-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:auto;overscroll-behavior:contain;padding:0 12px 12px;scrollbar-width:thin;scrollbar-color:var(--fv-line2) transparent} +:is(.fv-iv,.fv-work-column) .fv-iv-day{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:8px;height:32px;margin:0 -12px;padding:0 12px;font-size:var(--fv-fs-1,12px);font-weight:600;color:var(--fv-fg3); background:linear-gradient(rgb(var(--fv-tint) / .92) 70%,rgb(var(--fv-tint) / 0))} :root[data-glass=solid] .fv-iv .fv-iv-day,:root.lite .fv-iv-day{background:rgb(var(--fv-solid2))} -.fv-iv .fv-iv-day-n{font-weight:400} -.fv-iv .fv-iv-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:8px} -.fv-iv .fv-iv-tile{position:relative;aspect-ratio:1;border-radius:var(--fv-rad-ctl,12px);overflow:hidden;background:rgb(var(--fv-tint));transition:transform var(--fv-dur-1,160ms) var(--iv-ease),box-shadow var(--fv-dur-1,160ms)} +:is(.fv-iv,.fv-work-column) .fv-iv-day-n{font-weight:400} +:is(.fv-iv,.fv-work-column) .fv-iv-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:8px} +:is(.fv-iv,.fv-work-column) .fv-iv-tile{position:relative;aspect-ratio:1;border-radius:var(--fv-rad-ctl,12px);overflow:hidden;background:rgb(var(--fv-tint));transition:transform var(--fv-dur-1,160ms) var(--iv-ease),box-shadow var(--fv-dur-1,160ms)} /* Only the tiles in sight are laid out and drawn: a long works list costs nothing when the view comes back. */ -.fv-iv .fv-iv-tile{content-visibility:auto;contain-intrinsic-size:auto 96px} -.fv-iv .fv-iv-tile:hover{transform:scale(1.03)} -.fv-iv .fv-iv-tile:active{transform:scale(.98);transition-duration:60ms} -.fv-iv .fv-iv-tile-open{position:absolute;inset:0;width:100%;height:100%;padding:0;border:0;background:none;cursor:pointer} -.fv-iv .fv-iv-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;transition:transform var(--iv-dur) var(--iv-ease),border-radius var(--iv-dur) var(--iv-ease)} +:is(.fv-iv,.fv-work-column) .fv-iv-tile{content-visibility:auto;contain-intrinsic-size:auto 96px} +:is(.fv-iv,.fv-work-column) .fv-iv-tile:hover{transform:scale(1.03)} +:is(.fv-iv,.fv-work-column) .fv-iv-tile:active{transform:scale(.98);transition-duration:60ms} +:is(.fv-iv,.fv-work-column) .fv-iv-tile-open{position:absolute;inset:0;width:100%;height:100%;padding:0;border:0;background:none;cursor:pointer} +:is(.fv-iv,.fv-work-column) .fv-iv-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;transition:transform var(--iv-dur) var(--iv-ease),border-radius var(--iv-dur) var(--iv-ease)} /* placeholders while a picture loads: a soft moving sheen on the frame or tile; the picture fades in whole */ @keyframes fv-iv-sheen{from{background-position:100% 0}to{background-position:-100% 0}} -.fv-iv .fv-iv-frame[data-loading=true] .fv-iv-pic,.fv-iv .fv-iv-tile[data-hx-unl]{ +.fv-iv .fv-iv-frame[data-loading=true] .fv-iv-pic,:is(.fv-iv,.fv-work-column) .fv-iv-tile[data-hx-unl]{ background:linear-gradient(100deg,rgb(var(--fv-tint)) 30%,color-mix(in srgb,rgb(var(--fv-tint)) 88%,#fff) 50%,rgb(var(--fv-tint)) 70%) 0 0/200% 100%;animation:fv-iv-sheen 1.4s linear infinite} -.fv-iv .fv-iv-picture[data-loaded=false],.fv-iv .fv-iv-tile img[data-loaded=false]{opacity:0;animation:none} -.fv-iv .fv-iv-tile img[data-loaded=true]{animation:fv-iv-in 120ms var(--iv-ease)} -.fv-iv .fv-iv-tile.fv-iv-current[data-hx-unl]::after{display:none} +.fv-iv .fv-iv-picture[data-loaded=false],:is(.fv-iv,.fv-work-column) .fv-iv-tile img[data-loaded=false]{opacity:0;animation:none} +:is(.fv-iv,.fv-work-column) .fv-iv-tile img[data-loaded=true]{animation:fv-iv-in 120ms var(--iv-ease)} +:is(.fv-iv,.fv-work-column) .fv-iv-tile.fv-iv-current[data-hx-unl]::after{display:none} /* a picture whose file is gone: a plain tile or frame in place of the browser's broken-image mark */ -.fv-iv img[data-missing=true]{visibility:hidden} +:is(.fv-iv,.fv-work-column) img[data-missing=true]{visibility:hidden} .fv-iv .fv-iv-cap[data-missing=true] .fv-image-action,.fv-iv .fv-iv-cap[data-missing=true] .fv-iv-sep{display:none} .fv-iv .fv-iv-pic[data-hx-miss]{background:rgb(var(--fv-tint))} -@media(prefers-reduced-motion:reduce){.fv-iv .fv-iv-frame[data-loading=true] .fv-iv-pic,.fv-iv .fv-iv-tile[data-hx-unl]{animation:none}} +@media(prefers-reduced-motion:reduce){.fv-iv .fv-iv-frame[data-loading=true] .fv-iv-pic,:is(.fv-iv,.fv-work-column) .fv-iv-tile[data-hx-unl]{animation:none}} /* the shown picture opens large on a click */ .fv-iv .fv-iv-frame[data-state=done] .fv-iv-picture{cursor:zoom-in} .fv-image .fv-iv-viewer{position:fixed;inset:0;z-index:40;display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);place-items:center;padding:24px;box-sizing:border-box;background:rgb(0 0 0 / .92);opacity:0;transition:opacity 160ms ease;outline:none} @@ -462,27 +466,27 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-image .fv-iv-viewer .fv-iv-viewer-x{position:absolute;top:16px;right:16px;width:40px;height:40px;color:#fff;background:rgb(255 255 255 / .12)} .fv-image .fv-iv-viewer .fv-iv-viewer-x:hover{background:rgb(255 255 255 / .2)} @media(prefers-reduced-motion:reduce){.fv-image .fv-iv-viewer{transition:none}} -.fv-iv .fv-iv-tile.fv-iv-current::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 2px var(--fv-accent-ink),inset 0 0 0 4px rgb(0 0 0 / .25);pointer-events:none} -.fv-iv .fv-iv-tile-check{position:absolute;left:4px;top:4px;width:24px;height:24px;padding:0;border:0;border-radius:var(--fv-r-pill);display:grid;place-items:center;color:transparent;cursor:pointer; +:is(.fv-iv,.fv-work-column) .fv-iv-tile.fv-iv-current::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 2px var(--fv-accent-ink),inset 0 0 0 4px rgb(0 0 0 / .25);pointer-events:none} +:is(.fv-iv,.fv-work-column) .fv-iv-tile-check{position:absolute;left:4px;top:4px;width:24px;height:24px;padding:0;border:0;border-radius:var(--fv-r-pill);display:grid;place-items:center;color:transparent;cursor:pointer; box-shadow:inset 0 0 0 1.5px rgb(255 255 255 / .9);background:rgb(0 0 0 / .25);opacity:0;transition:opacity var(--fv-dur-1,160ms)} -.fv-iv .fv-iv-tile-check .fv-iv-icon{width:14px;height:14px;stroke-width:2.4} -.fv-iv .fv-iv-tile:hover .fv-iv-tile-check,.fv-iv .fv-iv-works[data-selecting=true] .fv-iv-tile-check,.fv-iv .fv-iv-tile-check:focus-visible{opacity:1} -.fv-iv .fv-iv-tile.fv-iv-picked .fv-iv-tile-check{opacity:1;background:var(--fv-accent-fill);box-shadow:none;color:#fff} -.fv-iv .fv-iv-tile.fv-iv-picked img{transform:scale(.88);border-radius:var(--fv-r-sm)} -.fv-iv .fv-iv-tile.fv-iv-picked{box-shadow:inset 0 0 0 2px var(--fv-accent-line)} -.fv-iv .fv-iv-tile-star{position:absolute;right:4px;top:4px;width:20px;height:20px;border-radius:var(--fv-r-pill);display:none;place-items:center;background:rgb(0 0 0 / .45);color:#ffd166;pointer-events:none} -.fv-iv .fv-iv-tile-star .fv-iv-icon{width:12px;height:12px;fill:currentColor} -.fv-iv .fv-iv-tile.fv-iv-fav .fv-iv-tile-star{display:grid} -.fv-iv .fv-iv-tile-run{display:grid;place-items:center;background:#161a22} -.fv-iv .fv-iv-tile-run::before{content:"";position:absolute;inset:0;background:rgb(0 0 0 / .32);z-index:1} -.fv-iv .fv-iv-ring{position:relative;z-index:2;width:30px;height:30px;border-radius:var(--fv-r-pill);background:conic-gradient(#fff calc(var(--p,0) * 360deg),rgb(255 255 255 / .3) 0); +:is(.fv-iv,.fv-work-column) .fv-iv-tile-check .fv-iv-icon{width:14px;height:14px;stroke-width:2.4} +:is(.fv-iv,.fv-work-column) .fv-iv-tile:hover .fv-iv-tile-check,:is(.fv-iv,.fv-work-column) .fv-iv-works[data-selecting=true] .fv-iv-tile-check,:is(.fv-iv,.fv-work-column) .fv-iv-tile-check:focus-visible{opacity:1} +:is(.fv-iv,.fv-work-column) .fv-iv-tile.fv-iv-picked .fv-iv-tile-check{opacity:1;background:var(--fv-accent-fill);box-shadow:none;color:#fff} +:is(.fv-iv,.fv-work-column) .fv-iv-tile.fv-iv-picked img{transform:scale(.88);border-radius:var(--fv-r-sm)} +:is(.fv-iv,.fv-work-column) .fv-iv-tile.fv-iv-picked{box-shadow:inset 0 0 0 2px var(--fv-accent-line)} +:is(.fv-iv,.fv-work-column) .fv-iv-tile-star{position:absolute;right:4px;top:4px;width:20px;height:20px;border-radius:var(--fv-r-pill);display:none;place-items:center;background:rgb(0 0 0 / .45);color:#ffd166;pointer-events:none} +:is(.fv-iv,.fv-work-column) .fv-iv-tile-star .fv-iv-icon{width:12px;height:12px;fill:currentColor} +:is(.fv-iv,.fv-work-column) .fv-iv-tile.fv-iv-fav .fv-iv-tile-star{display:grid} +:is(.fv-iv,.fv-work-column) .fv-iv-tile-run{display:grid;place-items:center;background:#161a22} +:is(.fv-iv,.fv-work-column) .fv-iv-tile-run::before{content:"";position:absolute;inset:0;background:rgb(0 0 0 / .32);z-index:1} +:is(.fv-iv,.fv-work-column) .fv-iv-ring{position:relative;z-index:2;width:30px;height:30px;border-radius:var(--fv-r-pill);background:conic-gradient(#fff calc(var(--p,0) * 360deg),rgb(255 255 255 / .3) 0); -webkit-mask:radial-gradient(circle,transparent 11px,#000 12px);mask:radial-gradient(circle,transparent 11px,#000 12px);transition:background .4s} -.fv-iv .fv-iv-panel-foot.fv-iv-batch,.fv-iv .fv-iv-batch,.fv-iv .fv-iv-links{display:flex;align-items:center;gap:4px;min-height:32px} +:is(.fv-iv,.fv-work-column) .fv-iv-panel-foot.fv-iv-batch,.fv-iv .fv-iv-batch,:is(.fv-iv,.fv-work-column) .fv-iv-links{display:flex;align-items:center;gap:4px;min-height:32px} .fv-iv .fv-iv-picked{font-size:var(--fv-fs-2,13px);color:var(--fv-fg);font-weight:600;margin:0 8px 0 4px;white-space:nowrap} -.fv-iv .fv-iv-link{height:32px;padding:0 8px 0 0;color:var(--fv-fg2)} -.fv-iv .fv-iv-link .fv-iv-icon{width:16px;height:16px} -.fv-iv .fv-iv-link-n{min-width:18px;height:18px;padding:0 4px;border-radius:var(--fv-r-sm);display:inline-grid;place-items:center;font-size:var(--fv-fs-1,12px);font-weight:600;color:var(--fv-accent-ink);background:var(--fv-accent-soft)} -.fv-iv .fv-iv-link-n:empty{display:none} +:is(.fv-iv,.fv-work-column) .fv-iv-link{height:32px;padding:0 8px 0 0;color:var(--fv-fg2)} +:is(.fv-iv,.fv-work-column) .fv-iv-link .fv-iv-icon{width:16px;height:16px} +:is(.fv-iv,.fv-work-column) .fv-iv-link-n{min-width:18px;height:18px;padding:0 4px;border-radius:var(--fv-r-sm);display:inline-grid;place-items:center;font-size:var(--fv-fs-1,12px);font-weight:600;color:var(--fv-accent-ink);background:var(--fv-accent-soft)} +:is(.fv-iv,.fv-work-column) .fv-iv-link-n:empty{display:none} .fv-iv .fv-iv-trash-head{display:flex;align-items:center;gap:4px;height:40px} .fv-iv .fv-iv-trash-note{margin:0 0 8px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} .fv-iv .fv-iv-trash-list{display:flex;flex-direction:column;gap:4px} @@ -491,7 +495,7 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-trash-tx{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px} .fv-iv .fv-iv-trash-tx b{font-size:var(--fv-fs-2,13px);font-weight:500;color:var(--fv-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .fv-iv .fv-iv-trash-tx small{font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} -.fv-iv .fv-iv-works[data-view=trash] .fv-iv-chips{display:none} +:is(.fv-iv,.fv-work-column) .fv-iv-works[data-view=trash] .fv-iv-chips{display:none} /* solid fallback: panels keep a visible edge so the layers still read apart */ :is(:root[data-glass=solid],:root.lite) .fv-iv .fv-iv-panel{box-shadow:inset 0 1px 0 var(--fv-edge-hi),var(--fv-sh1)} @@ -502,15 +506,15 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-panel{z-index:4} .fv-iv[data-drawer=left] .fv-iv-left,.fv-iv[data-drawer=right] .fv-iv-right{box-shadow:inset 0 1px 0 var(--fv-edge-hi),var(--fv-sh3)} } -@media(max-width:1279px){.fv-iv{--iv-lw:320px;--iv-rw:320px}} -@media(max-width:900px){.fv-iv .fv-iv-cap .fv-iv-text-btn .fv-iv-btn-label{display:none}.fv-iv .fv-iv-cap .fv-iv-text-btn{width:32px;padding:0} +@media(max-width:1279px){.fv-iv{--iv-lw:var(--fv-col-w,300px);--iv-rw:var(--fv-col-w,300px)}} +@media(max-width:900px){:is(.fv-iv,.fv-work-column) .fv-iv-cap .fv-iv-text-btn .fv-iv-btn-label{display:none}.fv-iv .fv-iv-cap .fv-iv-text-btn{width:32px;padding:0} .fv-iv .fv-iv-cap{width:min(100cqw,max(240px,min(100cqw,calc((100cqh - 88px) * var(--ar)))))} } @media(max-width:719px){ .fv-iv{overflow:auto;display:flex;flex-direction:column;gap:12px;padding:8px 12px 0;--iv-gut:0px} .fv-iv .fv-iv-panel,.fv-iv .fv-iv-stage{position:relative;inset:auto;left:auto;right:auto;top:auto;bottom:auto;width:auto;flex:none} .fv-iv .fv-iv-panel[data-collapsed=true]>:not(.fv-iv-rail){opacity:1;pointer-events:auto;visibility:visible} - .fv-iv .fv-iv-rail,.fv-iv .fv-iv-collapse,.fv-iv .fv-iv-show-works{display:none!important} + :is(.fv-iv,.fv-work-column) .fv-iv-rail,:is(.fv-iv,.fv-work-column) .fv-iv-collapse,.fv-iv .fv-iv-show-works{display:none!important} /* The scrolling area stops above the fixed Generate console, so nothing ever slides under it. */ .fv-iv{flex:none;padding-bottom:12px;height:calc(100dvh - var(--fv-header-h,56px) - 132px - env(safe-area-inset-bottom));min-height:240px} .fv-iv .fv-iv-stage{order:0}.fv-iv .fv-iv-left{order:1;overflow:visible}.fv-iv .fv-iv-right{order:2} @@ -525,7 +529,7 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv .fv-iv-slot{margin-bottom:8px} /* a blurred panel would hold the fixed console inside itself */ .fv-iv .fv-iv-left.fv-glass{-webkit-backdrop-filter:none;backdrop-filter:none;background:rgb(var(--fv-solid2))} - .fv-iv .fv-iv-cap .fv-iv-text-btn .fv-iv-btn-label{display:none} + :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-cap .fv-iv-text-btn .fv-iv-btn-label{display:none} .fv-iv .fv-iv-cap{width:100cqw;height:80px;flex-wrap:wrap;align-content:center;row-gap:4px} .fv-iv .fv-iv-cap-info{flex:1 1 100%} .fv-iv .fv-iv-cap-actions{flex:1;justify-content:flex-end} @@ -538,43 +542,41 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} } /* ── right column pages ── */ -.fv-iv .fv-iv-works>.fv-iv-panel-head{display:none} -.fv-iv .fv-iv-col-head{gap:4px;padding:0 12px} -.fv-iv .fv-iv-col-tabs{flex:1;min-width:0} -.fv-iv .fv-iv-col-tabs>button{padding:0 8px;gap:4px} -.fv-iv .fv-iv-tab-n{font-size:var(--fv-fs-1,12px);font-weight:400;color:var(--fv-fg3);font-variant-numeric:tabular-nums} -.fv-iv .fv-iv-tab-n:empty{display:none} -.fv-iv .fv-iv-col-pane{flex:1;min-height:0;display:flex;flex-direction:column} -.fv-iv .fv-iv-info-pane{overflow:auto;padding:4px 16px 16px} -.fv-iv .fv-iv-info{display:grid;gap:8px;-webkit-user-select:text;user-select:text} -.fv-iv .fv-iv-info-prompt{margin:0 0 4px;padding:12px;border-radius:var(--fv-rad-ctl,12px);background:var(--iv-well);box-shadow:inset 0 0 0 1px var(--fv-line);font-size:var(--fv-fs-2,13px);line-height:1.6;color:var(--fv-fg)} -.fv-iv .fv-iv-info-acts{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px} -.fv-iv .fv-iv-queue-body{flex:1;min-height:0;overflow:auto;padding:0 12px 12px} -.fv-iv .fv-iv-qrow{position:relative;display:flex;align-items:center;gap:4px;margin-bottom:4px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg)} -.fv-iv .fv-iv-qrow-open{flex:1;min-width:0;display:flex;align-items:center;gap:12px;padding:8px;border-radius:var(--fv-rad-ctl,12px);text-align:left;cursor:pointer} -.fv-iv .fv-iv-qrow-open:hover{background:var(--fv-ctl-hover)} -.fv-iv .fv-iv-qthumb{width:48px;height:28px;flex:none;border-radius:var(--fv-r-sm);overflow:hidden;display:grid;place-items:center;background:rgb(var(--fv-tint));color:var(--fv-fg3)} -.fv-iv .fv-iv-qthumb img{width:100%;height:100%;object-fit:cover;display:block} -.fv-iv .fv-iv-qthumb .fv-iv-icon{width:16px;height:16px} -.fv-iv .fv-iv-qtx{min-width:0;display:flex;flex-direction:column;gap:4px} -.fv-iv .fv-iv-qtx b{font-size:var(--fv-fs-2,13px);font-weight:500;color:var(--fv-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} -.fv-iv .fv-iv-qtx small{font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} -.fv-iv .fv-iv-qrow[data-status=failed] .fv-iv-qtx small,.fv-iv .fv-iv-qrow[data-status=interrupted] .fv-iv-qtx small{color:var(--fv-warn)} -.fv-iv .fv-iv-qrow[data-status=running] .fv-iv-qtx small{color:var(--fv-accent-ink)} -.fv-iv .fv-iv-qbar{position:absolute;left:68px;right:12px;bottom:4px;height:2px;border-radius:var(--fv-r-xs);background:var(--fv-line2);overflow:hidden} -.fv-iv .fv-iv-qbar::after{content:"";position:absolute;inset:0;background:var(--fv-accent-ink);transform-origin:0 50%;transform:scaleX(var(--p,0));transition:transform .4s var(--iv-ease)} -.fv-iv .fv-iv-qstop{margin-right:4px;color:var(--fv-fg3)} -.fv-iv .fv-iv-queue-foot{display:flex;align-items:center;gap:8px;min-height:48px} -.fv-iv .fv-iv-queue-sum{font-size:var(--fv-fs-2,13px);color:var(--fv-fg2);font-variant-numeric:tabular-nums} +:is(.fv-iv,.fv-work-column) .fv-iv-works>.fv-iv-panel-head{display:none} +:is(.fv-iv,.fv-work-column) .fv-iv-col-head{gap:4px;padding:0 12px} +:is(.fv-iv,.fv-work-column) .fv-iv-col-tabs{flex:1;min-width:0} +:is(.fv-iv,.fv-work-column) .fv-iv-col-tabs>button{padding:0 8px;gap:4px} +:is(.fv-iv,.fv-work-column) .fv-iv-tab-n{font-size:var(--fv-fs-1,12px);font-weight:400;color:var(--fv-fg3);font-variant-numeric:tabular-nums} +:is(.fv-iv,.fv-work-column) .fv-iv-tab-n:empty{display:none} +:is(.fv-iv,.fv-work-column) .fv-iv-col-pane{flex:1;min-height:0;display:flex;flex-direction:column} +:is(.fv-iv,.fv-work-column) .fv-iv-info-pane{overflow:auto;padding:4px 16px 16px} +:is(.fv-iv,.fv-work-column) .fv-iv-info{display:grid;gap:8px;-webkit-user-select:text;user-select:text} +:is(.fv-iv,.fv-work-column) .fv-iv-info-prompt{margin:0 0 4px;padding:12px;border-radius:var(--fv-rad-ctl,12px);background:var(--iv-well);box-shadow:inset 0 0 0 1px var(--fv-line);font-size:var(--fv-fs-2,13px);line-height:1.6;color:var(--fv-fg)} +:is(.fv-iv,.fv-work-column) .fv-iv-info-acts{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px} +:is(.fv-iv,.fv-work-column) .fv-iv-queue-body{flex:1;min-height:0;overflow:auto;padding:0 12px 12px} +:is(.fv-iv,.fv-work-column) .fv-iv-qrow{position:relative;display:flex;align-items:center;gap:4px;margin-bottom:4px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg)} +:is(.fv-iv,.fv-work-column) .fv-iv-qrow-open{flex:1;min-width:0;display:flex;align-items:center;gap:12px;padding:8px;border-radius:var(--fv-rad-ctl,12px);text-align:left;cursor:pointer} +:is(.fv-iv,.fv-work-column) .fv-iv-qrow-open:hover{background:var(--fv-ctl-hover)} +:is(.fv-iv,.fv-work-column) .fv-iv-qthumb{width:48px;height:28px;flex:none;border-radius:var(--fv-r-sm);overflow:hidden;display:grid;place-items:center;background:rgb(var(--fv-tint));color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-qthumb img{width:100%;height:100%;object-fit:cover;display:block} +:is(.fv-iv,.fv-work-column) .fv-iv-qthumb .fv-iv-icon{width:16px;height:16px} +:is(.fv-iv,.fv-work-column) .fv-iv-qtx{min-width:0;display:flex;flex-direction:column;gap:4px} +:is(.fv-iv,.fv-work-column) .fv-iv-qtx b{font-size:var(--fv-fs-2,13px);font-weight:500;color:var(--fv-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} +:is(.fv-iv,.fv-work-column) .fv-iv-qtx small{font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} +:is(.fv-iv,.fv-work-column) .fv-iv-qrow[data-status=failed] .fv-iv-qtx small,:is(.fv-iv,.fv-work-column) .fv-iv-qrow[data-status=interrupted] .fv-iv-qtx small{color:var(--fv-warn)} +:is(.fv-iv,.fv-work-column) .fv-iv-qrow[data-status=running] .fv-iv-qtx small{color:var(--fv-accent-ink)} +:is(.fv-iv,.fv-work-column) .fv-iv-qbar{position:absolute;left:68px;right:12px;bottom:4px;height:2px;border-radius:var(--fv-r-xs);background:var(--fv-line2);overflow:hidden} +:is(.fv-iv,.fv-work-column) .fv-iv-qbar::after{content:"";position:absolute;inset:0;background:var(--fv-accent-ink);transform-origin:0 50%;transform:scaleX(var(--p,0));transition:transform .4s var(--iv-ease)} +:is(.fv-iv,.fv-work-column) .fv-iv-qstop{margin-right:4px;color:var(--fv-fg3)} /* ── status line ── */ .fv-iv .fv-iv-sbar{position:absolute;left:0;right:0;bottom:0;height:var(--iv-sbar);z-index:3;display:flex;align-items:center;gap:12px;padding:0 12px 0 20px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3)} .fv-iv .fv-iv-sbar-state,.fv-iv .fv-iv-receipt{display:flex;align-items:center;gap:8px;white-space:nowrap} .fv-iv .fv-iv-receipt{color:var(--fv-fg2)} -.fv-iv .fv-iv-receipt .fv-iv-icon{width:14px;height:14px} +:is(.fv-iv,.fv-work-column) .fv-iv-receipt .fv-iv-icon{width:14px;height:14px} .fv-iv .fv-iv-receipt-act{height:24px;padding:0 8px;color:var(--fv-accent-ink);font-size:var(--fv-fs-1,12px);font-weight:600} -.fv-iv .fv-iv-sbar .fv-iv-icon-btn{width:28px;height:28px;color:var(--fv-fg3)} -.fv-iv .fv-iv-sbar .fv-iv-icon-btn .fv-iv-icon{width:16px;height:16px} +:is(.fv-iv,.fv-work-column) .fv-iv-sbar .fv-iv-icon-btn{width:28px;height:28px;color:var(--fv-fg3)} +:is(.fv-iv,.fv-work-column) .fv-iv-sbar .fv-iv-icon-btn .fv-iv-icon{width:16px;height:16px} .fv-iv .fv-iv-dot{width:8px;height:8px;border-radius:var(--fv-r-pill);background:var(--fv-ok,#3fcf8e);box-shadow:0 0 0 3px color-mix(in srgb,var(--fv-ok,#3fcf8e) 18%,transparent)} .fv-iv .fv-iv-dot-wait{background:var(--fv-fg3);box-shadow:none} .fv-iv .fv-iv-keys{right:0;bottom:36px;min-width:280px;padding:8px 12px} @@ -586,36 +588,36 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} .fv-iv[data-density=compact] .fv-iv-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px} .fv-iv[data-density=compact] .fv-iv-sec{padding-bottom:8px} @media(max-width:719px){.fv-iv .fv-iv-sbar{display:none}.fv-iv{--iv-sbar:0px}} -.fv-iv .fv-iv-prompt-bar .fv-iv-ref-tool{color:var(--fv-fg2);padding:0 8px 0 0} -.fv-iv .fv-iv-prompt-bar .fv-iv-sketch-tool{color:var(--fv-fg2)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-iv-ref-tool{color:var(--fv-fg2);padding:0 8px 0 0} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar .fv-iv-sketch-tool{color:var(--fv-fg2)} .fv-iv .fv-iv-ref-sketch{position:absolute;left:2px;top:2px;max-width:calc(100% - 4px);height:16px;padding:0 4px;box-sizing:border-box;border-radius:var(--fv-r-xs);display:flex;align-items:center; font-style:normal;font-size:var(--fv-fs-1,12px);font-weight:600;line-height:16px;color:#1a1d24;background:rgb(255 255 255 / .9);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none} .fv-iv .fv-iv-ref-count{color:var(--fv-fg3);font-weight:400;font-variant-numeric:tabular-nums} -.fv-iv .fv-iv-sec[data-drop=true] .fv-iv-prompt{box-shadow:inset 0 0 0 2px var(--fv-accent-line)} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-drop=true] .fv-iv-prompt{box-shadow:inset 0 0 0 2px var(--fv-accent-line)} /* glass that stays smooth: panels paint on their own, blur pauses while their content scrolls, the day bar is solid */ .fv-iv .fv-iv-panel{contain:paint} .fv-iv .fv-iv-panel.fv-glass[data-scrolling=true]{-webkit-backdrop-filter:none;backdrop-filter:none;background:rgb(var(--fv-solid2))} -.fv-iv .fv-iv-day{background:rgb(var(--fv-solid2))} +:is(.fv-iv,.fv-work-column) .fv-iv-day{background:rgb(var(--fv-solid2))} .fv-iv{--iv-sbar:0px} .fv-iv .fv-iv-sbar{display:none} -.fv-iv .fv-iv-menu-item>span{flex:1;min-width:0} +:is(.fv-iv,.fv-work-column) .fv-iv-menu-item>span{flex:1;min-width:0} /* Phone: every target at least 44 px (the a11y layer's rule for phones). Buttons that already read as rows grow; small marks (a tile's tick, the shape row) keep their look and take a transparent margin for the finger. */ @media(max-width:720px){ - .fv-iv :is(.fv-iv-icon-btn,.fv-iv-btn.fv-iv-icon-btn){min-width:44px;min-height:44px} - .fv-iv :is(.fv-iv-text-btn,.fv-iv-chip,.fv-iv-link,.fv-iv-model-action){min-height:44px} - .fv-iv .fv-iv-chip{min-width:44px} + :is(.fv-iv,.fv-work-column,.fv-sc-col) :is(.fv-iv-icon-btn,.fv-iv-btn.fv-iv-icon-btn){min-width:44px;min-height:44px} + :is(.fv-iv,.fv-work-column,.fv-sc-col) :is(.fv-iv-text-btn,.fv-iv-chip,.fv-iv-link,.fv-iv-model-action){min-height:44px} + :is(.fv-iv,.fv-work-column) .fv-iv-chip{min-width:44px} .fv-iv .fv-iv-field{height:44px} - .fv-iv .fv-iv-seg>button{min-height:44px} - .fv-iv .fv-iv-tile-check{box-sizing:content-box;border:12px solid transparent;background-clip:padding-box;margin:-12px;opacity:1} + :is(.fv-iv,.fv-work-column) .fv-iv-seg>button{min-height:44px} + :is(.fv-iv,.fv-work-column) .fv-iv-tile-check{box-sizing:content-box;border:12px solid transparent;background-clip:padding-box;margin:-12px;opacity:1} .fv-iv .fv-iv-ref :is(.fv-image-reference-remove,.fv-iv-ref-restore){box-sizing:content-box;border:12px solid transparent;background-clip:padding-box;margin:-12px} /* four to a row: each corner button's finger room stays clear of the picture's middle, which opens the editor */ .fv-iv .fv-iv-refs{grid-template-columns:repeat(4,minmax(0,1fr))} .fv-image .fv-iv-at .fv-iv-at-item{height:44px} .fv-iv .fv-iv-cap{height:auto;min-height:96px} .fv-iv .fv-iv-cap .fv-iv-text-btn{width:44px;min-width:44px} - .fv-iv .fv-iv-search{height:44px} + :is(.fv-iv,.fv-work-column) .fv-iv-search{height:44px} /* paint containment would hold the fixed Generate console inside the panel */ .fv-iv .fv-iv-left{contain:none} .fv-iv .fv-iv-canvas{height:min(calc(100vw - 24px + 104px),76vh)} @@ -624,29 +626,29 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} /* Tablets: the same finger sizes as phones, in the side-panel layout. Mouse sizes are unchanged. */ @media(pointer:coarse){ - .fv-iv :is(.fv-iv-icon-btn,.fv-iv-btn.fv-iv-icon-btn){min-width:var(--fv-touch);min-height:var(--fv-touch)} - .fv-iv :is(.fv-iv-text-btn,.fv-iv-chip,.fv-iv-link,.fv-iv-model-action){min-height:var(--fv-touch)} - .fv-iv .fv-iv-chip{min-width:var(--fv-touch)} - .fv-iv :is(.fv-iv-field,.fv-iv-search){height:var(--fv-touch)} - .fv-iv .fv-iv-seg>button{min-height:var(--fv-touch)} - .fv-iv .fv-iv-prompt-bar{height:auto} - .fv-iv.fv-iv .fv-iv-prompt-bar :is(.fv-ed-expand,.fv-iv-reverse-tool){width:var(--fv-touch);height:var(--fv-touch);min-width:var(--fv-touch);min-height:var(--fv-touch);margin-left:0} + :is(.fv-iv,.fv-work-column,.fv-sc-col) :is(.fv-iv-icon-btn,.fv-iv-btn.fv-iv-icon-btn){min-width:var(--fv-touch);min-height:var(--fv-touch)} + :is(.fv-iv,.fv-work-column,.fv-sc-col) :is(.fv-iv-text-btn,.fv-iv-chip,.fv-iv-link,.fv-iv-model-action){min-height:var(--fv-touch)} + :is(.fv-iv,.fv-work-column) .fv-iv-chip{min-width:var(--fv-touch)} + :is(.fv-iv,.fv-work-column) :is(.fv-iv-field,.fv-iv-search){height:var(--fv-touch)} + :is(.fv-iv,.fv-work-column) .fv-iv-seg>button{min-height:var(--fv-touch)} + :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar{height:auto} + :is(.fv-iv.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-prompt-bar :is(.fv-ed-expand,.fv-iv-reverse-tool){width:var(--fv-touch);height:var(--fv-touch);min-width:var(--fv-touch);min-height:var(--fv-touch);margin-left:0} .fv-iv.fv-iv :is(.fv-iv-size,.fv-iv-lora) button.fvp-chip{height:var(--fv-touch)!important;min-height:var(--fv-touch)!important} .fv-iv .fv-iv-cap .fv-iv-text-btn{min-width:var(--fv-touch)} } /* ── model: one dropdown row; the list floats over the page (fixed, so the panel never cuts it) ── */ -.fv-iv .fv-iv-sec-model{padding:12px 16px} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec-model{padding:12px 16px} .fv-iv .fv-iv-mpick{position:relative;display:flex;align-items:center;gap:4px;height:40px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);overflow:hidden} .fv-iv .fv-iv-mpick-btn{flex:1;min-width:0;height:100%;display:flex;align-items:center;justify-content:flex-start;gap:8px;padding:0 12px;text-align:left;cursor:pointer;color:var(--fv-fg);transition:background-color var(--fv-dur-1,160ms)} .fv-iv .fv-iv-mpick-btn:hover,.fv-iv .fv-iv-mpick-btn[aria-expanded=true]{background:var(--fv-ctl-hover)} .fv-iv .fv-iv-mpick-icon{width:16px;height:16px;color:var(--fv-fg3)} .fv-iv .fv-iv-mpick-name{flex:1 1 auto;text-align:left;min-width:0;font-size:var(--fv-fs-2,13px);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .fv-iv .fv-iv-mpick-status{flex:0 0 auto;display:flex;align-items:center;justify-content:flex-end;gap:4px;font-size:var(--fv-fs-1,12px);color:var(--fv-fg3);white-space:nowrap} -.fv-iv .fv-iv-mpick-status .fv-iv-icon{width:13px;height:13px} +:is(.fv-iv,.fv-work-column) .fv-iv-mpick-status .fv-iv-icon{width:13px;height:13px} .fv-iv .fv-iv-mpick-status[hidden]{display:none} .fv-iv .fv-iv-mpick[data-state=ready] .fv-iv-mpick-status{color:var(--fv-fg2)} -.fv-iv .fv-iv-mpick[data-state=ready] .fv-iv-mpick-status .fv-iv-icon{color:var(--fv-ok,#4fd39a)} +:is(.fv-iv,.fv-work-column) .fv-iv-mpick[data-state=ready] .fv-iv-mpick-status .fv-iv-icon{color:var(--fv-ok,#4fd39a)} .fv-iv .fv-iv-mpick[data-state=failed] .fv-iv-mpick-status{color:var(--fv-warn)} .fv-iv .fv-iv-mpick[data-state=downloading] .fv-iv-mpick-status{color:var(--fv-accent-ink)} .fv-iv .fv-iv-mpick-chev{width:16px;height:16px;color:var(--fv-fg3);transition:transform var(--iv-dur) var(--iv-ease)} @@ -675,26 +677,26 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} @media(max-width:720px){.fv-iv .fv-iv-mpick{height:44px}.fv-iv .fv-iv-mpick-act{min-height:0;height:32px}.fv-image .fv-iv-mopt{min-height:52px}.fv-image .fv-iv-mlist .fv-iv-mopt-act{height:44px}} .fv-iv .fv-iv-mpick:is([data-state=missing],[data-state=failed]) .fv-iv-mpick-status span{display:none} /* visual alignment: one inner edge per column, boxed small tools, centred empty states, a ring that keeps the column */ -.fv-iv .fv-iv-works-tools>.fv-iv-icon-btn{background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line)} -.fv-iv .fv-iv-works-tools>.fv-iv-icon-btn:hover{background:var(--fv-ctl-hover)} -.fv-iv .fv-iv-works-body>.fv-iv-grid-wrap{flex:none} -.fv-iv .fv-iv-works-body>.fv-iv-empty{flex:1;padding-bottom:20%} +:is(.fv-iv,.fv-work-column) .fv-iv-works-tools>.fv-iv-icon-btn{background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line)} +:is(.fv-iv,.fv-work-column) .fv-iv-works-tools>.fv-iv-icon-btn:hover{background:var(--fv-ctl-hover)} +:is(.fv-iv,.fv-work-column) .fv-iv-works-body>.fv-iv-grid-wrap{flex:none} +:is(.fv-iv,.fv-work-column) .fv-iv-works-body>.fv-iv-empty{flex:1;padding-bottom:20%} .fv-studio .fv-iv .fv-iv-prompt:focus-visible{outline-offset:-2px!important} .fv-iv .fv-iv-slot:empty{background:none} -.fv-iv .fv-iv-right .fv-iv-panel-foot{padding:8px 12px 12px} +:is(.fv-iv,.fv-work-column) .fv-iv-right .fv-iv-panel-foot{padding:8px 12px 12px} /* The prompt takes the panel's free height (three lines at least); the other groups stay compact and nothing is left empty. */ @media(min-width:721px){ .fv-iv .fv-iv-panel-scroll{display:flex;flex-direction:column} .fv-iv .fv-iv-panel-scroll>.fv-image-inputs{flex:1 0 auto;display:flex;flex-direction:column} - .fv-iv .fv-iv-sec[data-section=prompt][data-open=true]{flex:1 0 auto;display:flex;flex-direction:column} - .fv-iv .fv-iv-sec[data-section=prompt][data-open=true]>.fv-iv-sec-body{flex:1 0 auto;display:flex;flex-direction:column} - .fv-iv .fv-iv-sec[data-section=prompt][data-open=true] .fv-iv-sec-inner{flex:1 0 auto;display:flex;flex-direction:column;overflow:visible} - .fv-iv .fv-iv-sec[data-section=prompt] .fv-image-enhance{flex:1 0 auto;display:flex;flex-direction:column} - .fv-studio .fv-iv .fv-iv-sec[data-section=prompt] .fv-iv-prompt{flex:1 0 auto;height:auto;min-height:96px;max-height:none} + :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-section=prompt][data-open=true]{flex:1 0 auto;display:flex;flex-direction:column} + :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-section=prompt][data-open=true]>.fv-iv-sec-body{flex:1 0 auto;display:flex;flex-direction:column} + :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-section=prompt][data-open=true] .fv-iv-sec-inner{flex:1 0 auto;display:flex;flex-direction:column;overflow:visible} + :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-section=prompt] .fv-image-enhance{flex:1 0 auto;display:flex;flex-direction:column} + .fv-studio :is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-section=prompt] .fv-iv-prompt{flex:1 0 auto;height:auto;min-height:96px;max-height:none} } -.fv-iv .fv-iv-sec[data-open=false] .fv-iv-sec-inner{padding:0;margin:0} +:is(.fv-iv,.fv-work-column,.fv-sc-col) .fv-iv-sec[data-open=false] .fv-iv-sec-inner{padding:0;margin:0} /* waiting for the engine's list with nothing cached: a quiet empty frame, never the samples */ .fv-iv .fv-iv-frame[data-state=waiting]{box-shadow:none} @@ -733,7 +735,7 @@ dialog.fv-studio.fv-image:not([open]){display:none!important} /* ── tall window (portrait, wider than a phone; image_view.js sets data-tall): the works keep to the top in the layout of one to four columns that gives each picture the most room; the settings float over them as an opaque drawer; the works panel opens below them and takes the height they leave ── */ -.fv-iv[data-tall=true]{--iv-lw:320px;--iv-rw:320px} +.fv-iv[data-tall=true]{--iv-lw:var(--fv-col-w,300px);--iv-rw:var(--fv-col-w,300px)} .fv-iv[data-tall=true][data-drawer=left]{--iv-lp:var(--iv-lw)} .fv-iv[data-tall=true] .fv-iv-panel{z-index:4} .fv-iv[data-tall=true][data-drawer=left] .fv-iv-left{background:rgb(var(--fv-solid2))!important;-webkit-backdrop-filter:none!important;backdrop-filter:none!important;box-shadow:inset 0 1px 0 var(--fv-edge-hi),var(--fv-sh3)} diff --git a/web/image_view.js b/web/image_view.js index 07263b9a..32ea2228 100644 --- a/web/image_view.js +++ b/web/image_view.js @@ -19,7 +19,7 @@ import { openAutopilot, viewChanged, viewSwitch } from './view_navigation.js'; import { wordmark } from './wordmark.js'; import { keepViewSwitchPlace } from './view_switch_place.js'; import { openReferenceMenu, removeSavedImages } from './image_library.js'; -import { BLANK_CANVAS_AREAS, createImageGenClient, fittedNote, imageGenError, imageRemainingText, imageReportBar, originStep, renderImageFailure } from './image_generation.js'; +import { BLANK_CANVAS_AREAS, createImageGenClient, fittedNote, imageGenError, imageRemainingText, imageReportBar, originStep, renderImageFailure, WAITING_TEXT } from './image_generation.js'; import { duration } from './generation_progress.js'; import { randomSeed } from './studio_queue.js'; import { createLayout } from './image_view_layout.js'; @@ -30,10 +30,12 @@ import { el, icon, t, cn, tip, button, section, readStore, writeStore, mod } fro import { IMAGE_MODELS, modelPicker, modelState, verifyText, pausedText } from './image_view_models.js'; import { RANGES, RATIOS, areaRange, estimateSeconds, machineLimit, presetAt, ratioValue, sizePicker, sizeFor, sizeText, megapixels } from './image_view_size.js'; import { createMetaStore, createTrash, filterCounts, filterRows, groupRows, historyPanel, sessionPrompts } from './image_view_history.js'; -import { brokenMentions, mentionText, mentionsToEngine, posePrompt, promptMentions, renumberMentions, sketchPrompt } from './image_view_mentions.js'; +import { PICTURE_WORDS, SUBJECT_WORDS, brokenMentions, mentionText, mentionsToEngine, posePrompt, promptMentions, renumberMentions, sketchPrompt } from './image_view_mentions.js'; import { HISTORY_KEY, forgetDeletedPrompts, promptLibrary, rememberPrompt } from './image_view_prompts.js'; import { COMPARE_MAX, compareView } from './image_view_compare.js'; import { queuePanel } from './image_view_queue.js'; +import { createWorkColumn } from './work_column.js'; +import { pictureURL } from './picture_url.js'; import { isHeld, worksClient, saveToWorks } from './image_works.js'; import { createWarmer } from './image_view_warm.js'; import { preloadMode } from './preload_setting.js'; @@ -41,7 +43,9 @@ import { openPictureViewer } from './image_view_viewer.js'; import { LORA_MODEL, imageViewLora } from './image_view_lora.js'; import { hasPictureThumbnail, mediaQueue, pictureThumbnailURL } from './work_media.js'; import { fieldNote } from './field_note.js'; +import { createPanelShell } from './panel_shell.js'; import { copyText } from './clipboard_text.js'; +import { pageLang } from './i18n_tables.js'; export { IMAGE_MODELS, RATIOS }; for (const name of ['./image_view.css']) { @@ -123,7 +127,6 @@ export function createFakeImageClient({delay = 600, ready = {'minimax-h3-image': }; } -const pictureURL = file => { const at = file.lastIndexOf('/'); return api.apiURL('/view?' + new URLSearchParams({filename: file.slice(at + 1), subfolder: at < 0 ? '' : file.slice(0, at), type: 'input'})); }; // Tiles, the rail and the source line show a picture's small copy; the stage, the viewer and comparisons the picture. const thumbURL = file => hasPictureThumbnail(file) ? pictureThumbnailURL(file) : pictureURL(file); const SAMPLE_PROMPTS = { @@ -187,7 +190,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = kept?.dispose(); kept = null; void poll; studio?.querySelectorAll('video,audio').forEach(media => media.pause()); - const dialog = el('dialog', 'fv-studio fv-image'); dialog.dataset.fvReady = 'false'; dialog.lang = cn ? 'zh' : 'en'; dialog.setAttribute('aria-label', t('Images', '图像视图')); + const dialog = el('dialog', 'fv-studio fv-image'); dialog.dataset.fvReady = 'false'; dialog.lang = pageLang(); dialog.setAttribute('aria-label', t('Images', '图像视图')); const header = el('header', 'fv-header'), brand = el('div', 'fv-brand'), tools = el('div', 'fv-header-actions'); brand.append(wordmark()); const settings = el('button', 'fv-quiet', t('Settings', '设置')); settings.type = 'button'; settings.onclick = openSetup; @@ -245,13 +248,13 @@ export function openImageView(node, {studio = null, client: given = null, poll = // ───── Layout ───── const body = el('div', 'fv-image-body fv-iv'); const left = el('aside', 'fv-iv-panel fv-iv-left fv-image-left fv-glass fv-g2'), stage = el('main', 'fv-iv-stage fv-image-stage'), column = el('aside', 'fv-iv-panel fv-iv-right fv-image-works-column fv-glass fv-g2'); - left.setAttribute('aria-label', t('Make a picture', '生成图片')); column.setAttribute('aria-label', t('Works', '作品')); + left.setAttribute('aria-label', t('Make an image', '生成图片')); column.setAttribute('aria-label', t('Creations', '作品')); body.append(left, stage, column); // Left panel: head, the groups, the foot with the status slot and Generate. const leftHead = el('div', 'fv-iv-panel-head'); - const leftCollapse = button('fv-iv-icon-btn fv-iv-collapse', {iconName: 'panelL', name: t('Hide settings', '收起设置栏'), use: t('More room for the picture', '给画面腾出空间')}); - leftHead.append(el('h2', 'fv-iv-panel-title', t('Create', '生成')), el('span', 'fv-iv-grow'), leftCollapse); + const leftCollapse = button('fv-iv-icon-btn fv-iv-collapse', {iconName: 'panelL', name: t('Hide settings', '收起设置栏'), use: t('More room for the image', '给画面腾出空间')}); + leftHead.append(el('h2', 'fv-iv-panel-title', t('Generate', '生成')), el('span', 'fv-iv-grow'), leftCollapse); const scroll = el('div', 'fv-iv-panel-scroll'); const inputs = el('div', 'fv-image-inputs'); @@ -264,7 +267,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = // Prompt: the enhancer wraps the box, as on the video page. // Every group is open as it is (CEO: nobody folds these); when the panel has no room it scrolls. - const promptGroup = section('prompt', {title: t('Prompt', '描述'), iconName: 'prompt', fixed: true}); + const promptGroup = section('prompt', {title: t('Prompt', '提示词'), iconName: 'prompt', fixed: true}); const prompt = el('textarea', 'fv-image-prompt fv-iv-prompt'); prompt.rows = 3; prompt.maxLength = 2000; // Prompt help (the creation panel's own: switch, original and rewritten, rewrite again, back to the original, // download and enable, errors) for a picture: the engine rewrites in the chosen model's own style, with the @@ -287,8 +290,8 @@ export function openImageView(node, {studio = null, client: given = null, poll = // The rewrite names only the pictures sent with it, as the generation does. prepare: text => { const sent = references.slice(0, cap_(model)).length; - return mentionsToEngine(text, sent).replace(/(?:图\s?|Image\s)(\d+)/g, (all, n) => Number(n) >= 1 && Number(n) <= sent ? `` : all) - .replace(/(?:主体\s?|Subject\s)(\d+)/g, (_, n) => ``); + return mentionsToEngine(text, sent).replace(PICTURE_WORDS, (all, n) => Number(n) >= 1 && Number(n) <= sent ? `` : all) + .replace(SUBJECT_WORDS, (_, n) => ``); }, restore: text => text.replace(//g, (_, n) => mentionText(n)).replace(//g, (_, n) => subject(Number(n)))}); let enhancerReady = false; @@ -316,7 +319,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = enhancer.chip.classList.add('fv-iv-text-btn', 'fv-iv-enhance-tool'); enhancer.chip.querySelector('span')?.classList.add('fv-iv-btn-label'); // Prompt from a picture or video: a key beside Expand; while it runs the same key stops it. The file only feeds the // description (it is not added to the references). - const reverseKey = button('fv-iv-icon-btn fv-iv-reverse-tool', {iconName: 'reverse', name: t('Prompt from a picture or video', '从图片或视频生成提示词'), use: t("Pick a picture or video; its description fills the box", '选一张图片或一段视频,生成的描述填入描述框')}); + const reverseKey = button('fv-iv-icon-btn fv-iv-reverse-tool', {iconName: 'reverse', name: t('Prompt from an image or video', '从图片或视频生成提示词'), use: t("Pick an image or video; its prompt fills the box", '选一张图片或一段视频,生成的提示词填入提示词框')}); promptBar.append(refAdd, sketchAdd, layoutAdd, enhancer.chip, el('span', 'fv-iv-grow'), promptCount, reverseKey, expand.element); // The row stays on one line inside the panel, Expand at the same inset as the box: when its words do not fit (a // narrow panel, longer words), its keys keep their icons only (their hover cards still name them). Measured again @@ -334,12 +337,12 @@ export function openImageView(node, {studio = null, client: given = null, poll = promptGroup.body.append(enhancer.element, promptBar); // References. - const refGroup = section('refs', {title: t('Reference pictures', '参考图'), iconName: 'refs'}); + const refGroup = section('refs', {title: t('Reference images', '参考图'), iconName: 'refs'}); const strip = el('div', 'fv-image-references fv-iv-refs'), notice = el('p', 'fv-image-notice'); notice.hidden = true; notice.setAttribute('aria-hidden', 'true'); const refNote = el('p', 'fv-iv-note'); const pick = el('input'); pick.type = 'file'; pick.accept = 'image/*'; pick.multiple = true; pick.hidden = true; promptGroup.body.append(strip, refNote, notice, pick); - const refHeadAdd = button('fv-iv-icon-btn fv-iv-sec-add', {iconName: 'plus', name: t('Add a reference picture', '添加参考图'), use: t('From works, the library or this computer', '从作品、素材库或电脑选择')}); + const refHeadAdd = button('fv-iv-icon-btn fv-iv-sec-add', {iconName: 'plus', name: t('Add a reference image', '添加参考图'), use: t('From creations, the library or this computer', '从作品、素材库或电脑选择')}); refHeadAdd.addEventListener('click', () => openRefMenu(refHeadAdd)); refAdd.addEventListener('click', () => openRefMenu(refAdd)); refGroup.tools.append(refHeadAdd); @@ -352,7 +355,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = advGroup.element.classList.add('fv-image-advanced'); const advanced = {get open() { return advGroup.isOpen(); }, set open(value) { advGroup.open(!!value); }}; const seedInput = el('input'); seedInput.type = 'number'; seedInput.min = '0'; seedInput.max = String(2 ** 53 - 1); seedInput.step = '1'; - seedInput.placeholder = t('New each run', '每次随机'); tip(seedInput, t('Seed', '种子'), t('Empty: new each time; a number repeats a picture', '留空每次不同;填数字可复现同一张')); + seedInput.placeholder = t('New each run', '每次随机'); tip(seedInput, t('Seed', '种子'), t('Empty: new each time; a number repeats an image', '留空每次不同;填数字可复现同一张')); const dice = button('fv-iv-icon-btn', {iconName: 'dice', name: t('Random seed', '随机种子'), use: t('Fill in a random seed', '填入一个随机种子')}); dice.addEventListener('click', () => { seedInput.value = String(randomSeed()); render(); }); seedInput.addEventListener('input', () => render()); @@ -384,10 +387,10 @@ export function openImageView(node, {studio = null, client: given = null, poll = go.append(goFill, goLabel, goSub); leftFoot.append(slot, note, go); const leftRail = el('div', 'fv-iv-rail'); - const railOpen = button('fv-iv-icon-btn', {iconName: 'panelL', name: t('Show settings', '展开设置栏'), use: t('Model, prompt, size and more', '模型、描述、尺寸等')}); + const railOpen = button('fv-iv-icon-btn', {iconName: 'panelL', name: t('Show settings', '展开设置栏'), use: t('Model, prompt, size and more', '模型、提示词、尺寸等')}); const railGen = button('fv-iv-icon-btn fv-iv-rail-go', {iconName: 'gen'}); leftRail.append(railOpen, el('i', 'fv-iv-rail-sep'), ...['model', 'prompt', 'refs', 'size'].map(name => { - const b = button('fv-iv-icon-btn', {iconName: name, name: {model: t('Model', '模型'), prompt: t('Prompt', '描述'), refs: t('Reference pictures', '参考图'), size: t('Frame & size', '画幅与尺寸')}[name], use: t('Open the settings at this group', '展开设置栏并跳到这一组')}); + const b = button('fv-iv-icon-btn', {iconName: name, name: {model: t('Model', '模型'), prompt: t('Prompt', '提示词'), refs: t('Reference images', '参考图'), size: t('Frame & size', '画幅与尺寸')}[name], use: t('Open the settings at this group', '展开设置栏并跳到这一组')}); b.addEventListener('click', () => { setPanel('left', true); const s = inputs.querySelector(`[data-section=${name}]`); s?.scrollIntoView({block: 'nearest'}); }); return b; }), el('span', 'fv-iv-grow'), railGen); @@ -410,7 +413,10 @@ export function openImageView(node, {studio = null, client: given = null, poll = const clearStep = () => { stepURL = ''; stepPicture.removeAttribute('src'); stepFrame.hidden = true; block.classList.remove('fv-image-block-low'); }; const block = el('div', 'fv-image-block'), progressText = el('p', 'fv-image-progress'); const progressLine = el('b'), progressSub = el('span'), runReport = el('div', 'fv-image-run-report'); - progressLine.setAttribute('role', 'status'); progressText.append(progressLine, progressSub); block.append(progressText, runReport); + // While the page waits for FreeVideo to come back (#1121): a button that stops waiting, beside the waiting line. + const stopWaiting = el('button', 'fv-action fv-image-stop-waiting'); stopWaiting.type = 'button'; stopWaiting.hidden = true; + stopWaiting.onclick = () => { if (running?.id) jobs.stopWaiting(running.id); }; + progressLine.setAttribute('role', 'status'); progressText.append(progressLine, progressSub, stopWaiting); block.append(progressText, runReport); const meter = el('i', 'fv-iv-meter'); // The video's rising wave: it reads the level from this element, as in the studio. const sceneHost = el('div', 'fv-iv-scene'), level = el('div'); level.hidden = true; sceneHost.append(level); @@ -419,7 +425,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = for (const key of cn ? ['fox', 'window', 'perfume', 'fjord'] : ['jazz', 'window', 'perfume', 'fjord']) { const b = el('button'), i = el('img'); b.type = 'button'; i.alt = ''; i.draggable = false; i.src = new URL(`./assets/tour/sample-${key}.webp`, import.meta.url).href; if (key === 'jazz') i.style.objectPosition = '50% 0'; - tip(b, t('Try this prompt', '试试这条描述'), SAMPLE_PROMPTS[key].slice(0, 48) + '…'); b.append(i); + tip(b, t('Try this prompt', '试试这条提示词'), SAMPLE_PROMPTS[key].slice(0, 48) + '…'); b.append(i); b.onclick = () => { prompt.value = SAMPLE_PROMPTS[key]; prompt.dispatchEvent(new Event('input', {bubbles: true})); promptGroup.open(true); prompt.focus(); }; grid.append(b); } @@ -447,21 +453,21 @@ export function openImageView(node, {studio = null, client: given = null, poll = const cap = el('div', 'fv-iv-cap fv-image-actions sgf-avoid'); const info_ = el('p', 'fv-image-info fv-iv-cap-info'), infoText = el('span'), doneReport = el('span', 'fv-image-done-report'); // The picture's facts, the prompt among them (selectable, to copy), one click from its caption. - const infoBtn = button('fv-iv-icon-btn fv-iv-info-btn', {iconName: 'info', name: t('About this picture', '图片信息'), use: t('Prompt, model, size and time', '提示词、模型、尺寸和用时'), key: 'I'}); - const infoPop = el('div', 'fv-iv-info'); infoPop.setAttribute('aria-label', t('About this picture', '图片信息')); - infoBtn.addEventListener('click', () => { if (rightTab === 'info' && column.dataset.collapsed !== 'true') setRightTab('works'); else { setRightTab('info'); setPanel('right', true); } }); + const infoBtn = button('fv-iv-icon-btn fv-iv-info-btn', {iconName: 'info', name: t('About this image', '图片信息'), use: t('Prompt, model, size and time', '提示词、模型、尺寸和用时'), key: 'I'}); + const infoPop = el('div', 'fv-iv-info'); infoPop.setAttribute('aria-label', t('About this image', '图片信息')); + infoBtn.addEventListener('click', () => { if (workColumn.tab === 'info' && column.dataset.collapsed !== 'true') setRightTab('works'); else { setRightTab('info'); setPanel('right', true); } }); info_.append(infoBtn, infoText, doneReport); const editThis = button('fv-iv-text-btn fv-image-action', {iconName: 'edit', label: t('Edit', '编辑'), name: t('Edit', '编辑'), use: t('Make a new version: it becomes Image 1', '以这张为图 1,描述要改的地方')}); - const asReference = button('fv-iv-text-btn fv-image-action', {iconName: 'asref', label: t('Use as reference', '用作参考图'), name: t('Use as reference', '用作参考图'), use: t('Add it to the reference pictures', '加入参考图')}); + const asReference = button('fv-iv-text-btn fv-image-action', {iconName: 'asref', label: t('Use as reference', '用作参考图'), name: t('Use as reference', '用作参考图'), use: t('Add it to the reference images', '加入参考图')}); const favBtn = button('fv-iv-icon-btn fv-iv-fav-btn', {iconName: 'star'}); const save = el('a', 'fv-iv-icon-btn fv-iv-btn fv-image-action'); save.setAttribute('download', ''); save.append(icon('down')); - tip(save, t('Download', '下载'), t('Save the full-size picture', '保存原尺寸图片')); + tip(save, t('Download', '下载'), t('Save the full-size image', '保存原尺寸图片')); const moreButton = button('fv-iv-icon-btn', {iconName: 'more', name: t('More', '更多'), use: t('Folder, copy prompt, delete', '打开文件夹、复制提示词、删除')}); moreButton.setAttribute('aria-haspopup', 'true'); const more = el('div', 'fv-iv-menu fv-image-more fv-glass fv-g3'); more.hidden = true; more.setAttribute('role', 'menu'); const menuItem = (iconName, text, use, onClick, cls = '') => { const b = el('button', 'fv-iv-menu-item ' + cls); b.type = 'button'; b.setAttribute('role', 'menuitem'); b.append(icon(iconName), el('span', '', text)); tip(b, text, use); b.addEventListener('click', () => { more.hidden = true; onClick(); }); return b; }; const copyPrompt = () => { void copyText(promptFor(shownFile)); }; // with the selection copy where the clipboard API is missing (LAN over http) - const usePromptItem = menuItem('prompt', t('Use prompt', '使用提示词'), t('Put its prompt back in the box', '把它的提示词填回描述框'), () => usePrompt(shownFile)); + const usePromptItem = menuItem('prompt', t('Use prompt', '使用提示词'), t('Put its prompt back in the box', '把它的提示词填回提示词框'), () => usePrompt(shownFile)); // For MOSS the boxes are part of the prompt: they come back with the words, and MOSS is chosen. function usePrompt(file) { const text = promptFor(file), boxes = layoutOf[file]; @@ -469,17 +475,17 @@ export function openImageView(node, {studio = null, client: given = null, poll = prompt.value = text; prompt.dispatchEvent(new Event('input', {bubbles: true})); promptGroup.open(true); if (boxes) { const moss = IMAGE_MODELS.find(m => m.id === MOSS); if (moss && model.id !== MOSS) chooseModel(moss); layout.set(boxes); } } - more.append(menuItem('folder', t('Open folder', '打开文件夹'), t('Show the pictures on this computer', '在电脑上打开保存图片的文件夹'), () => void openFolder()), - menuItem('copy', t('Copy prompt', '复制提示词'), t('Copy the words this picture was made from', '复制这张图的提示词'), copyPrompt), usePromptItem, + more.append(menuItem('folder', t('Open folder', '打开文件夹'), t('Show the images on this computer', '在电脑上打开保存图片的文件夹'), () => void openFolder()), + menuItem('copy', t('Copy prompt', '复制提示词'), t('Copy the words this image was made from', '复制这张图的提示词'), copyPrompt), usePromptItem, menuItem('trash', t('Delete', '删除'), t('Move to recently deleted; can be undone', '移到最近删除,可以撤销'), () => deleteFiles([shownFile]), 'fv-iv-danger')); const moreHost = el('span', 'fv-image-more-host fv-iv-more-host'); moreHost.append(moreButton, more); // Where there is room the menu's actions sit in the row itself; the menu is left for a phone. const inline = el('span', 'fv-iv-cap-inline'); const inlineBtn = (iconName, name, use, onClick, cls = '') => { const b = button('fv-iv-icon-btn ' + cls, {iconName, name, use}); b.addEventListener('click', onClick); return b; }; - const copyInline = inlineBtn('copy', t('Copy prompt', '复制提示词'), t('Copy the words this picture was made from', '复制这张图的提示词'), copyPrompt); - const useInline = inlineBtn('prompt', t('Use prompt', '使用提示词'), t('Put its prompt back in the box', '把它的提示词填回描述框'), () => usePromptItem.click()); + const copyInline = inlineBtn('copy', t('Copy prompt', '复制提示词'), t('Copy the words this image was made from', '复制这张图的提示词'), copyPrompt); + const useInline = inlineBtn('prompt', t('Use prompt', '使用提示词'), t('Put its prompt back in the box', '把它的提示词填回提示词框'), () => usePromptItem.click()); inline.append(copyInline, useInline, - inlineBtn('folder', t('Open folder', '打开文件夹'), t('Show the pictures on this computer', '在电脑上打开保存图片的文件夹'), () => void openFolder()), + inlineBtn('folder', t('Open folder', '打开文件夹'), t('Show the images on this computer', '在电脑上打开保存图片的文件夹'), () => void openFolder()), inlineBtn('trash', t('Delete', '删除'), t('Move to recently deleted; can be undone', '移到最近删除,可以撤销'), () => deleteFiles([shownFile]), 'fv-iv-danger')); const capActions = el('div', 'fv-iv-cap-actions'); capActions.append(editThis, asReference, el('i', 'fv-iv-sep'), favBtn, save, inline, moreHost); cap.append(info_, capActions); @@ -492,30 +498,30 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (model_) parts.push(row(t('Model', '模型'), model_)); const w = picture.dataset.file === shownFile && picture.naturalWidth ? picture.naturalWidth : m.width, h = picture.dataset.file === shownFile && picture.naturalHeight ? picture.naturalHeight : m.height; if (w) parts.push(row(t('Size', '尺寸'), `${w} × ${h} · ${megapixels(w * h)} MP`)); - if (m.seconds) parts.push(row(t('Time', '用时'), t(`${m.seconds} s`, `${m.seconds} 秒`))); + if (m.seconds) parts.push(row(t('Time', '用时'), t('{seconds} s', '{seconds} 秒', { seconds: m.seconds }))); if (m.seed) parts.push(row(t('Seed', '种子'), String(m.seed))); const drawn = layoutOf[shownFile]?.length; - if (drawn) parts.push(row(t('Layout', '布局'), t(`${drawn} ${drawn === 1 ? 'box' : 'boxes'}`, `${drawn} 个框`))); + if (drawn) parts.push(row(t('Layout', '布局'), (drawn === 1 ? t('1 box', '1 个框') : t('{count} boxes', '{count} 个框', { count: drawn })))); // Where it came from (an edit of another work): its thumbnail and name, opening it on the stage. if (m.source) { const name = String(m.source).slice(String(m.source).lastIndexOf('/') + 1), there = rows.find(r => r.file === m.source || r.name === name); const line = el('div', 'fv-iv-info-row fv-iv-info-row-src'), go = el('button', 'fv-iv-info-src'); go.type = 'button'; if (there) { const img = el('img'); img.src = thumbURL(there.file); img.alt = ''; img.loading = 'lazy'; go.append(img); } go.append(el('span', '', name)); - if (there) { tip(go, t('Open the source', '打开来源'), t('Show the work this picture was made from', '显示这张图的来源作品')); go.addEventListener('click', () => showFile(there.file)); } - else { go.disabled = true; tip(go, t('Source', '来源'), t('The source is no longer in the works', '来源作品已不在作品里')); } + if (there) { tip(go, t('Open the source', '打开来源'), t('Show the creation this image was made from', '显示这张图的来源作品')); go.addEventListener('click', () => showFile(there.file)); } + else { go.disabled = true; tip(go, t('Source', '来源'), t('The source is no longer in the creations', '来源作品已不在作品里')); } line.append(el('span', 'fv-iv-info-k', t('Source', '来源')), go); parts.push(line); } - if (!text) parts.push(el('p', 'fv-iv-info-none', t('Prompts are not kept in this browser; one shows while the page that made the picture is open.', '提示词不保存在浏览器里,只在生成它的页面打开期间显示。'))); + if (!text) parts.push(el('p', 'fv-iv-info-none', t('Prompts are not kept in this browser; one shows while the page that made the image is open.', '提示词不保存在浏览器里,只在生成它的页面打开期间显示。'))); if (text || drawn) { const acts = el('div', 'fv-iv-info-acts'); - const copy = button('fv-iv-text-btn', {iconName: 'copy', label: t('Copy prompt', '复制提示词'), name: t('Copy prompt', '复制提示词'), use: t('Copy the words this picture was made from', '复制这张图的提示词')}); + const copy = button('fv-iv-text-btn', {iconName: 'copy', label: t('Copy prompt', '复制提示词'), name: t('Copy prompt', '复制提示词'), use: t('Copy the words this image was made from', '复制这张图的提示词')}); copy.addEventListener('click', copyPrompt); - const reuse = button('fv-iv-text-btn', {iconName: 'prompt', label: t('Use prompt', '使用提示词'), name: t('Use prompt', '使用提示词'), use: t('Put its prompt back in the box', '把它的提示词填回描述框')}); + const reuse = button('fv-iv-text-btn', {iconName: 'prompt', label: t('Use prompt', '使用提示词'), name: t('Use prompt', '使用提示词'), use: t('Put its prompt back in the box', '把它的提示词填回提示词框')}); reuse.addEventListener('click', () => { usePrompt(shownFile); if (narrowQuery.matches || tallQuery.matches) setPanel('left', true); }); acts.append(...(text ? [copy] : []), reuse); parts.push(acts); } - if (!shownFile) { const e = el('div', 'fv-iv-empty fv-iv-empty-small'); e.append(icon('info'), el('span', '', t('Pick a picture to see its facts', '选一张图片查看信息'))); parts.splice(0, parts.length, e); } + if (!shownFile) { const e = el('div', 'fv-iv-empty fv-iv-empty-small'); e.append(icon('info'), el('span', '', t('Pick an image to see its facts', '选一张图片查看信息'))); parts.splice(0, parts.length, e); } infoPop.replaceChildren(...parts); } // The picture is centred in the room above; the action row stays at the foot of the stage whatever the picture's shape. @@ -568,13 +574,13 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (globalThis.FreeVideoShell?.setTheme) globalThis.FreeVideoShell.setTheme(next); else document.documentElement.dataset.theme = next; paintSettings(); }); - const KEYS = [[`${mod}+Enter`, t('Generate', '生成')], ['← →', t('Previous / next picture', '上一张 / 下一张')], ['F', t('Star or unstar', '收藏 / 取消收藏')], [`${mod} / Shift`, t('Pick several works to compare', '多选作品即可对比')], ['I', t('Picture facts', '图片信息')], ['Delete', t('Delete (to recently deleted)', '删除(移到最近删除)')], - [`${mod}+F`, t('Search works', '搜索作品')], [`${mod}+A`, t('Select all while selecting', '多选时全选')], ['Esc', t('Close the top layer', '关闭最上层')]]; + const KEYS = [[`${mod}+Enter`, t('Generate', '生成')], ['← →', t('Previous / next image', '上一张 / 下一张')], ['F', t('Add to or remove from favorites', '收藏 / 取消收藏')], [`${mod} / Shift`, t('Pick several creations to compare', '多选作品即可对比')], ['I', t('Image facts', '图片信息')], ['Delete', t('Delete (to recently deleted)', '删除(移到最近删除)')], + [`${mod}+F`, t('Search creations', '搜索作品')], [`${mod}+A`, t('Select all while selecting', '多选时全选')], ['Esc', t('Close the top layer', '关闭最上层')]]; keysPop.append(...KEYS.map(([k, what]) => { const r = el('div', 'fv-iv-key-row'); r.append(el('span', '', what), el('kbd', 'fv-iv-kbd', k)); return r; })); keysBtn.addEventListener('click', () => { keysPop.hidden = !keysPop.hidden; keysBtn.setAttribute('aria-pressed', String(!keysPop.hidden)); }); function paintStatus() { const live = rows.filter(r => !isGone(r.file)).length; - sbarState.replaceChildren(el('i', 'fv-iv-dot' + (info ? '' : ' fv-iv-dot-wait')), el('span', '', info ? t(`Ready · ${live} pictures`, `就绪 · ${live} 张`) : t('Connecting…', '正在连接…'))); + sbarState.replaceChildren(el('i', 'fv-iv-dot' + (info ? '' : ' fv-iv-dot-wait')), el('span', '', info ? t('Ready · {live} images', '就绪 · {live} 张', { live }) : t('Connecting…', '正在连接…'))); } paintSettings(); @@ -594,39 +600,14 @@ export function openImageView(node, {studio = null, client: given = null, poll = onPurge: () => { void trash.flush(); }, onOpenFolder: () => void openFolder(), onCollapse: () => setPanel('right', false), onRun: () => returnToRun()}); - const rightRail = el('div', 'fv-iv-rail fv-iv-rail-right'); - const rightRailOpen = button('fv-iv-icon-btn', {iconName: 'panelR', name: t('Show works', '展开作品栏'), use: t('Your pictures, newest first', '你的图片,最新在前')}); - const railThumbs = el('div', 'fv-iv-rail-thumbs'); - rightRail.append(rightRailOpen, el('i', 'fv-iv-rail-sep'), railThumbs); - // The right column's three pages: works, the shown picture's facts, and the queue of every view. - const colHead = el('div', 'fv-iv-panel-head fv-iv-col-head'); - const tabs = el('div', 'fv-iv-seg fv-iv-col-tabs'); tabs.setAttribute('role', 'tablist'); - const tabWorks = button('', {label: t('Works', '作品'), name: t('Works', '作品'), use: t('Every picture made here', '在这里生成的所有图片')}); - const tabInfo = button('', {label: t('Info', '信息'), name: t('Info', '信息'), use: t('Prompt, model, size and time of the shown picture', '当前图片的提示词、模型、尺寸和用时'), key: 'I'}); - const tabQueue = button('', {label: t('Queue', '队列'), name: t('Queue', '队列'), use: t('What is generating in every view', '各个视图正在生成和排队的任务')}); - const tabWorksN = el('span', 'fv-iv-tab-n'), tabQueueN = el('span', 'fv-iv-tab-n'); tabWorks.append(tabWorksN); tabQueue.append(tabQueueN); - for (const b of [tabWorks, tabInfo, tabQueue]) b.setAttribute('role', 'tab'); - tabs.append(tabWorks, tabInfo, tabQueue); - const colCollapse = button('fv-iv-icon-btn fv-iv-collapse', {iconName: 'panelR', name: t('Hide works', '收起作品栏'), use: t('More room for the picture', '给画面腾出空间')}); - colHead.append(tabs, colCollapse); - const infoPane = el('div', 'fv-iv-col-pane fv-iv-info-pane'); infoPane.append(infoPop); + // The right column (works, info, queue) is the shared component of web/work_column.js. const queue = queuePanel({jobs, confirmStop, pictureURL, onOpen: row => openQueued(row)}); - queue.element.classList.add('fv-iv-col-pane'); - let rightTab = readStore('freevideo.imageView.rightTab', 'works'); - function setRightTab(name) { - rightTab = name; writeStore('freevideo.imageView.rightTab', name === 'info' ? 'works' : name); - column.dataset.tab = name; - for (const [b, n] of [[tabWorks, 'works'], [tabInfo, 'info'], [tabQueue, 'queue']]) { b.setAttribute('aria-pressed', String(n === name)); b.setAttribute('aria-selected', String(n === name)); } - works.element.hidden = name !== 'works'; infoPane.hidden = name !== 'info'; queue.element.hidden = name !== 'queue'; - infoBtn.setAttribute('aria-pressed', String(name === 'info')); - if (name === 'info') paintInfo(); - } - tabWorks.addEventListener('click', () => setRightTab('works')); - tabInfo.addEventListener('click', () => setRightTab('info')); - tabQueue.addEventListener('click', () => setRightTab('queue')); - colCollapse.addEventListener('click', () => setPanel('right', false)); - column.addEventListener('fv-iv-queue', event => { tabQueueN.textContent = event.detail.active ? String(event.detail.active) : ''; }); - column.append(colHead, works.element, infoPane, queue.element, rightRail); + const workColumn = createWorkColumn({works, info: infoPop, queue, storeKey: 'freevideo.imageView.rightTab', + onCollapse: () => setPanel('right', false), onOpen: () => setPanel('right', true), + onTab: name => { infoBtn.setAttribute('aria-pressed', String(name === 'info')); if (name === 'info') paintInfo(); }}); + const setRightTab = name => workColumn.setTab(name); + const railThumbs = workColumn.railThumbs; + workColumn.mount(column); // A queued row opens its own generation screen: here for a picture, in its view otherwise. function openQueued(row) { if (row.kind === 'image' && (row.view === 'image' || !row.view)) { @@ -652,7 +633,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = // The engine's own bin answers without a list: what it deleted leaves the works here, not only on the next load. if (answer.items) rows = answer.items; else rows = rows.filter(r => !gone.includes(r.file)); if (gone.length) { meta.forget(gone); void removeSavedImages(api, gone).catch(() => {}); announce('freevideo-works-removed', gone, {undoable: false}); } - if (kept.size) say(t(`Could not delete ${kept.size}.`, `有 ${kept.size} 张没能删除。`)); + if (kept.size) say(t('Could not delete {size}.', '有 {size} 张没能删除。', { size: kept.size })); if (undoNote && list?.some(f => undoNote.files.includes(f))) undoNote = null; } if (alive) { drawWorks(); render(); } @@ -661,28 +642,10 @@ export function openImageView(node, {studio = null, client: given = null, poll = // ───── Panels fold to a rail; the stage stays centred on the window either way ───── // Under 1280 wide both panels rest as rails and open as drawers over the stage, one at a time, so the picture // keeps the room; the stage still measures from the two rails, so it stays centred. Wide, they dock and fold. - const narrowQuery = matchMedia('(min-width: 720px) and (max-width: 1279px)'); - // A tall window (portrait, wider than a phone): the settings open as a drawer over the works, and the works panel - // opens below them, taking the height they leave (at least 320 px), so it never narrows them from the side. const tallQuery = matchMedia('(orientation: portrait) and (min-width: 720px)'); - let drawer = '', below = false; - function paintPanels() { - if (tallQuery.matches) { - if (drawer === 'right') drawer = ''; - left.dataset.collapsed = String(drawer !== 'left'); column.dataset.collapsed = String(!below); - body.dataset.tall = 'true'; body.dataset.below = String(below); body.dataset.narrow = 'true'; body.dataset.drawer = drawer; - body.dataset.left = 'rail'; body.dataset.right = 'rail'; - paintCover(); fitTallSoon(); - return; - } - delete body.dataset.tall; delete body.dataset.below; - const narrow = narrowQuery.matches; - const leftShown = narrow ? drawer === 'left' : panels.left !== false, rightShown = narrow ? drawer === 'right' : panels.right !== false; - left.dataset.collapsed = String(!leftShown); column.dataset.collapsed = String(!rightShown); - body.dataset.narrow = String(narrow); body.dataset.drawer = narrow ? drawer : ''; - body.dataset.left = leftShown && !narrow ? 'open' : 'rail'; body.dataset.right = rightShown && !narrow ? 'open' : 'rail'; - paintCover(); - } + const narrowQuery = matchMedia('(min-width: 720px) and (max-width: 1279px)'); + const shell = createPanelShell({body, left, right: column, stage, panels, save: () => writeStore(PANEL_KEY, panels), + onPaint: () => { paintCover(); if (tallQuery.matches) fitTallSoon(); }, onOpenLeft: () => fitSoon()}); // The next picture's empty frame is shown whole where the stage is not covered: an open settings drawer (narrow // windows) covers its left part, so the frame centres in the rest. function paintCover() { @@ -693,17 +656,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = } shot.style.setProperty('--iv-cover', `${cover}px`); } - function setPanel(side, open) { - if (tallQuery.matches && side === 'right') below = open; - else if (tallQuery.matches || narrowQuery.matches) drawer = open ? side : drawer === side ? '' : drawer; - else { panels[side] = open; writeStore(PANEL_KEY, panels); } - paintPanels(); if (open && side === 'left') fitSoon(); - } - narrowQuery.addEventListener('change', () => { drawer = ''; paintPanels(); fitSoon(); }); - tallQuery.addEventListener('change', () => { drawer = ''; below = false; paintPanels(); fitSoon(); }); - // A drawer closes when the stage is touched; on a tall window, when anything outside it is. - stage.addEventListener('pointerdown', () => { if (drawer) { drawer = ''; paintPanels(); } }); - body.addEventListener('pointerdown', event => { if (tallQuery.matches && drawer === 'left' && !left.contains(event.target)) { drawer = ''; paintPanels(); } }); + const setPanel = shell.setPanel, paintPanels = shell.paint; // The works grid on a tall window (the four samples, or three or four works compared): of one to four columns, the // layout that gives each picture the most room in the width and height there are; it keeps to the top. With the // works panel open below, the panel takes the height the grid leaves. @@ -732,7 +685,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (stage.dataset.mode === 'compare' && comparer.element.dataset.mode === 'grid' && panes) { const files = compare?.files || [], ratios = files.map(file => { const m = meta.get(file); return m?.width ? m.width / m.height : 0; }).filter(r => r > 0); const ratio = ratios.length ? ratios.reduce((a, b) => a + b, 0) / ratios.length : 1; - const extra = below ? now - (TALL_PANEL + 12) : 0, height = panes.clientHeight + extra; + const extra = shell.below() ? now - (TALL_PANEL + 12) : 0, height = panes.clientHeight + extra; const g = bestGrid(files.length, ratio, panes.clientWidth, height, 12); if (g) { for (const [name, value] of [['--iv-cols', g.cols], ['--iv-rows', g.rows], ['--iv-tw', `${g.w}px`], ['--iv-th', `${g.h}px`]]) panes.style.setProperty(name, String(value)); @@ -741,7 +694,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = } else if (stage.dataset.state === 'blank') { const pictures = [...grid.querySelectorAll('img')], first = pictures.find(i => i.naturalWidth); const ratio = first ? first.naturalWidth / first.naturalHeight : 1; - const extra = below ? now - (TALL_PANEL + 12) : 0, height = canvasArea.clientHeight - 88 + extra; + const extra = shell.below() ? now - (TALL_PANEL + 12) : 0, height = canvasArea.clientHeight - 88 + extra; const g = bestGrid(pictures.length, ratio, canvasArea.clientWidth, height, 12); if (g) { for (const [name, value] of [['--iv-cols', g.cols], ['--iv-rows', g.rows]]) shot.style.setProperty(name, String(value)); @@ -749,7 +702,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = used = 1; spare = height - g.height; } } - const want = below ? Math.round(TALL_PANEL + 12 + (used ? Math.max(0, spare) : 0)) : 0; + const want = shell.below() ? Math.round(TALL_PANEL + 12 + (used ? Math.max(0, spare) : 0)) : 0; if (want) { if (Math.abs(want - now) > 1 || !body.style.getPropertyValue('--iv-below')) body.style.setProperty('--iv-below', `${want}px`); } else body.style.removeProperty('--iv-below'); } @@ -759,9 +712,8 @@ export function openImageView(node, {studio = null, client: given = null, poll = comparer.element.addEventListener('load', () => { if (tallQuery.matches) fitTallSoon(); }, true); leftCollapse.addEventListener('click', () => setPanel('left', false)); railOpen.addEventListener('click', () => setPanel('left', true)); - rightRailOpen.addEventListener('click', () => setPanel('right', true)); railGen.addEventListener('click', () => go.click()); - paintPanels(); setRightTab(rightTab); + paintPanels(); setRightTab(workColumn.tab); // ───── Drop and paste ───── for (const target of [inputs, frame]) { @@ -799,8 +751,8 @@ export function openImageView(node, {studio = null, client: given = null, poll = }); return [icon('info'), tx]; } - const label = number => t(`Image ${number}`, `图 ${number}`); - const subject = number => t(`Subject ${number}`, `主体 ${number}`); + const label = number => t('Image {number}', '图 {number}', { number }); + const subject = number => t('Subject {number}', '主体 {number}', { number }); // Each model row says how many pictures it takes; the strip holds as many as the most generous one. // Until the engine answers, each model's usual reference count, so the strip has its final height from the first frame. const USUAL_CAPS = {'minimax-h3-image': 16, 'qwen-image-2.1-turbo': 4, 'moss-image-sft': 0}; @@ -818,7 +770,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = } // The note stays until the strip changes again. notice.dataset.keep = String(skipped > 0); - notice.textContent = skipped ? t(`At most ${most()}, ${skipped} more were not added.`, `最多 ${most()} 张,多出的 ${skipped} 张没有加入。`) : ''; + notice.textContent = skipped ? t('At most {most}, {skipped} more were not added.', '最多 {most} 张,多出的 {skipped} 张没有加入。', { most: most(), skipped }) : ''; render(); } async function useAsReference(file, first) { @@ -830,7 +782,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = changeRefs(() => { if (first) references.unshift(record); else references.push(record); }); const probe = new Image(); probe.onload = () => { record.width = probe.naturalWidth; record.height = probe.naturalHeight; if (alive) render(); }; probe.src = record.url; promptGroup.open(true); render(); prompt.focus(); - } catch { say(t('That picture could not be read.', '这张图读不了。')); } + } catch { say(t('That image could not be read.', '这张图读不了。')); } } // Any change to the pictures' order goes through here: the mentions in the prompt follow their pictures. function changeRefs(mutate) { @@ -845,8 +797,8 @@ export function openImageView(node, {studio = null, client: given = null, poll = // The engine reads ; the page writes "@图N" / "@Image N" (and older prompts "图 N"). A prompt that names none gets them // listed, all but the sketches: the words around the description name those. function engineText(seed) { - const swapped = mentionsToEngine(prompt.value, references.length).replace(/(?:图\s?|Image\s)(\d+)/g, (_, n) => ``) - .replace(/(?:主体\s?|Subject\s)(\d+)/g, (_, n) => ``); + const swapped = mentionsToEngine(prompt.value, references.length).replace(PICTURE_WORDS, (_, n) => ``) + .replace(SUBJECT_WORDS, (_, n) => ``); // A sketch with mannequins takes the pose words (the other pictures listed in front when the text names none). const poseAt = references.findIndex((r, at) => r.sketch && r.pose && at < cap_(model)); if (poseAt >= 0) { @@ -870,7 +822,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = // The sketch canvas: the current frame, its long side at most 1536; a sketch opens again with its strokes. function sketchTarget() { const s = size(), k = Math.min(1, 1536 / Math.max(s.width, s.height)); return {width: Math.max(256, Math.round(s.width * k / 32) * 32), height: Math.max(256, Math.round(s.height * k / 32) * 32)}; } async function drawSketch(record = null) { - if (cap_(model) === 0) { say(t(`${model.short} does not take reference pictures; choose the other model`, `${model.short} 不使用参考图,请换另一个模型`)); return; } + if (cap_(model) === 0) { say(t('{short} does not take reference images; choose the other model', '{short} 不使用参考图,请换另一个模型', { short: model.short })); return; } if (!record && references.length >= most()) { say(t('The reference slots are full; remove one', '参考图已满,先移除一张')); return; } let outcome; try { @@ -901,7 +853,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = const {openImageEditor} = await import('./image_editor.js').catch(error => { loadFailed = true; throw error; }); outcome = await openImageEditor({source: record.original?.url || record.url, name: record.original?.file?.name || record.file?.name || 'reference.png', edit: record.edit || null, role: 'reference', t, resolve: url => url, upload: async blob => client.upload(blob), imageGenClient: client}); - } catch { say(loadFailed ? t('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : t('This picture could not be read. Choose another picture.', '这张图无法读取。请重新选择一张。')); return; } + } catch { say(loadFailed ? t('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : t('This image could not be read. Choose another image.', '这张图无法读取。请重新选择一张。')); return; } if (!alive || !outcome || !references.includes(record)) return; if (outcome.restore) { restoreReference(record); return; } if (!outcome.blob) return; @@ -923,8 +875,8 @@ export function openImageView(node, {studio = null, client: given = null, poll = const cell = el('span', 'fv-image-reference fv-iv-ref'), use = el('button', 'fv-image-reference-use'), x = el('button', 'fv-image-reference-remove'); cell.dataset.over = String(at >= cap_(model)); cell.dataset.edited = String(!!r.original); use.type = x.type = 'button'; - tip(use, t('Edit', '编辑'), r.original ? t(`${label(at + 1)}, edited. Crop or retouch it again`, `${label(at + 1)}(已编辑):继续裁剪或修图`) : t(`Crop or retouch ${label(at + 1)}; it stays in its place`, `裁剪或修图${label(at + 1)},改完放回原位`)); - tip(x, t('Remove', '移除'), cell.dataset.over === 'true' ? t(`${model.short} takes ${cap_(model)}; remove this one`, `${model.short} 最多 ${cap_(model)} 张,请移除这张`) : t('Take this picture out', '去掉这张参考图')); + tip(use, t('Edit', '编辑'), r.original ? t('{name}, edited. Crop or retouch it again', '{name}(已编辑):继续裁剪或修图', { name: label(at + 1) }) : t('Crop or retouch {name}; it stays in its place', '裁剪或修图{name},改完放回原位', { name: label(at + 1) })); + tip(x, t('Remove', '移除'), cell.dataset.over === 'true' ? t('{short} takes {limit}; remove this one', '{short} 最多 {limit} 张,请移除这张', { short: model.short, limit: cap_(model) }) : t('Take this image out', '去掉这张参考图')); x.append(icon('x')); const i = el('img'); i.src = r.url; i.alt = ''; i.draggable = false; use.append(i, el('b', '', String(at + 1))); use.onclick = () => void editReference(r); @@ -935,7 +887,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (r.original) { const mark = el('i', 'fv-iv-ref-mark'); mark.append(icon('edit')); const back = el('button', 'fv-iv-ref-restore'); back.type = 'button'; back.append(icon('restore')); - tip(back, t('Restore original', '恢复原图'), t('Put back the picture as it was before editing', '换回编辑前的原图')); + tip(back, t('Restore original', '恢复原图'), t('Put back the image as it was before editing', '换回编辑前的原图')); back.onclick = () => restoreReference(r); cell.append(mark, back); } @@ -945,7 +897,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = // With pictures in the strip, one more small tile adds the next; with none, the tool row's button is the way in. if (room && references.length) { const add = el('button', 'fv-image-add fv-iv-ref fv-iv-ref-add'); add.type = 'button'; add.append(icon('plus')); - tip(add, t('Add a reference picture', '添加参考图'), t('From works, the library or this computer; or drop or paste', '从作品、素材库或电脑选择;也可拖入或粘贴')); + tip(add, t('Add a reference image', '添加参考图'), t('From creations, the library or this computer; or drop or paste', '从作品、素材库或电脑选择;也可拖入或粘贴')); add.onclick = () => openRefMenu(add); cells.push(add); } @@ -954,9 +906,9 @@ export function openImageView(node, {studio = null, client: given = null, poll = // No running count; only a full strip says so. refCount.textContent = cap_(model) && references.length >= cap_(model) ? t('Full', '已满') : ''; refAdd.setAttribute('aria-disabled', String(!room)); - tip(refAdd, t('Reference pictures', '参考图'), room ? t('Add from works, the library or this computer; or drop or paste', '从作品、素材库或电脑添加;也可拖入或粘贴') : ''); - if (!room) refAdd.dataset.fvTipWhy = cap_(model) === 0 ? t(`${model.short} does not take reference pictures; choose the other model`, `${model.short} 不使用参考图,请换另一个模型`) : t('The reference slots are full; remove one', '参考图已满,先移除一张'); else delete refAdd.dataset.fvTipWhy; - refNote.textContent = info && cap_(model) === 0 && references.length ? t(`${model.short} does not take reference pictures.`, `${model.short} 不使用参考图。`) : ''; + tip(refAdd, t('Reference images', '参考图'), room ? t('Add from creations, the library or this computer; or drop or paste', '从作品、素材库或电脑添加;也可拖入或粘贴') : ''); + if (!room) refAdd.dataset.fvTipWhy = cap_(model) === 0 ? t('{short} does not take reference images; choose the other model', '{short} 不使用参考图,请换另一个模型', { short: model.short }) : t('The reference slots are full; remove one', '参考图已满,先移除一张'); else delete refAdd.dataset.fvTipWhy; + refNote.textContent = info && cap_(model) === 0 && references.length ? t('{short} does not take reference images.', '{short} 不使用参考图。', { short: model.short }) : ''; refNote.hidden = !refNote.textContent; refHeadAdd.hidden = true; } @@ -999,7 +951,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = const on = enhancer.reversing, why = reverseWhy(); reverseKey.dataset.state = on ? 'running' : ''; reverseKey.setAttribute('aria-disabled', String(!on && !!why)); reverseKey.dataset.fvTipWhy = !on && why ? why : ''; if (!why || on) delete reverseKey.dataset.fvTipWhy; - tip(reverseKey, on ? t('Stop', '停止') : t('Prompt from a picture or video', '从图片或视频生成提示词'), on ? '' : t('Pick a picture or video; its description fills the box', '选一张图片或一段视频,生成的描述填入描述框')); + tip(reverseKey, on ? t('Stop', '停止') : t('Prompt from an image or video', '从图片或视频生成提示词'), on ? '' : t('Pick an image or video; its prompt fills the box', '选一张图片或一段视频,生成的提示词填入提示词框')); reverseKey.replaceChildren(icon(on ? 'stop' : 'reverse')); go.disabled = go.disabled || on; }; @@ -1065,7 +1017,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = // ───── Drawing ───── const visible = () => filterRows(rows.filter(r => !isGone(r.file)), {filter, query, sort}, meta); - const labelOf = file => { const m = meta.get(file); return [IMAGE_MODELS.find(x => x.id === m?.model)?.short, m?.width ? `${m.width} × ${m.height}` : '', m?.seconds ? t(`${m.seconds} s`, `${m.seconds} 秒`) : ''].filter(Boolean).join(' · ') || t('Picture', '图片'); }; + const labelOf = file => { const m = meta.get(file); return [IMAGE_MODELS.find(x => x.id === m?.model)?.short, m?.width ? `${m.width} × ${m.height}` : '', m?.seconds ? t('{seconds} s', '{seconds} 秒', { seconds: m.seconds }) : ''].filter(Boolean).join(' · ') || t('Image', '图片'); }; const runRow = () => running?.id ? jobs.get(running.id) : null; function paintSlot() { @@ -1076,21 +1028,24 @@ export function openImageView(node, {studio = null, client: given = null, poll = else if (note.textContent) { kind = note.dataset.kind === 'busy' ? 'info' : 'warn'; parts = [icon(kind === 'info' ? 'clock' : 'warn'), el('span', 'fv-iv-slot-tx', note.textContent)]; } else if (tooMany) { kind = 'warn'; - parts = [icon('warn'), el('span', 'fv-iv-slot-tx', cap_(model) === 0 ? t(`${model.short} does not take reference pictures. Remove ${over()}.`, `${model.short} 暂不支持参考图,请移除 ${over()} 张。`) : t(`${model.short} takes at most ${cap_(model)}. Remove ${over()}.`, `${model.short} 最多 ${cap_(model)} 张,请移除 ${over()} 张。`))]; + parts = [icon('warn'), el('span', 'fv-iv-slot-tx', cap_(model) === 0 ? t('{short} does not take reference images. Remove {extra}.', '{short} 暂不支持参考图,请移除 {extra} 张。', { short: model.short, extra: over() }) : t('{short} takes at most {limit}. Remove {extra}.', '{short} 最多 {limit} 张,请移除 {extra} 张。', { short: model.short, limit: cap_(model), extra: over() }))]; } else if (notice.dataset.keep === 'true' && notice.textContent) { kind = 'warn'; parts = [icon('warn'), el('span', 'fv-iv-slot-tx', notice.textContent)]; } else if (brokenMentions(prompt.value, references.length)) { - kind = 'warn'; parts = [icon('warn'), el('span', 'fv-iv-slot-tx', t('A picture named in the prompt was removed; choose it again with @', '描述里引用的参考图已移除,请用 @ 重新选择'))]; + kind = 'warn'; parts = [icon('warn'), el('span', 'fv-iv-slot-tx', t('An image named in the prompt was removed; choose it again with @', '提示词里引用的参考图已移除,请用 @ 重新选择'))]; } else if (s.state === 'failed') { - kind = 'warn'; parts = [icon('warn'), el('span', 'fv-iv-slot-tx', t(`${model.short} download failed${s.reason ? ': ' + s.reason.replace(/[.。]$/, '') : ''}. Retry to continue; if it keeps failing, report the problem.`, `${model.short} 下载失败${s.reason ? ':' + s.reason.replace(/[.。]$/, '') : ''}。请重试以继续下载;仍然失败时,请提交问题。`))]; + kind = 'warn'; parts = [icon('warn'), el('span', 'fv-iv-slot-tx', s.reason + ? t('{model} download failed: {reason}. Retry to continue; if it keeps failing, report the problem.', '{model} 下载失败:{reason}。请重试以继续下载;仍然失败时,请提交问题。', + { model: model.short, reason: s.reason.replace(/[.。]$/, '') }) + : t('{model} download failed. Retry to continue; if it keeps failing, report the problem.', '{model} 下载失败。请重试以继续下载;仍然失败时,请提交问题。', { model: model.short }))]; } else if (s.state === 'downloading' && s.paused) { // What the download waits for, and that the model row's Continue download runs it now. - kind = 'info'; parts = [icon('clock'), el('span', 'fv-iv-slot-tx', t(`${model.short}: ${pausedText(s)}`, `${model.short}:${pausedText(s)}`))]; + kind = 'info'; parts = [icon('clock'), el('span', 'fv-iv-slot-tx', t('{short}: {state}', '{short}:{state}', { short: model.short, state: pausedText(s) }))]; } else if (s.state === 'downloading') { - kind = 'info'; parts = [icon(s.unknown ? 'clock' : 'down'), el('span', 'fv-iv-slot-tx', s.verifying ? (pendingGenerate ? t(`Verifying ${model.short}; it generates when done`, `正在校验 ${model.short},完成后自动生成`) : t(`Verifying ${model.short}`, `正在校验 ${model.short}`)) - : pendingGenerate ? t(`Installing ${model.short}; it generates when done`, `正在安装 ${model.short},完成后自动生成`) : t(`Installing ${model.short}`, `正在安装 ${model.short}`))]; + kind = 'info'; parts = [icon(s.unknown ? 'clock' : 'down'), el('span', 'fv-iv-slot-tx', s.verifying ? (pendingGenerate ? t('Verifying {short}; it generates when done', '正在校验 {short},完成后自动生成', { short: model.short }) : t('Verifying {short}', '正在校验 {short}', { short: model.short })) + : pendingGenerate ? t('Installing {short}; it generates when done', '正在安装 {short},完成后自动生成', { short: model.short }) : t('Installing {short}', '正在安装 {short}', { short: model.short }))]; } else if (s.state === 'missing') { - kind = 'info'; parts = [icon('cloud'), el('span', 'fv-iv-slot-tx', t(`${model.short} is not installed; Generate installs it first`, `${model.short} 未安装,点生成会先安装`))]; + kind = 'info'; parts = [icon('cloud'), el('span', 'fv-iv-slot-tx', t('{short} is not installed; Generate installs it first', '{short} 未安装,点生成会先安装', { short: model.short }))]; } else if (sizeWarning()) { kind = 'warn'; parts = [icon('warn'), el('span', 'fv-iv-slot-tx', sizeWarning())]; } else if (fitted && fitted.file === shownFile) { kind = 'info'; parts = [icon('info'), el('span', 'fv-iv-slot-tx', fittedNote(fitted, t, !!info?.unified_memory))]; } else parts = running ? [el('span', 'fv-iv-slot-tx', t('Generating; you can leave this view', '正在生成,可以离开这个视图'))] : []; @@ -1105,7 +1060,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = const limit = machineLimit(model.id, info, fittedAreas[model.id]), now = size(); if (!Number.isFinite(limit.area) || now.width * now.height <= limit.area * 1.02) return ''; const smaller = sizeFor(model.id, ratioValue(shapeOf()), limit.area); - return t(`May not fit this computer; it would be made at about ${sizeText(smaller)}`, `这台电脑可能放不下,会自动改为约 ${sizeText(smaller)}`); + return t('May not fit this computer; it would be made at about {size}', '这台电脑可能放不下,会自动改为约 {size}', { size: sizeText(smaller) }); } // The left panel's first screen is whole: groups that would be cut at its bottom fold for this screen only // (the saved choice stays), least needed first; more room opens them again. A group the user opens stays open. @@ -1152,20 +1107,20 @@ export function openImageView(node, {studio = null, client: given = null, poll = delete go.dataset.fvTipWhy; if (busy) { goLabel.textContent = t('Stop', '停止'); goSub.textContent = ''; - tip(go, t('Stop', '停止'), t('Cancel this picture; asks first', '取消这一张,会先确认')); + tip(go, t('Stop', '停止'), t('Cancel this image; asks first', '取消这一张,会先确认')); } else if (s.state === 'downloading') { - goLabel.textContent = s.verifying ? verifyText(s) : s.paused ? t(`Paused ${Math.floor(s.fraction * 100)}%`, `已暂停 ${Math.floor(s.fraction * 100)}%`) - : t(`Installing ${Math.floor(s.fraction * 100)}%`, `正在安装 ${Math.floor(s.fraction * 100)}%`); + goLabel.textContent = s.verifying ? verifyText(s) : s.paused ? t('Paused {percent}%', '已暂停 {percent}%', { percent: Math.floor(s.fraction * 100) }) + : t('Installing {percent}%', '正在安装 {percent}%', { percent: Math.floor(s.fraction * 100) }); goSub.textContent = pendingGenerate ? t('then generates', '完成后生成') : ''; tip(go, pendingGenerate ? t('Generates when installed', '安装完自动生成') : t('Generate when installed', '安装完再生成'), pendingGenerate ? t('Press to not generate after it', '再按一次取消自动生成') : t('Press to generate as soon as it is installed', '按下后,安装完成即自动生成')); } else if (s.state === 'missing' || s.state === 'failed') { - goLabel.textContent = t('Install and generate', '安装并生成'); goSub.textContent = s.total ? t(`about ${(s.total / 1e9).toFixed(1)} GB`, `约 ${(s.total / 1e9).toFixed(1)} GB`) : ''; - tip(go, t('Install and generate', '安装并生成'), t(`Downloads ${model.short}, then makes the picture`, `先下载 ${model.short},再生成图片`), `${mod}+Enter`); + goLabel.textContent = t('Install and generate', '安装并生成'); goSub.textContent = s.total ? t('about {size} GB', '约 {size} GB', { size: (s.total / 1e9).toFixed(1) }) : ''; + tip(go, t('Install and generate', '安装并生成'), t('Downloads {short}, then makes the image', '先下载 {short},再生成图片', { short: model.short }), `${mod}+Enter`); } else { // The size is said once, on its own chip; Generate says only how long it may take. - goLabel.textContent = t('Generate', '生成'); goSub.textContent = est ? t(`about ${est} s`, `约 ${est} 秒`) : ''; - tip(go, t('Generate', '生成'), t(`Makes a ${sizeText(now)} picture`, `生成一张 ${sizeText(now)} 的图片`), `${mod}+Enter`); - if (!hasWords()) go.dataset.fvTipWhy = t('Describe the picture first', '先写一句描述'); + goLabel.textContent = t('Generate', '生成'); goSub.textContent = est ? t('about {est} s', '约 {est} 秒', { est }) : ''; + tip(go, t('Generate', '生成'), t('Makes a {size} image', '生成一张 {size} 的图片', { size: sizeText(now) }), `${mod}+Enter`); + if (!hasWords()) go.dataset.fvTipWhy = t('Describe the image first', '先写一句描述'); } // With no time (or size) to say beside it, the word sits alone in the middle of the key. go.dataset.eta = String(!!goSub.textContent); @@ -1210,7 +1165,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = ? t('Describe the people, their clothes and the place, for example: a young woman in a beige trench coat on a pier at dusk', '写下人物、衣着和地点,例如:穿米色风衣的年轻女性,站在黄昏的海边栈桥上') : references.some((r, at) => r.sketch && at < cap_(model)) ? t('Write what the sketch shows, for example: a person raising both hands', '写下草图画的是什么,例如:一个人举起双手') : ''; - prompt.setAttribute('aria-label', references.length ? t('What to make or change', '要画什么或要改什么') : t('Describe the picture', '描述画面')); + prompt.setAttribute('aria-label', references.length ? t('What to make or change', '要画什么或要改什么') : t('Describe the image', '描述画面')); // Said only near the limit. promptCount.textContent = prompt.value.length >= 1600 ? `${prompt.value.length} / 2000` : ''; // The count shows only near the limit; the row is fitted again when it comes or goes. @@ -1226,7 +1181,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = sizer.paint({model: model.id, ratio, ref: references.length && firstRef() ? {url: references[0].url, ratio: ratioValue(firstRef())} : null, custom, area, size: sent, locked, limit, ratioValue: ratioValue(shapeOf())}); seedInput.disabled = busy; - advGroup.meta.textContent = seedInput.value ? t(`Seed ${seedInput.value}`, `种子 ${seedInput.value}`) : ''; + advGroup.meta.textContent = seedInput.value ? t('Seed {value}', '种子 {value}', { value: seedInput.value }) : ''; paintGo(); paintSlot(); drawStage(); const row = runRow(); paintRunTile(row?.percent || 0); @@ -1271,7 +1226,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (next) { draftSize.textContent = sizeText(next); const est = estimateSeconds(meta.samples(), model.id, next.width * next.height); - draftHint.textContent = draftPreview ? '' : [t('Next picture', '下一张'), est ? t(`about ${est} s`, `约 ${est} 秒`) : ''].filter(Boolean).join(' · '); + draftHint.textContent = draftPreview ? '' : [t('Next image', '下一张'), est ? t('about {est} s', '约 {est} 秒', { est }) : ''].filter(Boolean).join(' · '); } if (state === 'done') { const mine = lastReport?.file === shownFile ? lastReport.id : null; @@ -1298,24 +1253,24 @@ export function openImageView(node, {studio = null, client: given = null, poll = save.href = url; save.setAttribute('download', shownFile.slice(shownFile.lastIndexOf('/') + 1)); const full = references.length >= most() || cap_(model) === 0; editThis.disabled = asReference.disabled = full; - const why = cap_(model) === 0 ? t(`${model.short} takes no references; choose the other model`, `${model.short} 不用参考图,请换另一个模型`) : t('The reference slots are full; remove one', '参考图已满,先移除一张'); + const why = cap_(model) === 0 ? t('{short} takes no references; choose the other model', '{short} 不用参考图,请换另一个模型', { short: model.short }) : t('The reference slots are full; remove one', '参考图已满,先移除一张'); tip(editThis, t('Edit', '编辑'), t('Make a new version: it becomes Image 1', '以这张为图 1,描述要改的地方')); - tip(asReference, t('Use as reference', '用作参考图'), t('Add it to the reference pictures', '加入参考图')); + tip(asReference, t('Use as reference', '用作参考图'), t('Add it to the reference images', '加入参考图')); for (const b of [editThis, asReference]) { if (full) b.dataset.fvTipWhy = why; else delete b.dataset.fvTipWhy; } const fav = meta.isFav(shownFile); favBtn.setAttribute('aria-pressed', String(fav)); - tip(favBtn, fav ? t('Remove star', '取消收藏') : t('Star', '收藏'), fav ? t('Take it out of favourites', '移出收藏') : t('Keep it in favourites', '加入收藏'), 'F'); + tip(favBtn, fav ? t('Remove from favorites', '取消收藏') : t('Favorite', '收藏'), fav ? t('Take it out of favorites', '移出收藏') : t('Keep it in favorites', '加入收藏'), 'F'); const known = promptFor(shownFile) || layoutOf[shownFile]; usePromptItem.hidden = useInline.hidden = !known; copyInline.hidden = !promptFor(shownFile); // The line under the picture is about the picture shown: the model that made it, its size, its shape and the time it took. const width = picture.naturalWidth && picture.dataset.file === shownFile ? picture.naturalWidth : shown?.width || 0, height = picture.naturalWidth && picture.dataset.file === shownFile ? picture.naturalHeight : shown?.height || 0; const madeBy = IMAGE_MODELS.find(m => m.id === (shown?.model || rows.find(r => r.file === shownFile)?.model))?.name; infoText.textContent = [madeBy, width ? `${width} × ${height}` : '', width ? pictureShape(width, height) : '', - shown?.seconds ? t(`${shown.seconds} s`, `${shown.seconds} 秒`) : started ? t(`${started} s`, `${started} 秒`) : ''].filter(Boolean).join(' · '); + shown?.seconds ? t('{seconds} s', '{seconds} 秒', { seconds: shown.seconds }) : started ? t('{started} s', '{started} 秒', { started }) : ''].filter(Boolean).join(' · '); } comparer.paint(compare); stage.dataset.mode = compare ? 'compare' : 'single'; if (tallQuery.matches) fitTallSoon(); - if (rightTab === 'info' && infoPop.dataset.file !== shownFile) { infoPop.dataset.file = shownFile; paintInfo(); } - tabWorksN.textContent = ''; + if (workColumn.tab === 'info' && infoPop.dataset.file !== shownFile) { infoPop.dataset.file = shownFile; paintInfo(); } + workColumn.setWorksCount(''); } picture.onload = () => { // Its real shape is kept, so the next time this picture opens its frame is the right size from the first frame. @@ -1434,9 +1389,9 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (length > 0 && length <= 2000) return true; note.dataset.kind = ''; say(length > 2000 - ? t(`With the picture references counted, the prompt is over 2,000 characters. Shorten it by ${length - 2000} and try again.`, - `加上图片引用后,提示词超过 2000 字。请缩短 ${length - 2000} 字后重试。`) - : t('The prompt has only picture references and no words. Describe the picture you want, then try again.', '提示词里只有图片引用,没有文字。请写上要生成的画面后重试。')); + ? t('With the image references counted, the prompt is over 2,000 characters. Shorten it by {count} and try again.', + '加上图片引用后,提示词超过 2000 字。请缩短 {count} 字后重试。', { count: length - 2000 }) + : t('The prompt has only image references and no words. Describe the image you want, then try again.', '提示词里只有图片引用,没有文字。请写上要生成的画面后重试。')); return false; }; if (!fits()) { prompt.focus(); return; } @@ -1509,7 +1464,11 @@ export function openImageView(node, {studio = null, client: given = null, poll = progressLine.textContent = row.status === 'running' ? [words, `${Math.floor(percent * 100)}%`].join(' · ') : words; // The second line changes with every report, so the page never looks stuck; elapsed counts from the job's own start. const begun = row.started_at || row.created_at || Date.now(); - progressSub.textContent = [`${t('Elapsed', '已用时')} ${duration((Date.now() - begun) / 1000)}`, imageRemainingText(row.eta_seconds, t)].filter(Boolean).join(' · '); + const waiting = Boolean(row.meta?.reconnecting); + // While waiting, no estimate: nothing is being made until FreeVideo answers again. + progressSub.textContent = [`${t('Elapsed', '已用时')} ${duration((Date.now() - begun) / 1000)}`, waiting ? '' : imageRemainingText(row.eta_seconds, t)].filter(Boolean).join(' · '); + if (waiting) progressLine.textContent = t(...WAITING_TEXT.status); + stopWaiting.hidden = !waiting; stopWaiting.textContent = t(...WAITING_TEXT.stop); level.hidden = false; level.dataset.counted = row.status === 'running' ? 'true' : 'false'; level.style.setProperty('--fv-progress', String(percent * 100)); if (row.meta?.preview) showStep(row.meta.preview); const reportId = row.meta?.report_id; @@ -1520,7 +1479,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = return; } // Ended: the page lets go of the job; the floating window has nothing more to say about it once seen here. - unwatch?.(); unwatch = null; running = null; level.hidden = true; clearStep(); delete canvas.dataset.fvTaskId; + unwatch?.(); unwatch = null; running = null; level.hidden = true; clearStep(); delete canvas.dataset.fvTaskId; stopWaiting.hidden = true; jobs.markSeen(row.id); if (row.status === 'done' && row.result?.file) { shownFile = row.result.file; promptOf[shownFile] = row.meta?.text ?? row.prompt ?? ''; if (row.meta?.layout) layoutOf[shownFile] = row.meta.layout; @@ -1530,6 +1489,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = } else if (row.status === 'failed' || row.status === 'interrupted') { const reason = row.failure || {}; failure = {error: reason.code || 'generation_failed', report_id: reason.report_id, stage: reason.stage, step: reason.step, fitted: reason.fitted, memory: reason.memory, other_usage: reason.other_usage, + cause: reason.cause, misses: reason.misses, retryStandard: row.meta?.tier === 'high' && reason.code === 'no_memory'}; renderFailure(); jobs.dismiss(row.id); } else jobs.dismiss(row.id); @@ -1544,16 +1504,17 @@ export function openImageView(node, {studio = null, client: given = null, poll = // A model this computer does not run: the way on is the other model, one press. const other = failure.error === 'model_unavailable' ? IMAGE_MODELS.find(m => m.id !== model.id && offers(m)) : null; renderImageFailure(failHost, {...failure, info}, t, {retry: other ? { - label: [`Use ${other.name}`, `改用 ${other.name}`], + label: ['Use {model}', '改用 {model}', { model: other.name }], onClick: () => { chooseModel(other); void generate(); }} : { label: failure.retryStandard ? ['Retry at Standard', '改用标准并重试'] : ['Retry', '重试'], onClick: () => { if (failure.noList) { failure = null; render(); go.onclick(); return; } if (failure.retryStandard) { area = RANGES[model.id].presets.standard; keepSize(); } void generate(); }}}); const head = el('div', 'fv-iv-fail-head'), mark = el('i', 'fv-iv-fail-icon'); mark.append(icon('warn')); - head.append(mark, el('h3', '', failure.error === 'engine_closed' || failure.error === 'engine_restarted' ? t('The engine stopped', '引擎停止了') : t('The picture was not made', '这张没有生成出来'))); + // One title for every failure; why FreeVideo went away is in the sentence below it (Lane, engine-closed-reason). + head.append(mark, el('h3', '', t('The image was not made', '这张没有生成出来'))); failHost.prepend(head); const stage_ = STAGE_WORDS[failure.stage]; // No request was made when the list could not be fetched: there is no model or size to name. - if (!failure.noList) failHost.append(el('p', 'fv-iv-fail-facts', [model.short, sizeText(asked), stage_ ? t(`stopped at: ${stage_[0].toLowerCase()}`, `停在:${stage_[1]}`) : ''].filter(Boolean).join(' · '))); + if (!failure.noList) failHost.append(el('p', 'fv-iv-fail-facts', [model.short, sizeText(asked), stage_ ? t('stopped at: {stage}', '停在:{stage}', { stage: t(...[stage_[0].toLowerCase(), stage_[1]]) }) : ''].filter(Boolean).join(' · '))); } // ── run: tasks owns this block (job store) ── // Stop asks first; closing the page or switching views never stops the job. @@ -1591,7 +1552,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = else if (!hasWords()) { promptGroup.open(true); prompt.focus(); } else void generate(); }; - go.addEventListener('click', () => { if (drawer === 'left' && go.dataset.state === 'ready' && hasWords()) { drawer = ''; paintPanels(); } }, {capture: true}); + go.addEventListener('click', () => { if (shell.drawer() === 'left' && go.dataset.state === 'ready' && hasWords()) shell.closeDrawer(); }, {capture: true}); prompt.addEventListener('input', () => { growPrompt(); render(); }); // Getting the model ready before Generate is pressed (nothing of it shows): being here a few seconds loads the model // where the card has free room for it (eager loading; the engine reads the files ahead where it would take the @@ -1622,7 +1583,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = try { const {openImageEditor} = await import('./image_editor.js').catch(error => { loadFailed = true; throw error; }); outcome = await openImageEditor({source: file, name: file, role: 'reference', t, resolve: pictureURL, upload: async blob => client.upload(blob), imageGenClient: client}); - } catch { say(loadFailed ? t('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : t('This picture could not be read. Choose another picture.', '这张图无法读取。请重新选择一张。')); return; } + } catch { say(loadFailed ? t('The image editor did not load. Reload the page and try again.', '图片编辑器没有加载出来。请刷新页面后再试。') : t('This image could not be read. Choose another image.', '这张图无法读取。请重新选择一张。')); return; } if (!alive || !outcome?.blob) return; try { const edited = new File([outcome.blob], outcome.name || 'edited.png', {type: outcome.blob.type || 'image/png'}); @@ -1632,7 +1593,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = const record = {file: edited, url: URL.createObjectURL(edited), width: outcome.width, height: outcome.height}; if (references.length >= most()) URL.revokeObjectURL(record.url); else { changeRefs(() => references.unshift(record)); promptGroup.open(true); } render(); - } catch (error) { say(isNetworkTypeError(error) ? connectionLostText(t) : t('The edited picture could not be saved. Try again; if it keeps failing, report the problem.', '编辑后的图片没能保存。请重试;仍然失败时,请提交问题。')); } + } catch (error) { say(isNetworkTypeError(error) ? connectionLostText(t) : t('The edited image could not be saved. Try again; if it keeps failing, report the problem.', '编辑后的图片没能保存。请重试;仍然失败时,请提交问题。')); } } asReference.addEventListener('click', () => void useAsReference(shownFile, false)); // Opens downward when it fits inside the stage, otherwise upward over the picture. @@ -1724,7 +1685,7 @@ export function openImageView(node, {studio = null, client: given = null, poll = if (layout.tookEscape() || layout.escape()) return; if (!more.hidden) more.hidden = true; else if (!keysPop.hidden) { keysPop.hidden = true; keysBtn.setAttribute('aria-pressed', 'false'); } - else if (drawer) { drawer = ''; paintPanels(); } + else if (shell.drawer()) shell.closeDrawer(); else if (compare) { selecting = false; picked.clear(); drawWorks(); render(); } else if (draft && shownFile) { draft = false; draftPreview = null; render(); } else if (view === 'trash') { view = 'works'; drawWorks(); } diff --git a/web/image_view_compare.js b/web/image_view_compare.js index fa8edc7b..68921338 100644 --- a/web/image_view_compare.js +++ b/web/image_view_compare.js @@ -17,7 +17,7 @@ export function compareView({pictureURL, labelOf, ratioOf = () => 0, onPick, onR const root = el('div', 'fv-iv-compare'); root.dataset.shown = 'false'; root.inert = true; root.setAttribute('aria-hidden', 'true'); const bar = el('div', 'fv-iv-compare-bar'); const note = el('span', 'fv-iv-compare-note'); - const close = button('fv-iv-text-btn', {iconName: 'x', label: t('Done', '完成'), name: t('Leave compare', '退出对比'), use: t('Clear the selection and see one picture', '取消多选,回到单张'), key: 'Esc'}); + const close = button('fv-iv-text-btn', {iconName: 'x', label: t('Done', '完成'), name: t('Leave compare', '退出对比'), use: t('Clear the selection and see one image', '取消多选,回到单张'), key: 'Esc'}); bar.append(note, el('span', 'fv-iv-grow'), close); const panes = el('div', 'fv-iv-compare-panes'); root.append(bar, panes); @@ -81,7 +81,7 @@ export function compareView({pictureURL, labelOf, ratioOf = () => 0, onPick, onR root.dataset.shown = String(shown); root.inert = !shown; root.setAttribute('aria-hidden', String(!shown)); if (!shown) return; const n = state.files.length, total = state.total || n; - note.textContent = total > n ? t(`Comparing the first ${n} of ${total}`, `对比前 ${n} 张(已选 ${total} 张)`) : t(`Comparing ${n}`, `对比 ${n} 张`); + note.textContent = total > n ? t('Comparing the first {n} of {total}', '对比前 {n} 张(已选 {total} 张)', { n, total }) : t('Comparing {n}', '对比 {n} 张', { n }); const mode = n === 2 ? pairMode(ratioOf(state.files[0]), ratioOf(state.files[1])) : 'grid'; const key = mode + '|' + state.files.join('|') + '|' + state.files.map(labelOf).join('|'); if (key === current) return; current = key; diff --git a/web/image_view_history.js b/web/image_view_history.js index c6068566..539b4397 100644 --- a/web/image_view_history.js +++ b/web/image_view_history.js @@ -153,8 +153,8 @@ export function createTrash({client, holdMs = 10000, now = () => Date.now(), set return trash; } -const FILTER_WORDS = {all: ['All', '全部'], fav: ['Favourites', '收藏'], today: ['Today', '今天'], 'minimax-h3-image': ['H3', 'H3'], 'qwen-image-2.1-turbo': ['Qwen', 'Qwen'], 'moss-image-sft': ['MOSS', 'MOSS']}; -const SORT_WORDS = {new: ['Newest first', '最新在前'], old: ['Oldest first', '最早在前'], fav: ['Favourites first', '收藏在前']}; +const FILTER_WORDS = {all: ['All', '全部'], fav: ['Favorites', '收藏'], today: ['Today', '今天'], 'minimax-h3-image': ['H3', 'H3'], 'qwen-image-2.1-turbo': ['Qwen', 'Qwen'], 'moss-image-sft': ['MOSS', 'MOSS']}; +const SORT_WORDS = {new: ['Newest first', '最新在前'], old: ['Oldest first', '最早在前'], fav: ['Favorites first', '收藏在前']}; // The column itself. `paint(state)` redraws; tiles are kept by file so pictures never reload on a redraw. // thumbURL: a picture's small copy for the tiles (the picture itself without one). queue: the page's background @@ -164,13 +164,13 @@ export function historyPanel({pictureURL, thumbURL = pictureURL, queue = null, o const root = el('div', 'fv-iv-works'); // Head: title and count, search, sort, select, fold. const head = el('div', 'fv-iv-panel-head'); - const title = el('h2', 'fv-iv-panel-title', t('Works', '作品')), count = el('span', 'fv-iv-count'); + const title = el('h2', 'fv-iv-panel-title', t('Creations', '作品')), count = el('span', 'fv-iv-count'); const sortBtn = button('fv-iv-icon-btn', {iconName: 'sort'}); const selectBtn = button('fv-iv-icon-btn', {iconName: 'select', name: t('Select', '选择'), use: t('Pick several to compare or delete', '选几张来对比或删除')}); - const collapse = button('fv-iv-icon-btn fv-iv-collapse', {iconName: 'panelR', name: t('Hide works', '收起作品栏'), use: t('More room for the picture', '给画面腾出空间')}); + const collapse = button('fv-iv-icon-btn fv-iv-collapse', {iconName: 'panelR', name: t('Hide creations', '收起作品栏'), use: t('More room for the image', '给画面腾出空间')}); head.append(title, count, el('span', 'fv-iv-grow'), collapse); const searchRow = el('label', 'fv-iv-search'); const query = el('input'); query.type = 'search'; query.placeholder = t('Search prompts', '搜索提示词'); - tip(query, t('Search', '搜索'), t('Find pictures by their prompt', '按提示词查找图片'), `${mod}+F`); searchRow.append(icon('search'), query); + tip(query, t('Search', '搜索'), t('Find images by their prompt', '按提示词查找图片'), `${mod}+F`); searchRow.append(icon('search'), query); const toolsRow = el('div', 'fv-iv-works-tools'); toolsRow.append(searchRow, sortBtn, selectBtn); const chips = el('div', 'fv-iv-chips'); chips.setAttribute('role', 'tablist'); const chipButtons = FILTERS.map(f => { const b = button('fv-iv-chip'); b.dataset.filter = f; b.setAttribute('role', 'tab'); b.append(el('span', 'fv-iv-btn-label', t(...FILTER_WORDS[f])), el('span', 'fv-iv-chip-n')); b.addEventListener('click', () => onFilter(f)); return b; }); @@ -186,16 +186,16 @@ export function historyPanel({pictureURL, thumbURL = pictureURL, queue = null, o // Foot: the selection bar, or the way to recently deleted and the folder. const foot = el('div', 'fv-iv-panel-foot'); const batch = el('div', 'fv-iv-batch'), picked = el('b', 'fv-iv-picked'); - const allBtn = button('fv-iv-text-btn', {label: t('All', '全选'), name: t('Select all', '全选'), use: t('Pick every picture shown', '选中当前显示的全部图片'), key: `${mod}+A`}); + const allBtn = button('fv-iv-text-btn', {label: t('All', '全选'), name: t('Select all', '全选'), use: t('Pick every image shown', '选中当前显示的全部图片'), key: `${mod}+A`}); const favBtn = button('fv-iv-icon-btn', {iconName: 'star'}); const deleteBtn = button('fv-iv-icon-btn fv-iv-danger', {iconName: 'trash'}); const doneBtn = button('fv-iv-text-btn', {label: t('Done', '完成'), name: t('Done', '完成'), use: t('Leave selection', '退出多选'), key: 'Esc'}); // Two or more picked are compared on the stage by themselves; the bar keeps what is done to all of them. batch.append(picked, allBtn, el('span', 'fv-iv-grow'), favBtn, deleteBtn, doneBtn); const links = el('div', 'fv-iv-links'); - const trashLink = button('fv-iv-link', {iconName: 'trash', label: t('Recently deleted', '最近删除'), name: t('Recently deleted', '最近删除'), use: t('Bring back a picture you just deleted', '找回刚删除的图片')}); + const trashLink = button('fv-iv-link', {iconName: 'trash', label: t('Recently deleted', '最近删除'), name: t('Recently deleted', '最近删除'), use: t('Bring back an image you just deleted', '找回刚删除的图片')}); const trashN = el('span', 'fv-iv-link-n'); trashLink.append(trashN); - const folderLink = button('fv-iv-icon-btn', {iconName: 'folder', name: t('Open folder', '打开文件夹'), use: t('Show the pictures on this computer', '在电脑上打开保存图片的文件夹')}); + const folderLink = button('fv-iv-icon-btn', {iconName: 'folder', name: t('Open folder', '打开文件夹'), use: t('Show the images on this computer', '在电脑上打开保存图片的文件夹')}); links.append(trashLink, el('span', 'fv-iv-grow'), folderLink); foot.append(batch, links); root.append(head, toolsRow, chips, sortMenu, body, foot); @@ -277,12 +277,12 @@ export function historyPanel({pictureURL, thumbURL = pictureURL, queue = null, o b.setAttribute('aria-selected', String(state.filter === f)); b.setAttribute('aria-pressed', String(state.filter === f)); b.querySelector('.fv-iv-chip-n').textContent = ''; b.hidden = (f.includes('-') && !n && state.filter !== f); - tip(b, t(...FILTER_WORDS[f]), {all: t('Show every picture', '显示全部图片'), fav: t('Only the starred ones', '只看收藏的图片'), today: t('Only pictures made today', '只看今天生成的'), - 'minimax-h3-image': t('Only pictures made with H3 Image', '只看 H3 Image 生成的'), 'qwen-image-2.1-turbo': t('Only pictures made with Qwen-Image', '只看 Qwen-Image 生成的'), - 'moss-image-sft': t('Only pictures made with MOSS-Image', '只看 MOSS-Image 生成的')}[f]); + tip(b, t(...FILTER_WORDS[f]), {all: t('Show every image', '显示全部图片'), fav: t('Only the starred ones', '只看收藏的图片'), today: t('Only images made today', '只看今天生成的'), + 'minimax-h3-image': t('Only images made with H3 Image', '只看 H3 Image 生成的'), 'qwen-image-2.1-turbo': t('Only images made with Qwen-Image', '只看 Qwen-Image 生成的'), + 'moss-image-sft': t('Only images made with MOSS-Image', '只看 MOSS-Image 生成的')}[f]); } for (const item of sortItems) item.setAttribute('aria-checked', String(item.dataset.sort === state.sort)); - tip(sortBtn, t('Sort', '排序'), t(`Now: ${t(...SORT_WORDS[state.sort])}`, `当前:${t(...SORT_WORDS[state.sort])}`)); + tip(sortBtn, t('Sort', '排序'), t('Now: {order}', '当前:{order}', { order: t(...SORT_WORDS[state.sort]) })); selectBtn.setAttribute('aria-pressed', String(state.selecting)); if (query.value !== state.query && document.activeElement !== query) query.value = state.query; // Grid. @@ -320,7 +320,7 @@ export function historyPanel({pictureURL, thumbURL = pictureURL, queue = null, o tile.classList.toggle('fv-iv-picked', state.picked.has(row.file)); tile.classList.toggle('fv-iv-fav', state.meta.isFav(row.file)); const open = tile.firstChild, words = promptOfRow(row); - tip(open, words ? (words.length > 40 ? words.slice(0, 40) + '…' : words) : t('Picture', '图片'), + tip(open, words ? (words.length > 40 ? words.slice(0, 40) + '…' : words) : t('Image', '图片'), state.selecting ? t('Click to pick; Shift picks a run', '点选;按住 Shift 连选') : t('Show it on the stage; pick several to compare', '在中间显示;多选即可对比')); open.setAttribute('aria-pressed', String(state.selecting ? state.picked.has(row.file) : row.file === state.shownFile)); open.setAttribute('aria-selected', String(state.selecting ? state.picked.has(row.file) : row.file === state.shownFile)); @@ -334,22 +334,23 @@ export function historyPanel({pictureURL, thumbURL = pictureURL, queue = null, o reconcile(grid, blocks); for (const [file, tile] of tiles) if (!order.includes(file) && !state.allFiles.has(file)) originals?.unobserve(tile), tiles.delete(file), tile.remove(); empty.hidden = state.rows.length > 0 || !!state.running || !!state.loading; - empty.replaceChildren(icon(state.total ? 'search' : 'asref'), el('span', '', state.total ? t('Nothing matches', '没有符合条件的图片') : t('Pictures you make appear here', '生成的图片会出现在这里'))); + // With no work at all the page stays empty: no sentence (design 11-19); a filter that hides every work says so. + if (state.total) empty.replaceChildren(icon('search'), el('span', '', t('Nothing matches', '没有符合条件的图片'))); else empty.replaceChildren(); } else { empty.hidden = true; const rows = state.trash; const headRow = el('div', 'fv-iv-trash-head'); - const back = button('fv-iv-text-btn', {iconName: 'left', label: t('Works', '作品'), name: t('Back to works', '回到作品'), use: t('Leave recently deleted', '离开最近删除'), key: 'Esc'}); + const back = button('fv-iv-text-btn', {iconName: 'left', label: t('Creations', '作品'), name: t('Back to creations', '回到作品'), use: t('Leave recently deleted', '离开最近删除'), key: 'Esc'}); back.addEventListener('click', () => onTrash(false)); headRow.append(back, el('span', 'fv-iv-grow')); if (rows.length) { const all = button('fv-iv-text-btn fv-iv-danger', {label: t('Delete now', '立即删除'), name: t('Delete now', '立即删除'), use: t('Remove these for good, without waiting', '不再等待,永久删除这些图片')}); all.addEventListener('click', () => onPurge(null)); headRow.append(all); } - const note = el('p', 'fv-iv-trash-note', t(`Deleted pictures stay here for ${Math.round(state.holdSeconds)} s, then they are gone.`, `删除的图片在这里保留 ${Math.round(state.holdSeconds)} 秒,之后永久删除。`)); + const note = el('p', 'fv-iv-trash-note', t('Deleted images stay here for {seconds} s, then they are gone.', '删除的图片在这里保留 {seconds} 秒,之后永久删除。', { seconds: Math.round(state.holdSeconds) })); const list = el('div', 'fv-iv-trash-list'); for (const h of rows) { const item = el('div', 'fv-iv-trash-row'); const th = el('img'); th.alt = ''; th.src = pictureURL(h.row.file); const left = Math.max(0, Math.ceil((h.at + state.holdSeconds * 1000 - Date.now()) / 1000)); - const tx = el('span', 'fv-iv-trash-tx'); tx.append(el('b', '', promptOfRow(h.row) || h.row.name || h.row.file), el('small', '', t(`Gone in ${left} s`, `${left} 秒后永久删除`))); - const restore = button('fv-iv-text-btn', {iconName: 'restore', label: t('Restore', '恢复'), name: t('Restore', '恢复'), use: t('Put it back in works', '放回作品里')}); + const tx = el('span', 'fv-iv-trash-tx'); tx.append(el('b', '', promptOfRow(h.row) || h.row.name || h.row.file), el('small', '', t('Gone in {left} s', '{left} 秒后永久删除', { left }))); + const restore = button('fv-iv-text-btn', {iconName: 'restore', label: t('Restore', '恢复'), name: t('Restore', '恢复'), use: t('Put it back in creations', '放回作品里')}); restore.addEventListener('click', () => onRestore([h.row.file])); item.append(th, tx, restore); list.append(item); } @@ -358,12 +359,12 @@ export function historyPanel({pictureURL, thumbURL = pictureURL, queue = null, o } // Foot. batch.hidden = !state.selecting; links.hidden = state.selecting; - picked.textContent = t(`${state.picked.size} selected`, `已选 ${state.picked.size} 张`); + picked.textContent = t('{size} selected', '已选 {size} 张', { size: state.picked.size }); const none = state.picked.size === 0; const allFav = !none && [...state.picked].every(f => state.meta.isFav(f)); favBtn.setAttribute('aria-disabled', String(none)); deleteBtn.setAttribute('aria-disabled', String(none)); - tip(favBtn, allFav ? t('Remove star', '取消收藏') : t('Star', '收藏'), none ? t('Pick a picture first', '先选中图片') : allFav ? t('Take these out of favourites', '把选中的移出收藏') : t('Keep these in favourites', '把选中的加入收藏'), 'F'); - tip(deleteBtn, t('Delete', '删除'), none ? t('Pick a picture first', '先选中图片') : t('Move to recently deleted; can be undone', '移到最近删除,可以撤销'), 'Delete'); + tip(favBtn, allFav ? t('Remove from favorites', '取消收藏') : t('Favorite', '收藏'), none ? t('Pick an image first', '先选中图片') : allFav ? t('Take these out of favorites', '把选中的移出收藏') : t('Keep these in favorites', '把选中的加入收藏'), 'F'); + tip(deleteBtn, t('Delete', '删除'), none ? t('Pick an image first', '先选中图片') : t('Move to recently deleted; can be undone', '移到最近删除,可以撤销'), 'Delete'); trashN.textContent = state.trash.length ? String(state.trash.length) : ''; trashLink.setAttribute('aria-pressed', String(state.view === 'trash')); } diff --git a/web/image_view_layout.js b/web/image_view_layout.js index 65226571..794f4c70 100644 --- a/web/image_view_layout.js +++ b/web/image_view_layout.js @@ -101,7 +101,7 @@ export function createLayout({host, layer = document.body, onChange = () => {}, function say(event) { // Once, beside the pointer, gone by itself: never a dialog, never left on the page. hint?.remove(); - hint = el('div', 'fv-iv-lhint', t(`Up to ${limit} boxes`, `最多 ${limit} 个框`)); hint.setAttribute('role', 'status'); + hint = el('div', 'fv-iv-lhint', t('Up to {limit} boxes', '最多 {limit} 个框', { limit })); hint.setAttribute('role', 'status'); hint.style.left = `${event.clientX + 12}px`; hint.style.top = `${event.clientY + 12}px`; layer.append(hint); const mine = hint; setTimeout(() => { mine.remove(); if (hint === mine) hint = null; }, 1600); @@ -150,8 +150,8 @@ export function createLayout({host, layer = document.body, onChange = () => {}, head.append(no); if (quotedParts(item.line).length) { const T = el('button', 'fv-iv-lbox-t', 'T'); T.type = 'button'; - T.setAttribute('aria-pressed', String(!item.textOff)); T.setAttribute('aria-label', t('Text in the picture', '写进画面的字')); - tip(T, t('Text in the picture', '写进画面的字')); + T.setAttribute('aria-pressed', String(!item.textOff)); T.setAttribute('aria-label', t('Text in the image', '写进画面的字')); + tip(T, t('Text in the image', '写进画面的字')); T.addEventListener('pointerdown', event => event.stopPropagation()); T.addEventListener('click', event => { event.stopPropagation(); remember(); item.textOff = !item.textOff; changed(); }); head.append(T); diff --git a/web/image_view_lora.js b/web/image_view_lora.js index 8a744a9b..fe4a8a24 100644 --- a/web/image_view_lora.js +++ b/web/image_view_lora.js @@ -31,7 +31,7 @@ export function imageViewLora({host, fetchApi, modelName = () => 'Qwen-Image 2.1 chip.element.dataset.active = String(on && n > 0); tip(chip.element, 'LoRA', t('Add a style or character model', '叠加风格或人物模型')); if (on) delete chip.element.dataset.fvTipWhy; - else { chip.element.dataset.fvTipWhy = t(`LoRA works with ${modelName()}; choose it to use one`, `LoRA 用于 ${modelName()},选用该模型后可添加`); chip.close(); } + else { chip.element.dataset.fvTipWhy = t('LoRA works with {model}; choose it to use one', 'LoRA 用于 {model},选用该模型后可添加', { model: modelName() }); chip.close(); } } paint(); return {element, paint, diff --git a/web/image_view_mentions.js b/web/image_view_mentions.js index 2c8778b4..88a110f0 100644 --- a/web/image_view_mentions.js +++ b/web/image_view_mentions.js @@ -4,9 +4,17 @@ // and is marked until it is chosen again. The marks are drawn over the box (the text stays the box's own). import { listenDialogKey } from './dialog_keys.js'; import { el, t, icon } from './image_view_ui.js'; +import { keywordSource } from './i18n.js'; -const TOKEN = /@(?:图|Image) ?(\d+|\?)/g; -export const mentionText = n => t(`@Image${n}`, `@图${n}`); +// The words a picture is named by in text, from the language's file and the built-in ones ("Image", "图", "圖"), and the +// ones a rewrite names a subject by ("Subject", "主体", "主體"): read before a number, with a space where the word is +// written in letters. Built with the `u` flag: a word of the language's own is bounded by what stands before and after it +// (web/i18n.js keywordSource). +const SEPARATORS = {latin: '\\s', cjk: '\\s?'}; +export const PICTURE_WORDS = new RegExp(keywordSource('image', undefined, SEPARATORS) + '(\\d+)', 'gu'); +export const SUBJECT_WORDS = new RegExp(keywordSource('subject', undefined, SEPARATORS) + '(\\d+)', 'gu'); +const TOKEN = new RegExp('@' + keywordSource('image') + ' ?(\\d+|\\?)', 'gu'); +export const mentionText = n => t('@Image{n}', '@图{n}', { n }); // The text with each mention renumbered from `before` (the pictures as they were) to `after` (as they are now). // `caret` is moved by the change in length of the mentions in front of it. @@ -128,7 +136,7 @@ export function posePrompt(text, n, words, seed) { return `${desc ? desc + close : ''}${who ? who + (who.endsWith('.') ? ' ' : '') : ''}${lead ? lead + '。' : ''}${place ? `场景是${place}。` : ''}${POSE_SKETCH(n)}${words?.arms ? words.arms + '。' : ''}${desc && STYLE_WORDS.test(desc) ? POSE_STYLED : POSE_REAL}`; } export const brokenMentions = (text, count) => [...text.matchAll(TOKEN)].filter(([, n]) => n === '?' || Number(n) < 1 || Number(n) > count).length; -export const hasMentions = text => new RegExp(TOKEN.source).test(text); +export const hasMentions = text => new RegExp(TOKEN.source, 'u').test(text); // The marks over the box and the "@" list. pictures(): [{url, label}] in order; onAdd(anchor): the way to add one. export function promptMentions({prompt, host, pictures, onAdd, onPick = () => {}}) { @@ -136,7 +144,7 @@ export function promptMentions({prompt, host, pictures, onAdd, onPick = () => {} marks.setAttribute('aria-hidden', 'true'); marks.append(sheet); prompt.after(marks); const list = el('div', 'fv-iv-at fv-glass fv-g3'); list.setAttribute('role', 'listbox'); list.hidden = true; - list.setAttribute('aria-label', t('Reference pictures', '参考图')); + list.setAttribute('aria-label', t('Reference images', '参考图')); host.append(list); let open = null; // {start, active, items} const COPY = ['fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'letterSpacing', 'lineHeight', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'textIndent', 'wordSpacing', 'tabSize']; @@ -183,7 +191,7 @@ export function promptMentions({prompt, host, pictures, onAdd, onPick = () => {} function items(query) { const all = pictures().map((p, at) => ({n: at + 1, ...p})); - const q = query.replace(/^(图|image)/i, '').trim(); + const q = query.replace(new RegExp('^' + keywordSource('image'), 'iu'), '').trim(); return q ? all.filter(p => String(p.n).startsWith(q)) : all; } function draw() { @@ -197,9 +205,9 @@ export function promptMentions({prompt, host, pictures, onAdd, onPick = () => {} return b; }); if (!rows.length) { - const empty = el('p', 'fv-iv-at-empty', pictures().length ? t('No picture with that number', '没有这个编号的参考图') : t('No reference pictures yet', '还没有参考图')); + const empty = el('p', 'fv-iv-at-empty', pictures().length ? t('No image with that number', '没有这个编号的参考图') : t('No reference images yet', '还没有参考图')); const add = el('button', 'fv-iv-at-item fv-iv-at-add'); add.type = 'button'; add.setAttribute('role', 'option'); add.tabIndex = -1; - add.append(icon('plus'), el('span', 'fv-iv-at-name', t('Add a reference picture', '添加参考图'))); + add.append(icon('plus'), el('span', 'fv-iv-at-name', t('Add a reference image', '添加参考图'))); add.setAttribute('aria-selected', 'true'); add.addEventListener('pointerdown', event => event.preventDefault()); add.addEventListener('click', () => { const at = open?.start; close(); if (at != null) removeAt(at); onAdd(prompt); }); diff --git a/web/image_view_models.js b/web/image_view_models.js index 3fa86680..1b8e89a2 100644 --- a/web/image_view_models.js +++ b/web/image_view_models.js @@ -4,6 +4,7 @@ // not installed and pressing Generate installs it first, then generates. import { listenDialogKey } from './dialog_keys.js'; import { el, icon, t, tip, button } from './image_view_ui.js'; +import { localized } from './i18n_tables.js'; export const IMAGE_MODELS = Object.freeze([ {id: 'minimax-h3-image', name: 'MiniMax H3 Image', short: 'H3 Image'}, @@ -30,7 +31,7 @@ export function modelState(info, id) { // A setup, update or cleanup holds the installation: the download goes on by itself and cannot be asked to go on. locked: install.state === 'paused_for_generation' && install.reason === 'busy_setup'}; if (install.state === 'failed') - return {state: 'failed', row, total, done, fraction, reason: t(install.message_en || '', install.message_zh || '') || install.reason || ''}; + return {state: 'failed', row, total, done, fraction, reason: localized({en: install.message_en || '', zh: install.message_zh || ''}, t) || install.reason || ''}; return {state: 'missing', row, total, done, fraction, resume: done > 0}; } @@ -38,20 +39,20 @@ const gb = bytes => (bytes / 1e9).toFixed(1); // Why a download waits, as the engine reports it: only a video or a picture being made pauses it, and the user can // continue it at once. // What pressing Continue download does: the download runs now, beside the video or picture being made. -export const continueUse = () => t('Download now; a video or picture being made may take longer', '现在就下载;正在进行的生成可能会变慢'); +export const continueUse = () => t('Download now; a video or image being made may take longer', '现在就下载;正在进行的生成可能会变慢'); export function pausedText(state) { return state.waitsFor === 'busy_video' ? t('Paused while a video generates; resumes after it, or continue now', '视频生成中,下载已暂停,之后自动继续,也可以现在继续下载') - : state.waitsFor === 'busy_picture' ? t('Paused while a picture is made; resumes after it, or continue now', '正在出图,下载已暂停,出完自动继续,也可以现在继续下载') + : state.waitsFor === 'busy_picture' ? t('Paused while an image is made; resumes after it, or continue now', '正在出图,下载已暂停,出完自动继续,也可以现在继续下载') : state.waitsFor === 'busy_setup' ? t('Paused while FreeVideo installs, updates or cleans up; resumes after it', 'FreeVideo 正在安装、更新或清理,下载已暂停,结束后自动继续') : t('Paused while FreeVideo uses the graphics card for another task; resumes after it, or continue now', 'FreeVideo 正在用显卡做别的任务,下载已暂停,之后自动继续,也可以现在继续下载'); } // Checking files already on disk: a percentage only when the engine reports one. -export const verifyText = state => state.unknown ? t('Verifying', '正在校验') : t(`Verifying ${Math.floor(state.fraction * 100)}%`, `正在校验 ${Math.floor(state.fraction * 100)}%`); +export const verifyText = state => state.unknown ? t('Verifying', '正在校验') : t('Verifying {percent}%', '正在校验 {percent}%', { percent: Math.floor(state.fraction * 100) }); // The size to download, said once: files the video models already have are not fetched again. export function downloadText(state) { if (!state.total) return t('Download needed', '需下载'); - if (state.resume) return t(`${gb(state.done)} of ${gb(state.total)} GB`, `已下载 ${gb(state.done)} / ${gb(state.total)} GB`); - return t(`Download needed · ${gb(state.total)} GB`, `需下载 · ${gb(state.total)} GB`); + if (state.resume) return t('{done} of {total} GB', '已下载 {done} / {total} GB', { done: gb(state.done), total: gb(state.total) }); + return t('Download needed · {total} GB', '需下载 · {total} GB', { total: gb(state.total) }); } export function statusLine(state) { switch (state.state) { @@ -68,14 +69,14 @@ const ICON_OF = {ready: 'check', failed: 'warn', downloading: 'down', unavailabl const gbOf = state => state.total ? (state.total / 1e9).toFixed(1) : ''; function useOf(model, state) { const shared = model.id !== 'moss-image-sft'; - const size = state.total ? shared ? t(`about ${gbOf(state)} GB, files shared with video are not downloaded again`, `约 ${gbOf(state)} GB,和视频共用的文件不重复下载`) - : t(`about ${gbOf(state)} GB`, `约 ${gbOf(state)} GB`) : ''; + const size = state.total ? shared ? t('about {size} GB, files shared with video are not downloaded again', '约 {size} GB,和视频共用的文件不重复下载', { size: gbOf(state) }) + : t('about {size} GB', '约 {size} GB', { size: gbOf(state) }) : ''; return { - ready: model.id === IMAGE_MODELS[0].id ? t('Large, detailed pictures, up to 16 references', '大尺寸、细节多,最多 16 张参考图') - : model.id === 'moss-image-sft' ? t('Pictures from a text prompt', '根据文字提示出图') : t('Fast pictures, up to 4 references', '出图快,最多 4 张参考图'), + ready: model.id === IMAGE_MODELS[0].id ? t('Large, detailed images, up to 16 references', '大尺寸、细节多,最多 16 张参考图') + : model.id === 'moss-image-sft' ? t('Images from a text prompt', '根据文字提示出图') : t('Fast images, up to 4 references', '出图快,最多 4 张参考图'), missing: state.row?.blocked_by ? t('Not installed: another model is downloading; this one installs after it, or when you press Generate', '未安装:另一个模型正在下载,完成后才会安装这个,也可点生成') - : t(`Not installed: Generate installs it first, ${size}`, `未安装:点生成会先安装,${size}`), - downloading: state.paused ? pausedText(state) : state.verifying ? (state.unknown ? t('Verifying the files; usable when done', '正在校验文件,完成后可以使用') : t(`Verifying the files ${Math.floor(state.fraction * 100)}%; usable when done`, `正在校验文件 ${Math.floor(state.fraction * 100)}%,完成后即可使用`)) : t(`Downloading ${Math.floor((state.fraction || 0) * 100)}%; usable when done`, `正在下载 ${Math.floor((state.fraction || 0) * 100)}%,完成后即可使用`), + : t('Not installed: Generate installs it first, {size}', '未安装:点生成会先安装,{size}', { size }), + downloading: state.paused ? pausedText(state) : state.verifying ? (state.unknown ? t('Verifying the files; usable when done', '正在校验文件,完成后可以使用') : t('Verifying the files {percent}%; usable when done', '正在校验文件 {percent}%,完成后即可使用', { percent: Math.floor(state.fraction * 100) })) : t('Downloading {percent}%; usable when done', '正在下载 {percent}%,完成后即可使用', { percent: Math.floor((state.fraction || 0) * 100) }), failed: state.reason || t('The download stopped; press Retry', '下载中断了,点重试'), unavailable: model.id === 'moss-image-sft' ? t('MOSS-Image needs an NVIDIA graphics card, which this computer does not have. Choose another model', 'MOSS-Image 需要 NVIDIA 显卡,这台电脑没有。请选别的模型') : t('This model needs an NVIDIA graphics card, which this computer does not have. Choose another model', '这个模型需要 NVIDIA 显卡,这台电脑没有。请选别的模型'), @@ -148,9 +149,9 @@ export function modelPicker({host, onPick, onInstall, onPause}) { status.replaceChildren(icon(state.unknown ? 'clock' : ICON_OF[state.state] || 'cloud'), el('span', '', statusLine(state))); // Closed, the row names the model only; it speaks when something needs doing (to download, downloading, failed). status.hidden = state.state === 'ready' || state.state === 'checking'; - tip(trigger, t('Model', '模型'), t(`${model.name}: ${useOf(model, state)}. Click to choose another`, `${model.name}:${useOf(model, state)}。点开换别的模型`)); + tip(trigger, t('Model', '模型'), t('{name}: {state}. Click to choose another', '{name}:{state}。点开换别的模型', { name: model.name, state: useOf(model, state) })); const act = actionOf(state); action.hidden = !act; action.replaceChildren(el('span', 'fv-iv-btn-label', act)); - if (act) tip(action, state.paused ? t('Continue download', '继续下载') : state.state === 'downloading' ? t('Pause download', '暂停下载') : state.state === 'failed' ? t('Retry download', '重新下载') : t(`Install ${model.short}`, `安装 ${model.short}`), + if (act) tip(action, state.paused ? t('Continue download', '继续下载') : state.state === 'downloading' ? t('Pause download', '暂停下载') : state.state === 'failed' ? t('Retry download', '重新下载') : t('Install {short}', '安装 {short}', { short: model.short }), state.paused ? continueUse() : useOf(model, state)); bar.hidden = state.state !== 'downloading'; bar.style.setProperty('--p', String(state.fraction || 0)); if (!list.hidden) { paintList(); place(); } diff --git a/web/image_view_prompts.js b/web/image_view_prompts.js index 6f45d246..12394326 100644 --- a/web/image_view_prompts.js +++ b/web/image_view_prompts.js @@ -96,8 +96,8 @@ export function promptLibrary({onUsePrompt, onApplyPreset, currentSettings, desc clearAll.hidden = tab !== 'history' || !prompts.length; if (tab === 'history') { const items = orderedPrompts(prompts); - list.replaceChildren(...items.slice(0, 30).map(p => row({title: p.text, sub: p.count > 1 ? t(`used ${p.count}×`, `用过 ${p.count} 次`) : '', pinned: p.pinned, - useName: t('Use this prompt', '使用这条提示词'), useText: t('Puts it in the prompt box', '填入描述框'), + list.replaceChildren(...items.slice(0, 30).map(p => row({title: p.text, sub: p.count > 1 ? t('used {count}×', '用过 {count} 次', { count: p.count }) : '', pinned: p.pinned, + useName: t('Use this prompt', '使用这条提示词'), useText: t('Puts it in the prompt box', '填入提示词框'), onUse: () => onUsePrompt(p.text), onPin: () => { prompts = prompts.map(x => x.text === p.text ? {...x, pinned: !x.pinned} : x); writeStore(HISTORY_KEY, prompts); paint(); }, onRemove: () => { prompts = prompts.filter(x => x.text !== p.text); writeStore(HISTORY_KEY, prompts); paint(); }}))); diff --git a/web/image_view_queue.js b/web/image_view_queue.js index 3c757dd5..000ba3b8 100644 --- a/web/image_view_queue.js +++ b/web/image_view_queue.js @@ -7,24 +7,12 @@ const VIEW_WORDS = {image: ['Images', '图像视图'], studio: ['Create', '创 const STATUS_WORDS = {submitting: ['Starting', '正在开始'], queued: ['Waiting', '排队中'], running: ['Generating', '正在生成'], cancelling: ['Stopping', '正在停止'], done: ['Done', '已完成'], failed: ['Failed', '失败'], cancelled: ['Stopped', '已停止'], interrupted: ['Interrupted', '已中断']}; const ACTIVE = new Set(['submitting', 'queued', 'running', 'cancelling']); -export const queueSummary = rows => { - const running = rows.filter(r => r.status === 'running' || r.status === 'cancelling'), waiting = rows.filter(r => r.status === 'queued' || r.status === 'submitting'); - return {running, waiting, active: running.length + waiting.length, percent: running[0] && Number.isFinite(running[0].percent) ? running[0].percent : null}; -}; - export function queuePanel({jobs, confirmStop, pictureURL, onOpen}) { const root = el('div', 'fv-iv-queue'); - const body = el('div', 'fv-iv-queue-body'), foot = el('div', 'fv-iv-panel-foot fv-iv-queue-foot'); - const footText = el('span', 'fv-iv-queue-sum'); - const stop = button('fv-iv-text-btn fv-iv-danger', {iconName: 'stop', label: t('Stop', '停止'), name: t('Stop', '停止'), use: t('Stop what is generating; asks first', '停止正在生成的任务,会先确认')}); - foot.append(footText, el('span', 'fv-iv-grow'), stop); - root.append(body, foot); + // No foot: what is generating is on its row, with the row's own stop key (the tab carries the count). + const body = el('div', 'fv-iv-queue-body'); + root.append(body); let rows = []; - stop.addEventListener('click', async () => { - const {running} = queueSummary(rows); const row = running[0]; if (!row) return; - if (!await confirmStop(stop, {kind: row.kind === 'image' ? 'image' : 'video', queued: false})) return; - try { await jobs.cancel(row.id); } catch { /* the row says it is still running */ } - }); function line(row) { const item = el('div', 'fv-iv-qrow'); item.dataset.status = row.status; const open = el('button', 'fv-iv-qrow-open'); open.type = 'button'; @@ -32,7 +20,7 @@ export function queuePanel({jobs, confirmStop, pictureURL, onOpen}) { const preview = row.meta?.preview || (row.status === 'done' && row.kind === 'image' && row.result?.file ? pictureURL(row.result.file) : ''); if (preview) { const i = el('img'); i.alt = ''; i.src = preview; i.draggable = false; th.append(i); } else th.append(icon(row.kind === 'image' ? 'asref' : 'single')); const tx = el('span', 'fv-iv-qtx'); - const title = (row.meta?.text || row.prompt || '').trim() || t(row.kind === 'image' ? 'Picture' : 'Video', row.kind === 'image' ? '图片' : '视频'); + const title = (row.meta?.text || row.prompt || '').trim() || (row.kind === 'image' ? t('Image', '图片') : t('Video', '视频')); const status = t(...(STATUS_WORDS[row.status] || STATUS_WORDS.running)) + (row.status === 'running' && Number.isFinite(row.percent) ? ` ${Math.floor(row.percent * 100)}%` : ''); tx.append(el('b', '', title), el('small', '', [t(...(VIEW_WORDS[row.view] || VIEW_WORDS.studio)), status].join(' · '))); open.append(th, tx); @@ -61,10 +49,6 @@ export function queuePanel({jobs, confirmStop, pictureURL, onOpen}) { else { const e = el('div', 'fv-iv-empty fv-iv-empty-small'); e.append(icon('clock'), el('span', '', t('Nothing is generating', '没有正在生成的任务'))); sections.push(e); } if (done.length) { sections.push(head(t('Recent', '最近完成'))); sections.push(...done.map(line)); } body.replaceChildren(...sections); - const {running, waiting, percent} = queueSummary(rows); - footText.textContent = running.length ? [t(`Generating ${percent == null ? '' : Math.floor(percent * 100) + '%'}`.trim(), `正在生成 ${percent == null ? '' : Math.floor(percent * 100) + '%'}`.trim()), waiting.length ? t(`${waiting.length} waiting`, `排队 ${waiting.length}`) : ''].filter(Boolean).join(' · ') - : waiting.length ? t(`${waiting.length} waiting`, `排队 ${waiting.length}`) : t('Idle', '空闲'); - stop.hidden = !running.length; root.dataset.count = String(active.length); root.dispatchEvent(new CustomEvent('fv-iv-queue', {bubbles: true, detail: {active: active.length}})); } diff --git a/web/image_view_size.js b/web/image_view_size.js index 5871976e..dbafe517 100644 --- a/web/image_view_size.js +++ b/web/image_view_size.js @@ -145,16 +145,16 @@ export function sizePicker({onChange, onPreview = () => {}}) { const all = sel => [...made.pop.querySelectorAll(sel)]; for (const b of all('button[data-shape]')) { const id = b.dataset.shape; - if (id === 'same') tip(b, t('Match image', '跟随图片'), t('Match the first reference picture', '画幅跟第一张参考图一致')); + if (id === 'same') tip(b, t('Match image', '跟随图片'), t('Match the first reference image', '画幅跟第一张参考图一致')); else if (id === 'custom') tip(b, t('Custom shape', '自定义画幅'), t('The width and height typed last', '上次输入的宽和高')); - else tip(b, `${t(...SHAPE_WORDS[id])} ${id}`, t('Width to height of the picture', '画面的宽高比例')); + else tip(b, `${t(...SHAPE_WORDS[id])} ${id}`, t('Width to height of the image', '画面的宽高比例')); } const [frameMore, sizeMore] = all('.fvp-more-button'); const q = sel => all(sel)[0]; if (frameMore) tip(frameMore, t('More shapes', '更多画幅'), next.ref ? t('Other shapes and Image 1', '其他比例和“同图 1”') : t('Other shapes', '其他比例')); if (sizeMore) tip(sizeMore, t('More sizes', '更多尺寸'), t('Any size between the two ends', '两端之间的任意大小')); if (q('.fvp-custom-item')) tip(q('.fvp-custom-item'), t('Custom size', '自定义尺寸'), t('Drag, or type width × height', '拖动,或输入宽 × 高')); - if (q('.fvp-slider')) tip(q('.fvp-slider'), t('Picture size', '画面大小'), t('Drag to set the pixel count', '拖动选择像素数,宽高随之变化'), '← →'); + if (q('.fvp-slider')) tip(q('.fvp-slider'), t('Image size', '画面大小'), t('Drag to set the pixel count', '拖动选择像素数,宽高随之变化'), '← →'); const [width, height] = all('.fvp-dim'); if (width) tip(width, t('Width', '宽度'), t('Type a width; snaps to 32', '输入宽度,自动对齐到 32 的倍数')); if (height) tip(height, t('Height', '高度'), t('Type a height; snaps to 32', '输入高度,自动对齐到 32 的倍数')); @@ -176,12 +176,12 @@ export function sizePicker({onChange, onPreview = () => {}}) { // for a size above it are in the status line over Generate, not repeated here. picker.set({shape, ratio: next.ratioValue, pixels: next.area / PX, width: next.size.width, height: next.size.height, locked: next.locked, range: {min: limits.min / PX, max: limits.max / PX, step: range.step / PX}, - unavailable: {same: next.ref ? '' : t('Add a reference picture first', '先添加参考图')}, + unavailable: {same: next.ref ? '' : t('Add a reference image first', '先添加参考图')}, limit: capped && limitArea > limits.min * 1.01 ? {pixels: limitArea / PX, note: ''} : null}); // Each quick size says what it makes at this shape. for (const b of picker.picker.parts.size.querySelectorAll('button[data-pixels]')) { const area = presetIn(next.model, Number(b.dataset.pixels)), made = area ? sizeText(sizeFor(next.model, next.ratioValue, area)) : ''; - tip(b, b.querySelector('.fvp-sub')?.textContent || '', t(`Quick size: ${made} at this shape`, `快捷尺寸:当前画幅下 ${made}`)); + tip(b, b.querySelector('.fvp-sub')?.textContent || '', t('Quick size: {made} at this shape', '快捷尺寸:当前画幅下 {made}', { made })); } refocus?.(); } diff --git a/web/image_view_ui.js b/web/image_view_ui.js index 930ae3a4..7f1890c3 100644 --- a/web/image_view_ui.js +++ b/web/image_view_ui.js @@ -97,8 +97,8 @@ export function writeStore(key, value) { // A collapsible group with a fixed header row; its open state is kept per name. // fixed: a group that is always open (its head is a plain title, nothing to fold). -export function section(name, {title, iconName, open = true, meta = null, actions = [], fixed = false} = {}) { - const key = 'freevideo.imageView.sections'; +export function section(name, {title, iconName, open = true, meta = null, actions = [], fixed = false, store = 'freevideo.imageView.sections'} = {}) { + const key = store; const saved = readStore(key, {}); const box = el('section', 'fv-iv-sec'); box.dataset.section = name; if (fixed) box.dataset.fixed = 'true'; const head = el('div', 'fv-iv-sec-head'); diff --git a/web/image_view_viewer.js b/web/image_view_viewer.js index 56e70ed3..ead21f50 100644 --- a/web/image_view_viewer.js +++ b/web/image_view_viewer.js @@ -8,7 +8,7 @@ import { zoomable } from './picture_zoom.js'; // step(by) → the URL of the picture now shown, or '' at an end. export function openPictureViewer({host, url, step = null, onClose = () => {}}) { const root = el('div', 'fv-iv-viewer'); root.setAttribute('role', 'dialog'); root.setAttribute('aria-modal', 'true'); - root.setAttribute('aria-label', t('Picture', '图片')); root.tabIndex = -1; + root.setAttribute('aria-label', t('Image', '图片')); root.tabIndex = -1; const img = el('img', 'fv-iv-viewer-img'); img.alt = ''; img.draggable = false; img.src = url; const close = button('fv-iv-icon-btn fv-iv-viewer-x', {iconName: 'x', name: t('Close', '关闭'), use: t('Back to the view', '回到视图'), key: 'Esc'}); root.append(img, close); host.append(root); diff --git a/web/image_works.js b/web/image_works.js index 25efbc02..b5312cfa 100644 --- a/web/image_works.js +++ b/web/image_works.js @@ -136,19 +136,19 @@ export function deleteWithUndo(files, t) { const {toast} = await import('./notifications.js'); const count = handle.files.length; let undone = false; - const note = toast(t(count === 1 ? 'Picture deleted' : `${count} pictures deleted`, `已删除 ${count} 张图片`), {ms: UNDO_MS, - action: {label: t('Undo', '撤销'), use: t('Put the pictures back', '把图片放回去'), run: () => { undone = true; handle.undo(); }}}); + const note = toast(count === 1 ? t('Image deleted', '已删除 1 张图片') : t('{count} images deleted', '已删除 {count} 张图片', { count }), {ms: UNDO_MS, + action: {label: t('Undo', '撤销'), use: t('Put the images back', '把图片放回去'), run: () => { undone = true; handle.undo(); }}}); const result = await handle.done; note.close(); const named = result.kept.flatMap(file => cardsKeeping.get(file) || []); const inCards = result.kept.filter(file => cardsKeeping.has(file)), others = result.kept.length - inCards.length; if (!undone && inCards.length) { const cards = [...new Set(named)].join(', '); - toast(cards ? t(`Used by the character card ${cards}. Remove the picture from the card, or delete the card, then delete it here.`, `这张图正被角色卡 ${cards} 使用。先从角色卡中移除这张图,或删除角色卡后再删。`) - : t('Used by a character card. Remove the picture from the card, or delete the card, then delete it here.', '这张图正被角色卡使用。先从角色卡中移除这张图,或删除角色卡后再删。'), {tone: 'warn'}); + toast(cards ? t('Used by the character card {cards}. Remove the image from the card, or delete the card, then delete it here.', '这张图正被角色卡 {cards} 使用。先从角色卡中移除这张图,或删除角色卡后再删。', { cards }) + : t('Used by a character card. Remove the image from the card, or delete the card, then delete it here.', '这张图正被角色卡使用。先从角色卡中移除这张图,或删除角色卡后再删。'), {tone: 'warn'}); for (const file of inCards) cardsKeeping.delete(file); } - if (!undone && others > 0) toast(t(`${others} could not be deleted.`, `有 ${others} 张没能删除。`), {tone: 'warn'}); + if (!undone && others > 0) toast(t('{others} could not be deleted.', '有 {others} 张没能删除。', { others }), {tone: 'warn'}); })(); return handle; } diff --git a/web/issue_button.js b/web/issue_button.js index 48066053..86f68bef 100644 --- a/web/issue_button.js +++ b/web/issue_button.js @@ -3,6 +3,7 @@ // and typed text never travel (the message goes through the same redaction as the failure card's report). import {createErrorReport} from './error_panel.js'; import {focusReportTip, reportIssue, showReportTip} from './report_issue.js'; +import { translatorFor } from './i18n.js'; const MESSAGE = 300, TAIL = 1500; const ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new'; @@ -12,7 +13,7 @@ const ISSUE_FORM = 'https://github.com/FlashML-org/FreeVideo/issues/new'; * ("Export", "导出"); `message` is the sentence the user sees; `facts` is an optional flat object of numbers, * states and fixed code identifiers (never user text or paths) that travels in the summary. */ -export function issueDraft({where, message, kind = null, facts = null}, t = en => en) { +export function issueDraft({where, message, kind = null, facts = null}, t = translatorFor(null, false)) { const place = Array.isArray(where) ? where : [String(where || 'FreeVideo'), String(where || 'FreeVideo')]; const clean = createErrorReport({exception_message: String(message || '')}).message; const lines = clean.split(/\r?\n/).filter(line => line.trim()); diff --git a/web/lan_access.js b/web/lan_access.js index e4172d83..24c597b7 100644 --- a/web/lan_access.js +++ b/web/lan_access.js @@ -4,6 +4,7 @@ import {qrcodegen} from './qrcodegen.js'; import {listenDialogKey} from './dialog_keys.js'; import { skin } from './glass/library.js'; import {userMessage} from './user_message.js'; +import {CATALOG} from './i18n.js'; const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = new URL('./lan_access.css', import.meta.url).href; document.head.append(css); const seenKey = 'freevideo.phone.opened'; export function qrMatrix(link) { return qrcodegen.QrCode.encodeText(link, qrcodegen.QrCode.Ecc.MEDIUM); } @@ -84,8 +85,8 @@ export function createLanAccess(t, api) { problem.hidden = !shown; problemText.textContent = shown ? reasons[shown] : ''; retry.disabled = writing; retry.hidden = unavailable; starting.replaceChildren(); if (pending && windows) { - if (t('en', 'zh') === 'zh') { starting.append(document.createTextNode('Windows 会弹出确认框,'), el('br'), el('span', '', '请勾选“专用网络”,再点“允许访问”。')); } - else starting.textContent = 'Windows will ask for permission. Check "Private networks", then click "Allow access".'; + if (t('en', 'zh') === 'zh' && !CATALOG) { starting.append(document.createTextNode('Windows 会弹出确认框,'), el('br'), el('span', '', '请勾选“专用网络”,再点“允许访问”。')); } + else starting.textContent = t('Windows will ask for permission. Check "Private networks", then click "Allow access".', 'Windows 会弹出确认框,请勾选“专用网络”,再点“允许访问”。'); } else if (pending) starting.textContent = t('Opening…', '正在打开…'); passwordState.textContent = state.password_set ? t('Password: on', '密码:已设置') : t('Password: not set', '密码:未设置'); set.textContent = state.password_set ? t('Change', '修改') : t('Set', '设置'); diff --git a/web/language_picker.js b/web/language_picker.js new file mode 100644 index 00000000..04480ba9 --- /dev/null +++ b/web/language_picker.js @@ -0,0 +1,187 @@ +// The interface language in Settings: a button with the globe and the language's own name, and a list of the languages +// ready to offer (Lane-5x, review/i18n/language-switch.md, direction A). The choice is saved with the launcher's settings +// (/freevideo/language), so the launcher and the page show the same language; the page reloads to change it. +import { el, icon, tip } from './settings_kit.js'; +import { listenDialogKey } from './dialog_keys.js'; +import { agentPost } from './agent_session.js'; +import { LANGUAGE } from './i18n.js'; + +// The order of the list: the languages FreeVideo's users read most first (plan.md 9.3), then any other by name. +const ORDER = ['zh-Hans', 'zh-Hant', 'en', 'es', 'pt-BR', 'ru', 'uk', 'ja', 'ko', 'fr', 'de', 'tr', 'id', 'vi', 'it', 'ar', 'fa']; +// English names, so a search for "spanish" finds Español. +const ENGLISH = {'zh-Hans': 'Chinese Simplified', 'zh-Hant': 'Chinese Traditional', en: 'English', es: 'Spanish', 'pt-BR': 'Portuguese Brazil', + ru: 'Russian', uk: 'Ukrainian', ja: 'Japanese', ko: 'Korean', fr: 'French', de: 'German', tr: 'Turkish', id: 'Indonesian', + vi: 'Vietnamese', it: 'Italian', ar: 'Arabic', fa: 'Persian'}; +const AUTO = 'auto'; +// A list longer than this gets a search box at its top. +const SEARCH_FROM = 10; +// The most rows the list shows before it scrolls. +const MAX_ROWS = 10; + +// The address value a language opens with: zh and en for the two in the code, the tag for any other. +export const addressLanguage = tag => tag === 'zh-Hans' ? 'zh' : tag; + +export function sortLanguages(rows) { + const rank = tag => { const i = ORDER.indexOf(tag); return i < 0 ? ORDER.length : i; }; + return [...rows].sort((a, b) => rank(a.tag) - rank(b.tag) || a.name.localeCompare(b.name)); +} + +// A language matches when its tag, its own name or its English name, or any word of them, starts with what was typed +// (es and spanish find Español; es does not find Chinese or Portuguese). +export function matches(row, query) { + const q = query.trim().toLowerCase(); + if (!q) return true; + const names = [row.tag, row.name, ENGLISH[row.tag] || ''].map(name => name.toLowerCase()); + return names.some(name => name.startsWith(q) || name.split(/[\s()\-]+/).some(word => word && word.startsWith(q))); +} + +// state: the answer of GET /freevideo/language ({setting, language, system, languages}). t is the module's t(en, zh). +// onSaved(state) runs after a choice is saved, with the new answer. +export function languagePicker({api, t, state, onSaved, onError}) { + const root = el('div', 'st-lang'); + const trigger = el('button', 'st-lang-btn'); trigger.type = 'button'; + trigger.setAttribute('aria-haspopup', 'listbox'); trigger.setAttribute('aria-expanded', 'false'); + const name = el('span', 'w'); + trigger.append(icon('globe'), name, icon('chev')); + // FreeVideo's own tip, as on the other settings buttons (no browser tooltip); the same words as before. + tip(trigger, t('Interface language', '界面语言'), ''); + const pop = el('div', 'st-lang-pop'); pop.hidden = true; + const search = el('input', 'st-lang-find'); search.type = 'search'; + search.placeholder = t('Search languages', '搜索语言'); search.setAttribute('aria-label', t('Search languages', '搜索语言')); + const find = el('label', 'st-lang-search'); find.append(icon('search', 'fv-i st-lang-glass'), search); + const list = el('div', 'st-lang-list'); list.setAttribute('role', 'listbox'); list.setAttribute('aria-label', t('Interface language', '界面语言')); + const none = el('div', 'st-lang-none', t('No language found', '没有找到这种语言')); none.hidden = true; + // Its own scroll bar, drawn by the page: system scroll bars that appear only while scrolling (macOS) would not show + // that the list goes on. + const track = el('div', 'st-lang-track'), thumb = el('i'); track.append(thumb); track.setAttribute('aria-hidden', 'true'); + const scrolled = () => { + const over = list.scrollHeight - list.clientHeight; + track.hidden = over <= 1; + if (track.hidden) return; + track.style.top = `${list.offsetTop}px`; track.style.height = `${list.clientHeight}px`; + const size = Math.max(24, list.clientHeight * list.clientHeight / list.scrollHeight); + thumb.style.height = `${size}px`; + thumb.style.transform = `translateY(${(list.clientHeight - size) * list.scrollTop / over}px)`; + }; + list.addEventListener('scroll', scrolled, {passive: true}); + pop.append(find, list, none, track); + root.append(trigger, pop); + let rows = [], active = -1, saving = false; + + const nameOf = tag => state.languages.find(row => row.tag === tag)?.name || tag; + function paintButton() { name.textContent = nameOf(state.language); } + function items() { + const query = find.hidden ? '' : search.value; + const offered = sortLanguages(state.languages).filter(row => matches(row, query)); + const auto = {tag: AUTO, name: t('Follow system ({name})', '跟随系统({name})', {name: nameOf(state.system)})}; + return query && !matches(auto, query) ? offered : [auto, ...offered]; + } + function paintList() { + rows = items(); + none.hidden = rows.length > 0; + requestAnimationFrame(scrolled); + list.replaceChildren(...rows.map((row, index) => { + const option = el('div', 'st-lang-opt' + (row.tag === AUTO ? ' is-auto' : '')); + option.setAttribute('role', 'option'); option.id = `st-lang-${row.tag}`; + option.setAttribute('aria-selected', String(row.tag === state.setting)); + if (row.tag !== AUTO) option.lang = row.tag; + option.append(icon('check', 'fv-i st-lang-mark'), el('span', 'w', row.name)); + option.onmousemove = () => { if (active !== index) { active = index; paintActive(); } }; + option.onclick = () => choose(row.tag); + return option; + })); + active = Math.max(0, rows.findIndex(row => row.tag === state.setting)); + paintActive(); + } + function paintActive() { + [...list.children].forEach((node, index) => node.classList.toggle('is-active', index === active)); + const node = list.children[active]; + if (node) { list.setAttribute('aria-activedescendant', node.id); node.scrollIntoView({block: 'nearest'}); } + } + function open() { + if (saving) return; + find.hidden = state.languages.length + 1 <= SEARCH_FROM; search.value = ''; + paintList(); + pop.hidden = false; trigger.setAttribute('aria-expanded', 'true'); + // Below the button when it fits, otherwise on the side with more room; the list scrolls within that room. + list.style.maxHeight = ''; + // The room is the settings pane's, not the window's: the top bar lies over the top of the window. + const box = trigger.getBoundingClientRect(), margin = 12; + const area = (root.closest('.st-pane') || document.documentElement).getBoundingClientRect(); + const below = Math.min(innerHeight, area.bottom) - box.bottom - margin, above = box.top - Math.max(0, area.top) - margin; + const up = pop.offsetHeight > below && above > below; + pop.classList.toggle('is-up', up); + const chrome = pop.offsetHeight - list.offsetHeight, room = Math.max(96, Math.min(420, (up ? above : below) - chrome)); + // When the list scrolls, its last visible row is cut in half, so it reads as more below (Lane 11-24). + // At most ten rows (Iris 11-24); when it scrolls, its bottom edge runs through the middle of a row, so the list + // reads as going on (Lane 11-24). Measured from the rows themselves: the line under Follow system adds its gap. + // Positions from the boxes on screen (not offsetTop, which depends on which ancestor is positioned). + const rows = [...list.children], origin = list.getBoundingClientRect().top - list.scrollTop; + const top = node => node.getBoundingClientRect().top - origin; + const fits = rows.length <= MAX_ROWS && list.scrollHeight <= room; + if (fits) list.style.maxHeight = ''; + else { + let cut = 0; + for (const [index, node] of rows.entries()) { + const middle = top(node) + node.getBoundingClientRect().height / 2; + if (index >= MAX_ROWS || middle > room) break; + if (index >= 2) cut = middle; + } + list.style.maxHeight = `${Math.max(cut, 80)}px`; + } + scrolled(); + (find.hidden ? list : search).focus(); + document.addEventListener('pointerdown', outside, true); + } + function close(focus = true) { + if (pop.hidden) return; + pop.hidden = true; trigger.setAttribute('aria-expanded', 'false'); + document.removeEventListener('pointerdown', outside, true); + if (focus) trigger.focus(); + } + function outside(event) { if (!root.contains(event.target)) close(false); } + async function choose(tag) { + close(); + if (tag === state.setting) return; + saving = true; trigger.disabled = true; + try { + const response = await agentPost(api, '/freevideo/language', {language: tag}); + if (!response.ok) throw new Error(String(response.status)); + state = await response.json(); + paintButton(); + onSaved?.(state); + } catch { + onError?.(t('Could not save the language. Try again.', '未能保存语言,请重试。')); + } finally { + saving = false; trigger.disabled = false; + } + } + trigger.onclick = () => pop.hidden ? open() : close(); + list.tabIndex = -1; + search.oninput = () => paintList(); + listenDialogKey(root, 'keydown', event => { + if (pop.hidden) { + if (event.target === trigger && ['ArrowDown', 'ArrowUp'].includes(event.key)) { event.preventDefault(); open(); } + return; + } + const step = {ArrowDown: 1, ArrowUp: -1}[event.key]; + if (step) { event.preventDefault(); active = (active + step + rows.length) % rows.length; paintActive(); return; } + if (event.key === 'Enter') { event.preventDefault(); if (rows[active]) choose(rows[active].tag); return; } + if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); close(); return; } + if (event.key === 'Tab') { close(false); return; } + // Without a search box, typing a letter jumps to the next language that starts with it. + if (find.hidden && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) { + const letter = event.key.toLowerCase(); + for (let k = 1; k <= rows.length; k++) { + const index = (active + k) % rows.length, row = rows[index]; + if (row.tag !== AUTO && [row.name, ENGLISH[row.tag] || ''].some(word => word.toLowerCase().startsWith(letter))) { + active = index; paintActive(); break; + } + } + } + }); + paintButton(); + return {element: root, get state() { return state; }, close: () => close(false), + // Whether the page, as it is open, shows another language than the saved choice. + differs: () => state.language !== LANGUAGE}; +} diff --git a/web/length_plan.js b/web/length_plan.js index d296b63e..f3b35919 100644 --- a/web/length_plan.js +++ b/web/length_plan.js @@ -33,8 +33,9 @@ export function readLengthPlan(reply) { export function classifyPlanError(reply) { if (reply?.code === 'device_limit') return 'continuation_unavailable'; if (reply?.code === 'too_long' || ['too_many_parts', 'too_many_short_parts'].includes(reply?.code)) return 'too_long'; - if (reply?.code === 'block_too_short' || reply?.code === 'block_too_long') return reply.code; - if (['too_short', 'invalid'].includes(reply?.code)) return 'other'; + // A length below the shortest video is the same answer every time: say so, do not offer another try. + if (['too_short', 'block_too_short', 'block_too_long'].includes(reply?.code)) return reply.code; + if (reply?.code === 'invalid') return 'other'; const value = reply?.error; const message = reply?.code || (typeof value === 'string' ? value : value?.code || value?.message || ''); if (/single.*(?:limit|long|cannot|unavailable|impossible)|force.*single|强制单次/i.test(message)) return 'single_unavailable'; diff --git a/web/library.js b/web/library.js index 2ce41f8c..912bc3de 100644 --- a/web/library.js +++ b/web/library.js @@ -21,6 +21,7 @@ import { hasPictureThumbnail, mediaQueue, pictureThumbnailURL, watchCards } from import { zoomable } from './picture_zoom.js'; import { createUpscaleOffer, upscaleChoices, UPSCALE_USE, UPSCALE_QUEUED, UPSCALE_FAILED } from './upscale_offer.js'; import { capabilityPoints } from './chain_support.js'; +import { LANGUAGE } from './i18n.js'; const style = document.createElement('link'); style.rel = 'stylesheet'; style.href = new URL('./library.css', import.meta.url).href; document.head.append(style); @@ -216,7 +217,8 @@ const videoFolderMessage = (t, answer, single = false) => !answer ? t('Could not open the folder. Open it on the computer that runs FreeVideo.', '没能打开文件夹。请在运行 FreeVideo 的电脑上打开。') : answer.missing ? t('The video file cannot be found. If you moved the file, refresh the page.', '找不到这条视频的文件。如果移动过文件,请刷新页面。') : answer.opened === false && answer.folder - ? t(`Could not open the folder. ${single ? 'This video is' : 'The videos are'} in ${answer.folder}`, `没能打开文件夹。视频在 ${answer.folder}`) : ''; + ? (single ? t('Could not open the folder. This video is in {folder}', '没能打开文件夹。视频在 {folder}', { folder: answer.folder }) + : t('Could not open the folder. The videos are in {folder}', '没能打开文件夹。视频在 {folder}', { folder: answer.folder })) : ''; // Keeps earlier batches of one click undoable while its next request runs, then gives them the normal time again. async function holdBatches(tokens, running) { const states = await askUndoState('/freevideo/library/hold', {batches: tokens, running}); @@ -275,9 +277,11 @@ export async function libraryPage(t, {limit = 24, before = null, favorite = null return response.json(); } -export function videoTimestamp(row, t) { +export function videoTimestamp(row, t, language = LANGUAGE) { const value = new Date(row.created_at); - if (Number.isNaN(value.getTime())) return row.kind === 'image' ? t('Saved picture', '已保存的图片') : t('Saved video', '已保存的视频'); + if (Number.isNaN(value.getTime())) return row.kind === 'image' ? t('Saved image', '已保存的图片') : t('Saved video', '已保存的视频'); + // A language file's page: the date as that language writes it. + if (language !== 'en' && language !== 'zh-Hans') return new Intl.DateTimeFormat(language, {month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit'}).format(value); if (t('en', 'zh') === 'zh') return `${value.getMonth() + 1}月${value.getDate()}日 ${String(value.getHours()).padStart(2, '0')}:${String(value.getMinutes()).padStart(2, '0')}`; return value.toLocaleString('en-US', {month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit', hour12: true}); } @@ -288,7 +292,7 @@ export function videoDimensions(row, t = null) { const shown = row.preview && row.preview_geometry?.width ? row.preview_geometry : g; if (shown.width && shown.height) parts.push(`${shown.width} × ${shown.height}`); const duration = g.seconds || (g.frames && g.frames / (g.fps || 24)); - if (duration) parts.push(t ? t(`${Number(duration).toFixed(1)} s`, `${Number(duration).toFixed(1)} 秒`) : `${Number(duration).toFixed(1)} s`); + if (duration) parts.push(t ? t('{seconds} s', '{seconds} 秒', { seconds: Number(duration).toFixed(1) }) : `${Number(duration).toFixed(1)} s`); return parts.join(' · '); } @@ -320,11 +324,11 @@ async function workflowBackfill(collection, t, before = null) { actions.replaceChildren(); while ((value = await status()) && value.state === 'running') await new Promise(resolve => setTimeout(resolve, 1500)); const result = value?.result || {}; - heading.textContent = result.embedded ? t(`Settings added to ${result.embedded} videos`, `已为 ${result.embedded} 个视频补上生成设置`) : t('No video was changed', '没有视频被改动'); + heading.textContent = result.embedded ? t('Settings added to {embedded} videos', '已为 {embedded} 个视频补上生成设置', { embedded: result.embedded }) : t('No video was changed', '没有视频被改动'); text.textContent = result.embedded ? t('Drop them back onto FreeVideo to bring back the settings they were made with. Each original is kept as a backup.', '把它们拖回 FreeVideo 即可还原生成时的设置。每个原视频都另存了一份备份。') : t('Videos that could not be checked safely were left as they were.', '无法安全确认的视频都保持原样。'); - if (result.failed) text.textContent += ' ' + t(`${result.failed} videos were left unchanged and will be offered again.`, `另有 ${result.failed} 个视频未改动,之后会再次提示。`); + if (result.failed) text.textContent += ' ' + t('{failed} videos were left unchanged and will be offered again.', '另有 {failed} 个视频未改动,之后会再次提示。', { failed: result.failed }); const full = Math.min(Number.isSafeInteger(result.no_space) ? result.no_space : 0, result.failed || 0); if (full > 0) text.textContent += ' ' + t(full === result.failed ? 'The disk is full. Free some space first.' : `${full} of them could not be changed because the disk is full. Free some space first.`, full === result.failed ? '磁盘空间不够,请先空出空间。' : `其中 ${full} 个因磁盘空间不够,请先空出空间。`); @@ -332,8 +336,8 @@ async function workflowBackfill(collection, t, before = null) { } if (value.state === 'running') { follow(); return; } heading.textContent = t('Add settings to earlier videos', '为之前的视频补上生成设置'); - text.textContent = t(`${value.count} earlier videos can get the settings they were made with, so dropping them back onto FreeVideo brings those settings back. Nothing changes before confirming, and each original is kept as a backup (about ${gb(value.bytes)} GB).`, - `有 ${value.count} 个之前生成的视频可以补上生成时的设置,之后拖回 FreeVideo 即可还原。确认前不会改动任何文件,每个原视频都会另存一份备份(约 ${gb(value.bytes)} GB)。`); + text.textContent = t('{count} earlier videos can get the settings they were made with, so dropping them back onto FreeVideo brings those settings back. Nothing changes before confirming, and each original is kept as a backup (about {size} GB).', + '有 {count} 个之前生成的视频可以补上生成时的设置,之后拖回 FreeVideo 即可还原。确认前不会改动任何文件,每个原视频都会另存一份备份(约 {size} GB)。', { count: value.count, size: gb(value.bytes) }); const run = button(t('Add settings', '补上设置'), async () => { run.disabled = later.disabled = true; try { if (!(await post('run')).ok) throw new Error(); follow(); } @@ -464,7 +468,7 @@ export function openLibrary(t, options = {}) { const tabWorks = button(t('Creations', '作品'), () => showTab('works'), 'fv-library-tab'); const tabCast = button(t('Cast', '角色'), () => showTab('cast'), 'fv-library-tab'); for (const tab of [tabWorks, tabCast]) tab.setAttribute('role', 'tab'); - tip(tabWorks, t('Creations', '作品'), t('Generated videos and pictures', '生成的视频和图片')); + tip(tabWorks, t('Creations', '作品'), t('Generated videos and images', '生成的视频和图片')); tip(tabCast, t('Cast', '角色'), t('Characters, scenes and props to reuse', '可反复使用的角色、场景和道具')); title.replaceChildren(tabWorks, tabCast); let tab = 'works', castRoom = null; @@ -517,9 +521,9 @@ export function openLibrary(t, options = {}) { item.setAttribute('aria-label', name); tip(item, name, use); places.append(item); return item; }; - const placeAll = placeButton('all', t('All', '全部'), 'grid', t('Every video and picture', '所有视频和图片')); + const placeAll = placeButton('all', t('All', '全部'), 'grid', t('Every video and image', '所有视频和图片')); const placeVideo = placeButton('video', t('Videos', '视频'), 'video', t('Only the generated videos', '只看生成的视频')); - const placeImage = placeButton('image', t('Pictures', '图片'), 'picture', t('Only the generated pictures', '只看生成的图片')); + const placeImage = placeButton('image', t('Images', '图片'), 'picture', t('Only the generated images', '只看生成的图片')); const placeFavorites = placeButton('favorites', t('Favorites', '收藏'), 'heart', t('Creations marked with the heart', '点过爱心的作品')); const tagGroup = sideGroup(t('Tags', '标签'), 'fv-library-tags'); const tagList = el('div', null, 'fv-library-tag-list'); @@ -532,11 +536,11 @@ export function openLibrary(t, options = {}) { placeTrash.append(line('trash'), el('span', t('Recently deleted', '最近删除'), 'fv-library-place-name'), el('span', '', 'fv-library-count')); tip(placeTrash, t('Recently deleted', '最近删除'), t('Bring back what was just deleted', '恢复刚删除的作品')); const openFolder = button('', async () => { - try { const answer = await (await pictures()).historyOpen(); if (answer && answer.opened === false && answer.folder) say(t(`The pictures are in ${answer.folder}`, `图片在 ${answer.folder}`)); } + try { const answer = await (await pictures()).historyOpen(); if (answer && answer.opened === false && answer.folder) say(t('The images are in {folder}', '图片在 {folder}', { folder: answer.folder })); } catch { say(t('Could not open the folder.', '没能打开文件夹。'), true); } }, 'fv-library-place fv-library-open-folder'); - openFolder.append(line('folder'), el('span', t('Picture folder', '图片文件夹'), 'fv-library-place-name')); - tip(openFolder, t('Picture folder', '图片文件夹'), t('Show the pictures in the file manager', '在文件管理器里打开图片所在文件夹')); + openFolder.append(line('folder'), el('span', t('Image folder', '图片文件夹'), 'fv-library-place-name')); + tip(openFolder, t('Image folder', '图片文件夹'), t('Show the images in the file manager', '在文件管理器里打开图片所在文件夹')); const openVideoFolderButton = button('', async () => { const answer = await openVideoFolder(); const text = videoFolderMessage(t, answer); if (text) say(text, !answer || answer.missing, answer?.folder ? 20000 : 4000); // a path stays long enough to be copied @@ -597,7 +601,7 @@ export function openLibrary(t, options = {}) { const barDownload = button('', () => downloadPicked(), 'fv-quiet fv-library-bar-download'); barDownload.append(line('download'), el('span', t('Download', '下载'))); barDownload.setAttribute('aria-label', t('Download', '下载')); - tip(barDownload, t('Download', '下载'), t('Save the picked works as a zip file', '将所选作品保存为压缩包')); + tip(barDownload, t('Download', '下载'), t('Save the picked creations as a zip file', '将所选作品保存为压缩包')); const barCompare = button('', () => { const keys = [...picked]; if (keys.length === 2) openCompare(keys); }, 'fv-quiet fv-library-bar-compare'); barCompare.append(line('compare'), el('span', t('Compare', '对比'))); barCompare.setAttribute('aria-label', t('Compare', '对比')); @@ -653,7 +657,7 @@ export function openLibrary(t, options = {}) { summary.append(summaryTitle, summaryNote, summaryGrid); detail.append(summary); function drawSummary(size) { const count = picked.size; - summaryTitle.textContent = count ? t(`${count} selected`, `已选 ${count} 个作品`) + (size == null ? '' : ` · ${t('about', '约')} ${gb(size)}`) : ''; + summaryTitle.textContent = count ? t('{count} selected', '已选 {count} 个作品', { count }) + (size == null ? '' : ` · ${t('about', '约')} ${gb(size)}`) : ''; summaryTitle.hidden = !count; summaryNote.hidden = !count; const keys = [...picked].slice(0, 12), have = [...summaryGrid.children].map(node => node.dataset.key); @@ -812,8 +816,8 @@ export function openLibrary(t, options = {}) { }, () => { detail += ' head-failed'; }); return note; } - const pictureProblem = () => { const note = el('p', null, 'fv-library-message'); fault(note, t('This picture can no longer be read. It may have been moved or deleted.', '这张图片已无法读取,可能已被移动或删除。')); return note; }; - const pictureDimensions = row => [t('Picture', '图片'), row.size?.width ? `${row.size.width} × ${row.size.height}` : ''].filter(Boolean).join(' · '); + const pictureProblem = () => { const note = el('p', null, 'fv-library-message'); fault(note, t('This image can no longer be read. It may have been moved or deleted.', '这张图片已无法读取,可能已被移动或删除。')); return note; }; + const pictureDimensions = row => [t('Image', '图片'), row.size?.width ? `${row.size.width} × ${row.size.height}` : ''].filter(Boolean).join(' · '); // The hover tips of the shared action bar, which the studio's module builds. function tipActions(root) { for (const [selector, name, use] of [ @@ -821,8 +825,8 @@ export function openLibrary(t, options = {}) { ['a.fv-action', t('Download video', '下载视频'), t('Save the MP4 to this computer', '把视频文件保存到电脑')], ['.fv-action-copy', t('Copy path', '复制路径'), t('Copy where the file is saved', '复制文件保存的位置')], ['.fv-action-reuse', t('Reuse settings', '复用设置'), t('Fill the creation panel with these settings', '把这次的设置填回创作面板')], - ['.fv-action-extend', t('Continue', '接着生成'), t('Make a longer video from its end', '从结尾继续生成更长的视频')], - ['.fv-share-trigger', t('Share', '分享'), t('Make a picture or clip to share', '生成可分享的图片或短片')], + ['.fv-action-extend', t('Extend', '接着生成'), t('Make a longer video from its end', '从结尾继续生成更长的视频')], + ['.fv-share-trigger', t('Share', '分享'), t('Make an image or clip to share', '生成可分享的图片或短片')], ['.fv-action-report', t('Download report', '下载报告'), t('Save the diagnostic report of this run', '保存这次生成的诊断报告')], ['.fv-action-delete > summary', t('Delete', '删除'), t('Delete it; undo for 10 seconds', '删除这个作品,10 秒内可撤销')], ['.fv-action-second-pass', t('Run second pass', '继续二采'), t('Finish the full-resolution video', '从预览继续生成全分辨率视频')], @@ -843,13 +847,13 @@ export function openLibrary(t, options = {}) { }; syncHeart(); const download = el('a', null, 'fv-action fv-action-primary'); download.href = pictureURL(row); download.download = row.name || ''; - download.append(icon('download'), el('span', t('Download picture', '下载图片'))); - tip(download, t('Download picture', '下载图片'), t('Save the picture to this computer', '把图片保存到电脑')); + download.append(icon('download'), el('span', t('Download image', '下载图片'))); + tip(download, t('Download image', '下载图片'), t('Save the image to this computer', '把图片保存到电脑')); // The image view's own next steps for a picture: its prompt back in the box, and the picture itself. const text = picturePrompt(row); const usePrompt = button('', () => usePicturePrompt(text), 'fv-action fv-action-secondary fv-action-use-prompt'); usePrompt.append(icon('reuse'), el('span', t('Use prompt', '使用提示词'))); - tip(usePrompt, t('Use prompt', '使用提示词'), t('Put its prompt in the box of the image view', '把它的提示词填回图像视图的描述框')); + tip(usePrompt, t('Use prompt', '使用提示词'), t('Put its prompt in the box of the image view', '把它的提示词填回图像视图的提示词框')); usePrompt.hidden = !text; const imageView = button('', () => openInImageView(row), 'fv-action fv-action-secondary fv-action-image-view'); imageView.append(line('picture'), el('span', t('Open in Images', '在图像视图打开'))); @@ -899,7 +903,7 @@ export function openLibrary(t, options = {}) { // A picture's time, as the image view shows it; kept only for pictures made in this browser. const seconds = Number(pictureFacts.get(row.file)?.seconds); stats.replaceChildren(); - if (seconds > 0) { const item = el('div', null, 'fv-stat'); item.append(el('strong', t(`${seconds} s`, `${seconds} 秒`)), el('span', t('Time', '用时'))); stats.append(item); } + if (seconds > 0) { const item = el('div', null, 'fv-stat'); item.append(el('strong', t('{seconds} s', '{seconds} 秒', { seconds })), el('span', t('Time', '用时'))); stats.append(item); } stats.hidden = !stats.childElementCount; budget.textContent = ''; sound.textContent = ''; run.hidden = stats.hidden; if (reveal) dialog.dataset.detail = 'true'; return; } @@ -941,7 +945,7 @@ export function openLibrary(t, options = {}) { if (editor && !disposed) { dialog.close(); editor.element?.focus({preventScroll: true}); } return editor; } - catch (error) { fault(notice, userMessage(error, t, t('Could not open the editor. Try again.', '无法打开剪辑,请重试。')), ['Continue video', '延长视频'], null, error); } + catch (error) { fault(notice, userMessage(error, t, t('Could not open the editor. Try again.', '无法打开剪辑,请重试。')), ['Extend video', '延长视频'], null, error); } } // Fill the creation panel with a video's prompt, size, length and seed, then go back to it. async function reuseSaved(row) { @@ -1052,7 +1056,7 @@ export function openLibrary(t, options = {}) { if (shownMark) { stack.textContent = String(head.videos.length); stack.setAttribute('aria-expanded', String(unfoldedNow)); - stack.setAttribute('aria-label', t(`${head.videos.length} videos from this task`, `同一任务的 ${head.videos.length} 个视频`)); + stack.setAttribute('aria-label', t('{count} videos from this task', '同一任务的 {count} 个视频', { count: head.videos.length })); } } } @@ -1065,6 +1069,7 @@ export function openLibrary(t, options = {}) { const yesterday = dayOf({created_at: new Date(Date.now() - 864e5).toISOString()}); if (day === today) return t('Today', '今天'); if (day === yesterday) return t('Yesterday', '昨天'); + if (!Number.isNaN(value.getTime()) && LANGUAGE !== 'en' && LANGUAGE !== 'zh-Hans') return value.toLocaleDateString(LANGUAGE, {month: 'long', day: 'numeric', weekday: 'short'}); return Number.isNaN(value.getTime()) ? day : (t('en', 'zh') === 'zh' ? `${value.getMonth() + 1}月${value.getDate()}日 ${value.toLocaleDateString('zh-CN', {weekday: 'short'})}` : value.toLocaleDateString('en-US', {month: 'long', day: 'numeric', weekday: 'short'})); }; const dayOfKey = key => dayOf(works.get(key) || {}); @@ -1084,7 +1089,7 @@ export function openLibrary(t, options = {}) { const snippet = text => { const first = String(text || '').replace(/\s+/g, ' ').trim(); return first.length > 40 ? first.slice(0, 40) + '…' : first; }; const clock = row => { const value = new Date(row.created_at); return Number.isNaN(value.getTime()) ? '' : `${String(value.getHours()).padStart(2, '0')}:${String(value.getMinutes()).padStart(2, '0')}`; }; // A creation is named by its words (or by what it is), never by a date or a time; the line under it is its size. - const workName = row => row.agent?.label || snippet(row.kind === 'image' ? picturePrompt(row) : prompts.get(row.id)) || (row.kind === 'image' ? t('Picture', '图片') : t('Video', '视频')); + const workName = row => row.agent?.label || snippet(row.kind === 'image' ? picturePrompt(row) : prompts.get(row.id)) || (row.kind === 'image' ? t('Image', '图片') : t('Video', '视频')); function labelCard(key) { const row = works.get(key), card = cards.get(key); if (!row || !card) return; @@ -1117,7 +1122,7 @@ export function openLibrary(t, options = {}) { if (row.kind === 'image') { // A picture's words come from the engine's record (or this page's memory); one without says so. const text = picturePrompt(row); - promptText.textContent = text || t('This picture kept no prompt.', '这张图片没有保存提示词。'); + promptText.textContent = text || t('This image kept no prompt.', '这张图片没有保存提示词。'); promptText.dataset.none = String(!text); promptCopy.hidden = !text; promptBox.hidden = false; return; } @@ -1270,8 +1275,8 @@ export function openLibrary(t, options = {}) { if (filter.tag) return t('No creation has this tag yet. Select creations and press Tag.', '还没有作品带这个标签。选中作品后点“标签”。'); if (filter.period !== 'any' || filter.source || filter.preview || filter.agent) return t('Nothing matches these filters.', '没有符合筛选条件的作品。'); if (filter.favorites) return t("No favorite creations. Click the heart in a creation's details to add one.", '暂无收藏的作品。点作品详情中的爱心图标收藏。'); - if (filter.kind === 'image') return picturesState === 'failed' ? t('Pictures could not be read just now.', '图片暂时无法读取。') : t('Pictures made in the image view appear here.', '在图像视图里生成的图片会保存在这里。'); - return t('Finished videos and pictures appear here.', '生成完成的视频和图片会保存在这里。'); + if (filter.kind === 'image') return picturesState === 'failed' ? t('Images could not be read just now.', '图片暂时无法读取。') : t('Images made in the image view appear here.', '在图像视图里生成的图片会保存在这里。'); + return t('Finished videos and images appear here.', '生成完成的视频和图片会保存在这里。'); } function syncCounts() { const videos = [...works.values()].filter(row => row.kind !== 'image'); @@ -1390,7 +1395,7 @@ export function openLibrary(t, options = {}) { const period = [['any', t('Any time', '任何时间')], ['today', t('Today', '今天')], ['week', t('Last 7 days', '最近 7 天')], ['month', t('Last 30 days', '最近 30 天')]]; filterMenu.replaceChildren(el('div', t('When', '时间'), 'fv-library-menu-label')); for (const [key, label] of period) filterMenu.append(menuItem(label, filter.period === key, () => { filter.period = key; drawFilterMenu(); applyFilter(); })); - filterMenu.append(el('div', null, 'fv-library-menu-sep'), el('div', t('Pictures from', '图片来源'), 'fv-library-menu-label')); + filterMenu.append(el('div', null, 'fv-library-menu-sep'), el('div', t('Images from', '图片来源'), 'fv-library-menu-label')); for (const [key, label] of [['', t('Any', '全部')], ['image', t('Image', '图片')], ['edit', t('Edit', '编辑')], ['cast', t('Character', '角色')]]) { filterMenu.append(menuItem(label, filter.source === key, () => { filter.source = key; drawFilterMenu(); applyFilter(); })); } @@ -1431,7 +1436,7 @@ export function openLibrary(t, options = {}) { function openTagMenu(anchor, keys, point = null) { if (!keys.length) return; const draw = () => { - tagMenu.replaceChildren(el('div', keys.length > 1 ? t(`Tags for ${keys.length} creations`, `${keys.length} 个作品的标签`) : t('Tags', '标签'), 'fv-library-menu-label')); + tagMenu.replaceChildren(el('div', keys.length > 1 ? t('Tags for {count} creations', '{count} 个作品的标签', { count: keys.length }) : t('Tags', '标签'), 'fv-library-menu-label')); for (const tag of meta.tags()) { const have = keys.filter(key => meta.tagsOf(key).includes(tag.id)).length; const item = menuItem(tag.name, have === keys.length, () => { meta.setTags(keys, have === keys.length ? [] : [tag.id], have === keys.length ? [tag.id] : []); draw(); }, 'menuitemcheckbox'); @@ -1465,7 +1470,7 @@ export function openLibrary(t, options = {}) { for (const key of keys) { const row = works.get(key); if (!isVideo(key)) { row.favorite = value; syncFavorite(row); } } let failed = 0; for (const key of keys.filter(isVideo)) { try { await saveFavorite(works.get(key), value, true); } catch { failed++; } } - if (!disposed) { if (failed) say(t(`${failed} could not be changed. Try again.`, `有 ${failed} 个没能更改,请重试。`), true); if (selected) select(selected, false); render(); } + if (!disposed) { if (failed) say(t('{failed} could not be changed. Try again.', '有 {failed} 个没能更改,请重试。', { failed }), true); if (selected) select(selected, false); render(); } }}); const tagRows = meta.tags().map(tag => { const have = keys.filter(key => meta.tagsOf(key).includes(tag.id)).length; @@ -1478,7 +1483,7 @@ export function openLibrary(t, options = {}) { items.push({id: 'compare', icon: 'compare', label: ['Compare', '对比'], disabled: comparing ? '' : ['Select exactly two creations first', '先正好选中两个作品'], run: () => openCompare(comparing)}); if (one) { items.push('-'); - items.push({id: 'download', icon: 'download', label: one.kind === 'image' ? ['Download picture', '下载图片'] : ['Download video', '下载视频'], run: () => { + items.push({id: 'download', icon: 'download', label: one.kind === 'image' ? ['Download image', '下载图片'] : ['Download video', '下载视频'], run: () => { downloadOne(one); }}); if (one.kind !== 'image') { @@ -1496,19 +1501,19 @@ export function openLibrary(t, options = {}) { items.push({id: 'reuse', icon: 'reuse', label: ['Reuse settings', '复用设置'], disabled: one.preview ? ['A first-pass preview: finish it first', '这是一采预览,先继续二采'] : '', run: () => reuseSaved(one)}); - items.push({id: 'extend', icon: 'arrow', label: ['Continue', '接着生成'], disabled: canExtend(one) ? '' : ['This video cannot be continued', '这条视频不能接着生成'], + items.push({id: 'extend', icon: 'arrow', label: ['Extend', '接着生成'], disabled: canExtend(one) ? '' : ['This video cannot be extended', '这条视频不能接着生成'], run: () => extendSaved(one)}); } if (one.kind === 'image') { - const text = picturePrompt(one), none = text ? '' : ['This picture kept no prompt', '这张图片没有保存提示词']; + const text = picturePrompt(one), none = text ? '' : ['This image kept no prompt', '这张图片没有保存提示词']; items.push({id: 'use-prompt', icon: 'reuse', label: ['Use prompt', '使用提示词'], disabled: none, - use: ['Put its prompt in the box of the image view', '把它的提示词填回图像视图的描述框'], run: () => usePicturePrompt(text)}); + use: ['Put its prompt in the box of the image view', '把它的提示词填回图像视图的提示词框'], run: () => usePicturePrompt(text)}); items.push({id: 'image-view', icon: 'image', label: ['Open in Images', '在图像视图打开'], use: ['Use it as a reference or make more like it there', '在那里用作参考图,或接着生成'], run: () => openInImageView(one)}); } const promptOf = one.kind === 'image' ? picturePrompt(one) : prompts.get(one.id); items.push({id: 'copy-prompt', icon: 'copy', label: ['Copy prompt', '复制提示词'], - disabled: promptOf ? '' : one.kind === 'image' ? ['This picture kept no prompt', '这张图片没有保存提示词'] : ['This video kept no prompt', '这条视频没有保存提示词'], + disabled: promptOf ? '' : one.kind === 'image' ? ['This image kept no prompt', '这张图片没有保存提示词'] : ['This video kept no prompt', '这条视频没有保存提示词'], run: async () => { if (await copyText(promptOf)) say(t('Prompt copied.', '已复制提示词。')); else say(t('Could not copy. Try again.', '未能复制,请重试。'), true); }}); } if (one) items.push({id: 'folder', icon: 'folder', label: ['Show in folder', '在文件夹中显示'], @@ -1518,13 +1523,13 @@ export function openLibrary(t, options = {}) { if (text) say(text, !answer || answer.missing, answer?.folder ? 20000 : 4000); return; } - try { const answer = await (await pictures()).historyOpen(); if (answer && answer.opened === false && answer.folder) say(t(`The pictures are in ${answer.folder}`, `图片在 ${answer.folder}`)); } + try { const answer = await (await pictures()).historyOpen(); if (answer && answer.opened === false && answer.folder) say(t('The images are in {folder}', '图片在 {folder}', { folder: answer.folder })); } catch { say(t('Could not open the folder.', '没能打开文件夹。'), true); } }}); if (!selecting) items.push({id: 'select', icon: 'check', label: ['Select', '选择'], use: ['Start selecting with this one', '从这一个开始多选'], run: () => { setSelecting(true); picked.add(keys[0]); anchor = keys[0]; syncSelection(); }}); items.push('-'); - items.push({id: 'trash', icon: 'trash', danger: true, label: keys.length > 1 ? [`Delete ${keys.length}`, `删除 ${keys.length} 个`] : ['Delete', '删除'], key: 'Delete', + items.push({id: 'trash', icon: 'trash', danger: true, label: keys.length > 1 ? ['Delete {count}', '删除 {count} 个', { count: keys.length }] : ['Delete', '删除'], key: 'Delete', use: ['Delete; undo for 10 seconds', '删除,10 秒内可撤销'], run: async () => { const result = await removeKeys(keys); if (disposed) return; @@ -1616,7 +1621,7 @@ export function openLibrary(t, options = {}) { } if (!selecting) { stageFollowsSelection(); return; } const count = picked.size, size = pickedSize(); - pickCount.textContent = t(`${count} selected`, `已选 ${count} 个`); + pickCount.textContent = t('{count} selected', '已选 {count} 个', { count }); drawSummary(size); if (fetchSizes) wantedSizes(); const about = size == null ? '' : ` · ${t('about', '约')} ${gb(size)}`; @@ -1627,14 +1632,15 @@ export function openLibrary(t, options = {}) { const why = count ? '' : t('Select creations first', '先选择作品'); for (const control of [barFavorite, barTag, barDownload, barDelete]) { if (why) control.dataset.fvTipWhy = why; else delete control.dataset.fvTipWhy; } if (confirming) { - barLabel.textContent = t(`Delete ${count} ${count === 1 ? 'creation' : 'creations'}?${size == null ? '' : ` About ${gb(size)}.`}`, `删除 ${count} 个作品?${size == null ? '' : `共约 ${gb(size)}。`}`); + barLabel.textContent = (count === 1 ? t('Delete 1 creation?', '删除 1 个作品?') : t('Delete {count} creations?', '删除 {count} 个作品?', { count })) + + (size == null ? '' : t(' About {size}.', '共约 {size}。', { size: gb(size) })); barText.textContent = t('They can be brought back for 10 seconds.', '10 秒内可以撤销。'); barDelete.textContent = deleting ? t('Deleting…', '正在删除…') : t('Delete', '删除'); barCancel.disabled = barDelete.disabled = deleting; } else { - barLabel.textContent = count ? t(`${count} selected`, `已选 ${count} 个`) : t('Select creations on the shelf', '点作品来选择'); + barLabel.textContent = count ? t('{count} selected', '已选 {count} 个', { count }) : t('Select creations on the shelf', '点作品来选择'); barText.textContent = ''; - barDelete.textContent = count ? t(`Delete ${count}`, `删除 ${count} 个`) + about : t('Delete', '删除'); + barDelete.textContent = count ? t('Delete {count}', '删除 {count} 个', { count }) + about : t('Delete', '删除'); barDelete.disabled = deleting || !count; barFavorite.disabled = barTag.disabled = barDownload.disabled = deleting || !count; } @@ -1674,7 +1680,7 @@ export function openLibrary(t, options = {}) { cell.append(media, el('figcaption', viewerName(row))); stage.append(cell); } const top = el('div', null, 'fv-library-viewer-bar'); - const label = el('div', null, 'fv-library-viewer-label'); label.append(el('strong', t(`Comparing ${rows.length}`, `对比 ${rows.length} 个`))); + const label = el('div', null, 'fv-library-viewer-label'); label.append(el('strong', t('Comparing {count}', '对比 {count} 个', { count: rows.length }))); const close = button('', () => setSelecting(false), 'fv-library-viewer-button'); close.append(line('close')); close.setAttribute('aria-label', t('Stop selecting', '退出多选')); tip(close, t('Stop selecting', '退出多选'), t('Back to one creation', '回到单个作品'), 'Esc'); top.append(label, close); @@ -1706,7 +1712,7 @@ export function openLibrary(t, options = {}) { if (!chosen.length || deleting) return; if (chosen.length === 1) { downloadOne(chosen[0]); return; } const asked = zipPayloads(chosen); - if (!asked.length) { say(t('These works cannot be downloaded.', '这些作品无法下载。'), true); return; } + if (!asked.length) { say(t('These creations cannot be downloaded.', '这些作品无法下载。'), true); return; } let answers; try { answers = await checkZips(api, asked); } catch { answers = asked.map(() => ({ready: 0, skipped: 0, failed: true})); } const payloads = asked.filter((_, at) => answers[at].ready > 0); @@ -1714,12 +1720,12 @@ export function openLibrary(t, options = {}) { const left = chosen.length - count; if (!payloads.length) { say(answers.some(answer => answer.failed) ? t('Could not start the download. Try again.', '无法开始下载,请重试。') - : t('These works cannot be read.', '无法读取这些作品。'), true); + : t('These creations cannot be read.', '无法读取这些作品。'), true); return; } - const zips = payloads.length > 1 ? t(` in ${payloads.length} zip files`, `,分成 ${payloads.length} 个压缩包`) : ''; - const missing = left > 0 ? t(`, ${left} could not be read`, `,其中 ${left} 个无法读取`) : ''; - say(t(`Downloading ${count} ${count === 1 ? 'work' : 'works'}${zips}${missing}`, `正在下载 ${count} 个作品${zips}${missing}`), left > 0); + const zips = payloads.length > 1 ? t(' in {count} zip files', ',分成 {count} 个压缩包', { count: payloads.length }) : ''; + const missing = left > 0 ? t(', {left} could not be read', ',其中 {left} 个无法读取', { left }) : ''; + say((count === 1 ? t('Downloading 1 creation', '正在下载 1 个作品') : t('Downloading {count} creations', '正在下载 {count} 个作品', { count })) + zips + missing, left > 0); try { await postZips(api, payloads, {alive: () => !disposed}); } catch { say(t('Could not start the download. Try again.', '无法开始下载,请重试。'), true); } } @@ -1732,7 +1738,7 @@ export function openLibrary(t, options = {}) { for (const key of keys.filter(isVideo)) { try { await saveFavorite(works.get(key), value, true); } catch { failed++; } } if (disposed) return; barFavorite.disabled = false; - say(failed ? t(`${failed} could not be changed. Try again.`, `有 ${failed} 个没能更改,请重试。`) : value ? t('Added to Favorites.', '已加入收藏。') : t('Removed from Favorites.', '已移出收藏。'), !!failed); + say(failed ? t('{failed} could not be changed. Try again.', '有 {failed} 个没能更改,请重试。', { failed }) : value ? t('Added to Favorites.', '已加入收藏。') : t('Removed from Favorites.', '已移出收藏。'), !!failed); render(); } async function confirmDelete() { @@ -1774,7 +1780,7 @@ export function openLibrary(t, options = {}) { const due = Math.min(...live.map(row => row.due), ...held.map(row => row.due)); const ring = el('span', null, 'fv-library-ring'); ring.style.setProperty('--fv-left', String(Math.max(0, Math.min(1, (due - Date.now()) / 10000)))); ring.style.setProperty('--fv-ms', `${Math.max(0, due - Date.now())}ms`); - const text = el('span', t(`Deleted ${deletedCount}`, `已删除 ${deletedCount} 个`)); + const text = el('span', t('Deleted {deletedCount}', '已删除 {deletedCount} 个', { deletedCount })); const undo = button(t('Undo', '撤销'), () => undoAll(tokens, batches, undo), 'fv-quiet'); tip(undo, t('Undo', '撤销'), t('Bring the deleted creations back', '恢复刚删除的作品'), '⌘Z'); undoBar.append(ring, text, undo, ...notes); @@ -1810,7 +1816,7 @@ export function openLibrary(t, options = {}) { undoFailure = ''; undoBar.hidden = false; undoBar.replaceChildren(el('span', expired ? t('The undo time has passed.', '已过了撤销时间。') - : lost ? t(`Restored, but ${lost} could not be brought back.`, `已恢复,其中 ${lost} 个没能恢复。`) : t('Restored.', '已恢复。'))); + : lost ? t('Restored, but {lost} could not be brought back.', '已恢复,其中 {lost} 个没能恢复。', { lost }) : t('Restored.', '已恢复。'))); if (lost && !expired) { const text = undoBar.firstElementChild.textContent; undoBar.append(issueButton(t, () => ({where: ['Restore creations', '恢复作品'], message: text}))); @@ -1846,8 +1852,8 @@ export function openLibrary(t, options = {}) { const restore = button('', () => undoAll(block.token ? [block.token] : [], block.batch ? [block.batch] : [], restore), 'fv-quiet fv-library-restore'); restore.append(line('restore'), el('span', t('Restore', '恢复'))); tip(restore, t('Restore', '恢复'), t('Put these creations back on the shelf', '把这些作品放回作品库')); - top.append(el('strong', t(`${block.count} ${block.count === 1 ? 'creation' : 'creations'}`, `${block.count} 个作品`)), - el('span', t(`${left} s left`, `还剩 ${left} 秒`), 'fv-library-trash-left'), restore); + top.append(el('strong', block.count === 1 ? t('1 creation', '1 个作品') : t('{count} creations', '{count} 个作品', { count: block.count })), + el('span', t('{left} s left', '还剩 {left} 秒', { left }), 'fv-library-trash-left'), restore); const strip = el('div', null, 'fv-library-trash-strip'); for (const row of block.rows.slice(0, 12)) { const cell = el('div', null, 'fv-library-trash-cell'); @@ -1860,10 +1866,12 @@ export function openLibrary(t, options = {}) { } const skippedText = skipped => { const using = skipped.filter(row => row.reason !== 'foreign-files').length, other = skipped.length - using; - const folders = (count, en) => count === 1 ? en.replace('folders have', 'folder has') : en; - if (using && other) return t(`${using + other} kept: ${using} in use, ${other} ${folders(other, 'folders have')} other files.`, `${using + other} 个已保留:${using} 个正在使用,${other} 个文件夹里有别的文件。`); - if (using) return t(`${using} in use, kept.`, `${using} 个正在使用,已保留。`); - return t(`${other} ${folders(other, 'folders have')} other files, kept.`, `${other} 个文件夹里有别的文件,已保留。`); + if (using && other) return other === 1 + ? t('{kept} kept: {using} in use, 1 folder has other files.', '{kept} 个已保留:{using} 个正在使用,1 个文件夹里有别的文件。', { kept: using + other, using }) + : t('{kept} kept: {using} in use, {other} folders have other files.', '{kept} 个已保留:{using} 个正在使用,{other} 个文件夹里有别的文件。', { kept: using + other, using, other }); + if (using) return t('{using} in use, kept.', '{using} 个正在使用,已保留。', { using }); + return other === 1 ? t('1 folder has other files, kept.', '1 个文件夹里有别的文件,已保留。') + : t('{other} folders have other files, kept.', '{other} 个文件夹里有别的文件,已保留。', { other }); }; function leaveShelf(key) { const row = works.get(key); @@ -1971,7 +1979,7 @@ export function openLibrary(t, options = {}) { for (const key of removed) picked.delete(key); confirming = false; undoFailure = removed.size - ? t(`${picked.size} could not be deleted. Try again.`, `还有 ${picked.size} 个没能删除,请重试。`) + ? t('{size} could not be deleted. Try again.', '还有 {size} 个没能删除,请重试。', { size: picked.size }) : why || t('Could not delete. Try again.', '没能删除,请重试。'); if (!picked.size) setSelecting(false); } else { undoFailure = ''; setSelecting(false); } @@ -2101,7 +2109,8 @@ export function openLibrary(t, options = {}) { fromCache = false; } unread += Number.isSafeInteger(data.unreadable) && data.unreadable > 0 ? data.unreadable : 0; - unreadable.textContent = unread ? t(`${unread} ${unread === 1 ? 'creation' : 'creations'} could not be read`, `另有 ${unread} 个作品无法读取`) : ''; + unreadable.textContent = !unread ? '' : unread === 1 ? t('1 creation could not be read', '另有 1 个作品无法读取') + : t('{count} creations could not be read', '另有 {count} 个作品无法读取', { count: unread }); for (const row of data.items || []) append(row); for (const row of arrivals) append(row); // Pages already read below the first stay; their cursor carries on from where it was. @@ -2182,7 +2191,7 @@ export function openLibrary(t, options = {}) { let viewerMuted = true, idleTimer = 0, infoOpen = false, menuClosedAt = 0; const viewerName = row => { const words = String(row.agent?.label || (row.kind === 'image' ? picturePrompt(row) : prompts.get(row.id)) || '').replace(/\s+/g, ' ').trim(); - return words ? words.slice(0, 300) : row.kind === 'image' ? t('Picture', '图片') : t('Video', '视频'); + return words ? words.slice(0, 300) : row.kind === 'image' ? t('Image', '图片') : t('Video', '视频'); }; function wake() { if (viewing == null || viewing === 'compare') return; @@ -2217,9 +2226,9 @@ export function openLibrary(t, options = {}) { more.classList.add('fv-library-viewer-more'); if (row.kind === 'image') { const download = el('a', null, 'fv-library-viewer-action'); download.href = pictureURL(row); download.download = row.name || ''; - download.append(icon('download'), el('span', t('Download', '下载'))); tip(download, t('Download picture', '下载图片'), t('Save the picture to this computer', '把图片保存到电脑')); + download.append(icon('download'), el('span', t('Download', '下载'))); tip(download, t('Download image', '下载图片'), t('Save the image to this computer', '把图片保存到电脑')); const text = picturePrompt(row); - const usePrompt = viewerAction(t('Use prompt', '使用提示词'), t('Put its prompt in the box of the image view', '把它的提示词填回图像视图的描述框'), icon('reuse'), () => usePicturePrompt(text)); + const usePrompt = viewerAction(t('Use prompt', '使用提示词'), t('Put its prompt in the box of the image view', '把它的提示词填回图像视图的提示词框'), icon('reuse'), () => usePicturePrompt(text)); usePrompt.hidden = !text; const imageView = viewerAction(t('Open in Images', '在图像视图打开'), t('Use it as a reference or make more like it there', '在那里用作参考图,或接着生成'), line('picture'), () => openInImageView(row)); foot.append(download, imageView, usePrompt, more); @@ -2227,7 +2236,7 @@ export function openLibrary(t, options = {}) { } const download = el('a', null, 'fv-library-viewer-action'); download.href = outputDownloadURL(api, row.video); download.download = ''; download.append(icon('download'), el('span', t('Download', '下载'))); tip(download, t('Download video', '下载视频'), t('Save the MP4 to this computer', '把视频文件保存到电脑')); - const extendButton = viewerAction(t('Continue', '接着生成'), canExtend(row) ? t('Make a longer video from its end', '从结尾继续生成更长的视频') : t('This video cannot be continued', '这条视频不能接着生成'), icon('extend'), () => { closeViewer(); extendSaved(row); }); + const extendButton = viewerAction(t('Extend', '接着生成'), canExtend(row) ? t('Make a longer video from its end', '从结尾继续生成更长的视频') : t('This video cannot be extended', '这条视频不能接着生成'), icon('extend'), () => { closeViewer(); extendSaved(row); }); extendButton.disabled = !canExtend(row); const again = row.preview && secondPassRunner() ? viewerAction(t('Run second pass', '继续二采'), t('Finish the full-resolution video', '从预览继续生成全分辨率视频'), icon('reuse'), () => { closeViewer(); secondPass(row); }) @@ -2242,7 +2251,7 @@ export function openLibrary(t, options = {}) { const extra = [{id: 'info', icon: 'info', label: infoOpen ? ['Hide info', '收起信息'] : ['Info', '信息'], use: ['Prompt and run details', '提示词和运行详情'], key: 'I', run: () => toggleInfo()}]; if (row.kind !== 'image') { const share = links.querySelector('.fv-share-trigger'), copy = links.querySelector('.fv-action-copy'); - if (share) extra.unshift({id: 'share', icon: 'globe', label: ['Share', '分享'], use: ['Make a picture or clip to share', '生成可分享的图片或短片'], run: () => share.click()}); + if (share) extra.unshift({id: 'share', icon: 'globe', label: ['Share', '分享'], use: ['Make an image or clip to share', '生成可分享的图片或短片'], run: () => share.click()}); if (copy) extra.push({id: 'copy-path', icon: 'folder', label: ['Copy path', '复制路径'], use: ['Copy where the file is saved', '复制文件保存的位置'], run: () => copy.click()}); } // Deleting from the viewer moves on to the next creation (or closes when none is left). @@ -2545,7 +2554,7 @@ export function openLibrary(t, options = {}) { const tag = meta.tag(id); if (!tag) continue; const chip = el('span', null, 'fv-library-chip'); chip.dataset.color = tag.color; const x = button('', () => { meta.setTags([key], [], [id]); }, 'fv-library-chip-remove'); x.append(line('close')); - x.setAttribute('aria-label', t(`Remove tag ${tag.name}`, `去掉标签“${tag.name}”`)); tip(x, t('Remove tag', '去掉标签'), t(`Take "${tag.name}" off this creation`, `从这个作品上去掉“${tag.name}”`)); + x.setAttribute('aria-label', t('Remove tag {name}', '去掉标签“{name}”', { name: tag.name })); tip(x, t('Remove tag', '去掉标签'), t('Take "{name}" off this creation', '从这个作品上去掉“{name}”', { name: tag.name })); chip.append(el('span', tag.name), x); tagRow.append(chip); } const add = button('', () => openTagMenu(add, [key]), 'fv-library-chip fv-library-chip-add'); @@ -2615,7 +2624,7 @@ export function openLibrary(t, options = {}) { // A picture whose delete could not be done comes back with a note. const pictureOff = pictureBin.subscribe(event => { if (disposed) return; - if (event?.failed?.length) { loadPictures().then(() => { render(); say(t(`${event.failed.length} could not be deleted; they are back.`, `有 ${event.failed.length} 个没能删除,已放回。`), true); }); return; } + if (event?.failed?.length) { loadPictures().then(() => { render(); say(t('{count} could not be deleted; they are back.', '有 {count} 个没能删除,已放回。', { count: event.failed.length }), true); }); return; } showUndo(); }); // A delete that an earlier opening of the dialog is still carrying out takes its creations off this one too. diff --git a/web/locales/zh-Hant.json b/web/locales/zh-Hant.json new file mode 100644 index 00000000..98f51fe4 --- /dev/null +++ b/web/locales/zh-Hant.json @@ -0,0 +1,6586 @@ +{ +"_meta": { +"name": "繁體中文", +"dir": "ltr", +"fallback": "zh-Hans", +"ready": true, +"generated_by": "scripts/i18n_hant.py", +"entries": 6573, +"reviewed": 770, +"note": "Generated from zh-Hans.json; do not edit. Corrections go in scripts/i18n_hant_review.json.", +"chars": "‘『’』“「”」㐷傌㐽偑㑇㑳㑈倲㑔㑯㑩儸㓆𠗣㓥劏㓰劃㔉劚㖊噚㖞喎㘎㘚㚯㜄㛀媰㛟𡞵㛠𡢃㛣㜏㛤孋㛿𡠹㟆㠏㟜𡾱㟥嵾㡎幓㤘㥮㤽懤㥪慺㧏掆㧐㩳㧑撝㧟擓㧰擽㨫㩜㭎棡㭏椲㭣𣙎㭤樢㭴樫㱩殰㱮殨㲿瀇㳔濧㳕灡㳠澾㳡濄㳢𣾷㳽瀰㴋潚㶉鸂㶶燶㶽煱㺍獱㻅璯㻏𤫩㻘𤪺䀥䁻䁖瞜䂵碽䃅磾䅉稏䅟穇䅪𥢢䇲筴䉤籔䌶䊷䌷紬䌸縳䌹絅䌺䋙䌻䋚䌼綐䌽綵䌾䋻䌿䋹䍀繿䍁繸䍠䍦䎬䎱䏝膞䑽𦪙䓓薵䓕薳䓖藭䓨罃䗖螮䘛𧝞䘞𧜗䙊𧜵䙌䙡䙓襬䜣訢䜤鿁䜥𧩙䜧䜀䜩讌䝙貙䞌𧵳䞍䝼䞎𧶧䞐賰䟢躎䢀𨊰䢁𨊸䢂𨋢䥺釾䥽鏺䥾䥱䥿𨯅䦀𨦫䦁𨧜䦂䥇䦃鐯䦅鐥䦆钁䦶䦛䦷䦟䩄靦䭪𩞯䯃𩣑䯄騧䯅䯀䲝䱽䲞𩶘䲟鮣䲠鰆䲡鰌䲢鰧䲣䱷䴓鳾䴔鵁䴕鴷䴖鶄䴗鶪䴘鷉䴙鸊䶮龑万萬与與专專业業丛叢东東丝絲丢丟两兩严嚴丧喪个個临臨为為丽麗举舉么麼义義乌烏乐樂乔喬习習乡鄉书書买買乱亂争爭于於亏虧云雲亚亞产產亩畝亲親亵褻亸嚲亿億仅僅从從仑侖仓倉仪儀们們众眾优優会會伛傴伞傘伟偉传傳伡俥伣俔伤傷伥倀伦倫伧傖伪偽伫佇体體余餘佥僉侠俠侣侶侥僥侦偵侧側侨僑侩儈侪儕侬儂侭儘俣俁俦儔俨儼俩倆俪儷俫倈俭儉债債倾傾偬傯偻僂偾僨偿償傤儎傥儻傧儐储儲傩儺儿兒兑兌兖兗兰蘭关關兴興兹茲养養兽獸冁囅内內冈岡册冊写寫军軍农農冯馮冲衝决決况況冻凍净淨凄悽凉涼减減凑湊凛凜几幾凤鳳凫鳧凭憑凯凱击擊凿鑿刍芻刘劉则則刚剛创創删刪别別刬剗刭剄刹剎刽劊刾㓨刿劌剀剴剂劑剐剮剑劍剥剝剧劇劝勸办辦务務劢勱动動励勵劲勁劳勞势勢勋勳勚勩匀勻匦匭匮匱区區医醫华華协協单單卖賣卢盧卤滷卧臥卫衛却卻卺巹厅廳历歷厉厲压壓厌厭厍厙厐龎厕廁厢廂厣厴厦廈厨廚厩廄厮廝县縣叁叄参參叆靉叇靆双雙发發变變叙敘叠疊号號叹嘆叽嘰吓嚇吕呂吗嗎吨噸听聽启啟吴吳呐吶呒嘸呓囈呕嘔呖嚦呗唄员員呙咼呛嗆呜嗚咏詠咙嚨咛嚀咝噝咤吒响響哑啞哒噠哓嘵哔嗶哕噦哗譁哙噲哜嚌哝噥哟喲唛嘜唝嗊唠嘮唡啢唢嗩唤喚啧嘖啬嗇啭囀啮齧啯嘓啰囉啴嘽啸嘯喷噴喽嘍喾嚳嗫囁嗳噯嘘噓嘤嚶嘱囑噜嚕嚣囂团團园園囱囪围圍囵圇国國图圖圆圓圣聖圹壙场場坏壞块塊坚堅坛壇坜壢坝壩坞塢坟墳坠墜垄壟垅壠垆壚垒壘垦墾垩堊垫墊垭埡垯墶垱壋垲塏垴堖埘塒埙壎埚堝堑塹堕墮塆壪墙牆壮壯声聲壳殼壶壺壸壼处處备備复復够夠头頭夹夾夺奪奁奩奂奐奋奮奖獎奥奧妆妝妇婦妈媽妩嫵妪嫗妫媯姗姍姹奼娄婁娅婭娆嬈娇嬌娈孌娱娛娲媧娴嫻婳嫿婴嬰婵嬋婶嬸媪媼媭嬃嫒嬡嫔嬪嫱嬙嬷嬤孙孫学學孪孿宁寧宝寶实實宠寵审審宪憲宫宮宽寬宾賓寝寢对對寻尋导導寿壽将將尔爾尘塵尝嘗尧堯尴尷尽盡层層屃屓屉屜届屆属屬屡屢屦屨屿嶼岁歲岂豈岖嶇岗崗岘峴岚嵐岛島岭嶺岽崬岿巋峃嶨峄嶧峡峽峣嶢峤嶠峥崢峦巒崂嶗崃崍崄嶮崭嶄嵘嶸嵚嶔嵝嶁巅巔巩鞏巯巰币幣帅帥师師帏幃帐帳帜幟带帶帮幫帱幬帻幘帼幗幂冪并並广廣庄莊庆慶庐廬庑廡库庫应應庙廟庞龐废廢庼廎廪廩开開异異弃棄弑弒张張弥彌弪弳弯彎弹彈强強归歸当當录錄彟彠彦彥彨彲彻徹径徑徕徠忆憶忏懺忧憂忾愾怀懷态態怂慫怃憮怄慪怅悵怆愴怜憐总總怼懟怿懌恋戀恒恆恳懇恶惡恸慟恹懨恺愷恻惻恼惱恽惲悦悅悫愨悬懸悭慳悮悞悯憫惊驚惧懼惨慘惩懲惫憊惬愜惭慚惮憚惯慣愠慍愤憤愦憒慑懾慭憖懑懣懒懶懔懍戆戇戋戔戏戲戗戧战戰戬戩戯戱户戶扑撲执執扩擴扪捫扫掃扬揚扰擾抚撫抛拋抟摶抠摳抡掄抢搶护護报報担擔拟擬拢攏拣揀拥擁拦攔拧擰拨撥择擇挂掛挚摯挛攣挜掗挝撾挞撻挟挾挠撓挡擋挢撟挣掙挤擠挥揮挦撏捝挩捞撈损損捡撿换換捣搗据據掳擄掴摑掷擲掸撣掺摻掼摜揽攬揾搵揿撳搀攙搁擱搂摟搄揯搅攪携攜摄攝摅攄摆擺摇搖摈擯摊攤撄攖撑撐撵攆撷擷撸擼撺攛擜㩵擞擻攒攢敌敵敚敓敛斂敩斆数數斋齋斓斕斩斬断斷无無旧舊时時旷曠旸暘昙曇昵暱昼晝昽曨显顯晋晉晒曬晓曉晔曄晕暈晖暉暂暫暅𣈶暧曖术術机機杀殺杂雜权權条條来來杨楊杩榪极極构構枞樅枢樞枣棗枥櫪枧梘枨棖枪槍枫楓枭梟柜櫃柠檸柽檉栀梔栅柵标標栈棧栉櫛栊櫳栋棟栌櫨栎櫟栏欄树樹栖棲样樣栾欒桠椏桡橈桢楨档檔桤榿桥橋桦樺桧檜桨槳桩樁桪樳梦夢梼檮梾棶梿槤检檢棁梲棂欞椁槨椝槼椟櫝椠槧椢槶椤欏椫樿椭橢椮槮楼樓榄欖榅榲榇櫬榈櫚榉櫸榝樧槚檟槛檻槟檳槠櫧横橫樯檣樱櫻橥櫫橱櫥橹櫓橼櫞檩檁欢歡欤歟欧歐歼殲殁歿殇殤残殘殒殞殓殮殚殫殡殯殴毆毁毀毂轂毕畢毙斃毡氈毵毿毶𣯶氇氌气氣氢氫氩氬氲氳汇匯汉漢汤湯汹洶沄澐沟溝没沒沣灃沤漚沥瀝沦淪沧滄沨渢沩溈沪滬泞濘泪淚泶澩泷瀧泸瀘泺濼泻瀉泼潑泽澤泾涇洁潔洒灑洼窪浃浹浅淺浆漿浇澆浈湞浉溮浊濁测測浍澮济濟浏瀏浐滻浑渾浒滸浓濃浔潯浕濜涂塗涚涗涛濤涝澇涞淶涟漣涠潿涡渦涢溳涣渙涤滌润潤涧澗涨漲涩澀渊淵渌淥渍漬渎瀆渐漸渑澠渔漁渖瀋渗滲温溫湾灣湿溼溁濚溃潰溅濺溆漵溇漊滗潷滚滾滞滯滟灩滠灄满滿滢瀅滤濾滥濫滦灤滨濱滩灘滪澦潆瀠潇瀟潋瀲潍濰潜潛潴瀦澛瀂澜瀾濑瀨濒瀕灏灝灭滅灯燈灵靈灾災灿燦炀煬炉爐炖燉炜煒炝熗点點炼煉炽熾烁爍烂爛烃烴烛燭烟煙烦煩烧燒烨燁烩燴烫燙烬燼热熱焕煥焖燜焘燾煴熅爱愛爷爺牍牘牦犛牵牽牺犧犊犢状狀犷獷犸獁犹猶狈狽狝獮狞獰独獨狭狹狮獅狯獪狰猙狱獄狲猻猃獫猎獵猕獼猡玀猪豬猫貓猬蝟献獻獭獺玑璣玙璵玚瑒玛瑪玮瑋环環现現玱瑲玺璽珐琺珑瓏珰璫珲琿琎璡琏璉琐瑣琼瓊瑶瑤瑷璦瑸璸璎瓔瓒瓚瓮甕瓯甌电電画畫畅暢畴疇疖癤疗療疟瘧疠癘疡瘍疬癧疭瘲疮瘡疯瘋疱皰疴痾痈癰痉痙痒癢痖瘂痨癆痪瘓痫癇瘅癉瘆瘮瘗瘞瘘瘻瘪癟瘫癱瘾癮瘿癭癞癩癣癬癫癲皑皚皱皺皲皸盏盞盐鹽监監盖蓋盗盜盘盤眍瞘眦眥眬矓着著睁睜睐睞睑瞼瞆瞶瞒瞞瞩矚矫矯矶磯矾礬矿礦砀碭码碼砖磚砗硨砚硯砜碸砺礪砻礱砾礫础礎硁硜硕碩硖硤硗磽硙磑硚礄确確硵磠碍礙碛磧碜磣碱鹼礼禮祃禡祎禕祢禰祯禎祷禱祸禍禀稟禄祿禅禪离離秃禿秆稈种種积積称稱秽穢秾穠稆穭税稅稣穌稳穩穑穡穞穭穷窮窃竊窍竅窎窵窑窯窜竄窝窩窥窺窦竇窭窶竖豎竞競笃篤笋筍笔筆笕筧笺箋笼籠笾籩筚篳筛篩筜簹筝箏筹籌筼篔签籤筿篠简簡箓籙箦簀箧篋箨籜箩籮箪簞箫簫篑簣篓簍篮籃篯籛篱籬簖籪籁籟籴糴类類籼秈粜糶粝糲粤粵粪糞粮糧糁糝糇餱糍餈紧緊絷縶緼縕縆緪纟糹纠糾纡紆红紅纣紂纤纖纥紇约約级級纨紈纩纊纪紀纫紉纬緯纭紜纮紘纯純纰紕纱紗纲綱纳納纴紝纵縱纶綸纷紛纸紙纹紋纺紡纻紵纼紖纽紐纾紓线線绀紺绁紲绂紱练練组組绅紳细細织織终終绉縐绊絆绋紼绌絀绍紹绎繹经經绐紿绑綁绒絨结結绔絝绕繞绖絰绗絎绘繪给給绚絢绛絳络絡绝絕绞絞统統绠綆绡綃绢絹绣繡绤綌绥綏绦絛继繼绨綈绩績绪緒绫綾绬緓续續绮綺绯緋绰綽绱鞝绲緄绳繩维維绵綿绶綬绷繃绸綢绹綯绺綹绻綣综綜绽綻绾綰绿綠缀綴缁緇缂緙缃緗缄緘缅緬缆纜缇緹缈緲缉緝缊縕缋繢缌緦缍綞缎緞缏緶缐線缑緱缒縋缓緩缔締缕縷编編缗緡缘緣缙縉缚縛缛縟缜縝缝縫缞縗缟縞缠纏缡縭缢縊缣縑缤繽缥縹缦縵缧縲缨纓缩縮缪繆缫繅缬纈缭繚缮繕缯繒缰韁缱繾缲繰缳繯缴繳缵纘罂罌网網罗羅罚罰罢罷罴羆羁羈羟羥羡羨翘翹翙翽翚翬耢耮耧耬耸聳耻恥聂聶聋聾职職聍聹联聯聩聵聪聰肃肅肠腸肤膚肮骯肴餚肾腎肿腫胀脹胁脅胆膽胧朧胨腖胪臚胫脛胶膠脉脈脍膾脏髒脐臍脑腦脓膿脔臠脚腳脱脫脶腡脸臉腘膕腭顎腻膩腼靦腽膃腾騰膑臏臜臢臺台舆輿舣艤舰艦舱艙舻艫艰艱艳豔艺藝节節芈羋芗薌芜蕪芦蘆苁蓯苇葦苈藶苋莧苌萇苍蒼苏蘇苧薴茎莖茏蘢茑蔦茔塋茕煢茧繭荆荊荐薦荙薘荚莢荛蕘荜蓽荝萴荞蕎荟薈荠薺荡蕩荣榮荤葷荥滎荦犖荧熒荨蕁荩藎荪蓀荫蔭荬蕒荭葒荮葤药藥莅蒞莱萊莲蓮莳蒔莴萵莶薟获獲莸蕕莹瑩莺鶯莼蓴萚蘀萝蘿萤螢营營萦縈萧蕭萨薩葱蔥蒀蒕蒇蕆蒉蕢蒋蔣蒌蔞蒏醟蓝藍蓟薊蓠蘺蓣蕷蓥鎣蓦驀蔂虆蔷薔蔹蘞蔺藺蔼藹蕰薀蕲蘄蕴蘊薮藪藓蘚藴蘊蘖櫱虏虜虑慮虚虛虬虯虮蟣虱蝨虽雖虾蝦虿蠆蚀蝕蚁蟻蚂螞蚃蠁蚕蠶蚬蜆蛊蠱蛎蠣蛏蟶蛮蠻蛰蟄蛱蛺蛲蟯蛳螄蛴蠐蜕蛻蜗蝸蝇蠅蝈蟈蝉蟬蝼螻蝾蠑螀螿螨蟎蟏蠨衅釁衔銜补補衬襯衮袞袄襖袅嫋袆褘袜襪袭襲袯襏装裝裆襠裈褌裢褳裣襝裤褲裥襉褛褸褴襤襕襴见見观觀觃覎规規觅覓视視觇覘览覽觉覺觊覬觋覡觌覿觍覥觎覦觏覯觐覲觑覷觞觴触觸觯觶訚誾詟讋誉譽誊謄讠訁计計订訂讣訃认認讥譏讦訐讧訌讨討让讓讪訕讫訖讬託训訓议議讯訊记記讱訒讲講讳諱讴謳讵詎讶訝讷訥许許讹訛论論讻訩讼訟讽諷设設访訪诀訣证證诂詁诃訶评評诅詛识識诇詗诈詐诉訴诊診诋詆诌謅词詞诎詘诏詔诐詖译譯诒詒诓誆诔誄试試诖詿诗詩诘詰诙詼诚誠诛誅诜詵话話诞誕诟詬诠詮诡詭询詢诣詣诤諍该該详詳诧詫诨諢诩詡诪譸诫誡诬誣语語诮誚误誤诰誥诱誘诲誨诳誑说說诵誦诶誒请請诸諸诹諏诺諾读讀诼諑诽誹课課诿諉谀諛谁誰谂諗调調谄諂谅諒谆諄谇誶谈談谉讅谊誼谋謀谌諶谍諜谎謊谏諫谐諧谑謔谒謁谓謂谔諤谕諭谖諼谗讒谘諮谙諳谚諺谛諦谜謎谝諞谞諝谟謨谠讜谡謖谢謝谣謠谤謗谥諡谦謙谧謐谨謹谩謾谪謫谫譾谬謬谭譚谮譖谯譙谰讕谱譜谲譎谳讞谴譴谵譫谶讖豮豶贝貝贞貞负負贠貟贡貢财財责責贤賢败敗账賬货貨质質贩販贪貪贫貧贬貶购購贮貯贯貫贰貳贱賤贲賁贳貰贴貼贵貴贶貺贷貸贸貿费費贺賀贻貽贼賊贽贄贾賈贿賄赀貲赁賃赂賂赃贓资資赅賅赆贐赇賕赈賑赉賚赊賒赋賦赌賭赍齎赎贖赏賞赐賜赑贔赒賙赓賡赔賠赕賧赖賴赗賵赘贅赙賻赚賺赛賽赜賾赝贗赞贊赟贇赠贈赡贍赢贏赣贛赪赬赵趙赶趕趋趨趱趲趸躉跃躍跄蹌跞躒践踐跶躂跷蹺跸蹕跹躚跻躋踌躊踪蹤踬躓踯躑蹑躡蹒蹣蹰躕蹿躥躏躪躜躦躯軀輼轀车車轧軋轨軌轩軒轪軑轫軔转轉轭軛轮輪软軟轰轟轱軲轲軻轳轤轴軸轵軹轶軼轷軤轸軫轹轢轺軺轻輕轼軾载載轾輊轿轎辀輈辁輇辂輅较較辄輒辅輔辆輛辇輦辈輩辉輝辊輥辋輞辌輬辍輟辎輜辏輳辐輻辑輯辒轀输輸辔轡辕轅辖轄辗輾辘轆辙轍辚轔辞辭辩辯辫辮边邊辽遼达達迁遷过過迈邁运運还還这這进進远遠违違连連迟遲迩邇迳逕迹跡适適选選逊遜递遞逦邐逻邏遗遺遥遙邓鄧邝鄺邬鄔邮郵邹鄒邺鄴邻鄰郏郟郐鄶郑鄭郓鄆郦酈郧鄖郸鄲酂酇酝醞酦醱酱醬酽釅酾釃酿釀醖醞释釋鉴鑑銮鑾錾鏨钅釒钆釓钇釔针針钉釘钊釗钋釙钌釕钍釷钎釺钏釧钐釤钑鈒钒釩钓釣钔鍆钕釹钖鍚钗釵钘鈃钙鈣钚鈈钛鈦钜鉅钝鈍钞鈔钟鍾钠鈉钡鋇钢鋼钣鈑钤鈐钥鑰钦欽钧鈞钨鎢钩鉤钪鈧钫鈁钬鈥钭鈄钮鈕钯鈀钰鈺钱錢钲鉦钳鉗钴鈷钵缽钶鈳钷鉕钸鈽钹鈸钺鉞钻鑽钼鉬钽鉭钾鉀钿鈿铀鈾铁鐵铂鉑铃鈴铄鑠铅鉛铆鉚铇鉋铈鈰铉鉉铊鉈铋鉍铌鈮铍鈹铎鐸铏鉶铐銬铑銠铒鉺铓鋩铔錏铕銪铖鋮铗鋏铘鋣铙鐃铚銍铛鐺铜銅铝鋁铞銱铟銦铠鎧铡鍘铢銖铣銑铤鋌铥銩铦銛铧鏵铨銓铩鎩铪鉿铫銚铬鉻铭銘铮錚铯銫铰鉸铱銥铲鏟铳銃铴鐋铵銨银銀铷銣铸鑄铹鐒铺鋪铻鋙铼錸铽鋱链鏈铿鏗销銷锁鎖锂鋰锃鋥锄鋤锅鍋锆鋯锇鋨锈鏽锉銼锊鋝锋鋒锌鋅锍鋶锎鐦锏鐧锐銳锑銻锒鋃锓鋟锔鋦锕錒锖錆锗鍺锘鍩错錯锚錨锛錛锜錡锝鍀锞錁锟錕锠錩锡錫锢錮锣鑼锤錘锥錐锦錦锧鑕锨鍁锩錈锪鍃锫錇锬錟锭錠键鍵锯鋸锰錳锱錙锲鍥锳鍈锴鍇锵鏘锶鍶锷鍔锸鍤锹鍬锺鍾锻鍛锼鎪锽鍠锾鍰锿鎄镀鍍镁鎂镂鏤镃鎡镄鐨镅鎇镆鏌镇鎮镈鎛镉鎘镊鑷镋钂镌鐫镍鎳镎鎿镏鎦镐鎬镑鎊镒鎰镓鎵镔鑌镕鎔镖鏢镗鏜镘鏝镙鏍镚鏰镛鏞镜鏡镝鏑镞鏃镟鏇镠鏐镡鐔镢钁镣鐐镤鏷镥鑥镦鐓镧鑭镨鐠镩鑹镪鏹镫鐙镬鑊镭鐳镮鐶镯鐲镰鐮镱鐿镲鑔镳鑣镴鑞镵鑱镶鑲长長门門闩閂闪閃闫閆闬閈闭閉问問闯闖闰閏闱闈闲閒闳閎间間闵閔闶閌闷悶闸閘闹鬧闺閨闻聞闼闥闽閩闾閭闿闓阀閥阁閣阂閡阃閫阄鬮阅閱阆閬阇闍阈閾阉閹阊閶阋鬩阌閿阍閽阎閻阏閼阐闡阑闌阒闃阓闠阔闊阕闋阖闔阗闐阘闒阙闕阚闞阛闤队隊阳陽阴陰阵陣阶階际際陆陸陇隴陈陳陉陘陕陝陦隯陧隉陨隕险險随隨隐隱隶隸隽雋难難雇僱雏雛雠讎雳靂雾霧霁霽霉黴霡霢霭靄靓靚靔靝静靜靥靨鞑韃鞒鞽鞯韉鞲韝韦韋韧韌韨韍韩韓韪韙韫韞韬韜韵韻页頁顶頂顷頃顸頇项項顺順须須顼頊顽頑顾顧顿頓颀頎颁頒颂頌颃頏预預颅顱领領颇頗颈頸颉頡颊頰颋頲颌頜颍潁颎熲颏頦颐頤频頻颒頮颓頹颔頷颕頴颖穎颗顆题題颙顒颚顎颛顓颜顏额額颞顳颟顢颠顛颡顙颢顥颣纇颤顫颥顬颦顰颧顴风風飏颺飐颭飑颮飒颯飓颶飔颸飕颼飖颻飗飀飘飄飙飆飚飈飞飛飨饗餍饜饣飠饤飣饥飢饦飥饧餳饨飩饩餼饪飪饫飫饬飭饭飯饮飲饯餞饰飾饱飽饲飼饳飿饴飴饵餌饶饒饷餉饸餄饹餎饺餃饻餏饼餅饽餑饾餖饿餓馀餘馁餒馂餕馃餜馄餛馅餡馆館馇餷馈饋馉餶馊餿馋饞馌饁馍饃馎餺馏餾馐饈馑饉馒饅馓饊馔饌馕饢马馬驭馭驮馱驯馴驰馳驱驅驲馹驳駁驴驢驵駔驶駛驷駟驸駙驹駒驺騶驻駐驼駝驽駑驾駕驿驛骀駘骁驍骂罵骃駰骄驕骅驊骆駱骇駭骈駢骉驫骊驪骋騁验驗骍騂骎駸骏駿骐騏骑騎骒騍骓騅骔騌骕驌骖驂骗騙骘騭骙騤骚騷骛騖骜驁骝騮骞騫骟騸骠驃骡騾骢驄骣驏骤驟骥驥骦驦骧驤髅髏髋髖髌髕鬓鬢鬶鬹魇魘魉魎鱼魚鱽魛鱾魢鱿魷鲀魨鲁魯鲂魴鲃䰾鲄魺鲅鮁鲆鮃鲇鯰鲈鱸鲉鮋鲊鮓鲋鮒鲌鮊鲍鮑鲎鱟鲏鮍鲐鮐鲑鮭鲒鮚鲓鮳鲔鮪鲕鮞鲖鮦鲗鰂鲘鮜鲙鱠鲚鱭鲛鮫鲜鮮鲝鮺鲞鯗鲟鱘鲠鯁鲡鱺鲢鰱鲣鰹鲤鯉鲥鰣鲦鰷鲧鯀鲨鯊鲩鯇鲪鮶鲫鯽鲬鯒鲭鯖鲮鯪鲯鯕鲰鯫鲱鯡鲲鯤鲳鯧鲴鯝鲵鯢鲶鯰鲷鯛鲸鯨鲹鰺鲺鯴鲻鯔鲼鱝鲽鰈鲾鰏鲿鱨鳀鯷鳁鰮鳂鰃鳃鰓鳄鱷鳅鰍鳆鰒鳇鰉鳈鰁鳉鱂鳊鯿鳋鰠鳌鰲鳍鰭鳎鰨鳏鰥鳐鰩鳑鰟鳒鰜鳓鰳鳔鰾鳕鱈鳖鱉鳗鰻鳘鰵鳙鱅鳚䲁鳛鰼鳜鱖鳝鱔鳞鱗鳟鱒鳠鱯鳡鱤鳢鱧鳣鱣鳤䲘鸟鳥鸠鳩鸡雞鸢鳶鸣鳴鸤鳲鸥鷗鸦鴉鸧鶬鸨鴇鸩鴆鸪鴣鸫鶇鸬鸕鸭鴨鸮鴞鸯鴦鸰鴒鸱鴟鸲鴝鸳鴛鸴鷽鸵鴕鸶鷥鸷鷙鸸鴯鸹鴰鸺鵂鸻鴴鸼鵃鸽鴿鸾鸞鸿鴻鹀鵐鹁鵓鹂鸝鹃鵑鹄鵠鹅鵝鹆鵒鹇鷳鹈鵜鹉鵡鹊鵲鹋鶓鹌鵪鹍鵾鹎鵯鹏鵬鹐鵮鹑鶉鹒鶊鹓鵷鹔鷫鹕鶘鹖鶡鹗鶚鹘鶻鹙鶖鹚鷀鹛鶥鹜鶩鹝鷊鹞鷂鹟鶲鹠鶹鹡鶺鹢鷁鹣鶼鹤鶴鹥鷖鹦鸚鹧鷓鹨鷚鹩鷯鹪鷦鹫鷲鹬鷸鹭鷺鹮䴉鹯鸇鹰鷹鹱鸌鹲鸏鹳鸛鹴鸘鹾鹺麦麥麸麩麹麴麺麵麽麼黄黃黉黌黡黶黩黷黪黲黾黽鼋黿鼌鼂鼍鼉鼹鼴齐齊齑齏齿齒龀齔龁齕龂齗龃齟龄齡龅齙龆齠龇齜龈齦龉齬龊齪龋齲龌齷龙龍龚龔龛龕龟龜鿎䃮鿏䥑鿒鿓鿔鎶𠀾𠁞𠆲儣𠆿𠌥𠇹俓𠉂㒓𠉗𠏢𠋆儭𠚳𠠎𠛅剾𠛆𠞆𠛾𪟖𠡠勑𠮶嗰𠯟哯𠯠噅𠰱㘉𠰷嚧𠱞囃𠲥𡅏𠴛𡃕𠴢𡄔𠵸𡄣𠵾㗲𡋀𡓾𡋗𡑭𡋤壗𡍣𡔖𡒄壈𡝠㜷𡞋㜗𡞱㜢𡠟孎𡥧孻𡭜𡮉𡭬𡮣𡳃𡳳𡳒𦘧𡶴嵼𡸃𡽗𡺃嶈𡺄嶘𢋈㢝𢗓㦛𢘙𢤱𢘝𢣚𢘞𢣭𢙏愻𢙐憹𢙑𢠼𢙒憢𢙓懀𢛯㦎𢠁懎𢢐𤢻𢧐戰𢫊𢷮𢫞𢶫𢫬摋𢬍擫𢬦𢹿𢭏擣𢽾斅𣃁斸𣆐曥𣈣𣋋𣍨𦢈𣍯腪𣍰脥𣎑臗𣏢槫𣐕桱𣐤欍𣑶𣠲𣒌楇𣓿橯𣔌樤𣗊樠𣗋欓𣗙㰙𣘐㯤𣘓𣞻𣘴檭𣘷𣝕𣚚欘𣞎𣠩𣨼殢𣭤𣯴𣯣𣯩𣱝氭𣲗湋𣲘潕𣳆㵗𣶩澅𣶫𣿉𣶭𪷓𣷷𤅶𣸣濆𣺼灙𣺽𤁣𣽷瀃𤆡熓𤆢㷍𤇃爄𤇄熌𤇭爖𤇹熚𤈶熉𤈷㷿𤊀𤒎𤊰𤓩𤋏熡𤎺𤓎𤎻𤑳𤙯𤛮𤝢𤢟𤞃獩𤞤玁𤠋㺏𤦀瓕𤩽瓛𤳄𤳸𤶊癐𤶧𤸫𤻊㿗𤽯㿧𤾀皟𤿲麬𥁢䀉𥅘𥌃𥅴䀹𥅿𥊝𥆧瞤𥇢䁪𥎝䂎𥐟礒𥐯𥖅𥐰𥕥𥐻碙𥞦𥞵𥧂𥨐𥩟竚𥩺𥪂𥫣籅𥬀䉙𥬞籋𥬠篘𥭉𥵊𥮋𥸠𥮜䉲𥮾篸𥱔𥵃𥹥𥼽𥺅䊭𥺇𥽖𦈈𥿊𦈉緷𦈋綇𦈌綀𦈎繟𦈏緍𦈐縺𦈑緸𦈒𦂅𦈓䋿𦈔縎𦈕緰𦈖䌈𦈗𦃄𦈘䌋𦈙䌰𦈚縬𦈛繓𦈜䌖𦈝繏𦈞䌟𦈟䌝𦈠䌥𦈡繻𦍠䍽𦛨朥𦝼膢𦟗𦣎𦨩𦪽𦰏蓧𦰴䕳𦶟爇𦶻𦾟𦻕蘟𧉐𧕟𧉞䗿𧌥𧎈𧏖蠙𧏗蠀𧑏蠾𧒭𧔥𧜭䙱𧝝襰𧝧𧟀𧮪詀𧳕𧳟𧹑䞈𧹒買𧹓𧶔𧹔賬𧹕䝻𧹖賟𧹗贃𧿈𨇁𨀁躘𨀱𨄣𨁴𨅍𨂺𨈊𨄄𨈌𨅛䠱𨅫𨇞𨅬躝𨉗軉𨐅軗𨐆𨊻𨐇𨏠𨐈輄𨐉𨎮𨐊𨏥𨑹䢨𨟳𨣞𨠨𨣧𨡙𨢿𨡺𨣈𨤰𨤻𨰾鎷𨰿釳𨱀𨥛𨱁鈠𨱂鈋𨱃鈲𨱄鈯𨱅鉁𨱆龯𨱇銶𨱈鋉𨱉鍄𨱊𨧱𨱋錂𨱌鏆𨱍鎯𨱎鍮𨱏鎝𨱐𨫒𨱑鐄𨱒鏉𨱓鐎𨱔鐏𨱕𨮂𨱖䥩𨷿䦳𨸀𨳕𨸁𨳑𨸂閍𨸃閐𨸄䦘𨸅𨴗𨸆𨵩𨸇𨵸𨸉𨶀𨸊𨶏𨸋𨶲𨸌𨶮𨸎𨷲𨸘𨽏𨸟䧢𩏼䪏𩏽𩏪𩏾𩎢𩏿䪘𩐀䪗𩓋顂𩖕𩓣𩖖顃𩖗䫴𩙥颰𩙦𩗀𩙧䬞𩙨𩘹𩙩𩘀𩙪颷𩙫颾𩙬𩘺𩙭𩘝𩙮䬘𩙯䬝𩙰𩙈𩟿𩚛𩠀𩚥𩠁𩚵𩠂𩛆𩠃𩛩𩠅𩟐𩠆𩜦𩠇䭀𩠈䭃𩠉𩜇𩠊𩜵𩠋𩝔𩠌餸𩠎𩞄𩠏𩞦𩠠𩠴𩡖𩡣𩧦𩡺𩧨駎𩧩𩤊𩧪䮾𩧫駚𩧬𩢡𩧭䭿𩧮𩢾𩧯驋𩧰䮝𩧱𩥉𩧲駧𩧳𩢸𩧴駩𩧵𩢴𩧶𩣏𩧸𩣫𩧺駶𩧻𩣵𩧼𩣺𩧿䮠𩨀騔𩨁䮞𩨂驄𩨃騝𩨄騪𩨅𩤸𩨆𩤙𩨇䮫𩨈騟𩨉𩤲𩨊騚𩨋𩥄𩨌𩥑𩨍𩥇𩨎龭𩨏䮳𩨐𩧆𩩈䯤𩬣𩭙𩬤𩰀𩭹鬖𩯒𩯳𩰰𩰹𩲒𩳤𩴌𩴵𩽹魥𩽺𩵩𩽻𩵹𩽼鯶𩽽𩶱𩽾鮟𩽿𩶰𩾁鯄𩾂䲖𩾃鮸𩾄𩷰𩾅𩸃𩾆𩸦𩾇鯱𩾈䱙𩾊䱬𩾋䱰𩾌鱇𩾎𩽇𪉂䲰𪉃鳼𪉄𩿪𪉅𪀦𪉆鴲𪉈鴜𪉉𪁈𪉊鷨𪉋𪀾𪉌𪁖𪉍鵚𪉎𪂆𪉏𪃏𪉐𪃍𪉑鷔𪉒𪄕𪉔𪄆𪉕𪇳𪎈䴬𪎉麲𪎊麨𪎋䴴𪎌麳𪑅䵳𪔭𪔵𪚏𪘀𪚐𪘯𪜎𠿕𪞝凙𪟎㔋𪟝勣𪠀𧷎𪠟㓄𪠡𠬙𪠳唓𪠵㖮𪠸嚛𪠺𠽃𪠽噹𪡀嘺𪡃嘪𪡋噞𪡏嗹𪡛㗿𪡞嘳𪡺𡃄𪢌㘓𪢐𡃤𪢒𡂡𪢕嚽𪢖𡅯𪢠囒𪢮圞𪢸墲𪣆埬𪣒堚𪣻塿𪤄𡓁𪤚壣𪥠𧹈𪥫孇𪥰嬣𪥿嬻𪧀孾𪧘寠𪨊㞞𪨗屩𪨧崙𪨩𡸗𪨶輋𪨷巗𪨹𡹬𪩇㟺𪩎巊𪩘巘𪩛𡿖𪩷幝𪩸幩𪪏廬𪪑㢗𪪞廧𪪴𢍰𪪼彃𪫌徿𪫡𢤩𪫷㦞𪫺憸𪬚𢣐𪬯𢤿𪭝𢯷𪭢摐𪭧擟𪭯𢶒𪭵掚𪭾撊𪮃㨻𪮋㩋𪮖撧𪮳𢺳𪮶攋𪯋㪎𪰶曊𪱥膹𪱷梖𪲎櫅𪲔欐𪲛檵𪲮櫠𪳍欇𪳗𣜬𪴙欑𪵑毊𪵣霼𪵱濿𪶄溡𪶒𤄷𪶮𣽏𪷍㵾𪷽灒𪸕熂𪸩煇𪹀𤑹𪹠𤓌𪹳爥𪹹𤒻𪺣𤘀𪺪𤜆𪺭犞𪺷獊𪺸𤠮𪺻㺜𪺽猌𪻐瑽𪻨瓄𪻲瑻𪻺璝𪼋㻶𪼴𤬅𪽈畼𪽝𤳷𪽪痮𪽭𤷃𪽮㿖𪽴𤺔𪽷瘱𪾔盨𪾢睍𪾣眝𪾦矑𪾸矉𪿊𥏝𪿞𥖲𪿫礮𪿵𥗇𫀌𥜰𫀓𥜐𫀨䅐𫀬䅳𫀮𥢷𫁂䆉𫁟竱𫁡鴗𫁱𥶽𫁲䉑𫁳𥯤𫁷䉶𫁺𥴼𫂃簢𫂆簂𫂈䉬𫂖𥴨𫂿𥻦𫃗𩏷𫄙糺𫄚䊺𫄛紟𫄜䋃𫄝𥾯𫄞䋔𫄟絁𫄠絙𫄡絧𫄢絥𫄣繷𫄤繨𫄥纚𫄦𦀖𫄧綖𫄨絺𫄩䋦𫄪𦅇𫄫綟𫄬緤𫄭緮𫄮䋼𫄯𦃩𫄰縍𫄱繬𫄲縸𫄳縰𫄴繂𫄵𦅈𫄶繈𫄷繶𫄸纁𫄹纗𫅅䍤𫅗羵𫅥𦒀𫅭䎙𫅼𦔖𫆏聻𫆝𦟼𫆫𦡝𫇘𦧺𫇛艣𫇪𦱌𫇭蒍𫇴蒭𫇽蕽𫈉蕳𫈎葝𫈟蔯𫈵蕝𫉁薆𫉄藷𫊪䗅𫊮蠦𫊸蟜𫊹𧒯𫊻蟳𫋇蟂𫋌蟘𫋲䙔𫋷襗𫋹襓𫋻襘𫌀襀𫌇襵𫌋𧞫𫌨覼𫌪覛𫌫𧡴𫌬𧢄𫌭覹𫌯䚩𫍐𧭹𫍙訑𫍚訞𫍛訜𫍜詓𫍝諫𫍞𧦝𫍟𧦧𫍠䛄𫍡詑𫍢譊𫍣詷𫍤譑𫍥誂𫍦譨𫍧誺𫍨誫𫍩諣𫍪誋𫍫䛳𫍬誷𫍭𧩕𫍮誳𫍯諴𫍰諰𫍱諯𫍲謏𫍳諥𫍴謱𫍵謸𫍶𧩼𫍷謉𫍸謆𫍹謯𫍺𧫝𫍻譆𫍼𧬤𫍽譞𫍾𧭈𫍿譾𫎆豵𫎌貗𫎦贚𫎧䝭𫎨𧸘𫎩賝𫎪䞋𫎫贉𫎬贑𫎭䞓𫎱䟐𫎳䟆𫎸𧽯𫎺䟃𫏃䠆𫏆蹳𫏋蹻𫏌𨂐𫏐蹔𫏑𨇽𫏕𨆪𫏞𨇰𫏨𨇤𫐄軏𫐅軕𫐆轣𫐇軜𫐈軷𫐉軨𫐊軬𫐋𨎌𫐌軿𫐍𨌈𫐎輢𫐏輖𫐐輗𫐑輨𫐒輷𫐓輮𫐔𨍰𫐕轊𫐖轇𫐗轐𫐘轗𫐙轠𫐷遱𫑘鄟𫑡鄳𫑷醶𫓥釟𫓦釨𫓧鈇𫓨鈛𫓩鏦𫓪鈆𫓫𨥟𫓬鉔𫓭鉠𫓮𨪕𫓯銈𫓰銊𫓱鐈𫓲銁𫓳𨰋𫓴鉾𫓵鋠𫓶鋗𫓷𫒡𫓸錽𫓹錤𫓺鐪𫓻錜𫓼𨨛𫓽錝𫓾錥𫓿𨨢𫔀鍊𫔁鐼𫔂鍉𫔃𨰲𫔄鍒𫔅鎍𫔆䥯𫔇鎞𫔈鎙𫔉𨰃𫔊鏥𫔋䥗𫔌鏾𫔍鐇𫔎鐍𫔏𨬖𫔐𨭸𫔑𨭖𫔒𨮳𫔓𨯟𫔔鑴𫔕𨰥𫔖𨲳𫔭開𫔮閒𫔯閗𫔰閞𫔲𨴹𫔴閵𫔵䦯𫔶闑𫔽𨼳𫕚𩀨𫕥霣𫕨𩅙𫖃靧𫖅䪊𫖇鞾𫖑𩎖𫖒韠𫖓𩏂𫖔韛𫖕韝𫖖𩏠𫖪𩑔𫖫䪴𫖬䪾𫖭𩒎𫖮顗𫖯頫𫖰䫂𫖱䫀𫖲䫟𫖳頵𫖴𩔳𫖵𩓥𫖶顅𫖷𩔑𫖸願𫖹顣𫖺䫶𫗇䫻𫗈𩗓𫗉𩗴𫗊䬓𫗋飋𫗚𩟗𫗞飦𫗟䬧𫗠餦𫗡𩚩𫗢飵𫗣飶𫗤𩛌𫗥餫𫗦餔𫗧餗𫗨𩛡𫗩饠𫗪餧𫗫餬𫗬餪𫗭餵𫗮餭𫗯餱𫗰䭔𫗱䭑𫗳𩝽𫗴饘𫗵饟𫘛馯𫘜馼𫘝駃𫘞駞𫘟駊𫘠駤𫘡駫𫘣駻𫘤騃𫘥騉𫘦騊𫘧騄𫘨騠𫘩騜𫘪騵𫘫騴𫘬騱𫘭騻𫘮䮰𫘯驓𫘰驙𫘱驨𫘽鬠𫙂𩯁𫚈鱮𫚉魟𫚊鰑𫚋鱄𫚌魦𫚍魵𫚎𩶁𫚏䱁𫚐䱀𫚑鮅𫚒鮄𫚓鮤𫚔鮰𫚕鰤𫚖鮆𫚗鮯𫚘𩻮𫚙鯆𫚚鮿𫚛鮵𫚜䲅𫚝𩸄𫚞鯬𫚟𩸡𫚠䱧𫚡鯞𫚢鰋𫚣鯾𫚤鰦𫚥鰕𫚦鰫𫚧鰽𫚨𩻗𫚩𩻬𫚪鱊𫚫鱢𫚬𩼶𫚭鱲𫛚鳽𫛛鳷𫛜鴀𫛝鴅𫛞鴃𫛟鸗𫛠𩿤𫛡鴔𫛢鸋𫛣鴥𫛤鴐𫛥鵊𫛦鴮𫛧𪀖𫛨鵧𫛩鴳𫛪鴽𫛫鶰𫛬䳜𫛭鵟𫛮䳤𫛯鶭𫛰䳢𫛱鵫𫛲鵰𫛳鵩𫛴鷤𫛵鶌𫛶鶒𫛷鶦𫛸鶗𫛹𪃧𫛺䳧𫛻𪃒𫛼䳫𫛽鷅𫛾𪆷𫜀鷐𫜁鷩𫜂𪅂𫜃鷣𫜄鷷𫜅䴋𫜊𪉸𫜑麷𫜒䴱𫜓𪌭𫜔䴽𫜕𪍠𫜙䵴𫜟𪓰𫜨䶕𫜩齧𫜪齩𫜫𫜦𫜬齰𫜭齭𫜮齴𫜯𪙏𫜰齾𫜲龓𫜳䶲𫝈㑮𫝋𠐊𫝦㛝𫝧㜐𫝨媈𫝩嬦𫝪𡟫𫝫婡𫝬嬇𫝭孆𫝮孄𫝵嶹𫞅𦠅𫞗潣𫞚澬𫞛㶆𫞝灍𫞠爧𫞡爃𫞢𤛱𫞣㹽𫞥珼𫞦璾𫞧𤩂𫞨璼𫞩璊𫞷𥢶𫟃絍𫟄綋𫟅綡𫟆緟𫟇𦆲𫟑䖅𫟕䕤𫟞訨𫟟詊𫟠譂𫟡誴𫟢䜖𫟤䡐𫟥䡩𫟦䡵𫟫𨞺𫟬𨟊𫟲釚𫟳釲𫟴鈖𫟵鈗𫟶銏𫟷鉝𫟸鉽𫟹鉷𫟺䤤𫟻銂𫟼鐽𫟽𨧰𫟾𨩰𫟿鎈𫠀䥄𫠁鑉𫠂閝𫠅韚𫠆頍𫠇𩖰𫠈䫾𫠊䮄𫠋騼𫠌𩦠𫠏𩵦𫠐魽𫠑䱸𫠒鱆𫠖𩿅𫠜齯𫢸僤𫧃𣍐𫧮𪋿𫫇噁𫬐㘔𫭟塸𫭢埨𫭼𡑍𫮃墠𫰛娙𫵷㠣𫶇嵽𫷷廞𫸩彄𬀩暐𬀪晛𬂩梜𬃊櫍𬇕澫𬇙浿𬇹漍𬉼熰𬊈燖𬊤燀𬍛瓅𬍡璗𬍤璕𬒈礐𬒗𥗽𬕂篢𬘓紃𬘘紞𬘡絪𬘩綎𬘫綄𬘬綪𬘭綝𬘯綧𬙂縯𬙊纆𬙋纕𬜬蔄𬜯䓣𬞟蘋𬟁虉𬟽蝀𬣙訏𬣞詝𬣡諓𬣳詪𬤇諲𬤊諟𬤝譓𬨂軝𬨎輶𬩽鄩𬪩醲𬬩釴𬬭錀𬬮鋹𬬱釿𬬸鉥𬬹鉮𬬻鑪𬬿鉊𬭁鉧𬭊𨧀𬭎鋐𬭚錞𬭛𨨏𬭤鍭𬭩鎓𬭬鏏𬭭鏚𬭯䥕𬭳𨭎𬭶𨭆𬭸鏻𬭼鐩𬮱闉𬮿隑𬯀隮𬯎隤𬱖頔𬱟頠𬳵駓𬳶駉𬳽駪𬳿駼𬴂騑𬴃騞𬴊驎𬶋鮈𬶍鮀𬶏鮠𬶐鮡𬶟鯻𬶠鰊𬶨鱀𬶭鰶𬶮鱚𬷕鵏𬸘鶠𬸚鸑𬸣鶱𬸦鷟𬸪鷭𬸯鷿𬹼齘𬺈齮𬺓齼𰬸繐𰰨菕𰶎譅𰾄鋂𰾭鑀𱊜𪈼" +}, +"\nReport saved with some diagnostic information missing.": "\n報告已儲存,部分診斷資訊未能收集。", +" (about {usual} on similar hardware)": "(相近配置約 {usual})", +" (copy)": "(副本)", +" (installed: ": "(已安裝 ", +" (single pass; the faster second pass needs 8 first-pass steps)": "(只採樣一遍;第二階段加速需第一階段 8 步)", +" (usually about {usual})": "(通常約 {usual})", +" + prompt": " + 提示詞準備", +" 1 other LoRA file in the folder is not in .safetensors format and is not listed.": " 資料夾中另有 1 個 LoRA 檔案不是 .safetensors 格式,未列出。", +" About {size}.": "共約 {size}。", +" Click the edit name at the top to open another edit.": "點選頂部的剪⁠輯⁠名可開啟其他剪輯。", +" Existing files are reused.": "已有檔案會繼續使用。", +" If it happens again, in Windows virtual memory settings, use a system-managed paging file on a drive with free space.": "仍然出現時,請在 Windows 虛擬記憶體設定中使用系統管理的分頁檔,並確保所在磁碟有可用空間。", +" 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.": "可在啟動器「設定 → 環境」中點一下「修復」恢復已驗證的檔案,原檔案會保留。", +" The old model stays for your fused LoRAs.": "舊模型為需要合併的 LoRA 保留。", +" You can also use Download report below and submit it in a GitHub issue; we will look into it.": "也可以點下方「下載報告」提交到 GitHub issue,我們會專門排查。", +" You can also use {levels} for now.": "也可以先用{levels}。", +" You can keep generating while it downloads.": "下載期間可以繼續生成。", +" in {count} zip files": ",分成 {count} 個壓縮檔", +" is available (current ": " 已釋出(目前 ", +" or ": "或", +" {count} other LoRA files in the folder are not in .safetensors format and are not listed.": " 資料夾中另有 {count} 個 LoRA 檔案不是 .safetensors 格式,未列出。", +" · about {size} needed": " · 需要約 {size}", +" · part {part}/{parts}": " · 第 {part}/{parts} 段", +" · {count} files packed": " · 已打包 {count} 個檔案", +" · {minutes} min": " · {minutes} 分", +" · {minutes} min {seconds} s": " · {minutes} 分 {seconds} 秒", +" · {s} s": " · {s} 秒", +" · ⁠includes first-time setup": " · 含⁠首⁠次⁠準⁠備", +"\"Click select\" needs a selection model downloaded once; the panel shows the progress.": "「點選」需要先下載一次選區模型,面板會顯示進度。", +"\"Edit this\" changes the current image and does not show the shape list.": "「改這張」修改目前圖片,不顯示比例清單。", +"\"Generate with AI\" and \"Click select\" appear only when image generation is available.": "「AI 生成」和「點選」需要圖片生成功能可用時才顯示。", +"\"High\" takes longer. If memory runs short, choose \"Retry at Standard\" on the error card.": "「精細」耗時更長;顯示卡記憶體不足時,錯誤卡片上可點一下「改用標準並重試」。", +"\"Use as is\" is not available here": "這裡還不能用「原樣使用」", +"\"Use as is\" is not available here yet. Set the audio to \"Reference\".": "這裡還不能用「原樣使用」的音訊,請改選「參考」。", +"\"Use as is\" is not available here.": "這裡不能「原樣使用」。", +"\"Use as is\" is not available on this computer yet.": "這台電腦上還不能用「原樣使用」。", +"\"Use as is\" is not available while extending a video. Remove \"Extends this video\" first.": "接在影片之後時不能「原樣使用」,請先移除「接在這段影片後面」。", +"\"{media}\" could not be found. Upload or select it again, then generate.": "素材「{media}」已不存在,請重新上傳或選擇後再生成。", +"\"{name}\" can't hold FreeVideo. Choose another disk.": "「{name}」 不能安裝 FreeVideo,請換一塊硬碟。", +"\"{name}\" can't store files over 4 GB. Choose another disk.": "「{name}」 不能存放 4 GB 以上的檔案,請換一塊硬碟。", +"\"{name}\" has {free} available; this installation needs about {need}.": "「{name}」可用 {free},這次安裝需要約 {need}。", +"\"{name}\" is not connected. Connect it to continue.": "「{name}」沒有連線,請接上這塊硬碟。", +"\"{name}\" is read-only. Choose another disk.": "「{name}」 不能寫入,請換一塊硬碟。", +"%s (%s): %s": "%s(%s):%s", +"%s freed. ": "已釋放 %s,", +"%s of models were copied from another disk. Keep your model library on the same disk as FreeVideo to avoid this.": "有 %s 的模型是從另一塊硬碟複製來的。把模型庫和 FreeVideo 放在同一塊硬碟上,就不會多佔這部分空間。", +"([\\d.]+ GiB) released": "已釋放 \\1", +"([\\d.]+ MiB) downloaded": "已下載 \\1", +"([\\d.]+ MiB) retained": "已保留 \\1", +"(\\d+ / \\d+) files": "\\1 個檔案", +"(\\d+) files / folders scanned": "正在尋找檔案", +"(references are cut to the generated length, up to 15 s)": "(參考素材只取與生成影片等長的部分,最長 15 秒)", +"). Download it and replace this version; models and settings are kept.": ")。下載新版後替換目前版本,模型和設定會保留。", +"). Updating keeps your models and settings. FreeVideo restarts after the download; running videos finish first.": ")。更新會保留模型和設定,下載完成後自動重新啟動;正在生成的影片會先完成。", +"). Updating takes about a minute, restarts FreeVideo once and keeps your models and settings.": ")。更新約需 1 分鐘,會重新啟動一次 FreeVideo,模型和設定都會保留。", +"). Updating takes about a minute, then FreeVideo starts; models and settings are kept.": ")。更新約需 1 分鐘,完成後自動啟動,模型和設定都會保留。", +"+ Audio track": "+ 音軌", +"+{seconds} s": "+{seconds} 秒", +", extends the clip before": ",接續上一段", +", or ": ",或 ", +", separate shot": ",獨立鏡頭", +", such as D:\\FreeVideo,": ",例如 D:\\FreeVideo", +", then removes the old model and frees about {size}.": ",完成後刪除舊模型,釋放約 {size}。", +", {left} could not be read": ",其中 {left} 個無法讀取", +". The model in use, your videos and settings are not touched.␟。正在使用的模型、视频和设置都不受影响。": "。正在使用的模型、影片和設定都不受影響。", +". The model in use, your videos and settings are not touched.␟。现在用的模型、视频和设置都不受影响。": "。現在用的模型、影片和設定都不受影響。", +". Try again.": "。請重試。", +"0.5.0: A fully upgraded sound system": "0.5.0 聲音系統全面升級", +"0.6.0: A new interface": "0.6.0 全新介面", +"0.98 MP · Recommended": "0.98 MP · 推薦", +"1 box": "1 個框", +"1 conversation could not be read": "另有 1 個對話無法讀取", +"1 creation": "1 個作品", +"1 creation could not be read": "另有 1 個作品無法讀取", +"1 edit could not be read": "另有 1 個剪輯無法讀取", +"1 file needs repair": "有 1 個檔案需要修復", +"1 folder has other files, kept.": "1 個資料夾裡有別的檔案,已保留。", +"1 image": "1 張圖", +"1 imported file": "1 個匯入素材", +"1 imported file could not be read": "另有 1 個匯入的檔案無法讀取", +"1 item could not be read": "另有 1 項無法讀取", +"1 job could not be read": "另有 1 個任務無法讀取", +"1 line could not be dubbed. Redub it.": "有 1 句無法配音,請重新配音。", +"1 music track": "1 段配樂", +"1 other LoRA file in the folder is not in .safetensors format and not listed.": "資料夾中另有 1 個 LoRA 檔案不是 .safetensors 格式,未列出。", +"1 sound effect": "1 段音效", +"1 stem set": "1 組分軌", +"1 step": "1 步", +"1 voiceover": "1 段配音", +"1. Download your packages": "1. 下載離線安裝包", +"2. Import when downloaded": "2. 下載完成後匯入", +"4K": "提高解析度", +"; the models and videos in the current folder are not deleted.": ";原資料夾裡的模型和作品不會被刪除。", +"; the old model stays so your LoRAs keep working, and no space is freed.": ";為了繼續使用已有的 LoRA,舊模型會保留,空間不會釋放。", +"@Image{n}": "@圖{n}", +"@Leo walks along the shore.": "@小林 走在海邊。", +"A Repair button appears here when the current task ends. Click it.": "目前任務結束後,這裡會出現「修復」按鈕,請點它。", +"A [length]-second product film: [product] on [background], the camera circles once.": "做一條【時長】秒的產品短片:【產品】放在【背景】上,鏡頭環繞一週。", +"A [length]-second short: [start], then [turn], and finally [end].": "做一條【時長】秒的短片:【開頭】,然後【轉折】,最後【結尾】。", +"A browser extension interfered with this page, so this action did not finish.": "瀏覽器裡的某個擴充功能干擾了頁面,這次操作沒有完成。", +"A browser extension is interfering with FreeVideo": "瀏覽器擴充功能干擾了 FreeVideo", +"A browser extension is interfering with FreeVideo. See the details on the picture.": "瀏覽器擴充功能干擾了 FreeVideo,詳見畫面上的說明。", +"A character may look slightly different between runs.": "角色的外觀可能每次略有不同。", +"A clip in this action is on a locked track": "這次操作涉及的片段在已鎖定的軌道上", +"A clip in this action is still generating": "這次操作涉及的片段還在生成", +"A clip on Audio 2 is generating; wait for it to finish": "聲音 2 上有片段在生成,等它完成", +"A clip's source file is missing, or cannot be read over the part the clip uses": "有片段的原始檔缺失,或在片段使用的範圍內無法讀取", +"A component needed to run FreeVideo could not load.": "FreeVideo 所需的執行元件未能載入。", +"A cyclist races down a mountain trail, the camera follows low and close, dust kicks up, fast breathing and tyres on gravel.": "自行車手沿山路飛馳而下,鏡頭低角度緊跟,揚起塵土,急促的呼吸聲和輪胎碾過碎石的聲音。", +"A dark castle emerges from the mist as the camera slowly moves closer.": "深色城堡從薄霧中顯現,鏡頭緩緩推近。", +"A deleted creation can be brought back from \"Recently deleted\" on the left within 10 seconds.": "刪除的作品在 10 秒內可在左側「最近刪除」中恢復。", +"A faster model is available for your GPU": "有適合這張顯示卡的更快模型", +"A faster model is available: about {size} to download, about {freed} freed afterwards.": "有更快的模型:下載約 {size},完成後刪除舊模型,釋放約 {freed}。", +"A faster model is available: about {size} to download.": "有更快的模型:下載約 {size}。", +"A file is in use by another program": "檔案被其他程式佔用", +"A file or folder FreeVideo needs is missing.": "缺少 FreeVideo 需要的檔案或資料夾。", +"A file with different contents is kept under a new name in its folder; delete it once it is no longer needed.": "內容不同的檔案改名保留在原資料夾,確認不再需要後可以自行刪除。", +"A file with this name already exists. Choose another name.": "已有同名檔案,請換一個檔名。", +"A first-pass preview: finish it first": "這是第一階段預覽,先繼續第二階段", +"A fox walks through a forest.": "狐狸走過森林。", +"A fox walks through a sunlit forest.": "一隻狐狸走過灑滿陽光的森林。", +"A fox walks through snow.": "狐狸走過雪地。", +"A ginger cat crouches on a living room floor, gathers itself and leaps up a staggered wooden bookshelf, jumping from one shelf to the next between rows of books, and finally settles on the top shelf, while the camera pans sideways and tilts up slightly to follow. Warm indoor daylight, realistic fur and wood, soft shadows, smooth camera motion. Soft room tone and the light thud of paws on wood.": "一隻橘貓在客廳地板上蹲下蓄力,跳上錯落的木書架,在成排的書之間一層一層往上跳,最後穩穩落在最高一層,鏡頭向側面平移並略微上搖跟隨。溫暖的室內日光,寫實的毛髮和木紋,柔和的陰影,鏡頭平滑。安靜的室內環境聲,爪子落在木頭上的輕響。", +"A girl runs along the beach at sunset and waves at the camera.": "一個女孩在日落的海邊奔跑,並向鏡頭揮手。", +"A golden puppy runs across a sunny green meadow toward the camera, ears flopping, soft daylight.": "一隻金毛小狗在陽光明媚的綠色草地上朝鏡頭跑來,耳朵晃動,柔和的日光。", +"A hiker crosses a mountain ridge at dawn. The camera follows from behind, then rises to show the valley below.": "清晨,一名徒步者走過山脊,鏡頭在身後跟隨,隨後升起,展現腳下的山谷。", +"A larger size and a longer length take more time and memory.": "尺寸越大、時長越長,耗時越長、顯示卡記憶體用量越多。", +"A layout box cannot be used. Draw it larger or change its words, then generate again.": "有一個佈局框用不了。請把它畫大一些或改一下文字,再生成。", +"A layout takes at most 8 boxes. Delete one, then generate again.": "佈局最多 8 個框。請刪掉一個,再生成。", +"A link in the image model folder leads to a place that does not exist, for example a drive that is not connected; connect that drive or folder, or delete the link and download the model again.": "圖片模型資料夾裡有連結指向不存在的位置(例如沒接上的硬碟);請接上它指向的磁碟或資料夾,或刪掉這個連結後重新下載模型。", +"A little slower, steadier": "稍慢,更穩", +"A longer duration is made in parts; extend part by part in Edit, or let Autopilot film it.": "填更長的時長會自動分段;也可以到剪輯檢視逐段接續,或交給 AI 全自動拍完。", +"A longer video is made in parts of up to this length": "更長的影片按這個長度分段生成", +"A loop is running. Stop it to start again.": "正在循環生成,停止後可重新開始", +"A loop stops when the page is closed.": "循環在關閉網頁後停止。", +"A media file is missing": "找不到素材", +"A merged or imported video can only be upscaled to the largest size.": "合併或匯入的影片只能放大到最大尺寸。", +"A mirror of the international source": "國際來源的鏡像站", +"A model file differs from the tested version and was left unchanged. Extract the package again into a new folder and start FreeVideo from there.": "一個模型檔案與測試過的版本不同,這次沒有修改它。請把整合包重新解壓到新資料夾,再從那裡啟動 FreeVideo。", +"A model file differs from the tested version and was left unchanged. Select \"Repair\" in the launcher under Settings > Environment and confirm.": "一個模型檔案與測試過的版本不同,這次沒有修改它。請在啟動器「設定 → 環境」中點選「修復」並確認。", +"A model file in the image model folder is a link to a file that is damaged or a different version; delete the link so FreeVideo can download the file again, or point the link to the right file.": "圖片模型資料夾裡有模型檔案是連結,它指向的檔案已損壞或版本不對;請刪掉這個連結讓 FreeVideo 重新下載,或把連結改指向正確的檔案。", +"A new chat is being made": "正在新增對話", +"A new image on a canvas that has images": "在已有圖片的畫布上生成新圖", +"A newer message was sent first. This one was not sent.": "已有更新的訊息,此⁠條⁠未⁠傳⁠送⁠。", +"A part followed by another part must be at least {followSeconds} seconds.": "後面還接著其他段時,這一段至少 {followSeconds} 秒。", +"A part followed by another part must be at least {least} seconds. Make it longer.": "後面還接著其他段時,這一段至少 {least} 秒,請加長這一段。", +"A part here is generating": "這裡有一段正在生成", +"A password is not copied": "密碼不能複製", +"A placed line can be undone, or changed with \"Redub\" under \"Lines\".": "放入後可以復原,也可在「台⁠詞」中點一下「重⁠新⁠配⁠音」改寫。", +"A preview is quicker, but the models still have to load.": "預覽生成較快,但仍需載入模型。", +"A program file is missing": "缺少一個程式檔案", +"A puppy runs across the grass.": "一隻小狗跑過草地。", +"A quiet Chinese poster: tea hills in morning mist, with the brushed title “Tea in the Hills” down the right side": "一張清雅的中式海報:晨霧中的層層茶山,右側豎排毛筆大字「山間茶事」", +"A ready scene takes words only": "現成場景只接受文字", +"A red fox in fresh snow turns its head toward the camera, breath visible in the cold air, soft morning light, snow crunching.": "雪地裡的紅狐狸轉頭看向鏡頭,冷空氣中呼出白氣,清晨柔光,踩雪的咯吱聲。", +"A reference video is trimmed to the length of the result, up to 15 seconds, and generation takes about twice as long as with images only.": "參考影片只取與成片等長的一段,最長 15 秒;生成耗時約為只用圖片時的兩倍。", +"A request uses either Replace person or first and last frames.": "替換人物與首影格、尾影格請選其一使用。", +"A request uses up to 1 scene and 2 props, which do not count toward the 3 characters.": "一次請求最多使用 1 個場景和 2 個道具,不佔角色的 3 個名額。", +"A request uses up to 3 characters.": "一次請求最多使用 3 個角色。", +"A required component is missing": "缺少必需的元件", +"A required model is not installed yet": "需要的模型還沒有安裝好", +"A reshoot counts as long from": "耗時較長的標準", +"A runtime component could not load": "執行元件無法載入", +"A saved image as the first frame": "選一張作品作首影格", +"A saved image as the last frame": "選一張作品作尾影格", +"A separation is already running": "已有一段正在分離", +"A slow push-in on a glass perfume bottle on wet black stone, soft rim light, droplets catch the light, a low ambient hum.": "鏡頭緩慢推近溼潤黑石上的玻璃香水瓶,柔和的輪廓光,水珠閃著光,低沉的環境聲。", +"A small orange cat walks along a sunlit windowsill and looks out at the rain.": "一隻橘色小貓沿著灑滿陽光的窗台慢慢走過,望向窗外的雨。", +"A small platform at dawn. Lin hurries in with a bag; Jay stands by the bench.\n0:01 Jay: You're late.\n0:02 Lin: The train was delayed.\n0:04 Cut: The two walk side by side to the train, tracking from the side.": "清晨的小站台,小林提著包快步走來,阿杰站在長椅旁。\n0:01 阿杰:你遲到了。\n0:02 小林:車晚點了。\n0:04 切:兩人並肩走向列車,側面跟拍", +"A sound is already being separated.": "正在分離另一段聲音。", +"A source file cannot be read. Import it again from the library.": "有素材讀不出來,請在素材庫重新匯入。", +"A source file is missing. Import it again from the library.": "有素材的原檔案找不到了,請在素材庫重新匯入。", +"A task this one depends on did not finish": "前面依賴的任務沒有完成", +"A token is set for this session. Clearing it falls back to credentials already on this computer.": "已設定本次權杖;清除後仍可使用本機已有的認證資訊。", +"A transfer failed or its received data did not match the expected file.": "傳輸中斷,或收到的資料與預期檔案不一致。", +"A video goes after the last picture, a sound at the playhead": "影片接在最後,聲音放在播放頭處", +"A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the menu bar icon.": "正在生成影片。結束會停止 FreeVideo 和這次生成;在背景執行時生成會繼續,可從選單列圖示重新開啟此視窗。", +"A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the taskbar.": "正在生成影片。結束會停止 FreeVideo 和這次生成;在背景執行時生成會繼續,可從工作列重新開啟此視窗。", +"A video is being generated. Exit stops FreeVideo and this generation. In the background, the generation continues, and this window can be reopened from the tray icon.": "正在生成影片。結束會停止 FreeVideo 和這次生成;在背景執行時生成會繼續,可從系統匣圖示重新開啟此視窗。", +"A video is being made. Try the example when it finishes.": "正在生成,完成後再試範例", +"A video is generating. Try again when it finishes.": "影片正在生成,完成後再試。", +"A video is still generating": "還有影片正在生成", +"A video is still generating. FreeVideo restarts and updates as soon as it finishes.": "還有影片正在生成,完成後會自動重新啟動並更新。", +"A video is still generating. Setup will continue when it has finished.": "還有影片正在生成,完成後將自動繼續", +"A video is using the graphics card; try again when it finishes.": "影片正在使用顯示卡,完成後再試。", +"A video of 30 seconds or longer is made in parts, and middle frames apply to the first part only.": "30 秒(含)以上的影片分段生成,中間影格只用於第一段。", +"A video that kept no prompt does not offer \"Reuse settings\".": "沒有儲存描述的影片不提供「沿用設定」。", +"A white stone castle rises above the mist as the camera slowly moves closer in daylight.": "白石城堡聳立在薄霧之上,日光下鏡頭緩緩推近。", +"A whitebox sets the motion and camera; the video comes out real.": "用白模定動作和鏡頭,生成寫實影片。", +"AI assistant": "AI 助手", +"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 image": "圖片資訊", +"About {decodeMinutes} min left": "還需約 {decodeMinutes} 分鐘", +"About {hours} h": "約 {hours} 小時", +"About {minutes} min": "約 {minutes} 分鐘", +"About {minutes} min left␟还要约 {minutes} 分钟": "還要約 {minutes} 分鐘", +"About {minutes} min left␟还需约 {minutes} 分钟": "還需約 {minutes} 分鐘", +"About {minutes} minutes": "約 {minutes} 分鐘", +"About {minutes} min left": "預計還需約 {minutes} 分鐘", +"About {n} s": "約 {n} 秒", +"About {size}": "約 {size}", +"About {size} can be freed. Models, environments and videos are kept.": "約 {size} 可清理,保留模型、執行環境和影片。", +"About {size} will be freed. Future repairs may need to download these installation files again.": "將釋放約 {size}。以後修復環境時,可能需要重新下載這些安裝檔案。", +"About {total} GiB": "約 {total} GiB", +"Above this computer's limit": "超出本機上限", +"Accept the included licenses to continue.": "請先同意隨附的授權條款。", +"Accept the installation plan and licenses.": "請先同意安裝計畫及授權條款。", +"Accept the reviewed installation plan to continue.": "請先同意本次安裝計畫及授權條款。", +"Access denied": "存取遭拒", +"Access denied, possibly by security software": "存取被拒,可能被安全軟體攔截", +"Access token": "存取權杖", +"Access was denied": "存取遭拒", +"Action follow": "動作跟拍", +"Actions": "操作", +"Active": "進行中", +"Activity will appear here after startup.": "啟動後將在這裡顯示執行記錄。", +"Add 1 video": "新增 1 個影片", +"Add LoRA": "新增 LoRA", +"Add LoRAs in the create panel. FreeVideo models are already accelerated, so no speed LoRA is needed.": "在創作面板裡新增 LoRA。FreeVideo 的模型已經加速,不需要加速 LoRA。", +"Add a character, scene or prop from images": "用圖片新增角色、場景或道具", +"Add a clothes image": "新增服裝圖", +"Add a clothes image first": "先新增服裝圖", +"Add a downloaded LoRA file in the creation panel to change the style of the picture.": "把下載好的 LoRA 檔案加進創作面板,改變畫面風格。", +"Add a female mannequin": "新增女性人偶", +"Add a front image first": "先新增正面圖片", +"Add a male mannequin": "新增男性人偶", +"Add a person image first.": "請先新增人物圖。", +"Add a photo": "新增照片", +"Add a photo first": "先新增照片", +"Add a reference image": "新增參考圖", +"Add a reference image first": "先新增參考圖", +"Add a saved video or image": "加入作品庫裡的影片或圖片", +"Add a source image, or put in the front or face close-up.": "請新增來源圖片,或放入正面或臉部特寫。", +"Add a source video and a person image first.": "請先新增來源影片和人物圖。", +"Add a source video first.": "請先新增來源影片。", +"Add a spoken line": "為一句話新增旁白", +"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 a subtitle; Auto subtitles is in the timeline menu": "新增一條字幕;自動字幕在時間軸右鍵選單裡", +"Add a title or words on the picture": "在畫面上加標題或文字", +"Add a voice, music or rhythm reference (its first 15 seconds at most are used)": "新增音色、音樂或節奏參考(最多使用前 15 秒)", +"Add an image": "新增圖片", +"Add an image first␟先添加一张图片": "先新增一張圖片", +"Add an image first␟先添加图片": "先新增圖片", +"Add an image in Media first": "先在素材裡新增圖片", +"Add an image in Media to follow its aspect ratio.": "請先在素材中新增圖片,再跟隨輸入比例。", +"Add audio track": "新增音軌", +"Add folder": "新增資料夾", +"Add folders to find matching models in their subfolders.": "新增資料夾,自動找出子資料夾中相符的模型。", +"Add from creations, the library or this computer; or drop or paste": "從作品、素材庫或電腦新增;也可拖入或貼上", +"Add image": "新增圖片", +"Add image layer": "新增圖片圖層", +"Add images": "新增圖片", +"Add images here and set each one as a reference, first frame, or last frame.": "在此新增圖片,每張可設為參⁠考、首⁠影⁠格或尾⁠影⁠格。", +"Add images under \"Media\" in the creation panel and set each one as a reference, first frame, or last frame.": "在創作面板的「素材」中新增圖片,每張可設為參考、首影格或尾影格。", +"Add images, video or audio": "新增圖片、影片或音訊", +"Add it to the reference images": "加入參考圖", +"Add it to the references of this edit": "加到這次修改的參考圖裡", +"Add marker": "新增標記", +"Add mask": "新增遮罩", +"Add media": "新增素材", +"Add model": "新增模型", +"Add music": "加配樂", +"Add music: generated to fit the selected length": "新增配樂:按選中的長度生成", +"Add or remove a part from selection": "新增或移出選擇", +"Add or remove tags on the selection": "給選中的作品加上或去掉標籤", +"Add or replace images in the face close-up, front, side and back slots; when all four are filled, choose \"Save\".": "在臉部特寫、正面、側面、背面四格中新增或替換圖片,四張齊了再點一下「儲⁠存」。", +"Add reference": "新增參考圖", +"Add reference images in the Images view and say what each one is for as \"Image 1\", \"Image 2\" in the prompt.": "在圖片檢視中加入參考圖,在描述裡用「圖 1」「圖 2」寫明每張圖的用途。", +"Add reference images when extending in Edit": "在剪輯檢視延長時加參考圖", +"Add reference images, video and sound": "加參考圖、影片和聲音", +"Add reference media to use @": "新增參考素材後可使用 @", +"Add settings": "補上設定", +"Add settings to earlier videos": "為之前的影片補上生成設定", +"Add sound to a video": "給影片加聲音", +"Add sound track": "新增音軌", +"Add text": "新增文字", +"Add text and subtitles": "加文字和字幕", +"Add the first image under \"Person image 1\". \"Person image 2\" appears next to it; add the second image there.": "在「人物圖 1」中新增第一張人物圖;右邊會出現「人物圖 2」,再新增第二張。", +"Add the selected creations to Favorites": "把選中的作品加入收藏", +"Add this page's address {address} to the extension's exclusion list or allowlist.": "把這個頁面的網址 {address} 加進擴充功能的排除清單或白名單。", +"Add to favorites": "收藏", +"Add to or remove from favorites": "收藏 / 取消收藏", +"Add to queue": "加入佇列", +"Add to the selection; Shift picks a run": "加入多選;按住 Shift 連選", +"Add to the timeline": "加入時間軸", +"Add to the tracks": "加到軌道上", +"Add up to 3 pictures between the first and last frames, each at a time you choose.": "在首影格和尾影格之間再指定最多 3 張畫面,並設定各自出現的時間。", +"Add video": "新增影片", +"Add video model": "新增影片模型", +"Add video or sound files from this computer": "從電腦加入影片或聲音檔案", +"Add videos": "新增影片", +"Add your own views. Empty views are made from one image in its style.": "放入各視角圖片,空著的視角按原圖風格生成。", +"Add {count} videos": "新增 {count} 個影片", +"Add {n} videos": "新增 {n} 個影片", +"Add · Shift": "新增 · Shift", +"Add-on models": "附加模型", +"Added to Favorites.": "已加入收藏。", +"Added to the queue. It starts when the current video finishes.": "已加入佇列,目前影片完成後自動開始。", +"Added to the queue. It starts when the previous one finishes.": "已加入佇列,前面的完成後自動開始。", +"Added to the timeline.": "已放到時間軸上。", +"Adding it to the timeline": "正在放到時間軸上", +"Adding room tone": "補環境聲", +"Adding the settings…": "正在補寫生成設定…", +"Adding the tracks": "正在放入時間軸", +"Adding to the queue. One moment.": "正在加入佇列,請稍候", +"Adding {current}/{total}…": "正在新增 {current}/{total}…", +"Adding…": "正在新增…", +"Adds a 10-bit video beside it, for color grading": "另存一份 10 位元影片,適合調色", +"Add␟加入": "加入", +"Add␟添加": "新增", +"Adjust": "調整", +"Adjust crop": "調整裁切", +"Adjust settings": "調整設定", +"Adjust the selection": "調整選中的片段", +"Adjustments": "調整分組", +"Advanced options": "進階選項", +"Advanced: access token": "進階:存取權杖", +"Advanced: installation and model folders": "進階:安裝位置與模型資料夾", +"Advanced␟高级": "進階", +"Advanced␟高级选项": "進階選項", +"Aerial landscape": "風景航拍", +"After downloading, extract ZIP files and choose the model folder below. Subfolders are scanned automatically.": "下載完成後先解壓縮 ZIP,再選擇模型所在資料夾;會自動掃描子資料夾。", +"After generation": "生成後", +"After raising it, a few smooth generations bring it back down": "提高後,連續順利完成幾次會再降回來", +"After the previous part": "接上一段", +"After the time, write \"Cut:\" and the new shot, and the shot changes at that time.": "時間後寫「切:」再寫新鏡頭的畫面,鏡頭會在這個時間切換。", +"After the time, write \"Name: line\" for a line the person says in turn, or a plain sentence for something that happens.": "時間後寫「名字:台詞」,表示這個人按順序說這句話;直接寫一句話,表示這時發生的事。", +"After the video": "接原影片", +"After your task finishes, open the new FreeVideo AppImage to update.": "目前任務完成後,開啟新版 FreeVideo AppImage 更新。", +"After your task finishes, open the new FreeVideo.app to update.": "目前任務完成後,開啟新版 FreeVideo.app 更新。", +"After your task finishes, open the new FreeVideo.exe to update.": "目前任務完成後,開啟新版 FreeVideo.exe 更新。", +"Agree": "同意", +"Align": "對齊", +"All bundled files verified": "離線安裝包校驗完成", +"All characters": "全部角色", +"All creations": "全部作品", +"All creations as a grid, to sort and select": "以網格檢視全部作品,便於整理和多選", +"All done": "全部完成", +"All quality levels": "全部品質等級", +"All tutorials": "全部教學", +"All {count} files load": "全部 {count} 個檔案都能載入", +"Allow edits on this track again": "允許修改這條軌", +"Allow empty prompt": "允許空提示詞", +"Allow restarting incomplete downloads": "允許重新下載無法續傳的檔案", +"All␟全选": "全選", +"All␟全部": "全部", +"Already added": "已加入", +"Already at the closest view": "已經放到最大", +"Already at the end": "已經在結尾", +"Already at the start": "已經在開頭", +"Already at the widest view": "已經縮到最小", +"Already here": "已有模型", +"Already installed. To reinstall, click Check installation first.": "已裝好。要重新安裝,請先點一下「檢查安裝」。", +"Already read; nothing to clear": "已經讀過,無需再標", +"Already saved": "已儲存過", +"Already separated; undo to separate again": "已經分離過了,復原後可重新分離", +"Also deletes media used only by this edit: {items}.": "同時刪除只在這個剪輯中使用的 {items}。", +"Also downloaded the first time they are used": "第一次用到時也會自動下載", +"Also running": "同時進行", +"Also save a high color depth copy": "同時儲存高色深版本", +"Also save images to the output folder": "同時將圖片儲存到 output 資料夾", +"Alt-click to set the source first.": "請先按住 Alt 點選設定取樣點。", +"Alt-click to set the source, then paint.": "先按住 Alt 點選設定取樣點,再塗抹。", +"Always download through the proxy": "一律透過代理伺服器下載", +"Ambience": "環境聲", +"Ambient": "氛圍", +"Amount to keep free": "預留數值", +"An NVIDIA graphics card or a Mac is required.": "需要 NVIDIA 顯示卡或 Mac。", +"An ad-blocking extension in this browser, such as uBlock Origin, AdGuard or Adblock Plus, blocked one of FreeVideo's page files, so the page cannot work properly.": "瀏覽器裡的廣告攔截類擴充功能(例如 uBlock Origin、AdGuard、Adblock Plus)攔下了 FreeVideo 的頁面檔案,頁面無法正常執行。", +"An aerial shot glides over misty karst peaks at sunrise, a river winds below, birds cross the frame, wind and distant water.": "日出時航拍掠過雲霧繚繞的喀斯特山峰,河流在下方蜿蜒,飛鳥掠過畫面,風聲和遠處的水聲。", +"An assistant can only be connected on the computer that runs FreeVideo.": "只能在執行 FreeVideo 的電腦上連線助手。", +"An assistant must be connected first. Until then only the connection card is shown.": "需要先連線助手,未連線時只顯示連線說明。", +"An earlier step did not succeed": "前序任務未成功", +"An error occurred while generating the image.": "生成畫面時出錯。", +"An error occurred while loading the image model.": "載入圖片模型時出錯。", +"An error occurred while producing the image.": "輸出圖片時出錯。", +"An error occurred while reading the prompt.": "讀取提示詞時出錯。", +"An error occurred while reading the reference images.": "讀取參考圖時出錯。", +"An error occurred while starting image generation.": "啟動圖片生成時出錯。", +"An error stopped changing the voice": "更換人聲時中途出錯", +"An error stopped composing the music": "生成配樂時中途出錯", +"An error stopped finishing the sound of the cut": "處理成片聲音時中途出錯", +"An error stopped recognizing the lines": "識別台詞時中途出錯", +"An error stopped separating the sound": "分離聲音時中途出錯", +"An example file is missing from this installation. Select \"Repair\" under Settings > Environment, then try again.": "範例素材不在本機安裝裡,在「設定 → 環境」裡點一下「修復」後重試", +"An existing model differs from the tested version": "已有模型與 FreeVideo 測試過的版本不同", +"An extended part is made in full": "接續會完整生成這一段", +"An extended part takes image references only": "接續段只能用圖片參考", +"An extended part uses the Light level.": "接著生成使用輕量檔。", +"An extended part uses the Medium level.": "接著生成使用標準檔。", +"An extended part uses up to 3 reference images and no first or last frames.": "接續生成最多使用 3 張參考圖,不使用首影格和尾影格。", +"An extended video keeps its size": "接著生成時沿用原影片尺寸", +"An image as the first frame": "選一張圖片作首影格", +"An image as the last frame": "選一張圖片作尾影格", +"An image named in the prompt was removed; choose it again with @": "提示詞裡引用的參考圖已移除,請用 @ 重新選擇", +"An image of the clothes to wear": "要換上的服裝圖片", +"An installation or a video is in progress. Try again when it finishes.␟有安装或生成正在进行,完成后可以再删除。": "有安裝或生成正在進行,完成後可以再刪除。", +"An installation or a video is in progress. Try again when it finishes.␟有安装或生成正在进行,请在完成后再清理。": "有安裝或生成正在進行,請在完成後再清理。", +"An interrupted download resumes; downloaded files are kept.": "下載中斷後可以接著下載,已下載的檔案不會丟。", +"An unexpected error stopped generation": "生成過程中出現了意外錯誤", +"An unexpected error stopped this task": "處理過程中出現了意外錯誤", +"An unfinished short film uses this card": "有未完成的短劇正在使用這張卡片", +"Animal portrait": "動物特寫", +"Animate this image in Create": "在創作面板裡讓它動起來", +"Anime style, a girl with long dark hair and a school uniform in a sunlit classroom raises her head slowly and turns to look back over her shoulder with a gentle smile, still camera.": "動漫風格,長髮校服少女在陽光教室裡緩緩抬頭,回頭看向鏡頭並微笑,鏡頭固定。", +"Another ComfyUI extension reported an error at the same time. Turn it off in ComfyUI Settings › Extensions, then reload.": "同時有其他 ComfyUI 外掛出錯。可在 ComfyUI「設定 › 擴充功能」裡暫時停用它,然後重新整理頁面。", +"Another download of this model is running.": "這個模型正在被另一處下載。", +"Another export is running. Try again shortly.": "已有分享影片正在匯出,請稍後再試。", +"Another image is generating. This one starts when it finishes.": "前面有 1 張在生成,完成後自動開始。", +"Another look, up to about 4 MP": "另一種畫風,最大約 4 MP", +"Another program is using a file FreeVideo needs.": "有其他程式正在使用 FreeVideo 需要的檔案。", +"Another program is using it, or this account does not have permission to delete it.": "正被其他程式使用,或目前帳戶沒有刪除權限。", +"Another program is using this port. Change the server address in Settings, then start again.": "有其他程式佔用了這個連接埠。請在設定裡換一個伺服器位址,再重新啟動。", +"Another task is using the image model package; try again when it finishes.": "圖片模型包被其他任務佔用,完成後再試。", +"Another task is using the resources this one needs": "另一項任務正在佔用所需的資源", +"Another task is using these files. Try again when it finishes.": "其他任務正在使用這些檔案,完成後可重試。", +"Another track for music or a voice": "多一條軌,放配樂或旁白", +"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.": "已切到別的檢視,範例沒有填入,回到創作面板再試", +"Answering": "回答中", +"Any": "全部", +"Any size between the two ends": "兩端之間的任意大小", +"Any time": "任何時間", +"Apache License 2.0": "Apache 授權條款 2.0", +"App": "應用", +"Appearance": "外觀", +"Appearance, language, settings": "外觀、語言和設定", +"Applies at once to every view": "立即套用到所有檢視", +"Applies at once to the preview on screen, also on the phone page.": "立即套用到螢幕上的預覽,手機頁面也一樣。", +"Applies from the next generation. Higher levels have the GPU handle less at a time, so generation is slower and the picture differs slightly; resolution, duration and steps stay the same.": "從下一次生成起生效。等級越高,顯示卡每次處理的資料越少,生成越慢,畫面也會有細微差別;解析度、時長和步數不變。", +"Applies to the next generation; higher levels are slower and may slightly change the picture.": "從下次生成起生效,等級越高越慢,畫面可能略有變化。", +"Apply": "應用", +"Apply preset": "應用預設", +"Apply this crop": "應用這次裁切", +"Approved␟已同意": "已同意", +"Approved␟已确认": "已確認", +"Arrange clips on the timeline and adjust picture, sound and speed.": "在時間軸上排列片段,調整畫面、聲音和速度。", +"Arrow": "箭頭", +"As described": "按描述", +"As the top bar narrows, it first keeps only the video memory figure, then only the icon; choosing the icon still opens the panel.": "頂欄變窄時先只留顯示卡記憶體數字,再只留圖示;點圖示仍能開啟面板。", +"Ask before": "先詢問", +"Ask before a long reshoot by the assistant": "助手重拍耗時較長時先詢問", +"Ask before the assistant starts a film": "助手開拍整部片前先詢問", +"Ask for the connection steps again": "重新取得連線說明", +"Ask for this action again when needed": "需要時重新提出這項操作", +"Ask phones for a password first": "手機存取前需要輸入密碼", +"Ask the assistant to continue in its own window": "請在助手的視窗裡讓它繼續", +"Asking the engine": "正在詢問引擎", +"Assemble downloaded parts": "合併已下載檔案", +"Assembling": "拼接中", +"Assembling ": "正在合併", +"Assembling {name}": "正在合併{gap}{name}", +"Assistant": "助手", +"Assistant activity": "助手動態", +"Assistant connected": "助手已連線", +"Assistant connection": "助手連線", +"Assistant task": "助手任務", +"Assistant tasks␟助手任务": "助手任務", +"Assistant tasks␟助手的任务": "助手的任務", +"At": "時間", +"At least {least} s␟最短 {least} 秒": "最短 {least} 秒", +"At least {least} s␟至少 {least} 秒": "至少 {least} 秒", +"At least {n}": "最少 {n}", +"At least {seconds} s": "至少 {seconds} 秒", +"At least {value}": "最少 {value}", +"At most 100 lines at a time; there are {count}.": "一次最多 100 行,現在有 {count} 行。", +"At most {most} s": "最長 {most} 秒", +"At most {most}, {skipped} more were not added.": "最多 {most} 張,多出的 {skipped} 張沒有加入。", +"At most {n}": "最多 {n}", +"At most {seconds} s": "最多 {seconds} 秒", +"At most {value}": "最多 {value}", +"Attach a screenshot of this page": "附上這一頁的截圖", +"Attach pasted images": "貼上圖片作為附件", +"Attached images": "已新增的圖片", +"Audio 1": "聲音 1", +"Audio 2": "聲音 2", +"Audio and video cache": "影音快取", +"Audio length: {seconds} s; uses up to the first 15 s within the video length.": "音訊長 {seconds} 秒,最多取前 15 秒且不超過影片時長。", +"Audio longer than 30 seconds used as is is made in parts, which needs \"Faster second pass\". Turn it on or set the audio to \"Reference\".": "超過 30 秒的音訊選「原樣使用」時會分段生成,需要「第二階段加速」。請開啟「第二階段加速」,或把音訊改選「參考」。", +"Audio only": "只聲音", +"Audio track": "音軌", +"Audio use": "音訊用途", +"Audio {number}": "聲音 {number}", +"Audio␟声音": "聲音", +"Audio␟音频": "音訊", +"Auto": "自動", +"Auto (recommended)": "自動(推薦)", +"Auto parts": "自動分段", +"Auto subtitles": "自動字幕", +"Auto subtitles (downloads {size} MB first)": "自動字幕(先下載 {size} MB)", +"Auto subtitles work on up to 2 hours of sound.": "自動字幕最多處理 2 小時的聲音。", +"Auto subtitles · Download {size} MB": "自動字幕 · 下載 {size} MB", +"Automatic download": "自動下載", +"Automatic optimization": "自動最佳化", +"Automatic␟自动安装": "自動安裝", +"Automatic␟自动选择": "自動選擇", +"Autopilot": "AI 全自動", +"Available after generation finishes": "生成完成後可改", +"Available after hardware setup.": "完成硬體檢查後可調整。", +"Available after this part is generated": "這一段生成後才能調整", +"Available sizes and lengths": "可生成範圍", +"Available system RAM is low": "系統可用記憶體不足", +"Available update": "可用更新", +"Available when nothing is being generated.": "沒有正在生成的任務時可用。", +"BGM": "音樂", +"BSD 3-Clause License": "BSD 3-Clause 授權條款", +"Back / forward 10 frames": "後退 / 前進 10 影格", +"Back / forward ten frames": "後退 / 前進 10 影格", +"Back to Settings; the plan stays": "回到設定,計畫保留", +"Back to all examples": "回到全部範例", +"Back to chat": "返回對話", +"Back to chats": "返回對話", +"Back to create": "返回創作", +"Back to creations": "回到作品", +"Back to edit": "返回修改", +"Back to it": "回到生成", +"Back to its generation screen": "回到它的生成畫面", +"Back to its progress": "回到生成畫面", +"Back to media": "返回素材", +"Back to one creation": "回到單個作品", +"Back to the chat": "回到對話", +"Back to the generation": "回到生成畫面", +"Back to the library": "回到作品庫", +"Back to the list": "回到列表", +"Back to the original image": "回到原圖,清除全部修改", +"Back to the panel; the text is already in it": "回到面板,變更已經在裡面", +"Back to the previous screen": "回到剛才的畫面", +"Back to the running generation": "回到進行中的生成", +"Back to the saved setting": "回到已儲存的設定", +"Back to the shelf␟回到作品列表": "回到作品列表", +"Back to the shelf␟回到角色列表": "回到角色列表", +"Back to the single video": "回到單一影片", +"Back to the view": "回到檢視", +"Back to this chapter": "回到教學這一章", +"Back to this generation": "回到這次生成的畫面", +"Back to this view's start": "回到這個檢視的開頭", +"Back to timeline": "回到時間軸", +"Back to what is added": "回到已加入的素材", +"Back to where you were": "回到開啟設定前的畫面", +"Back to {kept}": "已恢復為 {kept}", +"Back to {name}": "返回{name}", +"Background color": "背景色", +"Backing": "襯底", +"Back␟上一步": "上一步", +"Back␟背面": "背面", +"Back␟返回": "返回", +"Bag": "包", +"Balanced speed and detail": "速度和細節均衡", +"Balancing loudness": "統一響度", +"Base packages installing": "正在安裝基礎元件", +"Batch": "批次", +"Batch and loop use the seed in this panel. Disconnect the seed link in node view.": "批次和循環生成要用面板裡的種子,請在節點檢視斷開種子的連線。", +"Beat lines are hidden while they are too close together; zoom in on the timeline to see them. Other snap points nearby, such as clip edges or the playhead, take priority over beats.": "拍點線過密時不顯示,放大時間軸後出現;附近有片段邊緣、播放頭等其他貼齊點時,優先貼齊它們。", +"Bed": "床", +"Before shooting, a confirmation card appears in the chat: the size, length and estimated time at the top, and the beats of the outline in order below. With more than 8 beats only the first 7 are shown; choose \"N more\" to see the rest.": "開拍前,對話中出現確認卡片:上方是尺寸、時長和預計耗時,下方按順序列出大綱的各拍。超過 8 拍時只顯示前 7 拍,點一下「另外 N 拍」可展開。", +"Before shooting, the confirmation card lists the outline the assistant wrote. To change it, choose not to start yet and say what to change in the chat.": "開拍前,確認卡片上列出助手寫好的大綱;需要修改時先不拍,在對話中說明要改什麼。", +"Below the result, choose \"Edit\" to make it Image 1 and describe what to change, or \"Use as reference\" to add it after the other reference images.": "在結果下方點一下「編輯」,它會成為圖 1,接著描述要改的地方;點一下「用作參考圖」,它會加到參考圖的最後。", +"Biggest file first": "檔案最大", +"Black": "黑", +"Blend": "混合", +"Blend the two sounds; adds half a second": "讓兩段聲音平滑過渡,先加 0.5 秒", +"Blue": "藍", +"Blur": "模糊", +"Bold␟加粗": "加粗", +"Bold␟特粗": "特粗", +"Book": "書", +"Both at once, next to each other": "兩個並排顯示", +"Both audio tracks are full here. Move an audio clip first.": "這裡兩條音軌都滿了,請先挪開一段聲音。", +"Both videos from the same moment": "兩段影片從同一時刻播放", +"Both videos next to each other": "兩段影片左右並排", +"Bottom": "下", +"Box": "底色", +"Bring an image or character into the prompt": "在提示詞裡引用素材或角色", +"Bring back an image you just deleted": "找回剛刪除的圖片", +"Bring back deleted creations": "找回刪掉的作品", +"Bring back its prompt, size and length": "帶回這條的提示詞、尺寸和時長", +"Bring back the edit just undone": "重做剛才復原的變更", +"Bring back the subtitles you had": "恢復原來的字幕", +"Bring back what was just deleted": "恢復剛刪除的作品", +"Bring back what you undid": "重做剛才復原的變更", +"Bring the clip back": "把刪掉的內容恢復", +"Bring the deleted chat back": "找回剛刪除的對話", +"Bring the deleted creations back": "恢復剛刪除的作品", +"Bring your own videos, images or sound": "匯入自己的影片、圖片或聲音", +"Browse": "瀏覽", +"Browse every video you have made": "瀏覽你生成過的所有影片", +"Browser: ": "瀏覽器:", +"Browse…": "瀏覽…", +"Brush": "畫筆", +"Brush size": "筆刷大小", +"Build SageAttention 2": "準備顯示卡加速", +"Build a longer video shot by shot": "在剪輯檢視裡分段做長影片", +"Build: ": "建置編號:", +"Build: {version}": "建置編號:{version}", +"Bundle setup": "整合包初始化", +"By name": "按名稱", +"CUDA could not start on this GPU": "CUDA 未能在這張顯示卡上啟動", +"Cache": "快取", +"Cache limit": "快取上限", +"Calm": "舒緩", +"Camera and motion words": "運鏡與動作詞", +"Camera␟机位": "機位", +"Camera␟相机": "相機", +"Can be undone for 10 seconds": "10 秒內可以復原", +"Cancel current": "取消目前", +"Cancel export": "取消匯出", +"Cancel generation before changing this part.": "先取消生成,再改這一段。", +"Cancel selection or dragging, or close a popup": "取消選取、拖曳或關閉彈出視窗", +"Cancel this image; asks first": "取消這一張,會先確認", +"Cancel update": "取消更新", +"Cancel {size} · {seconds} s": "取消 {size} · {seconds} 秒", +"Cancel · Downloading {p}%": "取消 · 下載 {p}%", +"Cancel · Unpacking": "取消 · 正在解壓", +"Cancel · {p}%": "取消 · {p}%", +"Cancellation failed. Please use the launcher.": "取消沒成功,請在啟動器裡操作", +"Cancelled": "已取消", +"Cancelled. Your original prompt is retained.": "已取消,原文已保留。", +"Cancelling an export leaves no unfinished file.": "匯出過程中取消不會留下不完整的檔案。", +"Cancelling…": "正在取消…", +"Cancel␟取消": "取消", +"Cancel␟取消排队": "取消排隊", +"Cannot be used": "不能使用", +"Cannot be used: ": "不能使用:", +"Cannot install": "無法安裝", +"Cannot open": "打不開", +"Cannot play right now. Open it in Creations.": "暫時播放不了,可在作品庫中開啟", +"Cannot resume this format; enable restart in Setup␟此文件无法续传,请允许重新下载": "此檔案無法續傳,請允許重新下載", +"Cannot resume this format; enable restart in Setup␟此格式无法续传;如需重下,请勾选允许重新下载并重新检测": "此格式無法續傳;如需重下,請勾選允許重新下載並重新檢測", +"Canvas size": "畫布大小", +"Canvas size…": "畫布大小…", +"Captions only": "只去字幕", +"Car": "汽車", +"Cast": "角色", +"Cause": "原因", +"Center": "中", +"Certificate check failed": "證書驗證失敗", +"Change a line first": "先改一句台詞", +"Change address": "更改網址", +"Change disk": "更換硬碟", +"Change its role or remove it": "換個用途或移除", +"Change only the selected area and keep the rest.": "只改選中的區域,其餘保持不變。", +"Change part of an image": "局部改圖", +"Change size": "更改尺寸", +"Change source": "切換下載來源", +"Change that text, then export again": "修改這些文字後再匯出", +"Change the image size, then try again": "調整圖片尺寸後再試", +"Change the level or the switch first": "先修改等級或開關", +"Change the name or images": "修改名字或圖片", +"Change the order of the shelf": "改變作品的排列順序", +"Change the screenplay as indicated, then try again": "按提示修改劇本後再試", +"Change the settings to a supported range, then try again": "把設定改到可用範圍內後再試", +"Change the size or the length, then try again": "更換尺寸或時長後再試", +"Change the strength on the right if needed; the default is 1. Clear the checkbox at the start of the row to switch the LoRA off for now. With more than one LoRA, drag the handle on the left to change the order.": "需要時修改右邊的強度,預設是 1;取消行首的勾選可暫時停用;有多個 LoRA 時,拖曳左側的把手調整順序。", +"Change this in Settings": "到設定裡調整這一項", +"Change what should be different, then choose \"Generate video\".": "修改需要變更的內容,再點一下「生⁠成⁠影⁠片」。", +"Change your last message and send it again": "修改最後一句並重新發送", +"Changed elsewhere. Refresh and try again.": "已在別處修改,請重新整理後重試。", +"Changed elsewhere. Showing the latest version.": "已在別處修改,已顯示最新內容", +"Changed to {n}": "已改為 {n}", +"Changed to {value}": "已改為 {value}", +"Changes are kept in this page for now. Update and restart to save them.": "變更暫存在這個頁面裡,更新並重新啟動後會儲存。", +"Changes are not saved yet. Staying here keeps retrying.": "變更尚未儲存,留在此頁將繼續重試。", +"Changes save by themselves as you edit": "變更會自動儲存", +"Change␟修改": "修改", +"Change␟更改": "更改", +"Changing steps may lower quality.": "改步數可能降低品質。", +"Changing steps may lower quality. Default: 8 + 3 steps.": "改步數可能降低品質。預設 8 + 3 步。", +"Changing steps may lower quality. Default: 8 first-pass and 3 second-pass steps. With other first-pass steps the video is made in one pass. Second-pass steps other than 3 must be fewer than first-pass steps.": "改步數可能降低品質。預設第一階段 8 步、第二階段 3 步;第一階段不是 8 步時只生成一遍;第二階段步數不是 3 時需少於第一階段步數。", +"Changing the language reloads the page; generations keep running.": "切換語言會重新載入頁面,正在進行的生成不受影響。", +"Chapters": "章節", +"Character library": "角色庫", +"Characters and character sheets": "角色庫和角色設定圖", +"Characters show here once created.": "建立的角色會出現在這裡。", +"Characters that keep their own voice": "帶有專屬聲音的人物", +"Characters the chosen font does not have are reported before export.": "所選字型缺少的字會在匯出前提示。", +"Characters, scenes and props": "角色、場景和道具", +"Characters, scenes and props to reuse": "可反覆使用的角色、場景和道具", +"Characters␟人物": "人物", +"Characters␟角色": "角色", +"Character␟人物": "人物", +"Character␟角色": "角色", +"Chat": "對話", +"Chat name": "對話名稱", +"Chats": "對話", +"Check": "檢查", +"Check \"Private networks\", then click \"Allow access\".": "請勾選「私人網路」,再點一下「允許存取」。", +"Check & continue": "檢查並繼續", +"Check & resume": "檢查並繼續", +"Check ComfyUI dependencies": "檢查 ComfyUI 環境", +"Check GPU runtime": "檢查 GPU 執行環境", +"Check again": "重新檢查", +"Check again after fixing the problems": "處理問題後重新檢查", +"Check and install": "檢查並安裝", +"Check build tools": "檢查安裝工具", +"Check existing model folders": "尋找已有模型", +"Check files": "檢查檔案", +"Check first: models already on this computer are used as they are.": "先檢查一遍,電腦上已有的模型會直接使用。", +"Check folder permissions and Windows Security protection history, then retry. Export the report for the Windows error code.": "請檢查安裝資料夾的權限,並檢視 Windows 安全中心的保護歷史記錄,然後重試。", +"Check for updates␟检查更新": "檢查更新", +"Check for updates␟立即检查": "立即檢查", +"Check generation settings": "檢查生成設定", +"Check installation": "檢查安裝", +"Check installed packages": "檢查執行環境", +"Check local files": "檢查本機檔案", +"Check local models": "檢查已有模型", +"Check models and fix what is missing": "檢查模型並修復缺少的部分", +"Check text encoder": "檢查提示詞模型", +"Check that FreeVideo is still running and connected, then retry.": "請確認 FreeVideo 仍在執行、連線正常後重試。", +"Check that the freevideo-image folder in the input directory exists, is writable and has no file of the same name, then try again": "確認輸入目錄下的 freevideo-image 資料夾存在、可寫且沒有同名檔案後再試", +"Check that the output folder can be written to, then retry.": "請檢查輸出資料夾的寫入權限後重試。", +"Check the Python already prepared by the launcher": "檢查已有環境", +"Check the connection mode in Downloads and retry. Export the report for the source, route and failure code.": "請在「下載」裡檢查連線方式後重試。", +"Check the drama settings, then try again": "檢查短劇設定後再試", +"Check the edit settings, then try again": "檢查編輯設定後再試", +"Check the free disk space and the write access to the folder, then try again": "檢查磁碟空間和資料夾寫入權限後再試", +"Check the free disk space, then export again": "檢查磁碟空間後重新匯出", +"Check the free disk space, then export the film again": "檢查磁碟空間後重新匯出成片", +"Check the free disk space, then try again": "檢查磁碟空間後再試", +"Check the memory limit in Settings, or switch back to automatic. Export the report if it still fails.": "請在設定裡檢查記憶體上限,或改回自動。仍然失敗時,請匯出報告。", +"Check the named inputs, connections and model choices. Copy the details or export the error report when asking for help.": "檢查下方指出的輸入、節點連線和模型選項;回報問題時可複製詳情或匯出錯誤報告。", +"Check the network connection and click Check again, or install the Apple Command Line Tools.": "請檢查網路連線後點選「重新檢查」,或者安裝 Apple 命令列工具。", +"Check the network connection or choose another download source in Settings, then try again.": "請檢查網路,或在設定裡換一個下載來源,然後重試。", +"Check the network connection or choose another download source in Settings, then try again. If it happens again, choose \"Report a problem\" to send us the report.": "請檢查網路,或在設定裡換一個下載來源,然後重試。再次出現時,請點選「提交問題」,把報告傳給我們。", +"Check the network connection, then try again": "檢查網路連線後再試", +"Check the queue first. If you still want the current settings, choose \"Redo from here\" again.": "請先檢視佇列;仍需要按現在的設定生成時,再點一次「從這段重新生成」。", +"Check the queue's current state in a moment, then decide whether to act again.": "請稍後檢視佇列中的實際狀態,再決定是否需要重新操作。", +"Check the queue, and submit again only if the task is not there.": "請先檢視佇列,任務不在佇列中時再重新提交。", +"Check the settings, then generate.": "請檢查設定後再生成。", +"Check the task list to see whether it started; submit again if it did not": "檢視任務列表確認是否已開始,沒有再重新提交", +"Check the timeline: an extended part sits right against the part before it and carries a link mark. A separate shot is drawn apart from the video before it.": "看時間軸:接續的一段緊貼前一段,帶有連結標記;獨立鏡頭與前面的影片分開顯示。", +"Check this computer and list what would be installed": "檢查本機,列出要安裝或修復的內容", +"Check your media selection.": "請檢查素材用途是否衝突。", +"Check your network or change the source or connection mode in Settings → Downloads, then retry.": "檢查網路,或在「設定 → 下載」中切換下載來源、連線模式後重試。", +"Check your network or proxy, or change the source or connection mode, then retry.": "請檢查網路或代理,或切換下載來源、連線模式後重試。", +"Checked after setup": "安裝環境後檢查", +"Checked and ready to use: {count} files ({size})": "已驗證、可直接使用:{count} 個檔案({size})", +"Checking configuration": "檢查配置", +"Checking configuration and local models…": "正在檢查配置和本機模型…", +"Checking each file…": "正在逐個檢查…", +"Checking for updates. Please wait.": "正在檢查更新,請稍候", +"Checking for updates…": "正在檢查更新…", +"Checking installation…": "正在檢查安裝…", +"Checking offline packages": "檢查離線安裝包", +"Checking packages": "檢查相關套件", +"Checking the download…": "正在檢查下載內容…", +"Checking the environment": "正在檢查執行環境", +"Checking the hardware and the downloaded files…": "正在檢查硬體和已下載的檔案…", +"Checking the installation": "正在檢查安裝", +"Checking the latest release…": "正在檢查最新版本…", +"Checking the prompt model…": "正在檢查提示詞模型…", +"Checking the results": "正在檢查結果", +"Checking video…": "正在檢查影片…", +"Checking whether the Fast level can make this video…": "正在檢查極⁠速⁠檔能否生成這個影片…", +"Checking your installation": "正在檢查安裝", +"Checking {name}": "正在校驗{gap}{name}", +"Checking {percent}%": "檢查中 {percent}%", +"Checking. Available when finished.": "正在檢查,完成後可用。", +"Checking…": "正在檢查…", +"Checking␟检查中": "檢查中", +"Checking␟正在校验": "正在校驗", +"Checking␟正在检查": "正在檢查", +"Checks this installation and reinstalls anything missing or changed. Models and videos are kept.": "檢查這份安裝,重新安裝缺失或被修改的部分。模型和影片都會保留。", +"China source": "中國大陸來源", +"Chinese interface": "切換到中文介面", +"Choose": "選擇", +"Choose \"+ Audio track\" to add \"Audio 2\", then put music on it: drag it in from \"Imported\", or make it as in the \"Add music\" chapter.": "點一下「+ 音軌」新增「聲音 2」,把音樂放到這條軌上:從「已匯入」拖入,或按「加配樂」一章生成。", +"Choose \"+ Audio track\" to add a second audio track, \"Audio 2\".": "點一下「+ 音軌」,新增第二條音軌「聲音 2」。", +"Choose \"Add\" again, pick an image and set its role dropdown to \"Middle frame\".": "再點一下「新⁠增」選一張圖片,將它的用途下拉式選單選為「中間影格」。", +"Choose \"Advanced\" (the sliders icon) at the bottom of the creation panel.": "點創作面板底部的「進階選項」(滑桿圖示)。", +"Choose \"Autopilot\" at the top.": "點頂部的「AI 全自動」。", +"Choose \"Check again\" first, then export the download list.": "請先點一下「重新檢查」,再匯出下載清單。", +"Choose \"Creations\" at the start of the recent videos below the preview.": "點預覽下方最近作品開頭的「作品庫」。", +"Choose \"Edit\" at the top and move the playhead to where the words should appear.": "點頂部的「剪輯檢視」,把播放頭移到想加字的位置。", +"Choose \"Edit\" at the top.": "點頂部的「剪輯檢視」。", +"Choose \"Exit\" in the tray menu to exit completely. It asks again only while a video is being generated.": "在系統匣選單中選「結⁠束」可完全結束 FreeVideo;只有影片正在生成時會再確認一次。", +"Choose \"Exit\" to stop FreeVideo. A video being generated stops as well.": "點一下「結⁠束」,FreeVideo 會停止執行;正在生成的影片也會停止。", +"Choose \"Export\" at the top right. The words are drawn into the video.": "點右上角的「匯⁠出」,文字和字幕會一起畫進影片。", +"Choose \"Extend\" below a finished video to add the next part.": "在生成好的影片下方點一下「接著生成」,繼續下一段。", +"Choose \"Extend\" below a finished video to add the next part. Each added part is at least 5 seconds, and the last one can be as short as 2 seconds. With a part shorter than 10 seconds, one video has at most 4 parts.": "在生成好的影片下方點一下「接著生成」,繼續下一段。接著生成的每一段至少 5 秒,最後一段可短至 2 秒。有短於 10 秒的段時,每支影片最多 4 段。", +"Choose \"Extend\" below a finished video. The Edit view opens.": "在生成好的影片下方點一下「接著生成」,開啟剪輯檢視。", +"Choose \"Filter\" at the top to narrow the list by time, image source and more, or search by prompt or name in the search box.": "點上方的「篩⁠選」,按時間、圖片來源等條件縮小範圍;也可以在搜尋框中按提示詞或名稱搜尋。", +"Choose \"Generate preview\" and wait for it to finish.": "點一下「生⁠成⁠預⁠覽」,等待預覽完成。", +"Choose \"Generate video\".": "點一下「生⁠成⁠影⁠片」。", +"Choose \"Generate video\". With an empty prompt, a note appears first; choose \"Generate anyway\" to go ahead.": "點一下「生⁠成⁠影⁠片」。描述為空時會先提示,點一下「繼⁠續⁠生⁠成」仍可生成。", +"Choose \"Generate\".": "點一下「生⁠成」。", +"Choose \"Generate\". The image appears in the middle and is added to the creations on the right. The line below it names the model that made it, with its size and shape. Use the icons in the line below it to download it, open its folder or copy the prompt. A copy of the image is also saved to the output folder; this can be switched off in Settings.": "點一下「生成」。圖片顯示在中間,並加入右側的作品清單;圖片下方一行寫明生成它的模型、尺寸和比例。用圖片下方一行的圖示下載、開啟資料夾或複製提示詞。圖片也會另存一份到 output 資料夾,在「設定」中可以關閉。", +"Choose \"Generate\". The parts are made in order and joined into one video.": "點一下「生⁠成」,各段按順序生成並連成一段影片。", +"Choose \"Images\" at the top, then \"References\" below the prompt box, and pick \"From this computer…\" or an image from your creations. You can also drag images onto the left side or paste them into the prompt box.": "點頂部的「圖片檢視」,點提示詞框下方的「參考圖」,選「從電腦選擇…」或作品中的一張圖片;也可以把圖片拖到左側,或貼上到提示詞框中。", +"Choose \"Images\" at the top.": "點頂部的「圖片檢視」。", +"Choose \"Installation\" on the left of the launcher, keep the same installation folder, and choose \"Continue\" to reach the models step.": "在啟動器左側點一下「安裝」,保留原來的安裝資料夾,點一下「繼續」進入模型步驟。", +"Choose \"Landscape\" or \"Portrait\" and keep the rest as it is.": "畫面比例選「橫向」或「直向」,其餘保持預設。", +"Choose \"LoRA\" in the creation panel, then \"Add LoRA\", and pick the file from the list.": "點創作面板的「LoRA」,再點一下「新增 LoRA」,在下拉式清單中選擇檔案。", +"Choose \"Loop\" and then \"Start loop\" to keep making new takes; choose \"Stop after this video\" to end it.": "選「循環」後點一下「開始循環」,會一直生成新版本;點一下「完成目前後停止」結束。", +"Choose \"Media\" to upload or generate images, up to 3.": "點一下「素材」,上傳或生成圖片,最多 3 張。", +"Choose \"Media\" to upload or generate images.": "點一下「素材」,上傳或生成圖片。", +"Choose \"Offline packages\", then \"Choose model packages…\", or drop the model ZIPs on \"Drop model ZIPs here — no extraction needed\", and choose \"Check & continue\".": "選擇「離線安裝包安裝」,點一下「選擇模型包…」,或把模型 ZIP 拖到「將模型 ZIP 拖到這裡,無需解壓縮」處,再點一下「檢查並繼續」。", +"Choose \"Record\" in the toolbar.": "點工具列中的「錄⁠音」。", +"Choose \"Redub\" to speak the changed lines again.": "點一下「重新配音」,只重配改過的句子。", +"Choose \"Redub\". The changed lines are spoken again.": "點一下「重⁠新⁠配⁠音」,只重配改過的句子。", +"Choose \"Replace music\".": "點一下「替換配樂」。", +"Choose \"Report a problem\" to send us the report.": "點一下「回報問題」,把報告傳送給我們。", +"Choose \"Reuse settings\". Its prompt, size, duration and seed are filled into the creation panel.": "點一下「沿⁠用⁠設⁠定」,描述、尺寸、時長和種子會填回創作面板。", +"Choose \"Run in background\" (the default; Enter also works). The window closes, and FreeVideo and any video being generated keep running.": "點一下「背⁠景⁠執⁠行」(預設按鈕,按 Enter 也可以),視窗關閉,FreeVideo 和正在生成的影片繼續執行。", +"Choose \"Save\".": "點一下「儲存」。", +"Choose \"Save\". The edited image is used for generation and the original is kept. To switch back, choose \"Use the original image again\" in the image's drop-down.": "點一下「儲存」。修改後的圖片用於生成,原圖仍保留;要改回,在圖片的下拉選單中選「改回原圖」。", +"Choose \"Send\". The assistant generates and edits it. Choose \"Stop\" at any time, and \"Open\" or \"Edit\" when it finishes.": "點一下「傳送」,助手會生成並剪輯;可隨時點一下「停止」,完成後點一下「開啟」或「剪輯」。", +"Choose \"Separate tracks\". Dialogue, music and ambience become three tracks.": "點一下「分⁠離⁠音⁠軌」,人聲、音樂和環境聲會分成三條軌道。", +"Choose \"Settings\" at the top, and under \"Appearance\" turn on \"Show this computer in the status\".": "點頂部的「設定」,在「外觀」裡開啟「在執行狀態中顯示本機資料」。", +"Choose \"Start recording\" and speak into the microphone.": "點一下「開⁠始⁠錄⁠音」,對著麥克風說話。", +"Choose \"Start\" if it is right. To change it, choose \"Not now\" and say in the chat which beat to change. The assistant asks again once it is revised.": "滿意時點一下「開始」;需要修改時點一下「先不」,再在對話中說明要改哪一拍,助手改好後會再次詢問。", +"Choose \"Stop\". The recording is placed on an audio track.": "點一下「停⁠止」結束,錄音會放到音軌上。", +"Choose \"Upscale to W × H\". The smaller size is 1.5 times larger and redraws detail from the original prompt and seed; the larger size is about 4K, upscaled frame by frame.": "選「放大到 寬 × 高」:尺寸較小的一項放大 1.5 倍,按原來的描述和種子重新生成細節;尺寸較大的一項放大到約 4K,逐格放大。", +"Choose \"Use as is\" for only one audio file.": "一次只能有一段音訊選擇「原樣使用」。", +"Choose 1 to 16 points inside the image, with at least one to select (1 selects, 0 excludes).": "請在圖片內選 1 到 16 個點,其中至少一個是選中點(1 表示選中,0 表示排除)。", +"Choose Batch to set the number": "選「批次」後可設數量", +"Choose Batch to use it": "選「批次」後可用", +"Choose Reconnect and paste the steps to it again. If it is still refused, restart the assistant.": "請點一下「重新連線」,把連線說明再貼上給它一次;仍被拒絕時,請重新啟動助手。", +"Choose Reconnect and paste the steps to your assistant.": "請點一下「重新連線」,把連線說明貼上給助手。", +"Choose a FreeVideo installation folder first.": "請先選擇 FreeVideo 安裝位置。", +"Choose a FreeVideo model package or Environment ZIP.": "請選擇 FreeVideo 的模型包或執行環境包(ZIP 檔案)。", +"Choose a creation to see it here": "選一個作品,在這裡檢視", +"Choose a disk": "選擇安裝硬碟", +"Choose a finished video from Creations.": "請從作品庫裡選擇已完成的影片。", +"Choose a folder": "選擇資料夾", +"Choose a folder…": "選擇資料夾…", +"Choose a lower Quality level.": "請把品質降低一檔。", +"Choose a lower resolution or a shorter duration and retry.": "請降低解析度或縮短時長後重試。", +"Choose a part first": "先選中一段", +"Choose a part or drag a range first": "先選中一段或在時間軸上拖出範圍", +"Choose a part or drag a range on the timeline first": "先在時間軸上選中一段或拖出範圍", +"Choose a section of sound with someone speaking": "選擇有人說話的一段聲音", +"Choose a separate folder for FreeVideo, not the program folder or the folder that contains it.": "請給 FreeVideo 單獨選一個資料夾,不要用程式所在的資料夾或它的上層資料夾。", +"Choose a shorter duration, or add the next shot in Edit.": "請縮短時長,或在剪輯檢視中新增下一個鏡頭。", +"Choose a shorter duration.": "請縮短時長。", +"Choose a smaller picture size to make a longer video.": "如需生成更長的影片,請選擇更小的畫面大小。", +"Choose a smaller size.": "請縮小尺寸。", +"Choose a suggestion": "選擇候選項", +"Choose a supported frame count": "請選擇支援的影格數", +"Choose a tool on the left: \"Crop and canvas\" to recompose, \"Brush\", \"Spot healing\" or \"Clone stamp\" to retouch, \"Text\" to add words.": "在左側工具列選擇工具:「裁切與畫布」調整構圖,「畫筆」「汙點修復」「仿製印章」修圖,「文字」新增文字。", +"Choose a video file.": "請選擇影片檔案。", +"Choose a video from Creations.": "請從作品庫裡選擇影片。", +"Choose a video generated by FreeVideo.": "請選擇 FreeVideo 生成的影片。", +"Choose a video size with the same aspect ratio as the previous video.": "請選擇與上一段影片比例相同的畫面大小。", +"Choose a video that is at least 1.7 seconds long.": "請選擇至少 1.7 秒的影片。", +"Choose a video with at least 10 frames per second.": "請選擇每秒至少 10 影格的影片。", +"Choose a voice and write the words": "先選音色並寫下要說的話", +"Choose an MP4 video that plays normally.": "請選擇能正常播放的 MP4 影片。", +"Choose an empty spot on the timeline.": "請在時間軸上選一段空白。", +"Choose an existing folder to save the download list in.": "請選擇一個已有的資料夾來儲存下載清單。", +"Choose an image file.": "請選擇圖片檔案。", +"Choose an image, or drop one here": "選擇圖片,或把圖片拖到這裡", +"Choose an image, video or audio file": "請選擇圖片、影片或音訊檔案", +"Choose an installation folder you can write to, then retry.": "選擇有寫入權限的安裝資料夾後重試。", +"Choose an installation folder.": "請選擇安裝目錄。", +"Choose another download source in Settings and retry; download progress is kept.": "可在設定中切換下載來源後重試,下載進度會保留。", +"Choose another image": "換一張圖片", +"Choose another image model, then try again": "換一個圖片模型後再試", +"Choose another position, or move the clips in the way first": "換一個位置,或先挪開擋住的片段", +"Choose another settings page": "切換到其他設定頁", +"Choose another way of generating, or generate the whole video again": "換一種生成方式,或重新生成整段影片", +"Choose environment ZIP": "選擇執行環境包", +"Choose environment ZIP…": "選擇執行環境包…", +"Choose environment package": "選擇執行環境包", +"Choose folder": "選擇資料夾", +"Choose from creations": "從作品庫選擇", +"Choose model packages…": "選擇模型包…", +"Choose offline packages": "選擇離線安裝包", +"Choose one front image and up to 5 more angles": "選一張正面圖片,再加最多 5 張其他角度的圖片", +"Choose one image": "選一張圖片", +"Choose one of the existing takes, or add a new shot": "改為選用已有的鏡頭,或新增一個鏡頭", +"Choose one of the five views": "在五個檢視之間切換", +"Choose one of these, then reload the page:": "請任選一種做法,然後重新整理頁面:", +"Choose one option under \"Style\" and one under \"Mood\", or describe the music under \"Describe the music\". When there is a prompt, the music follows it alone.": "在「風格」和「情緒」中各選一項,或在「描述配樂」中寫下想要的音樂。寫了提示詞時,只按提示詞生成。", +"Choose one to see it here": "選一個角色,在這裡檢視", +"Choose the \"Save current frame\" button (camera icon) at the lower right of the preview.": "點預覽右下方的「儲存目前影格」按鈕(相機圖示)。", +"Choose the arrow beside \"Generate video\" and pick \"Generate preview\".": "點一下「生⁠成⁠影⁠片」右側的箭頭,選「生⁠成⁠預⁠覽」。", +"Choose the check box at the top right of a creation and choose others to add them. At the top right, choose the tag icon and pick a tag. Later, choose that tag on the left to see only the creations that have it.": "點作品右上角的核取方塊選中它,再點其他作品一起選中;在右側上方點標籤圖示,選一個標籤。之後在左側點這個標籤,只看帶有它的作品。", +"Choose the first frame": "選一張作首影格", +"Choose the image the video starts from and the one it ends on.": "指定影片從哪張圖開始、到哪張圖結束。", +"Choose the largest “Upscale to” option in the menu, or upscale each clip before merging.": "請在選單裡選「放大到」最大的那一項,或先放大各個片段再合併。", +"Choose the largest “Upscale to” option in the menu.": "請在選單裡選「放大到」最大的那一項。", +"Choose the last frame": "選一張作尾影格", +"Choose the previous video": "請選擇上一段影片", +"Choose the quality button in the bottom bar (it shows the current level, such as Light) and move the slider to Light, Medium, High or Max.": "點底欄的品質按鈕(顯示目前等級,如「輕量」),在滑桿上選擇「輕量」「標準」「精細」或「極⁠致」。", +"Choose the status in the top bar to open the Run status panel: running tasks at the top, and under \"This computer\" the video memory, temperature, graphics card load and free disk, updated every 2 seconds while the panel is open.": "點頂欄的執行狀態開啟「執行狀態」面板:上面是進行中的任務,「本機」下是顯示卡記憶體、溫度、顯示卡使用率和硬碟可用空間,面板開著時每 2 秒更新一次。", +"Choose the voice for the narration": "選擇旁白用的聲音", +"Choose up to 3 images": "最多選 3 張圖片", +"Choose what the video keeps": "選擇影片保留的畫面", +"Choose which image model draws it": "選擇用哪個模型生成", +"Choose which microphone records": "選擇用哪個麥克風錄音", +"Choose your GPU variant on the model page and keep its folder structure.": "按模型頁說明選擇顯示卡版本,保留下載的資料夾結構。", +"Choose your installation folder first.": "請先選擇安裝位置。", +"Choose × at the top right of an image to remove it.": "點人物圖右上角的 × 可以移除一張。", +"Cinematic": "電影感", +"Circle": "圓", +"City at night": "城市夜景", +"Clarity": "清晰度", +"Clean": "清理", +"Clean download cache": "清理快取", +"Clean download cache?": "清理下載快取?", +"Clean up": "清理", +"Clean up old reference images": "清理舊參考圖", +"Cleaning…": "正在清理…", +"Cleanup could not finish because of an unexpected error. Check again; if it happens again, use \"Report a problem\".": "清理因意外錯誤未完成。請重新檢查;如果再次出現,請點選「提交問題」。", +"Cleanup could not finish. Check again to retry.": "清理未完成,可重新檢查後再試。", +"Cleanup could not finish: some files are in use by another program, or this account cannot delete them. Close the programs using them, then check again.": "清理未完成:部分檔案正被其他程式使用,或目前帳戶沒有刪除權限。請關閉正在使用它們的程式,再重新檢查。", +"Cleanup stopped because files changed after the check. Check again, then clean.": "檢查之後檔案有變化,清理已停止。請重新檢查後再清理。", +"Clean…": "清理…", +"Clear / fill the selection": "清除 / 填充選區", +"Clear all": "全部清除", +"Clear cache": "清除快取", +"Clear either \"Second pass of preview\" or \"Extend from video\".": "請清空「繼續第二階段」或「接著生成」其中一項。", +"Clear filters": "清除篩選", +"Clear history": "清空", +"Clear its unread dot": "去掉未讀標記", +"Clear prompt history": "清空提示詞歷史", +"Clear the dot on the bell": "清掉鈴鐺上的數字", +"Clear the seed or use a smaller whole number, then try again": "清空種子或改用較小的整數後再試", +"Clear the selected pixels (Delete)": "清除選取的像素(Delete)", +"Clear the selection": "清空已選", +"Clear the selection and see one image": "取消多選,回到單張", +"Clear up": "清理", +"Cleared {size}": "已清除 {size}", +"Clear␟清屏": "清屏", +"Clear␟清空": "清空", +"Clear␟清除": "清除", +"Clear␟清除本次令牌": "清除本次權杖", +"Click": "點選", +"Click \"Generate video\" to get your first video.": "點一下「生成影片」,得到第一段影片。", +"Click \"Generate with AI\" at the top left and choose \"Edit this\".": "點左上角的「AI 生成」,選擇「改這張」。", +"Click \"Generate\". The selection stays after the result appears, so it can be changed again; click \"Save\" when satisfied.": "點一下「生⁠成」。結果出現後選區仍然保留,可以直接再改;滿意後點一下「儲存」。", +"Click \"New chat\" to continue": "點選「新對話」後繼續", +"Click Check installation again, then Install.": "請重新點一下「檢查安裝」,再點一下「安裝」。", +"Click Check installation, then Install.": "請先點一下「檢查安裝」,再點一下「安裝」。", +"Click Repair again.": "請再點一次「修復」。", +"Click Repair to check this installation and restore what is missing.": "請點選「修復」,FreeVideo 將檢查這份安裝並補裝缺失的元件。", +"Click Repair to reinstall a complete copy of PyTorch. Models and videos are kept.": "請點一下「修復」,FreeVideo 會重新安裝執行元件,模型和影片都會保留。", +"Click Retry installation below.": "請點下方的「重試安裝」。", +"Click Retry installation; FreeVideo then installs its own Git. On macOS, update the Command Line Tools.": "請點選「重試安裝」,FreeVideo 會改用內建的 Git;macOS 請更新命令列工具(Command Line Tools)。", +"Click Retry. If it stops here again, the ComfyUI log in the details shows why the FreeVideo nodes did not load; export the report to send it.": "請點一下「重試」。仍然停在這裡時,可以匯出報告。", +"Click Start in the FreeVideo launcher again.": "請在 FreeVideo 啟動器裡重新點選「啟動」。", +"Click Update now again when this video has finished. The video being generated is not interrupted.": "這個影片生成完成後,再點選「立即更新」。正在生成的影片不會被打斷。", +"Click a shape to move, resize or turn it.": "點一個形狀,可以移動、縮放或旋轉。", +"Click a sound clip on the timeline": "在時間軸上點一個聲音片段", +"Click on an image layer.": "請點在圖片圖層上。", +"Click on the canvas to pick a color.": "請點在畫布上取色。", +"Click or drag to go to a moment": "點按或拖曳,跳到某一刻", +"Click or drop an image": "點選或拖入圖片", +"Click select": "點選", +"Click the T icon in the toolbar to add a title, or the subtitle icon next to it to add a subtitle, then type.": "點工具列的 T 圖示加標題,或點它右邊的字幕圖示加一則字幕,然後直接輸入內容。", +"Click the image to add text; click text to edit it.": "點選畫面新增文字;點選已有文字進行編輯。", +"Click the seconds in the bottom bar to change the length. \"Available sizes and lengths\" shows the longest length and the estimated time for each size.": "點底欄的秒數,直接修改時長;「可⁠生⁠成⁠範⁠圍」中可檢視各尺寸的最長時長和預計耗時。", +"Click the source…": "點選取樣位置…", +"Click to add corners; double-click or press Enter to close.": "按一下新增頂點;按兩下或按 Enter 閉合。", +"Click to edit it in the image editor": "點選在圖片編輯器中修改", +"Click to edit it in the image editor, or drop an image to replace it": "點選在圖片編輯器中修改,或拖入圖片替換", +"Click to paint on it": "點選後畫筆畫在遮罩上", +"Click to pick the foreground color; Alt-click for the background color.": "點選吸取前景色;按住 Alt 點選吸取背景色。", +"Click to pick; Shift picks a run": "點選;按住 Shift 連選", +"Click to preview; drag or double-click to place": "按一下預覽,拖曳或按兩下放入時間軸", +"Click to retry": "點此重試", +"Click to save the changes again": "點一下重新儲存變更", +"Click to type an exact length": "點一下輸入精確時長", +"Click “Open FreeVideo”. If the page stays blank or keeps loading, open it in a current Chrome or Edge.": "請點選「開啟 FreeVideo」。如果頁面空白或一直在載入,請用最新版 Chrome 或 Edge 開啟。", +"Clip": "素材", +"Clips": "片段", +"Clips in time order; drag to arrange": "按時間排列的片段,可拖曳", +"Clips stick to edges and the playhead": "拖曳時貼齊片段邊緣和播放頭", +"Clone stamp": "仿製印章", +"Close": "關閉", +"Close FreeVideo?": "關閉 FreeVideo?", +"Close Settings and replay it here": "關閉設定,在目前檢視重放", +"Close a list or drawer, then Autopilot": "先關列表或抽屜,再關 AI 全自動", +"Close a menu, dialog or panel": "關閉選單、對話方塊或浮動面板", +"Close a menu, then the view": "先關選單,再關檢視", +"Close a panel, then Create": "先關浮層,再關創作面板", +"Close and go back to where you were": "收起教學,回到剛才的介面", +"Close cleaner or memory-limiting programs and generate again. Export the report if it still fails.": "請關閉清理類或限制記憶體的軟體後重新生成。仍然失敗時,請匯出報告。", +"Close compare": "關閉對比", +"Close memory-heavy applications and duplicate FreeVideo windows, then retry. Export the report if it still fails.": "關閉佔用記憶體較多的程式及重複執行的 FreeVideo 後重試。仍失敗時請匯出報告。", +"Close memory-heavy applications and retry. If you set a memory limit, remove or raise it. Copy the details below if it still fails.": "關閉佔用記憶體較多的程式後重試;設定過記憶體上限的,請取消或調高。仍然失敗時,可複製下方詳情。", +"Close memory-heavy applications and retry. In Windows virtual memory settings, use a system-managed paging file on a drive with free space.": "關閉佔用記憶體較多的程式後重試。在 Windows 虛擬記憶體設定中,使用系統管理的分頁檔,並確保所在磁碟有可用空間。", +"Close memory-heavy applications, or lower the resolution or duration, then retry.": "可關閉佔用記憶體較多的程式,或調低解析度、縮短時長後重試。", +"Close memory-heavy applications, or lower the resolution or duration, then retry. Export the report if it still fails.": "可關閉佔用記憶體較多的程式,或調低解析度、縮短時長後重試。仍然失敗時,請匯出報告。", +"Close memory-heavy applications, then retry. Downloaded files are retained.": "關閉佔用記憶體較多的程式後重試,已下載檔案會保留。", +"Close now; remind me later": "先關閉,稍後再提醒", +"Close other applications to free memory, then click \"Retry installation\". Downloaded files are retained.": "請關閉其他程式以空出記憶體,然後點選「重試安裝」。已下載的檔案會保留。", +"Close other memory-heavy applications and retry. Copy the details if it continues.": "關閉佔用記憶體較多的程式後重試;仍失敗時可複製詳情回報。", +"Close other memory-heavy applications and retry. Export the report if it still fails.": "請關閉其他佔用記憶體較多的程式後重試。仍然失敗時,請匯出報告。", +"Close other programs or use a shorter reference video, then try again.": "請關閉其他程式或換一段更短的參考影片,然後重試。", +"Close other programs that use memory, then try again": "關閉其他佔用記憶體的程式後再試", +"Close other programs that use the GPU, then try again.": "請關閉其他佔用顯示卡的程式,然後重試。", +"Close other programs that use the graphics card, or use a smaller image size, then try again": "關閉其他佔用顯示卡的程式,或縮小圖片尺寸後再試", +"Close other programs that use the graphics card, or use a smaller size or a shorter length, then try again": "關閉其他佔用顯示卡的程式,或縮小尺寸、縮短時長後再試", +"Close other programs using the GPU, then retry.": "關閉其他佔用顯示卡的程式後重試。", +"Close preview": "關閉預覽", +"Close recorder": "關閉錄音條", +"Close settings": "關閉設定", +"Close terminal": "收起終端", +"Close the ComfyUI that is running now, then click \"Connect again\".": "請關閉正在執行的 ComfyUI,然後點選「重新連線」。", +"Close the launcher window while FreeVideo is running and \"Close FreeVideo?\" appears.": "FreeVideo 執行時關閉啟動器視窗,會出現「關閉 FreeVideo?」。", +"Close the library and go back": "關閉作品庫,回到之前的檢視", +"Close the open panel or tray": "關閉開啟的面板或系統匣", +"Close the panel": "關閉面板", +"Close the panel; {mod}Enter generates": "關閉面板;{mod}Enter 直接生成", +"Close the plan without installing": "關閉計劃,不安裝", +"Close the release notes": "關閉版本說明", +"Close the selected gap": "移除選中的空隙", +"Close the top layer": "關閉最上層", +"Close the tour and go to the image view": "關閉介紹並開啟圖片檢視", +"Close the tour of this version": "關閉新功能介紹", +"Close the tour; it stays in Tutorial": "關閉介紹,教學裡可以再看", +"Close the viewer, then the library": "先關大圖,再關作品庫", +"Close this and keep dubbing": "不停止,接著配音", +"Close this and keep generating": "不停止,接著生成", +"Close this and let the step go on": "不停止,讓這一步接著做", +"Close this notice now": "現在收起這條提醒", +"Close this panel": "關閉這個面板", +"Close without changing the password": "不改密碼,關閉這一欄", +"Close without saving": "不儲存,關閉", +"Close; replay it in Version & updates": "關閉介紹,可在「版本與更新」裡重看", +"Close; your text is kept as a draft": "關閉,文字會保留為草稿", +"Closing Settings does not stop it.": "關閉設定不會中斷。", +"Closing the launcher: exit or keep running": "關閉啟動器:結束或背景執行", +"Closing the window while the launcher is installing or downloading first asks \"Pause and close?\".": "啟動器正在安裝或下載時關閉視窗,會先詢問「暫停並關閉?」。", +"Clothes": "服裝", +"Clothes image": "服裝圖", +"Color": "顏色", +"Color burn": "顏色加深", +"Color dodge": "顏色減淡", +"Colour": "顏色", +"Combine generation steps freely with nodes": "用節點自由組合生成步驟", +"Comfortable": "舒適", +"ComfyUI did not load FreeVideo": "ComfyUI 沒有載入 FreeVideo", +"ComfyUI folder": "ComfyUI 目錄", +"ComfyUI frontend: ": "ComfyUI 前端:", +"ComfyUI is ready. Open the browser again or copy its address.\n": "ComfyUI 已就緒,請重試開啟瀏覽器,或複製網址手動開啟。\n", +"ComfyUI ready": "ComfyUI 已就緒", +"ComfyUI sent the file with the wrong type, so the browser refused it. Restart ComfyUI. If it persists, use Report a problem.": "ComfyUI 傳給瀏覽器的檔案類型不對,瀏覽器拒絕使用。請重新啟動 ComfyUI;仍然出現時,請點一下「提交問題」。", +"Command layer": "命令與搜尋", +"Command palette": "命令面板", +"Compact": "緊湊", +"Compact layout": "簡潔模式", +"Compare": "對比", +"Compare as": "對比方式", +"Compare it with another one": "和另一個並排或滑桿對比", +"Compare proxy and direct connections automatically.": "自動測速,擇優使用代理或直連。", +"Compare sources on this computer.": "比較本機下載來源速度。", +"Compare two videos": "對比兩段影片", +"Compare with another video": "和另一段影片對比", +"Comparing the first {n} of {total}": "比較前 {n} 張(已選 {total} 張)", +"Comparing {count}": "對比 {count} 個", +"Comparing {n}": "比較 {n} 張", +"Compatibility": "相容性", +"Compatibility enabled": "已開啟相容性設定", +"Compatibility level␟兼容性档位": "相容性等級", +"Compatibility level␟兼容档位": "相容等級", +"Compatibility settings": "相容性設定", +"Compatibility settings are enabled, so generation will take longer.": "已開啟相容性設定,生成會較慢。", +"Compatibility view": "相容介面", +"Compatible": "通用", +"Compatible · the GPU handles less at a time; slower": "相容 · 顯示卡每次處理的資料更少,生成更慢", +"Compile acceleration for your GPU": "準備顯示卡加速", +"Compiling CUDA kernels": "準備顯示卡加速", +"Complete FreeVideo installation first.": "請先完成 FreeVideo 安裝。", +"Completed ": "已完成 ", +"Complete␟完成": "完成", +"Complete␟已完成": "已完成", +"Composing music": "生成配樂", +"Composition only": "僅參考構圖", +"Computer": "電腦", +"Conditioning": "條件輸入", +"Configuration check failed:": "配置檢測未完成:", +"Confirm": "確認刪除", +"Confirm & continue": "確認並繼續", +"Confirm and close": "確認並關閉", +"Confirm clean up": "確認清理", +"Confirm clear": "確認清除", +"Confirm delete": "確認刪除", +"Confirm every page file loads": "確認頁面的每個檔案都能載入", +"Confirm first, then run this action": "確認後再執行這項操作", +"Confirm installation": "確認安裝", +"Confirm the download in the launcher.": "請在啟動器中確認下載。", +"Confirm the update in the FreeVideo launcher.": "請在 FreeVideo 啟動器中確認本次更新。", +"Confirm this choice": "確認這個選擇", +"Connect IMAGE or AUDIO outputs from generation, editing or loading nodes, or upload files. Several reference images can be connected; uploaded references come first, then connected images from top to bottom. Choose first/last frames or experimental references. Empty media means text to video.": "連接圖片、音訊,或上傳檔案。可以連接多張參考圖片,上傳的素材排在前面,連接的圖片按從上到下的順序排在後面。選擇首尾影格或實驗性參考生成,留空則為文字生成影片。", +"Connect a FreeVideo Media panel in node view to upload here.": "在節點檢視連接 FreeVideo 素材面板,可在這裡上傳。", +"Connect again": "重新連線", +"Connect an assistant": "連線助手", +"Connect an assistant first": "先連線助手", +"Connect an assistant first; the steps are in the middle": "先連線助手,步驟在中間的卡片裡", +"Connect an assistant in Autopilot and describe the short drama, for example \"Make a 1-minute vertical short drama: a lighthouse keeper gets a letter from her sister asking for help\".": "在「AI 全自動」中連線助手,說明想拍的短劇,例如「做一部 1 分鐘的直式短劇:守塔人收到妹妹的求救信」。", +"Connect audio to \"Reference audio\" on the \"FreeVideo · Media\" node, or set \"Audio use\" to \"reference\".": "請把音訊接到「FreeVideo · 素材」節點的「參考音訊」,或把「音訊用途」改為「參考」。", +"Connect audio to \"Reference audio\", or set \"Audio use\" to \"reference\", before generating.": "請連接「參考音訊」,或把「音訊用途」改為「參考」後再生成。", +"Connect the disk that holds the installation folder, then check again, or choose another folder.": "請接上安裝位置所在的硬碟後重新檢查,或者換一個位置。", +"Connect the encoder to FreeVideo": "準備提示詞模型", +"Connect to FreeVideo: open {url} and follow the instructions.": "請連線 FreeVideo:開啟 {url} 並按說明操作。", +"Connect to the same Wi-Fi, then scan": "手機連同一個 Wi-Fi 後掃碼", +"Connect up to 3 images as references, and remove video, audio and pre-encoded inputs.": "最多接 3 張圖片作為參考圖,並移除影片、音訊參考和預編碼輸入。", +"Connect your existing installation.": "選擇已有安裝目錄。", +"Connect your phone to the same Wi-Fi, then scan with its camera. You can also copy the link to another device.": "手機連同一個 Wi-Fi 後用相機掃描 QR 碼,也可以複製連結到其他裝置開啟。", +"Connected": "已連線", +"Connected; speed not measured yet": "已連通,速度還沒測出", +"Connecting to ": "正在連線", +"Connecting to download server": "正在連線下載伺服器", +"Connecting workflow nodes": "正在連接工作流程節點", +"Connecting…": "正在連線…", +"Connection interrupted": "連線中斷", +"Connection lost": "連線中斷", +"Connection lost. Reconnecting…": "連線斷了,正在重新連線…", +"Connection lost. Try again.": "連線中斷,請重試。", +"Connection refused": "連線被拒絕", +"Connection speed": "連線速度", +"Connection steps": "連線方式", +"Connection timed out": "連線逾時", +"Connection␟连接": "連線", +"Connection␟连接方式": "連線方式", +"Connection␟连接模式": "連線模式", +"Connection␟连接状态": "連線狀態", +"Content": "內容", +"Contents": "目錄", +"Contiguous": "連續", +"Continue download": "繼續下載", +"Continue from here": "從這段繼續", +"Continue from part {number}": "從第 {number} 段繼續", +"Continue from the content you edited by hand, or reload the page and try again": "按手動修改後的內容繼續,或重新整理頁面後重新操作", +"Continue from this preview to the full-resolution video.": "從這個預覽繼續生成全解析度影片。", +"Continue generating": "繼續生成", +"Continue installation / retry": "繼續安裝/重試", +"Continue to feedback": "繼續意見回饋", +"Continue your setup": "繼續安裝", +"Continue␟继续": "繼續", +"Continue␟继续安装": "繼續安裝", +"Contrast": "對比度", +"Controlled by connected nodes.": "由連接的節點控制。", +"Conversation": "對話", +"Convert it to a standard MP4 with one fixed size, or choose another video, then try again.": "請把它轉成尺寸固定的標準 MP4,或換一段影片,然後重試。", +"Converting the reference video needs temporary space on the drive that holds FreeVideo's data.": "轉換參考影片需要在 FreeVideo 資料所在的磁碟上暫時佔用一些空間。", +"Converting the reference video stopped unexpectedly.": "參考影片轉換時意外中止。", +"Copied": "已複製", +"Copied @{name}. Paste it in a prompt.": "已複製 @{name},貼上到提示詞裡使用。", +"Copied the original. Changes go on the copy.": "已複製原圖,變更在副本上。", +"Copy": "複製", +"Copy / cut / paste": "複製 / 剪下 / 貼上", +"Copy @{name}": "複製 @{name}", +"Copy address": "複製網址", +"Copy details": "複製詳情", +"Copy error": "複製錯誤", +"Copy it to the clipboard": "複製到剪貼簿", +"Copy its prompt to paste elsewhere": "複製提示詞,可貼上到別處", +"Copy link": "複製連結", +"Copy link address": "複製連結網址", +"Copy local model": "複製模型", +"Copy log": "複製日誌", +"Copy mention": "複製引用", +"Copy or export the full log with private information hidden.": "可複製或匯出完整記錄,隱私資訊已隱藏。", +"Copy path": "複製路徑", +"Copy prompt": "複製提示詞", +"Copy reused models instead of linking them": "重複使用模型時複製一份,而不是連結", +"Copy the address to open on a phone": "複製網址,在手機上開啟", +"Copy the error text to paste elsewhere": "複製錯誤文字,便於貼上", +"Copy the error to send to us": "複製錯誤資訊,便於回報", +"Copy the log for a report": "複製日誌,用於提交問題", +"Copy the path, and other actions": "複製路徑等其他操作", +"Copy the selected text": "複製選中的文字", +"Copy the steps and paste them to your assistant": "複製連線說明,貼上給助手", +"Copy the steps to paste to your assistant": "複製連線說明,貼上給助手", +"Copy the words this image was made from": "複製這張圖的提示詞", +"Copy the words this was made from": "複製生成它所用的提示詞", +"Copy this sentence for your AI assistant": "複製這句話,發給你的 AI 助手", +"Copy to a new layer": "複製到新圖層", +"Copy to a new layer (Ctrl+J)": "複製到新圖層(Ctrl+J)", +"Copy where the file is saved␟复制文件保存的位置": "複製檔案儲存的位置", +"Copy where the file is saved␟复制视频文件所在位置": "複製影片檔案所在位置", +"Copy where the video file is stored": "複製影片檔案的位置", +"Copy where this link goes": "複製這個連結的網址", +"Copy, reveal or delete this image": "複製、定位或刪除這張圖", +"Copying ": "正在複製", +"Copying {name}": "正在複製{gap}{name}", +"Copyrights and licenses of the other components": "其餘元件的版權和授權", +"Corner radius": "圓角", +"Could not add the character's images": "無法加入角色的圖片", +"Could not add to the queue. Check the settings in node view.": "沒能加入佇列,請在節點檢視檢查設定。", +"Could not apply the preset.": "預設沒能套用。", +"Could not cancel. Refresh the page and try again.": "沒有取消成功,請重新整理頁面後再試。", +"Could not cancel. Try again.": "沒有取消成功,請重試。", +"Could not change phone access. Try again.": "沒能更改手機連線設定,請重試。", +"Could not change the resolution. Try again.": "沒能更改清晰度,請重試。", +"Could not check for updates.": "暫時無法檢查更新。", +"Could not check the video": "沒能檢查影片", +"Could not complete. Try again.": "沒有完成,請重試", +"Could not confirm whether the change was saved.": "無法確認這次修改是否已儲存。", +"Could not connect": "無法連線", +"Could not connect to the download server.": "無法連線下載伺服器。", +"Could not continue. Refresh the page and try again.": "沒有繼續生成,請重新整理頁面後再試。", +"Could not copy": "複製失敗", +"Could not copy the link. Try again.": "沒能複製連結,請重試。", +"Could not copy. Try again.": "未能複製,請重試。", +"Could not copy. Type the name after @ in a prompt.": "沒能複製。可在提示詞中輸入 @ 加名字。", +"Could not create subtitles. Try again; if it keeps failing, report the problem.": "沒能生成字幕。請重試;仍然失敗時,請提交問題。", +"Could not delete": "刪除失敗,請重試", +"Could not delete this creation.": "無法刪除這條作品。", +"Could not delete this edit. Please try again.": "刪除失敗,請重試。", +"Could not delete {size}.": "有 {size} 張無法刪除。", +"Could not delete. Try again.": "沒能刪除,請重試。", +"Could not delete: ": "沒有刪除成功:", +"Could not disconnect (HTTP {status}). Retry, or report it.": "中斷連線失敗(HTTP {status})。請重試,或回報問題。", +"Could not enhance the prompt. Retry or switch enhancement off to use the original.": "暫時無法改寫,請重試,或關閉增強使用原文。", +"Could not enhance the prompt: {reason}. Retry or switch enhancement off to use the original.": "暫時無法改寫。原因:{reason}。請重試,或關閉增強使用原文。", +"Could not fill in the prompt. Try again.": "未能填入提示詞,請重試。", +"Could not fill in the settings. Try again.": "沒能填入設定,請重試。", +"Could not find an object here. Try again.": "沒能在這裡找出物體,請再試一次。", +"Could not get address. Retry": "取得失敗,重試", +"Could not join the parts. See the details on the picture.": "未能接合各段,原因見畫面上的說明。", +"Could not move it. Try again.": "沒有移動成功,請重試。", +"Could not open it. Try again.": "沒能開啟,請重試。", +"Could not open the Edit view. Choose \"Edit\" at the top.": "無法開啟剪輯檢視,請點頂部的「剪輯檢視」。", +"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 open the folder. The videos are in {folder}": "沒能開啟資料夾。影片在 {folder}", +"Could not open the folder. This video is in {folder}": "沒能開啟資料夾。影片在 {folder}", +"Could not plan this video. Try again.": "暫時無法安排這段影片的分段,請重試。", +"Could not prepare this run. Try again.": "沒能準備這次生成,請重試。", +"Could not reach FreeVideo on this computer. Make sure it is still running, then retry.": "無法連線本機的 FreeVideo 服務,請確認它仍在執行後重試。", +"Could not read a frame from this video. Replace it with another video or an image, or use the original.": "讀不出這個影片的畫面,請換一個影片或圖片,或使用原文。", +"Could not read frames from this video. Choose another file.": "無法讀取這個影片的畫面,請換一個檔案。", +"Could not read the LoRA folder.": "無法讀取 LoRA 資料夾。", +"Could not read the LoRA list. Try again.": "無法讀取 LoRA 列表,請重試。", +"Could not read the creations.": "無法讀取作品。", +"Could not read the creations. Try again.": "沒能讀取作品,請重試。", +"Could not read the image dimensions. Choose another image.": "無法讀取圖片尺寸,請換一張圖片。", +"Could not read the phone access status. Try again.": "沒能讀取手機連線狀態,請重試。", +"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 setting. Try again.": "沒能讀取設定,請重試。", +"Could not read the trigger words. Try again.": "沒能讀取觸發詞,請重試。", +"Could not read this image. Choose another file.": "無法讀取這張圖片,請換一個檔案。", +"Could not read this image. Please choose another one.": "無法讀取這張圖片,請換一張。", +"Could not read this subtitle file": "讀不出這個字幕檔案", +"Could not read trigger words.": "無法讀取觸發詞。", +"Could not refresh the list. Try again.": "沒能重新整理清單,請重試。", +"Could not remove the favorite. Try again.": "無法取消收藏,請重試。", +"Could not rename.": "沒有重新命名成功。", +"Could not rename: ": "沒有重新命名成功:", +"Could not rename: this chat no longer exists.": "沒有重新命名成功:這個對話已不存在。", +"Could not save the favorite. Try again.": "無法儲存收藏,請重試。", +"Could not save the image. Try again.": "沒能儲存圖片,請重試。", +"Could not save the language. Try again.": "未能儲存語言,請重試。", +"Could not save the model folders. Try again.": "沒能儲存模型資料夾,請重試。", +"Could not save the preset.": "預設集沒能儲存。", +"Could not save the share image. Try again.": "分享圖沒有儲存成功,請重試。", +"Could not save the trigger words. Try again.": "沒能儲存觸發詞,請重試。", +"Could not save. The setting shown is the one in effect.": "儲存失敗,下面顯示的是目前生效的設定。", +"Could not save. Try again.␟没有保存,请再试一次。": "沒有儲存,請再試一次。", +"Could not save. Try again.␟没能保存,请重试。": "沒能儲存,請重試。", +"Could not search the creations": "暫時無法搜尋作品", +"Could not send: ": "沒有傳送成功:", +"Could not show the QR code. Use Copy link.": "沒能顯示QR 碼,請用「複製連結」。", +"Could not show the latest version. Close and open it again.": "沒能顯示最新內容,請關閉後重新開啟。", +"Could not start a new chat: ": "沒有新增成功:", +"Could not start shooting: ": "沒有開始拍攝:", +"Could not start the download. Try again.": "無法開始下載,請重試。", +"Could not start the measurement. Try again.": "沒能開始測量,請重試。", +"Could not start the second pass. Try again.": "沒能開始第二階段,請重試。", +"Could not start the second pass: ": "無法繼續第二階段:", +"Could not start upscaling: ": "無法開始放大:", +"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 start: ": "無法開始生成:", +"Could not stop. Click again; if it keeps failing, report the problem.␟未能停止。请再点一次;仍然失败时,请提交问题。": "未能停止。請再點一次;仍然失敗時,請提交問題。", +"Could not stop. Click again; if it keeps failing, report the problem.␟没能停止。请再点一次;仍然失败时,请提交问题。": "沒能停止。請再點一次;仍然失敗時,請提交問題。", +"Could not stop. Try again; if it keeps failing, report the problem.": "沒有停止成功。請重試;仍然失敗時,請提交問題。", +"Could not undo. Try again.": "無法復原,請重試。", +"Could not upload the image. Click it to try again.": "圖片上傳失敗,請點選該圖片重試。", +"Could not upload. Try again.": "沒能上傳,請重試。", +"Could not write the file": "無法寫入檔案", +"Could not write the prompt. Try again.": "暫時無法生成提示詞,請重試。", +"Could not write the prompt: {reason}. Try again.": "暫時無法生成提示詞。原因:{reason}。請重試。", +"Could not write to disk, so dubbing did not finish. The edited lines are kept. Check the free disk space, then redub.": "無法寫入磁碟,配音未完成,所改台詞已保留。請檢查磁碟空間後重新配音。", +"Could not {action}. Try again.": "無法{action},請重試。", +"Could not {action}: FreeVideo on the computer returned an error (HTTP {status}). Try again.": "無法{action}:電腦上的 FreeVideo 傳回錯誤(HTTP {status})。請重試。", +"Could not {action}: the phone cannot reach FreeVideo on the computer. Check that the computer is on and connected to the same Wi-Fi.": "無法{action}:手機連不上電腦上的 FreeVideo。請確認電腦已開機,並與手機連上同一個 Wi-Fi。", +"Couldn't capture this page. You can submit without it.": "沒能擷取這一頁,可以不帶截圖提交。", +"Couldn't open the browser. Click Copy address and open it in your browser.": "未能自動開啟瀏覽器。請點選「複製網址」,在瀏覽器中開啟。", +"Couldn't open the feedback page. Please try again later.": "沒能開啟意見回饋頁面,請稍後再試。", +"Couldn't open the feedback page. The link is copied; paste it into your browser.": "沒能開啟意見回饋頁面,連結已複製,請貼上到瀏覽器。", +"Couldn't read the diagnostic info. You can submit without it.": "沒能讀取診斷資訊,可以不帶它提交。", +"Couldn’t complete this step": "暫時未能完成", +"Cover canvas": "鋪滿畫布", +"Create ComfyUI Python environment": "建立 ComfyUI 環境", +"Create Python environment": "建立執行環境", +"Create a separate environment": "建立獨立的執行環境", +"Create desktop shortcut": "建立桌面捷徑", +"Create independent copies": "建立獨立副本", +"Created an editing project for you.": "已新增一個剪輯工程", +"Create␟创作面板": "創作面板", +"Create␟生成": "生成", +"Creating a new chat…": "正在新增對話…", +"Creation": "作品", +"Creations and export": "作品庫和匯出", +"Creations could not be loaded": "無法讀取作品", +"Creations marked with the heart": "點過愛心的作品", +"Creations␟作品": "作品", +"Creations␟作品库": "作品庫", +"Crop": "裁切", +"Crop and canvas": "裁切與畫布", +"Crop edge": "裁切", +"Crop for a video is set separately, with \"Adjust crop\".": "影片的裁切另在「調整裁切」中設定。", +"Crop or retouch {name}; it stays in its place": "裁切或修圖{name},改完放回原位", +"Crop the edges so the picture fills the frame": "裁掉多出的邊,鋪滿畫面", +"Crop, retouch or add text": "裁切、修圖或加文字", +"Crop, retouch or add text before generating. The original is always kept.": "在生成前裁切、修圖或加文字,原圖始終保留。", +"Crop, retouch, add text or layers": "裁切、修圖、加文字或圖層", +"Crossfade": "交叉淡化", +"Ctrl-click or check two videos in the history to compare them": "在右側作品欄按住 Ctrl 點或勾選兩段影片來對比", +"Cup": "杯子", +"Cupped": "托握", +"Current connection": "目前連線", +"Current version": "目前版本", +"Current version ": "目前版本 ", +"Current version {version}. Download it and replace this version; models and settings are kept.": "目前版本 {version}。下載新版後替換目前版本,模型和設定會保留。", +"Current version {version}. Updating keeps your models and settings and takes about a minute.": "目前版本 {version}。更新會保留模型和設定,約需 1 分鐘。", +"Custom ({steps} steps) is not downloaded yet": "「自訂({steps} 步)」還沒下載", +"Custom shape": "自訂畫面比例", +"Custom size␟自定义": "自訂", +"Custom size␟自定义尺寸": "自訂尺寸", +"Custom source": "自訂來源", +"Custom steps": "自訂步數", +"Custom␟自定": "自定", +"Custom␟自定义": "自訂", +"Cut clips, add sound and captions": "剪片段,配聲音和字幕", +"Cut the clip in two at the playhead": "在播放頭處把片段分成兩段", +"Cut to the beat": "對齊音樂節拍", +"Cut to the clipboard.": "已剪下到剪貼簿。", +"Cut, extend and add sound on a timeline": "在時間軸上剪輯、續寫、配聲音", +"Cut, join and add sound": "剪輯、拼接和配聲音", +"Cut␟剪切": "剪下", +"Cut␟剪开": "剪開", +"Dark": "深色", +"Dark appearance": "深色外觀", +"Dark panels, best for viewing": "深色介面,適合看畫面", +"Darken": "變暗", +"Declined": "已拒絕", +"Decoder": "解碼器", +"Decrement": "遞減", +"Default for the image view; clear lettering in images": "圖片檢視預設模型,圖中文字清晰", +"Delete": "刪除", +"Delete \"{name}\"? This can't be undone.": "刪除「{name}」?刪除後無法恢復。", +"Delete (to recently deleted)": "刪除(移到最近刪除)", +"Delete 1 ZIP file ({size})? This cannot be undone.": "刪除 {count} 個壓縮檔({size})?刪除後不能恢復。", +"Delete 1 creation?": "刪除 1 個作品?", +"Delete and close the gap": "刪除併合上空隙", +"Delete and free %s": "刪除並釋放 %s", +"Delete box": "刪除框", +"Delete character": "刪除角色", +"Delete creation": "刪除作品", +"Delete edit": "刪除剪輯", +"Delete every cached encoding": "刪除所有快取", +"Delete it for good; asks first": "永久刪除,會先確認", +"Delete it from the library": "從角色庫裡刪除", +"Delete it; undo for 10 seconds␟删除这个作品,10 秒内可撤销": "刪除這個作品,10 秒內可復原", +"Delete it; undo for 10 seconds␟删除这张图片,10 秒内可撤销": "刪除這張圖片,10 秒內可復原", +"Delete layer": "刪除圖層", +"Delete mask": "刪除遮罩", +"Delete model files no longer in use?": "刪除不再使用的模型檔案?", +"Delete now": "立即刪除", +"Delete on a selected gap": "選中空隙後按 Delete", +"Delete or restore creations": "刪除或恢復作品", +"Delete preset": "刪除預設", +"Delete prop": "刪除道具", +"Delete scene": "刪除場景", +"Delete style": "刪除樣式", +"Delete style {number}": "刪除樣式 {number}", +"Delete tag": "刪除標籤", +"Delete temporary files of finished videos": "刪除已完成影片的暫存檔", +"Delete the listed files for good": "徹底刪除清單上的檔案", +"Delete the selected (Delete)": "刪除選中的人物或道具(Delete)", +"Delete the selected clip and close the gap": "刪除選中的片段併合上空隙", +"Delete the selection": "刪除選中的內容", +"Delete the selection; undo for 10 seconds": "刪除選取的作品,10 秒內可復原", +"Delete the tag? Press again": "刪除這個標籤?再點一次", +"Delete this character from the library": "從角色庫刪除這個角色", +"Delete this chat for good": "確認刪除,無法復原", +"Delete this chat; you confirm first": "刪除這段對話,會先確認", +"Delete this clip": "刪除這個素材", +"Delete this clip?": "刪除這個素材?", +"Delete this creation?": "刪除這個作品?", +"Delete this empty sound track": "刪掉這條空的音軌", +"Delete this prop from the library": "從角色庫刪除這個道具", +"Delete this scene from the library": "從角色庫刪除這個場景", +"Delete this shape (Delete)": "刪除這個形狀(Delete)", +"Delete {count} ZIP files ({size})? This cannot be undone.": "刪除 {count} 個壓縮檔({size})?刪除後不能恢復。", +"Delete {count} creations?": "刪除 {count} 個作品?", +"Delete {count}␟删除 {count} 个": "刪除 {count} 個", +"Delete {count}␟删除 {count} 张": "刪除 {count} 張", +"Delete; undo for 10 seconds": "刪除,10 秒內可復原", +"Deleted creations can be brought back for 10 seconds.␟删除的作品 10 秒内可以撤销。": "刪除的作品 10 秒內可以復原。", +"Deleted creations can be brought back for 10 seconds.␟删除的作品在 10 秒内可以恢复。": "刪除的作品在 10 秒內可以恢復。", +"Deleted images stay here for {seconds} s, then they are gone.": "刪除的圖片在這裡保留 {seconds} 秒,之後永久刪除。", +"Deleted {deletedCount}": "已刪除 {deletedCount} 個", +"Deleted “{title}”": "已刪除「{title}」", +"Deleted.": "已刪除。", +"Deleted. The content after it cannot move earlier, so the gap remains.": "已刪除。後面的內容無法前移,空隙已保留。", +"Deleting…": "正在刪除…", +"Dependencies resolved": "元件檢查完成", +"Depth Anything V2 Small code and weights": "Depth Anything V2 Small 程式碼和權重", +"Depth only": "僅參考深度", +"Depth only uses a small model, which could not be downloaded or verified.": "「僅參考深度」需要一個小模型,這次未能下載或驗證未通過。", +"Describe": "按描述更換", +"Describe a scene to start": "寫一句描述,開始生成", +"Describe and generate": "描述並生成", +"Describe each part": "逐段描述", +"Describe how the picture changes, then choose \"Generate video\".": "在描述中寫明畫面如何變化,點一下「生⁠成⁠影⁠片」。", +"Describe it, then choose \"Generate\".": "填寫描述,然後點一下「生⁠成」。", +"Describe it; the assistant films it": "說想法,助手分鏡並拍完", +"Describe the character": "描述角色", +"Describe the character first": "先描述角色", +"Describe the character first.": "請先描述角色。", +"Describe the clothes first": "先描述服裝", +"Describe the clothes, e.g. a navy wool coat over a white shirt": "描述服裝,例如:白襯衫外穿藏青色羊毛大衣", +"Describe the image": "描述畫面", +"Describe the image first": "先寫一句描述", +"Describe the music": "描述配樂", +"Describe the music you want.": "描述想要的配樂。", +"Describe the part to generate": "描述要生成的片段", +"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 you want under \"Describe this part\".": "在「描述這一段」中寫下想看到的畫面。", +"Describe the prop": "描述道具", +"Describe the prop first.": "請先描述道具。", +"Describe the scene first.": "請先描述場景。", +"Describe the scene… Type @ to reference media": "描述畫面… 輸入 @ 引用素材", +"Describe the scene␟描述场景": "描述場景", +"Describe the scene␟描述画面": "描述畫面", +"Describe the shot, then choose the shape, size and length.": "用文字描述鏡頭,並選擇畫面比例、尺寸和時長。", +"Describe the shot…": "描述一個鏡頭…", +"Describe the video first.": "請先填寫影片描述。", +"Describe the video, and AI writes the shots, generates, and edits them.": "說出想要的影片,AI 寫分鏡、生成並剪輯。", +"Describe this part": "描述這一段", +"Describe what happens between the two images.": "在描述中寫明兩張圖之間發生了什麼。", +"Describe your scene": "描述畫面", +"Describe your video": "描述想生成的影片", +"Describing the image…": "正在描述圖片…", +"Describing the video…": "正在描述影片…", +"Deselect": "取消選區", +"Deselect (Ctrl+D)": "取消選擇(Ctrl+D)", +"Deselect all": "全不選", +"Deselect day": "取消這一天", +"Deselect every LoRA; the files stay": "取消選取所有 LoRA,檔案不刪", +"Desktop notification when done": "完成時發桌面通知", +"Detach audio": "分離原聲", +"Details": "詳情", +"Details and logs": "詳細資訊與記錄", +"Details and report": "詳情與提交問題", +"Details to add, if any (optional)": "可補充細節(選填)", +"Detect configuration": "檢測配置", +"Detect configuration for this installation folder.": "請檢測此目錄對應的安裝配置。", +"Detect configuration to load the pinned model licenses.": "先偵測設定,取得固定版本模型的授權條款。", +"Detect your hardware to see the installation plan.": "先偵測硬體,檢視安裝計畫。", +"Detecting the GPU": "正在偵測顯示卡", +"Development version": "開發版本", +"Device": "顯示卡總量", +"Device information is unavailable; compatibility settings are off.": "無法取得裝置資訊,相容性設定已關閉。", +"Diagnostic report": "診斷報告", +"Diagnostic report downloaded": "診斷報告已下載", +"Diagnostic report: hardware, settings and timings": "診斷報告:硬體、設定和耗時", +"Dialogue": "人聲", +"Did not finish": "沒有完成", +"Did not finish. Try again.": "沒有完成,請重試。", +"Did not finish: {line}": "沒有完成:{line}", +"Difference": "差值", +"Different aspect ratio from the video; it will be center-cropped.": "和影片比例不同,會置中裁切。", +"Direct": "直連", +"Direct only": "僅直連", +"Discard": "放棄修改", +"Discard this crop": "放棄這次裁切", +"Discard this sketch?": "放棄這張草圖?", +"Disconnect": "斷開", +"Disconnect it, or see how it is connected": "斷開,或檢視連線方式", +"Disconnecting…": "正在斷開…", +"Disk free": "磁碟可用", +"Disk full": "磁碟已滿", +"Disk needed": "磁碟需求", +"Disk space is insufficient": "磁碟空間不足", +"Disk:": "所在硬碟:", +"Dismiss this notice": "關掉這條提示", +"Dismiss␟关闭": "關閉", +"Dismiss␟收起": "收起", +"Divider between the two videos": "兩段影片的分界", +"Divider␟分割线": "分割線", +"Divider␟分界": "分界", +"Divider␟分界线": "分界線", +"Do not show this again": "以後不再顯示", +"Do this on the computer that runs FreeVideo": "在執行 FreeVideo 的電腦上操作", +"Don't ask again": "不再提示", +"Done this step": "這步做好了", +"Done · ": "已完成 · ", +"Done. Next: ": "做完了。下一篇:", +"Done␟完成": "完成", +"Done␟已完成": "已完成", +"Double-click to rename": "按兩下重新命名", +"Download": "下載", +"Download \"Image generation models\" in the launcher first.": "請先在啟動器裡下載「圖片生成模型」。", +"Download \"{name}\" in the launcher first, {size}.": "先在啟動器裡下載「{name}」,{size}。", +"Download & upgrade": "下載並升級", +"Download ComfyUI": "下載 ComfyUI", +"Download PyTorch + CUDA": "下載執行元件", +"Download again; the part downloaded is kept": "重新下載,已下載的部分會保留", +"Download ahead": "提前下載", +"Download and enable": "下載並啟用", +"Download and fix what the plan lists": "按計劃下載並修復缺少的部分", +"Download and generate": "下載並生成", +"Download and install the GPU runtime packages": "下載並安裝 GPU 執行元件", +"Download and install video and text encoding libraries": "下載並安裝生成元件", +"Download and prepare the private Python runtime": "準備執行環境", +"Download and turn on": "下載並啟用", +"Download and verify required files": "下載並驗證所需檔案", +"Download and verify the video model and text encoder": "下載並校驗模型", +"Download cache": "下載快取", +"Download click-select model": "下載點選模型", +"Download counter mismatch": "下載資料異常", +"Download directly, ignoring proxies.": "忽略代理,直接下載。", +"Download failed. Retry to continue.": "下載失敗,請重試以繼續。", +"Download from Quark or the web, then import.": "從夸克或網頁下載後匯入。", +"Download from Quark ↗": "開啟夸克網盤 ↗", +"Download from the release page ↗": "去釋出頁手動下載 ↗", +"Download image": "下載圖片", +"Download image generation models": "下載圖片生成模型", +"Download interrupted": "下載中斷了", +"Download list": "下載清單", +"Download list exported to {folder}": "下載清單已匯出到 {folder}", +"Download memory budget reached": "正在調整下載方式", +"Download model code": "下載模型元件", +"Download model weights": "下載所需模型", +"Download models & continue": "下載模型並繼續", +"Download needed · {total} GB": "需下載 · {total} GB", +"Download needed␟需下载": "需下載", +"Download needed␟需要下载": "需要下載", +"Download needs attention": "下載未完成", +"Download now; a video or image being made may take longer": "現在就下載;正在進行的生成可能會變慢", +"Download only what's missing.": "自動補齊缺少的檔案。", +"Download paused. Retry to resume.": "下載已暫停,重試可繼續。", +"Download progress is saved. Retry installation; copy the details if it happens again.": "下載進度已保留,請點一下「重試安裝」。", +"Download prompt model": "下載提示詞模型", +"Download report␟“下载报告”": "「下載報告」", +"Download report␟下载报告": "下載報告", +"Download response too large": "下載資料異常", +"Download size updated. ": "下載量已更新。", +"Download source": "下載來源", +"Download source failed": "下載來源暫不可用", +"Download the Environment ZIP from Quark, then import it here. Model packages come next.": "從夸克下載「執行環境」ZIP,在這裡匯入。模型包放在下一步。", +"Download the Replace person model again": "重新下載替換人物模型", +"Download the Replace person model now": "現在下載替換人物模型", +"Download the faster model": "下載更快的模型", +"Download the files with the exported list and place them as its README.txt describes. Back in the launcher, choose Resume on Image generation models; FreeVideo checks every file before using it.": "用匯出的清單下載這些檔案,按清單裡 README.txt 的說明放好。回到啟動器,在「圖片生成模型」處點一下「繼續」,FreeVideo 校驗每個檔案後才會使用。", +"Download the image model in the launcher first.": "請先在啟動器中下載圖片模型。", +"Download the latest ↗": "下載最新版 ↗", +"Download the models into this offline installation.": "把模型下載到這個離線安裝裡。", +"Download the optional model to enable enhancement.": "下載可選模型後可啟用。", +"Download the prompt model to your model folder.": "下載提示詞模型,放入模型目錄。", +"Download the replacement model again": "重新下載替換人物用的模型", +"Download the rewriting model, then use it": "下載改寫模型後自動啟用", +"Download the vae and audio_vae folders.": "下載 vae 和 audio_vae 資料夾。", +"Download the video model before generating": "下載影片模型後才能生成影片", +"Download this image model": "下載這個圖片模型", +"Download this model to use it here": "下載這個模型後即可使用", +"Download too slow": "下載速度過低", +"Download update": "下載新版", +"Download verified source code": "下載元件檔案", +"Download video": "下載影片", +"Download with your account this session": "本次執行用帳號額度下載", +"Download {size}": "需下載 {size}", +"Download ↗": "去下載 ↗", +"Download ␟下载 ": "下載 ", +"Download ␟正在下载": "正在下載", +"Downloaded when Replace person is first used": "開啟「替換人物」時自動下載", +"Downloaded · choose folder…": "已下載,選擇資料夾…", +"Downloaded. Restart to finish; models and settings are kept.": "下載完成,重新啟動可完成更新,模型和設定都會保留。", +"Downloaded; verifying": "已下載,正在校驗", +"Downloading 1 creation": "正在下載 1 個作品", +"Downloading Fast · {done} / {total}": "正在下載極⁠速⁠檔 · {done} / {total}", +"Downloading Fast…": "正在下載極⁠速⁠檔…", +"Downloading components": "正在下載元件", +"Downloading files for generation": "正在下載生成所需檔案", +"Downloading model files": "下載模型檔案", +"Downloading models": "下載模型", +"Downloading packages": "下載元件", +"Downloading packages · about (.+) across (\\d+) files": "下載元件 · 約 \\1,共 \\2 個檔案", +"Downloading runtime packages": "正在下載執行元件", +"Downloading the Replace person model · {done} / {total}": "正在下載替換人物模型 · {done} / {total}", +"Downloading the Replace person model…": "正在下載替換人物模型…", +"Downloading the diagnostic report failed: {reason}": "下載診斷報告時出錯:{reason}", +"Downloading the dubbing model": "正在下載配音模型", +"Downloading the dubbing model {value}%": "正在下載配音模型 {value}%", +"Downloading the faster model": "正在下載更快的模型", +"Downloading the model": "下載模型", +"Downloading the model · {done} / {total} GiB": "正在下載模型 · {done} / {total} GiB", +"Downloading the prompt model · {done} / {total}": "正在下載提示詞模型 · {done} / {total}", +"Downloading the separation model": "正在下載分離模型", +"Downloading the separation model {percent}%": "正在下載分離模型 {percent}%", +"Downloading the update": "正在下載更新", +"Downloading update {percent}": "正在下載更新 {percent}", +"Downloading {count} creations": "正在下載 {count} 個作品", +"Downloading {name}": "正在下載{gap}{name}", +"Downloading {percent}%; usable when done": "正在下載 {percent}%,完成後即可使用", +"Downloading {share}%": "正在下載 {share}%", +"Downloading · {done} GB / {size}{time}": "正在下載 · {done} GB / {size}{time}", +"Downloading. Available when finished.": "正在下載,完成後可用。", +"Downloading…": "正在下載…", +"Downloading␟下载中": "下載中", +"Downloading␟正在下载": "正在下載", +"Downloads": "下載", +"Downloads before generating: dubbing model {size}": "生成前會先下載:配音模型 {size}", +"Downloads before generating: music model {size}": "生成前會先下載:配樂模型 {size}", +"Downloads before generating: {items}{wait}": "生成前會先下載:{items}{wait}", +"Downloads continue from the new source, keeping progress where supported.": "切換後繼續下載,支援續傳的檔案會保留進度。", +"Downloads first": "需先下載", +"Downloads ready": "下載完成", +"Downloads {short}, then makes the image": "先下載 {short},再生成圖片", +"Draft small, then refine: usually faster": "先小後精,通常更快", +"Drag": "拖曳", +"Drag a part to pose it; drag the paper to turn the camera.": "拖曳身體擺姿勢,拖曳空白處轉動機位。", +"Drag a picture clip or the edge of a clip. Grey beat lines appear on the \"Audio 2\" track.": "拖曳畫面片段或片段的邊緣,「聲音 2」軌上會出現灰色的拍點線。", +"Drag a range on an empty part of the \"Audio 2\" track.": "在「聲音 2」軌的空白處拖出一段。", +"Drag a range on the sound track and add music, a voice-over or a recording.": "在音軌上拖一段,加配樂、旁白,或錄一段聲音。", +"Drag a range on the timeline first": "先在時間軸上拖出一段", +"Drag a video here.": "把影片拖到這裡。", +"Drag across the image.": "在畫面上拖曳。", +"Drag an empty range on the video track above a sound, and the picture follows it.": "在有聲音的區間上方的影片軌拖出一段空白,畫面隨聲音生成。", +"Drag for more or fewer pixels; marks are the usual sizes": "拖曳調像素數,刻度是常用尺寸", +"Drag it in": "拖進來", +"Drag media onto the timeline, or describe a shot below and generate it.": "把素材拖到時間軸上,或在下方描述後生成。", +"Drag on the timeline to choose a part first.": "先在時間軸上拖出一段。", +"Drag onto the timeline, or press + to add": "拖到時間軸,或按加號加入", +"Drag the ends on the timeline to set when they appear, and change the font, size and colour in the panel on the right.": "在時間軸上拖曳兩端調整出現的時間;在右側面板中改字型、大小和顏色。", +"Drag the frame on the picture to trim edges": "在畫面上拖邊框,裁掉多餘部分", +"Drag the playhead to the picture you want, or press Space to play and pause there.": "把播放頭拖到想要的畫面上,也可按空白鍵播放、暫停後停在該處。", +"Drag the right edge to make a part longer; drag in an empty spot to add one.": "拖右邊緣,把這一段拉長;在空白處拖出新的一段。", +"Drag to another corner": "拖到其他角落,放開即貼齊", +"Drag to draw a shape.": "請拖曳畫出形狀。", +"Drag to draw in the foreground color.": "拖曳繪製,使用前景色。", +"Drag to enlarge or shrink this part's picture": "拖曳放大或縮小這段畫面", +"Drag to move it; Delete removes it": "拖曳可移動,Delete 刪除", +"Drag to move through the edit␟拖动到要看的画面": "拖曳到要看的畫面", +"Drag to move through the edit␟拖动来移动播放位置": "拖曳來移動播放位置", +"Drag to move through the video␟拖动以跳到视频的任意位置": "拖曳以跳到影片的任意位置", +"Drag to move through the video␟拖动跳到视频的任意位置": "拖曳跳到影片的任意位置", +"Drag to move; double-click to edit": "拖曳移動,按兩下改內容", +"Drag to pan. Hold Space to pan with any tool; Ctrl + wheel zooms.": "拖曳平移。用任何工具時按住空格也能平移,Ctrl + 滾輪縮放。", +"Drag to reorder": "拖曳調整順序", +"Drag to scale the picture": "拖曳來縮放畫面", +"Drag to see more of either video": "拖曳來多看一邊", +"Drag to set how loud the preview plays": "拖曳調整預覽的響度", +"Drag to set the length, one second a step": "拖曳設定時長,每格 1 秒", +"Drag to set the pixel count": "拖曳選擇像素數,寬高隨之變化", +"Drag to set what stays in frame": "拖曳來調整保留的範圍", +"Drag to show more or less time": "拖曳調整時間軸的疏密", +"Drag, or type width × height": "拖曳,或輸入寬 × 高", +"Drag, or use the arrow keys␟拖动或用方向键移动": "拖曳或用方向鍵移動", +"Drag, or use the arrow keys␟拖动,或用方向键": "拖曳,或用方向鍵", +"Draw a sketch": "畫草圖", +"Draw again": "重畫", +"Draw something first.": "先畫點什麼。", +"Draw the layout on a blank canvas of this frame; it becomes Image 1": "在目前畫面比例的空白畫布上畫出構圖,作為圖 1", +"Drawing": "繪製中", +"Drawing lines from the reference video": "正在把參考影片轉成線稿", +"Dress the character as the prompt says": "按提示詞裡的服裝生成", +"Dress the character in the clothes of an image": "換上服裝圖裡的衣服", +"Dress the views as described": "各視角按描述更換服裝", +"Dress the views as in the image": "各視角保持圖片裡的服裝", +"Dress the views as in the photo": "各視角保持照片裡的服裝", +"Dress the views in the clothes of an image": "各視角換上服裝圖裡的衣服", +"Drop a photo of the person here, or choose one": "把人物照片拖到這裡,或按一下選擇", +"Drop an image of the character here, or choose one": "把角色圖片拖到這裡,或按一下選擇", +"Drop images or video here": "拖入圖片或影片", +"Drop images or videos here, or click Add": "把圖片或影片拖到這裡,或點一下「新增」", +"Drop it here, or choose one": "拖到這裡,或按一下選擇", +"Drop model ZIPs here — no extraction needed": "將模型 ZIP 拖到這裡,無需解壓", +"Drop or choose images, video or audio": "拖入或選擇圖片、影片、音訊", +"Drop the Environment ZIP here — no extraction needed": "將「執行環境」ZIP 拖到這裡,不需解壓縮", +"Drop them back onto FreeVideo to bring back the settings they were made with. Each original is kept as a backup.": "把它們拖回 FreeVideo 即可還原生成時的設定。每個原影片都另存了一份備份。", +"Dropped for a faster source": "速度較慢,已換用其他來源", +"Dub: in the original speaker's voice": "配音:沿用原說話人的聲音", +"Dubbing did not finish. The edited lines are kept. Redub them to try again.": "配音未完成,所改台詞已保留,請重新配音。", +"Dubbing is not available on this computer.": "這台電腦上無法使用配音。", +"Dubbing model download": "配音模型下載", +"Dubbing · line {index} of {count}{time}": "正在配音 · 第 {index}/{count} 句{time}", +"Dubbing{time}": "正在配音{time}", +"Dubbing␟正在配音": "正在配音", +"Dubbing␟配音中": "配音中", +"Duplicate": "建立副本", +"Duplicate layer": "複製圖層", +"Duration": "時長", +"Duration (s)": "時長(秒)", +"Duration in seconds": "時長(秒)", +"Duration · seconds": "時長 · 秒", +"ETA ~{time}": "預計剩餘約 {time}", +"Each added part is at least 5 seconds, and the last one can be as short as 2 seconds. One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds, and the creation panel accepts up to 60 seconds. For a storyboard, add shots one by one in Edit, or use Autopilot.": "接著生成的每一段至少 5 秒,最後一段可短至 2 秒。一個連續鏡頭最多 8 段,有短於 10 秒的段時最多 4 段;創作面板中時長最長 60 秒;分鏡劇本可在剪輯檢視中逐個鏡頭新增,或用 AI 全自動。", +"Each graphics card runs one request at a time, and the others wait in the queue.": "每張顯示卡同一時間處理一個請求,其餘請求在佇列中等待。", +"Each image must be under 10 MB.": "每張圖片不能超過 10 MB。", +"Each kind of file downloads from its fastest source": "每類檔案會從最快的來源下載", +"Each level is generated on its own, so the composition may differ and the results should not be compared frame by frame.": "不同等級各自生成,畫面構圖可能不同,不宜逐格比較。", +"Each line is one video, sent as written without enhancement": "每行生成一個影片,按原文傳送,不做描述增強", +"Each line of the prompt is one video": "提示詞的每一行生成一個影片", +"Each line of the prompt is one video, sent as written without enhancement.": "提示詞的每一行生成一個影片,按原文傳送,不做提示詞增強。", +"Each line of the prompt is one video.": "提示詞的每一行生成一個影片。", +"Each original video is kept as a backup.": "每個原影片都會另存一份備份。", +"Each part can now be replaced on its own.": "每條軌道現在都可以單獨替換。", +"Each part of a longer shot has its own prompt.": "較長鏡頭的每一段,各有各的提示詞。", +"Each part of a video made in parts uses the Light level.": "分段生成時,每段使用輕量檔。", +"Each part of a video made in parts uses the Medium level.": "分段生成時,每段使用標準檔。", +"Each part runs a second pass": "每段使用第二階段", +"Each part starts from the first frame: less drift": "每段參照首影格,減小畫面漂移", +"Each reference image counts as one media item.": "每張參考圖片各佔一個素材名額。", +"Each run makes one continuous shot, split into up to 8 parts when longer. ": "每次生成一個連續鏡頭,較長時自動分段,最多 8 段。", +"Each side is set on its own": "兩邊各自設定", +"Each time must be within the video length.": "時間必須在影片時長以內。", +"Each video and image the assistant makes is listed here, with its prompt, time and state.": "助手生成的每段影片和每張圖片都會列在這裡,帶提示詞、時間和狀態。", +"Earlier": "更早", +"Earlier prompts": "用過的提示詞", +"Earlier versions left reference images among your own files. Check each one before deleting it.": "舊版本的參考圖與其他檔案混在一起,請逐張確認後刪除。", +"Earliest images at the top": "按時間從舊到新排列", +"Edit an image": "編輯圖片", +"Edit and sound": "剪輯與聲音", +"Edit character": "編輯角色", +"Edit image␟改这张": "改這張", +"Edit image␟编辑图片": "編輯圖片", +"Edit lines one by one": "逐句改台詞", +"Edit lines: only changed lines are redubbed": "修改台詞:只為改過的台詞重新配音", +"Edit message": "編輯訊息", +"Edit name␟修改名字": "修改名字", +"Edit name␟剪辑名称": "剪輯名稱", +"Edit prompt": "修改提示詞", +"Edit prop": "編輯道具", +"Edit scene": "編輯場景", +"Edit takes images only. Add reference videos and audio under \"Media\" in the creation panel.": "剪輯檢視只能新增圖片;參考影片和音訊在創作面板的「素材」中新增。", +"Edit the prompt in a large box": "在大文本框裡編輯提示詞", +"Edit this": "改這張", +"Edit view": "剪輯檢視", +"Edited␟已编辑": "已編輯", +"Edited␟改图": "改圖", +"Editing": "編輯", +"Editing tracks": "剪輯軌道", +"Editor": "編輯器", +"Editor diagnostic report": "剪輯器診斷報告", +"Editor generation": "剪輯器生成", +"Editor media library": "剪輯器素材庫", +"Editor reference images": "剪輯器參考圖", +"Editor text fonts": "剪輯器文字字型", +"Edit␟剪辑": "剪輯", +"Edit␟剪辑任务": "剪輯任務", +"Edit␟剪辑生成": "剪輯生成", +"Edit␟剪辑视图": "剪輯檢視", +"Edit␟编辑": "編輯", +"Effects": "效果", +"Elapsed": "已用時", +"Elapsed {time}␟已用 {time}": "已用 {time}", +"Elapsed {time}␟已用时 {time}": "已用時 {time}", +"Electronic": "電子", +"Ellipse": "橢圓", +"Empty this list; creations stay": "清空列表,作品仍在作品庫", +"Empty: new each time; a number repeats an image": "留空每次不同;填數字可復現同一張", +"Enable LoRA": "啟用 LoRA", +"Enable up to 3 middle frames.": "中間影格最多啟用 3 張圖片。", +"Encoder configuring": "正在準備提示詞模型", +"Encoder importing": "正在載入提示詞模型", +"Encoder ready": "提示詞模型已就緒", +"End solo": "取消獨奏", +"End the walkthrough": "結束演示,回到正常介面", +"Ended without a result": "沒有傳回結果", +"End␟终点": "終點", +"End␟结尾": "結尾", +"Engine folder": "引擎目錄", +"Engine in use: build {build}": "正在使用的引擎:建置編號 {build}", +"Engine in use: {version}": "正在使用的引擎:{version}", +"Engine in use: {version} (build {build})": "正在使用的引擎:{version}(建置編號 {build})", +"Engine offline": "引擎已斷開", +"Engine update": "引擎更新", +"Engine {version}": "引擎 {version}", +"English interface": "切換到英文介面", +"Enhance": "增強", +"Enhanced": "改寫", +"Enhancement can read only images and videos added in Media. You can keep using the original.": "增強只能讀取素材中新增的圖片和影片,可先使用原文生成。", +"Enhancement cannot read audio. Add images or videos in Media, or use the original.": "增強讀不到音訊,請在素材中新增圖片或影片,或使用原文。", +"Enhancement cannot read connected nodes. Add images or videos in Media, or use the original.": "增強讀不到連接節點的素材,請在素材中新增圖片或影片,或使用原文。", +"Enhancing prompt": "增強提示詞", +"Enlarge or shrink this clip’s picture": "放大或縮小這一段的畫面", +"Enter a \"Name\" and add images: choose \"Upload images\" or \"Generate with AI\". A scene takes up to 3 images, a prop 1.": "填寫「名稱」,新增圖片:可「上傳圖片」,也可「AI 生成」。場景最多 3 張圖片,道具 1 張。", +"Enter a \"Name\" and add images: choose \"Upload images\", or \"Generate with AI\" or \"From a photo\", which make a face close-up, front, side and back view.": "填寫「名字」,新增圖片:可「上⁠傳⁠圖⁠片」,也可「AI 生成」或「從照片生成」,會生成臉部特寫、正面、側面和背面四張。", +"Enter a longer duration to generate in parts, or extend one part at a time.": "填寫更長的時長自動分段生成,也可逐段接續。", +"Enter a longer duration. It is made in parts automatically.": "填寫更長的時長,會自動分段生成。", +"Enter a longer duration. It is made in parts automatically. Choose the frame button (such as \"16:9 · 1M\"); \"Available sizes and lengths\" there shows how long each size can be and about how long it takes.": "填寫更長的時長,會自動分段生成;點畫面比例按鈕(如「16:9 · 1M」),在「可⁠生⁠成⁠範⁠圍」中可檢視各尺寸的最長時長和預計耗時。", +"Enter a name first": "先填寫名字", +"Enter a number from 0 to {MAX_MINUTES}.": "請輸入 0 到 {MAX_MINUTES} 之間的數字。", +"Enter a number in range": "請輸入範圍內的數", +"Enter a prompt first": "請先填寫提示詞", +"Enter a prompt first.": "請先填寫提示詞。", +"Enter a prompt of up to 12,000 characters.": "請輸入不超過 12,000 字元的提示詞。", +"Enter a speed from 0.25× to 4×.": "請輸入 0.25× 至 4× 的速度。", +"Enter a time in seconds.": "請填寫時間(秒)。", +"Enter a value.": "請輸入數值。", +"Enter a whole number, or leave it empty": "請輸入整數,或留空", +"Enter at least {least} GiB, or turn on Automatic optimization.": "請輸入不小於 {least} GiB 的數值,或開啟「自動最佳化」。", +"Enter localhost or an IP address of this computer, for example http://127.0.0.1:8188.": "請輸入 localhost 或本機的 IP 位址,例如 http://127.0.0.1:8188。", +"Enter password": "輸入密碼", +"Enter whole numbers from 1 to 20000 for width and height.": "寬和高請填 1 到 20000 的整數。", +"Enter whole numbers from 1 to 20000.": "請輸入 1 到 20000 的整數。", +"Environment": "環境", +"Environment creating": "正在建立執行環境", +"Environment ready. Import the model packages in the next step.": "執行環境已就緒,下一步匯入模型包。", +"Erase every stroke": "擦掉全部筆畫", +"Eraser␟橡皮": "橡皮", +"Eraser␟橡皮擦": "橡皮擦", +"Erases pixels of the selected layer.": "擦除目前圖層的像素。", +"Error code": "錯誤碼", +"Error details": "錯誤詳情", +"Error summary download started.": "已開始下載錯誤摘要。", +"Estimate time / memory": "預估耗時/記憶體", +"Estimating remaining time…": "正在估算剩餘時間…", +"Estimating time…": "正在估算用時…", +"Estimating…␟估算中…": "估算中…", +"Estimating…␟正在估算…": "正在估算…", +"Every character, scene and prop": "全部角色、場景和道具", +"Every file was checked.": "已檢查全部檔案。", +"Every image made here": "在這裡生成的所有圖片", +"Every key this page answers to": "這個頁面的全部快捷鍵", +"Every keyboard shortcut in this view": "查看這個檢視的全部快捷鍵", +"Every shortcut of every view": "所有檢視的快捷鍵", +"Every video and image": "所有影片和圖片", +"Every video and image made here": "生成過的全部影片和圖片", +"Everyone standing, the camera in front": "人物回到站立,機位回到正面", +"Everything at once": "一次看全部", +"Everything is read": "都已讀過", +"Everywhere": "全域", +"Example": "範例", +"Example part": "範例片段", +"Examples": "範例", +"Existing dialogue can be changed line by line: select a clip on the dialogue track, edit the words under \"Lines\" and choose \"Redub\".": "已有的人聲可逐句改寫:選中「人聲」軌上的片段,修改「台詞」中的文字,點一下「重⁠新⁠配⁠音」。", +"Existing installation connected. Ready to generate.": "已連接現有安裝,可以生成。", +"Existing model folder": "已有模型資料夾", +"Existing model folder (optional)": "已有模型資料夾(可選)", +"Existing models checked": "已有模型檢查完成", +"Exit": "結束", +"Exit code {code}": "結束代碼 {code}", +"Exit full screen": "離開全螢幕", +"Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the menu bar icon.": "結束會停止 FreeVideo。在背景執行時 FreeVideo 繼續執行,可從選單列圖示重新開啟此視窗。", +"Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the taskbar.": "結束會停止 FreeVideo。在背景執行時 FreeVideo 繼續執行,可從工作列重新開啟此視窗。", +"Exit stops FreeVideo. In the background, FreeVideo keeps running, and this window can be reopened from the tray icon.": "結束會停止 FreeVideo。在背景執行時 FreeVideo 繼續執行,可從系統匣圖示重新開啟此視窗。", +"Expand \"Media\" in the creation panel and choose + on the \"Scenes\" or \"Props\" row.": "展開創作面板的「素材」,在「場景」或「道具」一行點一下「+」新增。", +"Expand \"Media\" in the creation panel and turn on \"Replace person\".": "展開創作面板的「素材」,開啟「替換人物」。", +"Expand \"Media\" in the creation panel and, on the \"Characters\" row, choose + to create a character.": "展開創作面板的「素材」,在「角色」一行點一下「+」新增角色。", +"Expand \"Media\" in the creation panel, click the image (or \"Edit\" at its top) to open \"Edit image\".": "展開創作面板的「素材」,點圖片(或圖片上方的「編輯」),開啟「編輯圖片」。", +"Expand \"Media\" in the creation panel, turn on \"Replace person\" and add the video under \"Source video\".": "展開創作面板的「素材」,開啟「替換人物」,在「來源影片」中新增影片。", +"Expand \"Media\" in the creation panel, upload an image, then choose the image, or \"Edit\" at its top.": "展開創作面板的「素材」,上傳圖片後點圖片,或點圖片上方的「編輯」。", +"Expand␟展开": "展開", +"Expand␟展开编辑": "展開編輯", +"Explain a feature once, beside it, the first time": "第一次用到某個功能時,在它旁邊說明一次", +"Export": "匯出", +"Export a video or image to send": "匯出可傳送的影片或圖片", +"Export cancelled. No unfinished file is kept.": "已取消匯出,沒有留下不完整的檔案。", +"Export could not complete. Try again.": "分享影片匯出未完成,請重試。", +"Export diagnostics": "匯出診斷包", +"Export download list": "匯出下載清單", +"Export failed. Try again.": "匯出時出錯,請再試一次。", +"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: {error}": "匯出失敗:{error}", +"Export failed: {message}": "匯出時出錯:{message}", +"Export frame": "匯出畫面", +"Export report": "匯出報告", +"Export stems": "匯出分軌", +"Export the edit": "匯出剪輯", +"Export {percent}%": "匯出 {percent}%", +"Exporting full logs…": "正在匯出完整日誌…", +"Exporting the share video failed: the disk is full. Free some space, then export again.": "匯出分享影片時出錯:磁碟空間不夠,空出空間後再匯出。", +"Exporting the share video · Frame {frame} · {time} elapsed": "正在匯出分享影片 · 第 {frame} 影格 · 已用 {time}", +"Exporting the share video · Frame {frame} of {total} · {time} elapsed": "正在匯出分享影片 · 第 {frame} 影格,共 {total} 影格 · 已用 {time}", +"Exporting the share video…": "正在匯出分享影片…", +"Exporting the video failed": "匯出成片時出錯", +"Exporting. You can export again when it finishes.": "正在匯出,完成後可以再匯出一次。", +"Exporting; it goes to the library when done": "正在匯出,完成後進入作品庫", +"Exporting␟导出中": "匯出中", +"Exporting␟正在导出": "正在匯出", +"Exposure": "曝光", +"Extend a shot or start a new one": "接著生成,還是另起鏡頭", +"Extend a video you already have from its end.": "從一段已有影片的結尾繼續往下生成。", +"Extend an existing video": "延長已有影片", +"Extend and new shots both need an NVIDIA graphics card or a Mac.": "接著生成和另起鏡頭都需要 NVIDIA 顯示卡或 Mac。", +"Extend from the end, or arrange it in Edit.": "從結尾繼續下一段,或到剪輯檢視裡排列。", +"Extend from the finished video instead": "改為從完整影片重新接續", +"Extend from video": "接著生成", +"Extend from where the last clip ends.": "從上一段的結尾接著生成下一段。", +"Extend is not available in this version. Update FreeVideo and try again.": "目前版本不支援接著生成。請更新 FreeVideo 後重試。", +"Extend it into a longer video": "接著生成更長的影片", +"Extend makes the next part of the same shot. A part dragged out in an empty place on the timeline is a new shot.": "接著生成是同一個鏡頭的下一段;在時間軸空白處另起的是新鏡頭。", +"Extend the canvas with the background color instead of cropping": "用背景色補邊到影片比例,不裁掉畫面", +"Extend the selection": "擴大選取範圍", +"Extend this video␟接着生成": "接著生成", +"Extend this video␟接着生成这条视频": "接著生成這段影片", +"Extend video": "延長影片", +"Extending a video needs an NVIDIA GPU or a Mac. To make a new video, clear \"Extend from video\".": "接續影片需要 NVIDIA 顯示卡或 Mac。要生成新影片,請清空「接著生成」。", +"Extending needs an NVIDIA graphics card or a Mac.": "接續需要 NVIDIA 顯示卡或 Mac。", +"Extending needs the faster second pass": "接續需要第二階段加速", +"Extends this video": "接在這段影片後面", +"Extend␟拉长": "拉長", +"Extend␟接着生成": "接著生成", +"Extra VRAM to keep free. Applies from the next generation.": "額外保留的空閒顯示卡記憶體,下次生成起生效。", +"Extra disk space": "額外佔用磁碟", +"Extra memory to keep for the system and other apps. Applies from the next generation.": "額外保留給系統和其他程式的記憶體,下次生成起生效。", +"Extract the whole package again, and check that security software has not removed any files.": "請重新完整解壓安裝包,並檢查安全軟體是否刪掉了檔案。", +"Extracting depth from the reference video": "正在提取參考影片的深度", +"Extracting depth needs free GPU memory, and other programs were using it.": "提取深度需要空閒顯示卡記憶體,當時被其他程式佔用。", +"Eyedropper": "吸管", +"Face␟脸部": "臉部", +"Face␟脸部特写": "臉部特寫", +"Fade in": "淡入", +"Fade in and out": "淡入淡出", +"Fade out": "淡出", +"Failed": "失敗", +"Failed step: kernels (exit code ": "失敗步驟:GPU 檢查(結束代碼 ", +"Failed · ": "出錯了 · ", +"Failed — open details or export diagnostics": "未完成,可檢視詳情或匯出診斷", +"Failed: “{name}”": "「{name}」沒有完成", +"Fast images, up to 4 references": "出圖快,最多 4 張參考圖", +"Fast level download: about {size}, one time only.": "極⁠速⁠檔需下載約 {size},只需下載一次。", +"Fast makes the full size in one pass. Choose another level to use it.": "極速檔一次生成全解析度。選其他等級後可用。", +"Fast uses one pass": "極速檔一次生成", +"Faster second pass": "第二階段加速", +"Faster; fine detail may flicker": "更快,畫面細節可能閃爍", +"Fastest, for trying ideas": "最快,適合試效果", +"Fastest, with less detail": "最快,細節較少", +"Favorite images at the top": "收藏的圖片排在前面", +"Favorite, share, copy the prompt, delete and more": "收藏、分享、複製提示詞、刪除等", +"Favorited": "已收藏", +"Favorites": "收藏", +"Favorites first": "收藏在前", +"Favorite␟已收藏": "已收藏", +"Favorite␟收藏": "收藏", +"Feather": "羽化", +"Feature example": "功能範例", +"Feature examples": "功能範例", +"Featured": "精選", +"Feedback": "意見回饋", +"Female": "女", +"Fetch the model once, then say the line": "下載一次模型,然後生成這句", +"File checksum did not match": "檔案校驗不符", +"File size did not match": "檔案大小不符", +"File time left": "本檔案預計剩餘", +"Files": "檔案", +"Files added from this computer": "從電腦加入的檔案", +"Files in the LoRA folder": "LoRA 資料夾中的檔案", +"Files in the installation folder changed after you confirmed, so installation stopped. Click Check installation, then Install.": "確認之後安裝位置裡的檔案有變化,已停止。請先點一下「檢查安裝」,再點一下「安裝」。", +"Files in the installation folder changed after you confirmed.": "確認之後安裝位置裡的檔案有變化。", +"Files intact": "檔案完好", +"Fill color": "補邊顏色", +"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 longest part length.": "請填寫每段最長時長。", +"Fill in the number of videos.": "請填寫生成數量。", +"Fill in the preset name.": "請填寫預設名稱。", +"Fill in the second-pass steps.": "請填寫第二階段步數。", +"Fill in the seed.": "請填寫種子。", +"Fill in the width.": "請填寫寬度。", +"Fill in this example prompt": "把這條範例填進提示詞", +"Fill in this example to generate": "把範例的描述和素材填進去", +"Fill the creation panel with these settings": "把這次的設定填回創作面板", +"Fill the panel with this video's prompt, size and length": "把這條影片的提示詞、尺寸和時長填回面板", +"Fill the panel with this video’s settings": "把這部影片的設定填回面板", +"Fill the prompt, size, duration and seed of an earlier video back in.": "把以前一段影片的描述、尺寸、時長和種子填回來。", +"Fill the prompt, size, duration and seed of an earlier video back into the creation panel.": "把之前一段影片的描述、尺寸、時長和種子填回創作面板。", +"Fill the screen with the picture": "畫面鋪滿整個螢幕", +"Fill this example in Autopilot": "在 AI 全自動裡填好這個範例", +"Fill with the foreground color (Alt+Delete)": "用前景色填充(Alt+Delete)", +"Filled": "已鋪滿", +"Filled in": "已填入", +"Fills the prompt, media and settings together": "提示詞、素材和參數會一起填好", +"Fill␟填充": "填充", +"Fill␟铺满": "鋪滿", +"Film": "成片", +"Film this plan now": "按這份計劃開拍", +"Filter": "篩選", +"Finalizing": "正在收尾", +"Find a character, scene or prop by name": "按名稱搜尋角色、場景或道具", +"Find a chat by its name": "按名稱找到一段對話", +"Find a setting by its name": "按名稱搜尋設定", +"Find a shortcut": "搜尋快捷鍵", +"Find a task by its prompt or name": "按提示詞或名稱找到任務", +"Find by name or description": "按名稱和描述搜尋", +"Find by prompt or file name": "按提示詞或檔名搜尋", +"Find by title, summary and steps": "按標題、說明和步驟找", +"Find creations by prompt or name": "按提示詞或名稱搜尋作品", +"Find earlier videos and export them as files.": "找到生成過的影片,並匯出為檔案。", +"Find existing models": "尋找已有模型", +"Find images by their prompt": "按提示詞搜尋圖片", +"Find the saved image under \"Edit image > Generate with AI > Creations\".": "儲存後,在「編輯圖片 > AI 生成 > 作品庫」中找到這張圖片。", +"Find videos by their prompt": "按提示詞查詢影片", +"Finding existing models": "正在尋找已有模型", +"Finding files": "正在尋找檔案", +"Finding the lines␟正在识别台词": "正在識別台詞", +"Finding the lines␟识别台词": "識別台詞", +"Finding the object": "正在找出物體", +"Fine": "細", +"Fine details of an object may differ slightly between runs.": "物品的細節可能每次略有不同。", +"Finer levels take longer": "越細用時越長", +"Finish ComfyUI setup": "完成 ComfyUI 安裝", +"Finish and hide": "結束並收起", +"Finish model placement": "完成模型載入", +"Finish model storage": "完成模型準備", +"Finish or delete tasks you no longer need before continuing": "繼續前,先完成或刪除不需要的任務", +"Finish setup": "完成安裝", +"Finish the current queue before enhancing this prompt.": "請等待目前佇列完成後再改寫。", +"Finish the current queue before writing a prompt from media.": "請等待目前佇列完成後再生成提示詞。", +"Finish the full-resolution video": "從預覽繼續生成全解析度影片", +"Finish the installation or repair in the launcher or in Settings, then try again": "在啟動器或設定中完成安裝或修復後再試", +"Finish this one, then start no more": "做完這一個就不再繼續", +"Finished": "已完成", +"Finished 24 fps videos can be upscaled. For a preview, run the second pass first.": "生成完成的 24 fps 影片可以放大;預覽請先繼續第二階段,再放大。", +"Finished and failed generations show up here.": "生成完成或失敗時會出現在這裡。", +"Finished videos and images": "成片與圖片", +"Finished videos and images appear here.": "生成完成的影片和圖片會儲存在這裡。", +"Finished, failed and installing": "完成、失敗和安裝進度", +"Finishing": "收尾中", +"Finishing sound": "聲音收尾", +"First + last frame · 1 middle frame": "首尾影格生成 · 1 張中間影格", +"First + last frame · {count} middle frames": "首尾影格生成 · {count} 張中間影格", +"First and last frame": "首影格和尾影格", +"First and last frames": "首影格和尾影格", +"First and last frames can be used together and are center-cropped to the frame shape. They can also be used with reference images or videos (not yet on a Mac).": "首影格和尾影格可同時使用,會按畫面比例居中裁切;也可以與參考圖、參考影片同時使用(Mac 上暫不支援)。", +"First frame": "首影格", +"First frame + last frame": "首影格 + 尾影格", +"First prompt rewrite downloads {size}{wait}": "首次改寫提示詞會先下載 {size}{wait}", +"First-block cache": "首塊快取", +"First-frame reference": "首影格參考", +"First-pass preview": "第一階段預覽", +"First-pass preview · {width} × {height}": "第一階段預覽 · {width} × {height}", +"First-pass previews": "第一階段預覽", +"First-pass steps": "第一階段步數", +"Fist": "握拳", +"Fit": "完整顯示", +"Fit all␟全部完整显示": "全部完整顯示", +"Fit all␟看全部": "看全部", +"Fit everyone in the image": "全部人物入畫", +"Fit the whole edit in view␟整条剪辑放进当前宽度": "整條剪輯放進目前寬度", +"Fit the whole edit in view␟让整个剪辑显示在一屏内": "讓整個剪輯顯示在一屏內", +"Fit to window (Ctrl+0)": "適合視窗(Ctrl+0)", +"Fit to window / 100%": "適合視窗 / 100%", +"Five requests: first, repeat, new prompt, resolution, duration.": "連續五輪:首次、重複、更換提示詞、解析度、時長。", +"Fix the earlier task that failed, then submit this one again": "先處理前面失敗的任務,再重新提交", +"Fix the problems listed above, then check again.": "請先處理上面列出的問題,再重新檢查。", +"Fix these before installing": "安裝前需要先處理", +"Fix this in Settings": "到設定裡修復這個問題", +"Flip horizontally": "水平翻轉", +"Flip vertically": "垂直翻轉", +"Fold or show the picked task's details": "收起或展開所選任務的詳情", +"Fold the adjust panel away": "收起調整面板", +"Fold the book and mark the control": "收起教學,標出介面上的位置", +"Fold the record bar away": "收起錄音條", +"Fold the task list": "收起任務列表", +"Fold this group away": "收起這一組", +"Folder, copy prompt, delete": "開啟資料夾、複製提示詞、刪除", +"Folders found automatically": "自動發現的資料夾", +"Folders found automatically · {count}": "自動發現的資料夾 · {count}", +"Folders with models to reuse": "可重複使用模型所在的資料夾", +"Folders · optional": "目錄 · 可選", +"Folders, downloads, language and more": "資料夾、下載、語言等設定", +"Folders, language and engine options": "資料夾、語言和引擎選項", +"Folk": "民謠", +"Follow": "跟隨", +"Follow along": "跟著做", +"Follow speed": "跟隨速度", +"Follow system ({name})": "跟隨系統({name})", +"Font": "字型", +"Food": "美食", +"For Mac, choose the int8 model files and keep their folder structure.": "Mac 請選擇 int8 模型檔案,並保留下載的目錄結構。", +"For a finished file, choose \"Export\" in the Edit view.": "需要成片時,在「剪輯檢視」點一下「匯⁠出」。", +"For a longer video with several shots, start new shots in \"Edit\", or use \"Autopilot\".": "更長的多鏡頭影片,可在「剪輯檢視」中另起新的鏡頭,或使用「AI 全自動」。", +"For a new installation, also get the Environment package.": "全新安裝還需「執行環境」包。", +"For a storyboard, use ": "有分鏡劇本時,請用", +"For an ending picture, add another image and set it to \"Last frame\".": "需要結尾畫面時,再新增一張圖片並設為「尾⁠影⁠格」。", +"For everyday use": "日常使用", +"For older computers": "適合較舊的電腦", +"For reference images, see \"Make an image from reference images\". When MOSS is selected, choose \"Layout\" below the prompt box, drag boxes on the frame and write what goes in each one. A box sets where a thing goes and roughly how big it is; it does not stretch the thing to fill the box.": "加參考圖見「用參考圖生成圖片」。選 MOSS 時,點提示詞框下方的「版面配置」,在畫框上拖出框,每個框寫一句放什麼。框管位置和大致大小,不會把東西拉伸到填滿框。", +"For the final video, switch to High or Max.": "定稿時改用「精細」或「極⁠致」。", +"Force a single run": "強制單次生成", +"Force regeneration": "重新生成", +"Forecasts improve as you generate.": "生成越多,耗時與記憶體預測越準。", +"Foreground color": "前景色", +"Four quality levels": "四檔品質", +"Frame": "畫面比例", +"Frame & size": "畫面比例與尺寸", +"Frame rate": "影格速率", +"Frame sheet": "多影格拼圖", +"Frame size": "畫面大小", +"Free": "自由", +"Free disk": "硬碟剩餘", +"Free some space on that drive, then try again.␟请在该磁盘上腾出一些空间,然后重试。": "請在該磁碟上騰出一些空間,然後重試。", +"Free some space on that drive, then try again.␟请在该磁盘上腾出空间后重试。": "請在該磁碟上騰出空間後重試。", +"Free space on the installation/output drive and retry. Keep model downloads and retained outputs if you want to resume or inspect them.": "清理安裝目錄或輸出目錄所在磁碟的空間後重試;保留模型下載和輸出檔案,便於續傳或排查。", +"Free up %s of disk space": "可以釋放 %s 磁碟空間", +"Free up disk space, then try again": "清理磁碟空間後再試", +"Free up space on the installation drive, then retry.": "清理安裝磁碟空間後,點選重試。", +"FreeVideo already reloaded this page once with fresh copies of its files. Press Ctrl+F5. If it still fails, turn off browser extensions that block scripts on this page or open the same address in another browser. If that does not help, use Report a problem.": "FreeVideo 已經用重新下載的檔案自動重新整理過一次頁面。請按 Ctrl+F5 強制重新整理;仍然出現時,請停用會攔截此頁面指令碼的瀏覽器擴充功能,或換一個瀏覽器開啟同一網址。仍未解決時,請點一下「提交問題」。", +"FreeVideo asks before deleting a video, and a video used in an edit cannot be deleted.": "刪除作品前會確認;被剪輯使用的作品不能刪除。", +"FreeVideo cannot read its own files": "FreeVideo 讀不到自己的程式檔案", +"FreeVideo cannot run from this disk": "這塊硬碟上無法執行 FreeVideo", +"FreeVideo closed unexpectedly while generating.": "生成過程中 FreeVideo 意外關閉。", +"FreeVideo could not be opened from the menu": "從選單開啟 FreeVideo 失敗", +"FreeVideo could not reach the network.": "FreeVideo 無法連上網路。", +"FreeVideo could not read or write the long video files, so this part did not start. Check that the FreeVideo folder can be opened and is not read-only, then continue from this part.": "長影片檔案讀寫失敗,這一段沒能開始。請確認 FreeVideo 資料夾可以開啟且不是唯讀,然後從這段繼續。", +"FreeVideo could not read or write the long video files. Check that the FreeVideo folder can be opened and is not read-only, then try again.": "長影片檔案讀寫失敗。請確認 FreeVideo 資料夾可以開啟且不是唯讀,然後重試。", +"FreeVideo could not read this reference video frame by frame.": "FreeVideo 無法逐格讀取這段參考影片。", +"FreeVideo could not write a required file.": "FreeVideo 無法寫入所需檔案。", +"FreeVideo crashed. It has restarted.": "FreeVideo 意外崩潰,已重新啟動。", +"FreeVideo creative workspace": "FreeVideo 創作面板", +"FreeVideo did not answer in time": "FreeVideo 未在規定時間內應答", +"FreeVideo did not load completely": "FreeVideo 沒有完整載入", +"FreeVideo did not load completely in the browser": "瀏覽器裡的 FreeVideo 沒有完整載入", +"FreeVideo did not report a reason for this video. Try again, and report the problem if it keeps failing.": "FreeVideo 沒有給出這段影片失敗的原因。請重試,仍然失敗請提交問題。", +"FreeVideo did not start. See the message above.": "FreeVideo 未能啟動,原因見上方。", +"FreeVideo does not have permission to read some files in the selected folder. Choose another folder, or download the files again without administrator rights.": "FreeVideo 沒有權限讀取所選資料夾裡的部分檔案。請選擇其他資料夾,或不使用管理員身份重新下載。", +"FreeVideo download list\n\nRun this command in this folder:\naria2c --input-file=aria2.txt --continue=true --check-integrity=true\n\nYou can also import urls.txt into another download tool. urls.txt uses the download source chosen in Settings (Automatic uses Hugging Face); a few files are only available from Hugging Face. Keep all downloaded files in this folder or its subfolders.\n\nWhen the download finishes, return to the launcher, choose \"Use downloaded folder\", then \"Check & continue\". FreeVideo recognizes files by size and full checksum, so different file names are fine; missing or damaged files are downloaded as usual.\n\nThe paths in SHA256SUMS are where aria2 saves the files. With urls.txt the file names may differ, which does not matter.\n\nThere is no need to download the whole model repository. This folder is not an offline package; do not import it with \"Choose offline packages\".\n": "FreeVideo 下載清單\n\n在這個資料夾裡執行下面的命令:\naria2c --input-file=aria2.txt --continue=true --check-integrity=true\n\n也可以把 urls.txt 匯入其他下載工具。urls.txt 用的是設定裡選中的下載來源(選「自動」時用 Hugging Face);個別檔案只能從 Hugging Face 下載。請把下載的檔案都放在這個資料夾或它的子資料夾裡。\n\n下載完成後,回到啟動器點一下「使用已下載的資料夾」,再點一下「檢查並繼續」。FreeVideo 按檔案大小和完整校驗值識別檔案,檔名不同也可以;缺少或損壞的檔案會照常下載。\n\nSHA256SUMS 裡的路徑是 aria2 的存放路徑。用 urls.txt 下載時檔名可能不同,不影響使用。\n\n不必下載整個模型儲存庫。這個資料夾不是離線安裝包,不要用「選擇離線安裝包」匯入。\n\n", +"FreeVideo error": "FreeVideo 錯誤", +"FreeVideo has no permission to change the output folder. Check the folder, then try again.": "FreeVideo 無權修改輸出資料夾,請檢查該資料夾的權限後重試。", +"FreeVideo has stopped": "FreeVideo 已停止執行", +"FreeVideo image generation models download list\n\nRun this command in this folder:\naria2c --input-file=aria2.txt --continue=true --check-integrity=true\n\nYou can also import urls.txt into another download tool. urls.txt uses the download source chosen in Settings (Automatic uses Hugging Face).\n\nWhen the download finishes, copy the image_gen folder inside payload into the folder below, merging it with any image_gen folder already there:\n{model_folder}\nThen return to the launcher and choose \"Resume\" on Image generation models. FreeVideo checks every file by its checksum and downloads again any file that is missing or damaged.\n\nSHA256SUMS lists the checksum of every file. This list covers only the image generation models; the video model list is exported separately.\n": "FreeVideo 圖片生成模型下載清單\n\n在這個資料夾裡執行下面的命令:\naria2c --input-file=aria2.txt --continue=true --check-integrity=true\n\n也可以把 urls.txt 匯入其他下載工具。urls.txt 用的是設定裡選中的下載來源(選「自動」時用 Hugging Face)。\n\n下載完成後,把 payload 裡的 image_gen 資料夾複製到下面這個資料夾,和其中已有的 image_gen 合併:\n{model_folder}\n然後回到啟動器,在「圖片生成模型」處點一下「繼續」。FreeVideo 會按校驗值逐個檢查檔案,缺少或損壞的檔案會重新下載。\n\nSHA256SUMS 列出每個檔案的校驗值。這份清單只含圖片生成模型,影片模型的清單另外匯出。\n", +"FreeVideo is already open to the whole network. Start it for this computer only, then try again.": "FreeVideo 已直接對整個網路開放。請改為只在本機執行後重試。", +"FreeVideo is back on the previous version and works as before. Click Repair to reinstall the engine environment and update again; the details give the reason.": "FreeVideo 已退回原來的版本,可以照常使用。點一下「修復」可以再次更新,原因在詳情裡。", +"FreeVideo is back on the previous version and works as before. To update again, open Installation in the sidebar, keep the same folder, click Continue and then Check & continue, and finally click Install & launch on the confirmation page; the details give the reason.": "FreeVideo 已退回原來的版本,可以照常使用。要再次更新,請在「安裝」頁保持同一個安裝目錄,依次點一下「繼續」「檢查並繼續」和「安裝並啟動」。", +"FreeVideo is back on the previous version and works as before. When the current task ends, a Repair button appears here; clicking it reinstalls the engine environment and updates again. The details give the reason.": "FreeVideo 已退回原來的版本,可以照常使用。目前任務結束後,點這裡出現的「修復」可以再次更新。", +"FreeVideo is back on the previous version and works as before; the details give the reason.": "FreeVideo 已退回原來的版本,可以照常使用;原因寫在詳情裡。", +"FreeVideo is being installed, updated or cleaned up; try again when it finishes.": "FreeVideo 正在安裝、更新或清理,完成後再試。", +"FreeVideo is busy with a task or keeping the image model ready, so the image model cannot be repaired or removed now. Wait for it to finish, or close FreeVideo, then try again.": "FreeVideo 正在執行任務或保持圖片模型就緒,暫時無法修復或刪除圖片模型。請等待其結束,或關閉 FreeVideo 後再試。", +"FreeVideo is busy with another task": "FreeVideo 正在處理另一個任務", +"FreeVideo is busy with another task. Try again when it finishes. If nothing else is running, close duplicate FreeVideo instances, then try again.": "FreeVideo 正在處理另一個任務。請在它完成後重試。若沒有其他任務在進行,請關閉重複執行的 FreeVideo 後重試。", +"FreeVideo is installed in a FreeVideo folder on the disk you choose.": "FreeVideo 會裝在所選硬碟的 FreeVideo 資料夾裡。", +"FreeVideo is not responding": "FreeVideo 沒有響應", +"FreeVideo is ready": "FreeVideo 已就緒", +"FreeVideo keeps": "FreeVideo 佔用", +"FreeVideo needs no acceleration LoRA.␟FreeVideo 无需添加加速 LoRA": "FreeVideo 無需新增加速 LoRA", +"FreeVideo needs no acceleration LoRA.␟FreeVideo 无需添加加速 LoRA。": "FreeVideo 無需新增加速 LoRA。", +"FreeVideo now uses port {newPort} because port {oldPort} is in use by another program. If you bookmarked 127.0.0.1:{oldPort}, change the bookmark to this address.": "FreeVideo 現在使用埠 {newPort},因為埠 {oldPort} 已被其他程式佔用。如果已將 127.0.0.1:{oldPort} 加入書籤,請把書籤改為目前的網址。", +"FreeVideo now uses the faster model. Removing the old model frees about {size}; only its own files are removed.": "已在使用更快的模型,刪除舊模型可釋放約 {size},只刪除舊模型自己的檔案。", +"FreeVideo picks the amount for each generation": "每次生成由 FreeVideo 選擇數值", +"FreeVideo quit unexpectedly. It has restarted.": "FreeVideo 意外結束,已重新啟動。", +"FreeVideo ran into a problem": "FreeVideo 出錯了", +"FreeVideo ran into an unexpected problem.": "FreeVideo 遇到了意外問題。", +"FreeVideo reported an error": "FreeVideo 報錯", +"FreeVideo requires a GPU with compute capability 8.0 or higher, such as an NVIDIA GeForce RTX 30 series card or newer. This requirement does not depend on the amount of VRAM, and a driver update cannot change it.": "FreeVideo 需要計算能力 8.0 及以上的顯示卡,例如 NVIDIA GeForce RTX 30 系列及更新型號。這一要求與顯示卡記憶體大小無關,更新驅動程式也無法改變。", +"FreeVideo restarted": "FreeVideo 已重新啟動", +"FreeVideo restarted and the export stopped. Export again.": "FreeVideo 已重新啟動,匯出已中斷。請重新匯出。", +"FreeVideo restarted during this task": "FreeVideo 中途重新啟動了", +"FreeVideo restarted while this was being made, so it did not finish. Finished parts are in your creations.": "FreeVideo 在生成過程中重新啟動,這次沒有完成。已經完成的部分在作品裡。", +"FreeVideo restarts once; open pages refresh automatically.": "FreeVideo 會重新啟動一次,已開啟的頁面會自動重新整理。", +"FreeVideo restarts once; running videos finish first.": "FreeVideo 會重新啟動一次,正在生成的影片會先完成。", +"FreeVideo restarts when the download finishes. Models and settings are kept.": "下載完成後自動重新啟動,模型和設定都會保留。", +"FreeVideo returned an error (HTTP {status}). ": "FreeVideo 傳回錯誤(HTTP {status})。", +"FreeVideo sent a reply this page could not read (HTTP {status}). Try again, and report the problem if it happens again.": "FreeVideo 的回覆無法讀取(HTTP {status})。請重試,再次出現請回報問題。", +"FreeVideo sent a reply this page could not read. Try again, and report the problem if it happens again.": "FreeVideo 的回覆無法讀取。請重試,再次出現請提交問題。", +"FreeVideo settings": "FreeVideo 設定", +"FreeVideo showed an error.": "FreeVideo 顯示了一個錯誤。", +"FreeVideo stopped": "FreeVideo 已停止", +"FreeVideo stopped converting the reference video to keep the computer responsive.": "為保證電腦正常運作,FreeVideo 停止了參考影片的轉換。", +"FreeVideo update available": "FreeVideo 有新版本", +"FreeVideo uses Windows PowerShell to inspect this computer, but Windows PowerShell could not start. Restart the computer, then click \"Retry installation\". If it fails again, export the report.": "FreeVideo 要用 Windows PowerShell 檢查這台電腦,但 Windows PowerShell 沒能啟動。請重新啟動電腦,然後點選「重試安裝」。仍然失敗時,可以匯出報告。", +"FreeVideo view": "FreeVideo 檢視", +"FreeVideo was loaded more than once.": "FreeVideo 被載入了多份。", +"FreeVideo was not started by the launcher, so it cannot be restarted automatically. Once it is closed, the switch starts; until then the current model keeps working.": "FreeVideo 不是由啟動器啟動的,無法自動重新啟動。關閉後會自動開始切換,在此之前目前模型照常可用。", +"FreeVideo workspace": "FreeVideo 工作區", +"FreeVideo {version} is available": "FreeVideo {version} 可以更新", +"FreeVideo · Details": "FreeVideo · 詳情", +"FreeVideo · First / Last Frame": "FreeVideo · 首尾影格", +"FreeVideo · Generate & Preview": "FreeVideo · 生成與預覽", +"FreeVideo · Media": "FreeVideo · 素材", +"FreeVideo · Reference (experimental)": "FreeVideo · 參考(實驗)", +"FreeVideo · Video + Audio": "FreeVideo · 影片 + 音訊", +"FreeVideo’s page files are missing or unreadable. In the FreeVideo launcher, open Settings and click Repair, then open FreeVideo again. Without the launcher, update the FreeVideo node and restart ComfyUI.": "FreeVideo 的網頁檔案缺失或無法讀取。請在 FreeVideo 啟動器的「設定」裡點選「修復」,完成後重新開啟。沒有使用啟動器時,請更新 FreeVideo 節點並重新啟動 ComfyUI。", +"FreeVideo’s styles loaded but do not apply; another extension may be overriding them.": "FreeVideo 的樣式已下載但沒有生效,可能被其他擴充功能的樣式覆蓋。", +"FreeVideo’s styles were never requested.": "FreeVideo 的樣式檔案沒有被載入。", +"Freed %s": "已釋放 %s", +"Freed {size}": "已釋放 {size}", +"Freed {size}.": "已釋放 {size}。", +"Freed {size}. Some files changed; check again.": "已釋放 {size}。部分檔案已變化,請重新檢查。", +"Freehand": "自由套索", +"From a photo": "從照片生成", +"From creations": "從作品庫選擇", +"From creations, the library or this computer": "從作品、素材庫或電腦選擇", +"From creations, the library or this computer; or drop or paste": "從作品、素材庫或電腦選擇;也可拖入或貼上", +"From media": "來自素材", +"From the creations": "從作品庫選擇", +"From this computer": "從電腦選擇", +"From this computer…": "從電腦選擇…", +"From whitebox animation to finished video": "從白模動畫到寫實影片", +"Front": "正面", +"Front image": "正面圖片", +"Full": "已滿", +"Full resolution": "繼續第二階段", +"Full screen": "全螢幕", +"Full screen is not available here.": "這裡不能全螢幕。", +"Further right takes longer and keeps more detail.": "等級越靠右,耗時越長、細節越多。", +"GPU": "顯示卡", +"GPU acceleration building": "正在準備顯示卡加速", +"GPU information could not be read": "未能讀取顯示卡資訊", +"GPU information reading": "正在讀取顯示卡資訊", +"GPU memory unavailable": "顯示卡記憶體暫不可用", +"GPU not recorded": "顯示卡未記錄", +"GPU packages": "GPU 依賴", +"GPU runtime": "顯示卡執行環境", +"GPU tests finished": "顯示卡檢查已完成", +"GPU tests running": "正在檢查顯示卡", +"General": "通用", +"Generate": "生成", +"Generate (in the prompt box)": "生成(在提示詞框裡)", +"Generate a picture that matches a part that only has sound.": "為只有聲音的部分生成相符的畫面。", +"Generate again even when an identical completed video is saved locally.": "跳過已儲存結果的快取。", +"Generate again.": "請重新生成。", +"Generate again. If it happens again, choose \"Report a problem\".": "請重新生成。再次出現時,請點選「提交問題」。", +"Generate again. If it stops at the same step, export the report and send it to us.": "請重新生成。若仍停在同一步,請匯出報告並傳給我們。", +"Generate all again": "重新生成全部", +"Generate and edit still images": "生成和修改圖片", +"Generate anyway": "繼續生成", +"Generate image␟AI 生成": "AI 生成", +"Generate image␟生成图片": "生成圖片", +"Generate in one run, even beyond 30 seconds.": "超過 30 秒時也一次生成。", +"Generate in this view": "在目前檢視開始生成", +"Generate music in this style": "按這種風格生成配樂", +"Generate preview": "生成預覽", +"Generate the character reference video again, then try again": "重新生成這個角色參考影片後再試", +"Generate the chosen part": "生成選中的這一段", +"Generate the full video first, then upscale it.": "請先生成完整影片,再放大。", +"Generate the images first␟先生成场景图片": "先生成場景圖片", +"Generate the images first␟先生成角色图片": "先生成角色圖片", +"Generate the images first␟先生成道具图片": "先生成道具圖片", +"Generate the other views first, or add all four": "先生成其餘視角,或放入全部四張圖片", +"Generate the previous video again, then extend it.": "請重新生成上一段影片,再接續。", +"Generate the rest": "生成其餘視角", +"Generate the rest again": "重新生成其餘視角", +"Generate the views from the photo first": "先用照片生成各視角", +"Generate this part again": "按同樣的設定再生成一次", +"Generate this take again, or choose another one": "重新生成這一條,或選另一條", +"Generate video": "生成影片", +"Generate video from sound": "按聲音生成畫面", +"Generate when installed": "安裝完再生成", +"Generate with AI": "AI 生成", +"Generate without this image": "不再參考這張圖", +"Generated": "生成", +"Generated videos and images": "生成的影片和圖片", +"Generated with the original prompt. {reason}": "已用原文生成。{reason}", +"Generates and discards 17 extra frames to keep dialogue moving between parts.": "多生成 17 影格後丟棄,讓對白在前後兩段之間連貫。", +"Generates at a lower resolution, then upscales. Faster.": "先用低解析度生成,再放大成片,更快。", +"Generates from an empty prompt instead of asking for one.": "提示詞為空時直接生成,不再提示。", +"Generates when installed": "安裝完自動生成", +"Generating a new part before an existing part is not available in this version. Update FreeVideo and try again.": "目前版本不支援在已有片段前面生成新的一段。請更新 FreeVideo 後重試。", +"Generating a preview": "正在生成預覽", +"Generating image": "生成圖片", +"Generating images needs the image model to be downloaded first.": "圖片生成需要所用的圖片模型已經下載完成。", +"Generating in parts and Extend need an NVIDIA graphics card or a Mac.": "分段生成和接著生成需要 NVIDIA 顯示卡或 Mac。", +"Generating is not available here right now. Restart FreeVideo to try again.": "這台電腦現在不能生成。重新啟動 FreeVideo 後再試。", +"Generating music": "正在生成配樂", +"Generating part {part}": "生成第 {part} 段", +"Generating part {part}…": "正在生成第 {part} 段…", +"Generating the voice": "正在生成旁白", +"Generating video": "正在生成影片", +"Generating {percent}%": "生成中 {percent}%", +"Generating; move it when it is done": "正在生成,完成後再移動", +"Generating; you can leave this view": "正在生成,可以離開這個檢視", +"Generating␟正在生成": "正在生成", +"Generating␟生成中": "生成中", +"Generation could not start. Choose \"Generate\" again.": "生成沒能開始,請再點一下「生成」。", +"Generation could not start. Try again; if it keeps failing, report the problem.": "生成沒能開始。請重試;仍然失敗時,請提交問題。", +"Generation did not finish": "生成未完成", +"Generation did not finish.": "生成未完成。", +"Generation did not finish: {stage}": "生成未完成:{stage}", +"Generation did not start because there is not enough available RAM or GPU memory.": "可用記憶體或顯示卡記憶體不足,本次生成未開始。", +"Generation failed": "生成失敗", +"Generation failed; the cause was not saved. Retry, or download the report.": "生成失敗,原因沒有儲存下來。請重試,或下載報告。", +"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; it speeds up after 3 successful generations in a row, or you can change this in Settings.": "為了穩定,生成已自動放慢;連續完成 3 次後會加快一些,也可在設定裡調整。", +"Generation is slowed automatically for stability; it speeds up after the next successful generation, or you can change this in Settings.": "為了穩定,生成已自動放慢;下一次生成完成後會加快一些,也可在設定裡調整。", +"Generation is slowed automatically for stability; you can change this in Settings.": "為了穩定,生成已自動放慢;可在設定裡調整。", +"Generation mode": "生成方式", +"Generation needed more memory than was available.": "生成所需記憶體超過當時可用量。", +"Generation needs more GPU memory than is currently available.": "生成所需顯示卡記憶體超過目前可用量。", +"Generation on this computer shares its memory, so the level does not apply.": "這台電腦生成時共用記憶體,相容等級不適用。", +"Generation pauses for about 2 minutes during the switch; settings and videos are kept.": "切換期間暫停生成約 2 分鐘,設定和影片會保留。", +"Generation progress": "生成進度", +"Generation statistics": "生成統計", +"Generation stopped": "生成已停止", +"Generation stopped because available memory was too low.": "可用記憶體不足,生成已停止。", +"Generation stopped because memory was low or its configured limit was reached.": "記憶體不足或已達到設定的上限,生成已停止。", +"Generation stopped unexpectedly": "生成意外中斷", +"Generation stopped.": "生成已停止。", +"Generation stopped. Generate again.": "生成已中斷,請重新生成。", +"Generation time": "生成耗時", +"Generation took too long without a result": "生成等了太久沒有結果", +"Generation unavailable · retry": "生成服務暫不可用 · 重試", +"Generation was interrupted": "生成中途被打斷", +"Generation was slow; try a lower resolution or shorter video.": "生成較慢,可降低解析度或縮短時長後再試。", +"Generation was stopped": "生成已被停止", +"Generations": "生成", +"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.": "仍有生成正在進行或排隊。請等待完成或先取消,再開始效能測量。", +"Generation␟生成": "生成", +"Generation␟生成用时": "生成用時", +"Get a read token": "取得只讀權杖", +"Get a token ↗": "取得權杖 ↗", +"Get another rewrite of the prompt": "換一種寫法再改寫一次", +"Get started": "開始使用", +"Getting started␟上手": "上手", +"Getting started␟新手指引": "新手指引", +"Getting the connection address…": "正在取得連線位址…", +"Git could not be set up": "無法準備 Git", +"Git is too old": "Git 版本過舊", +"GitHub mirror": "GitHub 鏡像", +"Give it another name": "換一個名字", +"Give the assistant reference images": "給助手參考圖片", +"Give the tag another name": "給標籤換個名字", +"Give this chat a name you will find": "給這段對話起個好找的名字", +"Go back one step": "回到上一步", +"Go back to its picture": "回到它的生成畫面", +"Go back to the result": "回到生成結果", +"Go back to this setting": "回到這項設定", +"Go on from the finished parts": "從已完成的部分接著生成", +"Go on to the next step": "繼續下一步", +"Go on without this preview": "不用這個預覽,繼續", +"Go on; the latest changes are lost": "離開這裡,最近的變更會遺失", +"Go to Autopilot": "切換到 AI 全自動", +"Go to Create": "切換到創作面板", +"Go to Edit": "切換到剪輯檢視", +"Go to Images": "切換到圖片檢視", +"Go to Nodes": "切換到節點檢視", +"Go to end": "跳到結尾", +"Go to feedback page": "前往意見回饋頁面提交", +"Go to start": "跳到開頭", +"Go to the latest generation": "跳到最近生成", +"Go to the task": "定位到任務", +"Go to this page of the tour": "跳到介紹的這一頁", +"Go to where it was started": "回到發起這次生成的檢視", +"Gone in {left} s": "{left} 秒後永久刪除", +"Good to know": "注意", +"Got it": "知道了", +"Gradient": "漸變", +"Grain": "顆粒", +"Graphics card": "顯示卡", +"Graphics card load": "顯示卡佔用", +"Graphics memory and temperature in the top bar": "在頂端列顯示顯示卡記憶體和溫度", +"Graphics or system memory ran out during generation": "生成時顯示卡記憶體或記憶體不足", +"Green": "綠", +"Grey": "灰", +"Grid": "網格", +"Group creations with tags, narrow the list with filters, and compare two creations.": "用標籤歸類作品,按條件篩選,並把兩個作品放在一起比較。", +"Group it with a tag␟用标签给它分组": "用標籤給它分組", +"Group it with a tag␟给作品加上标签,方便查找": "給作品加上標籤,方便尋找", +"Guide the result with your own image": "用你的圖片引導生成結果", +"Guide this clip with an image": "用一張圖引導這一段", +"Guide this part with an image: first frame, last frame or a person": "用圖片指定首影格、尾影格或人物", +"H": "高", +"H3 Image uses up to 16 reference images. After switching to another image model, a note says how many to remove if there are more than it takes.": "H3 Image 最多使用 16 張參考圖;換用其他圖片模型後超出其上限時,會提示需要移除幾張。", +"H3 text encoder": "H3 文本編碼器", +"HD": "高畫質", +"HF Mirror": "HF 鏡像", +"HOME": "[使用者資料夾]", +"Hand": "抓手", +"Hand on chin": "托腮", +"Hand-drawn sketches give finer control over image generation": "可以透過手繪草圖更精細地控制生成", +"Hands": "手型", +"Hands on hips": "叉腰", +"Hardness": "硬度", +"Hardware, settings and timings only. No prompts, images or videos.": "僅包含硬體資訊、生成參數和耗時,不含提示詞、參考圖或影片。", +"Hardware, settings and timings, to send us": "硬體、設定和耗時,可發給我們", +"Heal": "修復範圍", +"Healing": "正在修復", +"Hear a sample of this voice": "聽一下這個音色", +"Hear all tracks": "恢復全部軌道", +"Hear every track again": "恢復聽全部軌道", +"Hear only this track␟只听这一条轨的声音": "只聽這一條軌的聲音", +"Hear only this track␟只听这条轨": "只聽這條軌", +"Hear the line where it is in the edit": "在剪輯裡試聽這一句", +"Hear the replaced voice": "聽替換後的新聲音", +"Hear the voice before replacing": "聽替換前的原聲", +"Hear this track again": "恢復這條軌的聲音", +"Height (px)": "高(px)", +"Height␟高": "高", +"Height␟高度": "高度", +"Help": "幫助", +"Hide chats": "收起對話欄", +"Hide creations": "收起作品欄", +"Hide dialogue tail": "隱藏對白尾段", +"Hide info": "收起資訊", +"Hide it; it will not show again": "收起,下次不再出現", +"Hide layer": "隱藏圖層", +"Hide password": "隱藏密碼", +"Hide recent videos": "收起最近作品", +"Hide settings": "收起設定欄", +"Hide tasks": "收起任務列", +"Hide the card and show the picture": "收起這張卡片,顯示畫面", +"Hide the guide; replay it in Settings": "收起指引,可在設定裡重看", +"Hide the status panel": "收起執行狀態", +"Hide this hint": "收起這條提示", +"Hide this message": "收起這條提示", +"Hide this offer for good": "以後不再顯示這條提示", +"Hide this panel": "收起這個面板", +"Hide this; nothing else changes": "收起說明,不影響目前操作", +"Hide this; the result stays in your creations": "收起提示,成品仍在作品裡", +"Hide; nothing else changes": "收起,不影響目前操作", +"Hide␟收起": "收起", +"Hide␟隐藏": "隱藏", +"High angle": "高角度", +"High color depth copy": "高色深版本", +"Higher is sharper and takes longer": "越高越清楚,生成越慢", +"Higher levels add detail and take longer.": "等級越高,畫面越細,用時越長。", +"Higher takes longer, shows more detail": "越高越清楚,用時越長", +"Highlights": "高光", +"High␟精细": "精細", +"High␟高": "高", +"High␟高清": "高畫質", +"Hints": "提示", +"History": "歷史", +"History and presets␟历史与预设": "歷史與預設", +"History and presets␟提示词与预设": "提示詞與預設", +"History and templates": "歷史與範本", +"Hold": "按住", +"Hold Alt while dragging to reverse snapping for that drag.": "拖曳時按住 Alt 可暫時反轉貼齊。", +"Hold on this frame": "停在目前畫面", +"Horizontal position": "水平位置", +"Host name could not be resolved": "無法解析域名", +"How prompts are rewritten": "瞭解提示詞是怎樣被改寫的", +"How the seed changes after each video": "每次生成後種子怎麼變", +"How to describe a scene well": "怎樣寫出效果更好的描述", +"How to write a prompt": "提示詞寫法", +"How to write a prompt ↗": "提示詞寫法 ↗", +"How would you like to get the rest?": "選擇下載方式", +"Hue": "色相", +"Hugging Face access required": "需要 Hugging Face 存取權限", +"Hugging Face token · optional": "Hugging Face 權杖 · 可選", +"Hugging Face · Audio": "Hugging Face · 音訊", +"Hugging Face · Video": "Hugging Face · 影片", +"I accept the displayed installation plan and model licenses.": "我接受所顯示的安裝計畫和模型授權條款。", +"I accept the installation plan and model / toolkit licenses.": "我同意安裝計畫及模型/工具套件授權條款。", +"I accept this installation plan and the model and toolkit licenses": "我同意目前顯示的安裝計畫和模型/工具套件授權條款", +"I can make videos for you,": "我可以為您生成影片,", +"I have been waiting here for you to come back.": "我一直在這裡等你回來。", +"INSTALL": "[安裝目錄]", +"If FreeVideo does not open completely, a card with the cause and the next step appears on its own.": "如果 FreeVideo 沒有完整開啟,會自動出現一張說明原因和下一步的卡片。", +"If it fails again, select \"Export report\", then select \"Report a problem\" and attach the report.": "仍然失敗時,請先點選「匯出報告」,再點選「提交問題」並附上報告。", +"If it happens again, choose \"Report a problem\" to send us the report.": "再次出現時,請點選「提交問題」,把報告發給我們。", +"If it happens again, use \"Report a problem\"": "再次出現時,請點選「提交問題」", +"If it still fails, choose \"Export report\" to save the diagnostic information.": "仍然失敗時,點一下「匯出報告」儲存診斷資訊。", +"If it still fails, use Download report in the preview and send it to us.": "仍然失敗時,可點預覽區的「下載報告」,發給我們。", +"If the LoRA asks for trigger words, enter them in \"Trigger words\". They are added to the prompt, and removed again with the LoRA.": "模型要求觸發詞時,填在「觸發詞」一欄,它會自動加進提示詞;移除這個 LoRA 時一併去掉。", +"If the fill was a mistake, choose \"Undo\" within 10 seconds to bring back what was there.": "填入有誤時,10 秒內點一下「復⁠原」,還原原來的內容。", +"If the line is longer than the selection, it is placed at full length when there is room after it. If it would cover the next clip, it is not placed, and the selection and text are kept.": "話比選區長時,後面有空位就按完整長度放入;會蓋住後面的片段時不放入,選區和文字保留。", +"If this computer has an NVIDIA graphics card, install NVIDIA driver 580 or newer, restart the computer, then click \"Retry installation\".": "如果這台電腦有 NVIDIA 顯示卡,請安裝 580 或更新版本的 NVIDIA 顯示卡驅動程式,重新啟動電腦後點選「重試安裝」。", +"Image 1": "圖 1", +"Image deleted": "已刪除 1 張圖片", +"Image diagnostic report": "生圖診斷報告", +"Image editing": "圖片編輯", +"Image editor": "圖片編輯器", +"Image editor save": "圖片編輯器儲存", +"Image editor upload": "圖片編輯器上傳", +"Image facts": "圖片資訊", +"Image folder": "圖片資料夾", +"Image generation": "圖片生成", +"Image generation models": "圖片生成模型", +"Image generation ran into an error.": "圖片生成出錯。", +"Image generation ran into an error. Try again.": "圖片生成出錯了,請再試一次。", +"Image generation stopped unexpectedly.": "圖片生成意外停止。", +"Image generation stopped unexpectedly. Try again.": "圖片生成意外停止了,請再試一次。", +"Image generation was cancelled.": "已取消圖片生成。", +"Image generation was interrupted": "圖片生成中途被打斷", +"Image generation was interrupted.": "圖片生成中途被打斷。", +"Image generation was interrupted. Try again.": "圖片生成中途被打斷,請重試。", +"Image models": "圖片模型", +"Image object selection": "圖片智慧去背", +"Image of the character": "角色圖片", +"Image pack": "圖片模型包", +"Image size…": "圖片大小…", +"Image size␟图像大小": "圖片大小", +"Image size␟画面大小": "畫面大小", +"Image {number}␟图 {number}": "圖 {number}", +"Image {number}␟图片 {number}": "圖片 {number}", +"Images and library": "圖片與作品", +"Images and people": "用圖片和人物", +"Images and sound": "素材", +"Images are center-cropped to the chosen shape.": "圖片會按所選畫面比例居中裁切。", +"Images could not be read just now.": "圖片暫時無法讀取。", +"Images from": "圖片來源", +"Images from a text prompt": "根據文字提示出圖", +"Images from a text prompt, up to about 4 MP": "根據文字提示出圖,最大約 4 MP", +"Images in ComfyUI’s input folder, deleted one by one": "ComfyUI 輸入資料夾中的圖片,逐張刪除", +"Images made in the image view appear here.": "在圖片檢視裡生成的圖片會儲存在這裡。", +"Images view: an image from one sentence": "圖片檢視:一句話生成圖片", +"Images, video or audio from this computer": "從電腦新增圖片、影片或音訊", +"Images␟图像": "圖片", +"Images␟图像视图": "圖片檢視", +"Images␟图片": "圖片", +"Images␟素材": "素材", +"Image␟上传服装图": "上傳服裝圖", +"Image␟图": "圖", +"Image␟图像": "圖片", +"Image␟图像视图": "圖片檢視", +"Image␟图片": "圖片", +"Image␟图片任务": "圖片任務", +"Image␟生成图像": "生成圖片", +"Import": "匯入", +"Import environment package": "匯入執行環境包", +"Import files": "匯入檔案", +"Import is unavailable until you restart after updating.": "更新後重新啟動可匯入素材。", +"Import offline packages": "匯入離線安裝包", +"Import only the model packages and continue; FreeVideo downloads the Mac environment automatically.": "請只匯入模型包並繼續安裝,FreeVideo 會自動下載 Mac 的執行環境。", +"Import subtitle file": "匯入字幕檔案", +"Import the Environment ZIP, or choose Automatic installation.": "請匯入執行環境包,或選擇「自動安裝」。", +"Import the offline package again on the Installation page of the launcher, then retry.": "可在啟動器「安⁠裝」頁重新匯入離線安裝包後重試。", +"Import the “{package}” package again on the Installation page: the confirmation page will list this file, and after you confirm, it is renamed and kept, then replaced with the version in the package.": "請在「安裝」頁重新匯入「{package}」包:確認頁會列出這個檔案,確認後會將它改名保留,再換成包裡的版本。", +"Imported": "已匯入", +"Importing offline packages": "匯入離線安裝包", +"In \"Describe the picture\", write the subject, the place and the style. Put any words that should appear in the picture in quotation marks, exactly as written.": "在「描述畫面」中寫下主體、場景和風格;圖中要出現的文字,用引號寫出原文。", +"In Autopilot, connect an assistant and say \"Draw an image of …\". The assistant makes only the image, not a video. When it finishes, choose \"Open\" to view it and \"Download\" to save it.": "在「AI 全自動」中,連線助手後說「畫一張……」,助手只生成圖片,不生成影片;完成後點一下「開啟」檢視,點一下「下載」儲存。", +"In Creations": "已放進作品庫", +"In Creations, right-click a finished video. The \"⋯\" menu in the large view and below a result in the creation panel has the same choices.": "在作品庫中,對生成好的影片按一下滑鼠右鍵;大圖檢視和創作面板結果下方的「⋯」選單中也有同樣的選項。", +"In Settings, under Models, select \"Check installation\", then \"Install\", and retry.": "可在設定的「模型」頁先點一下「檢⁠查⁠安⁠裝」,再點一下「安⁠裝」後重試。", +"In a creation's details, choose the heart to add it to favorites. On the left, choose \"Favorites\" to see only those, or \"All\" to see every creation.": "在作品詳情中點愛心圖示收⁠藏;在左側選「收藏」只看收藏的作品,選「全⁠部」看所有作品。", +"In a hand": "手持", +"In later prompts, type @ to pick the character and describe what the character does.": "之後在提示詞中輸入 @ 選擇該角色,並寫明其動作。", +"In progress": "進行中", +"In queue · #{queue_position}": "排隊 · 第 {queue_position} 位", +"In the Autopilot conversation, choose \"Edit\" on the film's card to open this edit. Or choose \"Edit\" at the top, choose the edit name, and pick the film's name in the menu.": "在 AI 全自動的對話中,點成片卡片上的「剪⁠輯」開啟這個專案;也可以在頂部的「剪輯檢視」中點專案名,在選單中選這部片的名字。", +"In the FreeVideo launcher, open Settings and click Repair.": "請在 FreeVideo 啟動器的設定裡點一下「修復」。", +"In the chat list, choose \"More\" next to a chat, then \"Rename\" to change its name.": "在對話清單中點對話旁的「更多」,選「重新命名」可修改對話名稱。", +"In the export window choose the range, quality and content. For smoother motion, choose 48 or 60 under \"Frame rate\"; the graphics card makes the frames in between. To keep the sound lossless, choose \"Lossless\" under \"Sound\". Then choose \"Export\".": "在匯⁠出視窗選擇範圍、畫質和內容;要更流暢的畫面時,在「影格速率」中選 48 或 60,中間的畫面由顯示卡補出;要保留無損的聲音,在「聲音」中選「無損」。再點一下「匯出」。", +"In the page settings, select \"Detect & review\", then \"Install / repair\", and retry.": "可在頁面設定中先點一下「檢⁠測⁠並⁠預⁠覽」,再點一下「安⁠裝⁠/⁠修⁠復」後重試。", +"In the prompt field, describe how the selection should change.": "在提示詞欄中寫下選區要改成什麼樣。", +"In the scene": "場景", +"Include diagnostic info (no prompts or images)": "附上診斷資訊(不含提示詞和畫面)", +"Include every quality level in the next installation": "下次安裝時一併準備全部品質等級", +"Include prompt": "包含提示詞", +"Include prompt and workflow": "包含提示詞和工作流程(便於在 ComfyUI 中還原)", +"Include the prompt": "包含提示詞", +"Include the seed": "包含種子值", +"Includes first-time setup": "含首次準備", +"Incorrect password.": "密碼不正確。", +"Increment": "遞增", +"Indoor, evening. A woman reads a letter by the lamp, her hands tremble. She whispers: \"So it was you.\" Close-up, then a slow pull-back.": "室內,傍晚。女人在台燈下讀信,手微微發抖。她低聲說:「原來是你。」先是特寫,然後緩慢拉遠。", +"Info": "資訊", +"Inputs ready": "輸入已準備好", +"Insert clip": "放入素材", +"Insert the chosen item": "插入選中的項", +"Inside a quiet cafe, rain runs down the window while a barista wipes the counter.": "安靜的咖啡館裡,雨水順著窗戶流下,店員擦拭著櫃檯。", +"Inspector": "素材檢查器", +"Install": "安裝", +"Install & launch": "安裝並啟動", +"Install / repair": "安裝/修復", +"Install ComfyUI packages": "安裝 ComfyUI 元件", +"Install FreeVideo in a folder with a shorter path, such as D:\\FreeVideo, then click \"Retry installation\".": "請把 FreeVideo 安裝到路徑較短的資料夾,例如 D:\\FreeVideo,然後點選「重試安裝」。", +"Install FreeVideo with the launcher first, then turn on Phone access": "先用啟動器安裝 FreeVideo,再開啟「手機連線」", +"Install FreeVideo workflow": "安裝 FreeVideo 工作流程", +"Install PyTorch + CUDA": "安裝執行元件", +"Install Python": "安裝執行環境", +"Install SageAttention 2": "安裝顯示卡加速元件", +"Install acceleration and download models": "安裝加速元件和下載模型", +"Install and generate": "安裝並生成", +"Install components in parallel": "安裝元件和模型", +"Install encoder support": "安裝編碼元件", +"Install engine dependencies": "安裝生成元件", +"Install location": "安裝位置", +"Install method": "安裝方式", +"Install model support": "安裝模型元件", +"Install on \"{name}\"": "改裝到「{name}」", +"Install the dubbing model first": "先安裝配音模型", +"Install the image model in the launcher or in Settings, then try again": "在啟動器或設定中安裝圖片模型後再試", +"Install the prepared GPU acceleration package": "安裝顯示卡加速元件", +"Install the required model in the launcher or in Settings, then try again": "在啟動器或設定中安裝所需模型後再試", +"Install the verified Windows acceleration package": "安裝顯示卡加速元件", +"Install the verified model code": "安裝模型元件", +"Install this model, or retry its download": "安裝這個模型,或重試下載", +"Install with space saver": "安裝元件和模型(極限省空間)", +"Install {short}": "安裝 {short}", +"Install · {size}": "安裝 · {size}", +"Installation RAM budget": "安裝記憶體預算", +"Installation and ComfyUI output will appear here.": "安裝和 ComfyUI 的輸出會顯示在這裡。", +"Installation cannot start until these are fixed.": "處理完這些問題後才能開始安裝。", +"Installation details": "安裝內容", +"Installation files kept for repairs. Models, environments and videos are never removed.": "安裝時快取的檔案,清理時不會刪除模型、執行環境和影片。", +"Installation folder␟安装位置": "安裝位置", +"Installation folder␟安装目录": "安裝目錄", +"Installation is still running. Try again after it finishes.": "安裝仍在進行,請在完成後重試。", +"Installation progress": "安裝進度", +"Installation settings could not be read": "無法讀取安裝設定", +"Installation stopped": "安裝已停止", +"Installation stopped. Use Continue installation / retry; completed files are reused.": "安裝已停止。點選「繼續安裝/重試」,重複使用已完成檔案。", +"Installation␟安装": "安裝", +"Installation␟安装信息": "安裝資訊", +"Installed": "已安裝", +"Installed engine {version}. Updating takes about a minute and keeps your models and settings.": "已安裝引擎 {version}。更新約需 1 分鐘,模型和設定都會保留。", +"Installed · about 76 MiB": "已安裝 · 約 76 MiB", +"Installed · {size} GiB": "已安裝 · {size} GiB", +"Installed.": "已安裝。", +"Installed; no change needed": "已安裝,無需變更", +"Installing": "正在安裝", +"Installing packages": "安裝元件", +"Installing {label}": "正在安裝 {label}", +"Installing {percent}%": "正在安裝 {percent}%", +"Installing {short}": "正在安裝 {short}", +"Installing {short}; it generates when done": "正在安裝 {short},完成後自動生成", +"Intel End User License Agreement for Developer Tools": "英特爾開發者工具終端使用者授權合約", +"Interface is slow": "介面較卡", +"Interface is slow. Try Compatibility view.": "介面較卡,可在設定中開啟相容介面", +"Interface language": "介面語言", +"Interface language: {name}": "介面語言:{name}", +"International mirror": "國際鏡像", +"International source": "國際來源", +"Interrupted␟上次中断": "上次中斷", +"Interrupted␟已中断": "已中斷", +"Invert": "反選", +"Invert (Ctrl+Shift+I)": "反選(Ctrl+Shift+I)", +"Invert snapping while dragging": "拖曳時反轉貼齊", +"It asks only when the launcher started FreeVideo. FreeVideo started another way is not stopped.": "只在 FreeVideo 由啟動器啟動時詢問;由其他方式啟動的不會被停止。", +"It cannot go on this track": "不能放到這條軌上", +"It could not be deleted. Check again; if it happens again, use \"Report a problem\".": "未能刪除。請重新檢查;如果再次出現,請點選「提交問題」。", +"It does not support the file operations that FreeVideo's Python environment needs. Choose a folder on the Mac's built-in disk.": "它不能安裝 FreeVideo。請選擇 Mac 內建硬碟上的資料夾。", +"It has not started; it will not be made.": "這項還沒有開始,取消後不會生成。", +"It has not started; it will not run.": "這一步還沒有開始,取消後不會進行。", +"It is a preview.": "它是預覽影片。", +"It is already the largest size.": "它已經是最大的尺寸。", +"It is formatted as FAT32, which stores files up to 4 GB; the prompt model alone is 15.7 GB. Choose a folder on an APFS or Mac OS Extended disk.": "它不能存放 4 GB 以上的檔案。請選擇其他硬碟上的資料夾。", +"It is formatted as FAT32, which stores files up to 4 GB; the prompt model alone is 15.7 GB. Choose a folder on another disk.": "它不能存放 4 GB 以上的檔案。請選擇其他硬碟上的資料夾。", +"It is formatted as exFAT, where FreeVideo's Python environment does not work. Choose a folder on an APFS or Mac OS Extended disk.": "它是 exFAT 格式,FreeVideo 的執行環境無法在上面工作。請選擇其他硬碟上的資料夾。", +"It is formatted as exFAT, where FreeVideo's Python environment does not work. Choose a folder on another disk.": "它是 exFAT 格式,FreeVideo 的執行環境無法在上面工作。請選擇其他硬碟上的資料夾。", +"It is mounted so that programs cannot run from it. Choose a folder on another disk.": "它掛載時設定為不允許執行程式。請選擇其他硬碟上的資料夾。", +"It is not 24 fps.": "它不是 24 fps。", +"It is not in the FreeVideo output folder.": "它不在 FreeVideo 的輸出資料夾裡。", +"It is stopping": "正在停止", +"It may have been moved or deleted. Choose another video from Creations.": "它可能已被移動或刪除,請從作品庫裡另選一個影片。", +"It may have been quarantined by security software. Restore the file or allow the FreeVideo folder, then click \"Retry installation\".": "可能被安全軟體隔離了。恢復這個檔案或允許 FreeVideo 所在的資料夾後,點一下「重試安裝」。", +"It may still be working.": "可能仍在處理中。", +"It needs about {required} free; {free} is free. Clean the download cache in Settings → Storage or free some space, then reopen FreeVideo.": "需要約 {required} 可用空間,目前剩餘 {free}。可以在 設定 → 儲存 清理下載快取,或者騰出空間後重新開啟 FreeVideo。", +"It needs to be at least about 1 s long. Choose a longer video.": "參考影片至少需要約 1 秒,請換一段更長的影片。", +"It stops hearing this chat until it calls again": "助手不再收到這裡的對話,再聯絡時自動重連", +"It will not be made": "這項不會再生成", +"Its generation did not finish.": "它沒有生成完成。", +"Its size can only be upscaled to the largest size.": "它的尺寸只能放大到最大尺寸。", +"Jobs": "任務列表", +"Joining clips": "拼接片段", +"Joining the parts": "正在接合各段", +"Joining the parts…": "正在接合各段…", +"Joining the shots": "正在拼接鏡頭", +"Joining · Part {part} of {count}": "正在接合 · 第 {part} 段,共 {count} 段", +"Jump to text the font cannot show": "跳到字型顯示不了的文字", +"Jump to the newest message": "跳到最新的訊息", +"Just now": "剛剛", +"Kai": "楷體", +"Keep clothes": "保持服裝", +"Keep custom_nodes/FreeVideo, move the other FreeVideo folders out of custom_nodes, then restart ComfyUI.": "請保留 custom_nodes/FreeVideo,把其他 FreeVideo 資料夾移出 custom_nodes,然後重新啟動 ComfyUI。", +"Keep dubbing": "繼續配音", +"Keep editing": "繼續編輯", +"Keep fixed": "保持固定", +"Keep for now": "暫時保留", +"Keep generating": "繼續生成", +"Keep generating new takes until you stop": "一直生成新版本,直到停止", +"Keep going␟继续": "繼續", +"Keep going␟继续生成": "繼續生成", +"Keep it at the top": "固定在列表最上面", +"Keep it at the top of Creations": "在作品裡置頂保留", +"Keep it in Favorites": "加入或移出收藏", +"Keep it in favorites": "加入收藏", +"Keep it in the library to reuse with @": "存進角色庫,之後用 @ 引用", +"Keep it under Favorites": "加入收藏,方便再找", +"Keep only one first frame and one last frame enabled.": "首影格和尾影格各只能啟用一張圖片。", +"Keep proportions": "鎖定比例", +"Keep running": "繼續執行", +"Keep source sound": "保留來源影片聲音", +"Keep source video sound": "保留來源影片聲音", +"Keep the changes made here": "儲存這裡的修改", +"Keep the clips on this track from changing": "鎖住這條軌上的片段不被修改", +"Keep the current model, shape and size": "儲存目前模型、畫面比例和尺寸", +"Keep the message as it was": "保留原來的訊息", +"Keep the picture at one moment of the timeline as an image, to use as a first frame, a reference or for further editing.": "把時間軸上某一刻的畫面存成圖片,可再用作首影格、參考圖或繼續修圖。", +"Keep the steps beside your work": "教學收成小卡片,邊看邊操作", +"Keep the whole picture, with bars at the sides": "保留整幅畫面,兩邊留黑", +"Keep these creations": "不刪除,保留這些作品", +"Keep these in favorites": "把選中的加入收藏", +"Keep this amount of VRAM free": "按這個數值預留顯示卡記憶體", +"Keep this chat": "保留這段對話", +"Keep this crop": "確認這次裁切", +"Keep this image easy to find": "收藏這張,方便以後找到", +"Keep this version for now␟暂不更新": "暫不更新", +"Keep this version for now␟暂不更新,继续用当前版本": "暫不更新,繼續用目前版本", +"Keep working": "繼續處理", +"Keeping the original file: ": "正在保留原檔案:", +"Keeps the opening voice consistent in extended dialogue.": "接著生成對白時,沿用原影片開頭的聲音,讓前後聲音一致。", +"Kept for reporting a problem": "提交問題時可附上", +"Kept for this session only": "只在本次執行中有效", +"Kept so a repeated prompt or image starts sooner": "讓重複的提示詞和圖片更快開始", +"Keyboard shortcuts␟快捷键": "快捷鍵", +"Keyboard shortcuts␟快捷键速查": "快捷鍵速查", +"Keys that work in every view": "在任何檢視都能用的按鍵", +"Kind": "類型", +"LAN access": "區域網路存取", +"LAN access has stopped. Turn it on again.": "區域網路存取已停止,請重新開啟。", +"LAN settings require a launcher installation.": "Complete installation in the FreeVideo launcher on this computer. 請在本機 FreeVideo 啟動器中完成安裝。", +"Landscape 16:9": "橫向 16:9", +"Landscape␟横向": "橫向", +"Landscape␟横屏": "橫向", +"Language": "語言", +"Language not supported yet": "暫不支援這種語言", +"Large": "大圖", +"Large, detailed images, up to 16 references": "大尺寸、細節多,最多 16 張參考圖", +"Larger tiles and rows": "縮圖和行更大", +"Largest size first": "尺寸最大", +"Lasso": "套索", +"Last 30 days": "最近 30 天", +"Last 30 minutes": "最近 30 分鐘", +"Last 7 days": "最近 7 天", +"Last attempt failed": "上次更新未完成", +"Last attempts": "最後幾次請求", +"Last frame": "尾影格", +"Last prompt not loaded": "上次的提示詞未能讀取", +"Last prompt not loaded. Click to retry": "上次的提示詞未能讀取,點此重試", +"Last step": "最後一步", +"Later, type @ in the prompt to pick it, and say where it is in the shot or how it is used.": "之後在提示詞中輸入 @ 選擇它,並寫明它在畫面中的位置或用法。", +"Later␟稍后": "稍後", +"Later␟稍后更新": "稍後更新", +"Latest": "最新", +"Latest images at the top": "按時間從新到舊排列", +"Launch": "啟動", +"Launch FreeVideo": "啟動 FreeVideo", +"Launch current version": "啟動目前版本", +"Launcher": "啟動器", +"Launcher ": "啟動器 ", +"Layer": "圖層", +"Layer mask": "圖層遮罩", +"Layer name": "圖層名稱", +"Layer {block}: ": "第 {block} 層:", +"Layer: ": "層:", +"Layers": "圖層", +"Layout␟布局": "佈局", +"Layout␟方式": "方式", +"Learn FreeVideo step by step": "一步步學會 FreeVideo", +"Learn each feature step by step␟一步步学会每个功能": "一步步學會每個功能", +"Learn each feature step by step␟按步骤学每个功能": "按步驟學每個功能", +"Leave compare": "離開比較", +"Leave recently deleted": "離開最近刪除", +"Leave selection": "結束多重選取", +"Leave the media preview": "結束素材預覽", +"Leave the picture as it was": "放棄這次裁切", +"Leave this plan for now": "暫時不拍這份計劃", +"Leave this track out of preview and export": "預覽和匯出裡不顯示", +"Leave without changing anything": "不做變更,離開這一步", +"Leave without saving": "放棄變更並離開", +"Leave without saving? Your changes to this image will be lost.": "不儲存就離開?對這張圖的修改會遺失。", +"Left": "左", +"Left by finished videos; your videos are not touched": "已完成影片留下的中間檔案,不會刪除作品", +"Left hand": "左手", +"Length": "時長", +"Length of the parts not made yet, in seconds": "還沒生成的段有多長(秒)", +"Length {before} s → {after} s": "時長 {before} 秒 → {after} 秒", +"Lengthen or add": "拉長或新增", +"Lengthened to {length} s.": "已加長到 {length} 秒。", +"Lengthened to {length} s. The last part must be at least {least} seconds.": "已加長到 {length} 秒。最後一段至少 {least} 秒。", +"Less": "減少", +"Less memory is available, so this generation will take longer.": "可用記憶體較少,這次生成會較慢。", +"Less than a minute left␟预计还需不到 1 分钟": "預計還需不到 1 分鐘", +"Less than a minute left␟预计还需不到 1 分钟": "預計還需不到 1 分鐘", +"Let an AI assistant make the video for you": "讓 AI 助手替你做完整個影片", +"Let it age out": "不再固定在最上面", +"Let phones on this network open FreeVideo": "允許同一網路的手機存取", +"Let the assistant make a film": "讓助手做一部片子", +"Let the assistant make a longer video": "讓助手分段生成更長的影片", +"Let us talk about this tomorrow.": "這件事我們明天再說。", +"Level": "等級", +"Level 1": "1 級", +"Level 2": "2 級", +"Level 3": "3 級", +"Library": "資料庫", +"Library and system": "作品與執行", +"License": "授權條款", +"Licenses": "授權條款", +"Light appearance": "淺色外觀", +"Light panels": "淺色介面", +"Light · the GPU handles a little less at a time": "輕度 · 顯示卡每次處理的資料減少一些", +"Lighten": "變亮", +"Light␟光线": "光線", +"Light␟浅色": "淺色", +"Light␟轻量": "輕量", +"Line {done} / {total}": "第 {done} / {total} 句", +"Line {line} has nothing after the cut. Describe the new shot.": "第 {line} 行的「切:」後面沒有內容,請寫出新鏡頭的畫面。", +"Line {line} is at {time}, beyond the video length ({length}). Change it to a time within {length}.": "第 {line} 行的時間 {time} 超出影片時長({length}),請改為 {length} 以內的時間。", +"Line {line} is at {time}, outside this part ({range}). Change it to a time within this part.": "第 {line} 行的時間 {time} 超出這一段({range}),請改為這段內的時間。", +"Linear": "線性", +"Lines": "台詞", +"Lines already dubbed are kept; the rest can be dubbed again later.": "已配好的台詞會保留,其餘台詞可以稍後重新配音。", +"Lines cannot be shortened automatically here yet": "這裡暫時不能自動縮短台詞", +"Line␟台词": "台詞", +"Line␟直线": "直線", +"Linked {linked} · copied {copied}": "連結 {linked} · 複製 {copied}", +"List the walkthroughs": "列出可演示的操作", +"Listen": "試聽", +"Live progress could not start": "生成進度無法更新", +"Live-action nature film, the fox shown in {image1} runs through a snowy field with soft snowfall, the camera follows beside it.": "紀錄片風格,{image1} 中的狐狸在飄雪的田野上奔跑,鏡頭在一側跟隨。", +"LoRA model": "LoRA 模型", +"LoRA not found: {names}": "找不到 LoRA:{names}", +"LoRA strength": "LoRA 強度", +"LoRA strength must be between -2 and 2.": "LoRA 強度必須在 -2 到 2 之間。", +"LoRA works with {model}; choose it to use one": "LoRA 用於 {model},選用該模型後可新增", +"Load cached blocks and upload resident weights": "載入模型", +"Load the models early when a generation looks near": "判斷快要生成時提前載入模型", +"Load the page again after the steps": "按上面的步驟處理後重新載入", +"Load the page again; generations keep running": "重新載入頁面,生成不受影響", +"Load the page again; usually recovers": "重新載入頁面,通常能恢復", +"Load this page again; the view in front comes back": "重新載入頁面,回到目前檢視", +"Loading needs about {size} GiB of free RAM. Close other programs and try again.": "載入需約 {size} GiB 可用記憶體,請關閉其他程式後再試。", +"Loading nodes and the web interface": "正在載入介面", +"Loading progress": "正在讀取進度", +"Loading settings…": "正在讀取設定…", +"Loading the model": "載入模型", +"Loading the model failed: {reason}": "載入模型時出錯:{reason}", +"Loading the prompt model": "正在載入提示詞模型", +"Loading the video decoder": "正在載入影片解碼器", +"Loading the video model": "正在載入影片模型", +"Loading this chat. Please send again shortly.": "正在讀取對話,請稍後再發一次", +"Loading…": "正在讀取…", +"Local model {model} · {size} GiB download · needs {ram} GiB free RAM. Your prompt and images stay on this computer.": "本機模型 {model} · 下載 {size} GiB · 需 {ram} GiB 可用記憶體。提示詞和圖片只在本機處理。", +"Local models verified": "已有模型校驗完成", +"Local network": "區域網路", +"Local verification stopped; files retained": "校驗已暫停,檔案已保留", +"Lock": "鎖定", +"Lock this track": "鎖定這條軌道", +"Locked": "已鎖定", +"Locked: typing one side changes the other": "鎖定時改一邊,另一邊按比例跟著變", +"Log: ": "日誌:", +"Long means at least": "達到", +"Long side 2048": "長邊 2048", +"Long video": "長影片", +"Longer": "加長", +"Longer and more": "更長、更完整", +"Longer videos": "更長的影片", +"Longer videos are made in parts and joined": "較長的影片分段生成後接起來", +"Longest first": "時長最長", +"Longest part": "每段最長", +"Look": "外觀", +"Look back": "背身回頭", +"Look for models in these folders": "按這些資料夾尋找模型", +"Look for this computer’s address again": "重新尋找這台電腦的位址", +"Look over \"Installation details\" on the \"Ready to install\" page. Models already in place show \"Installed; no change needed\", and a file that differs from the version FreeVideo tests is listed with the name it will be kept under and its size.": "在「確認安裝」頁檢視「安裝內容」:已經裝好的模型顯示「已安裝,無需變更」,與 FreeVideo 測試過的版本不同的檔案會列出重新命名後的名稱和大小。", +"Looking at the camera movement…": "正在看鏡頭運動…", +"Loop playback": "循環播放", +"Looping": "循環中", +"Loop␟循环": "循環", +"Loop␟循环播放": "循環播放", +"Lossless": "無損", +"Lost the connection to FreeVideo": "與 FreeVideo 的連線已斷開", +"Lost the connection to FreeVideo, so the export progress cannot be read. Export again once it is back.": "與 FreeVideo 的連線已斷開,無法讀取匯出進度。恢復後請重新匯出。", +"Lost the connection to FreeVideo. Try again once it is back.": "與 FreeVideo 的連線已斷開,恢復後請重試。", +"Lost the connection to FreeVideo. Waiting for it to come back…": "與 FreeVideo 的連線中斷,正在等待恢復…", +"Low angle": "低角度", +"Lower during speech": "對白時降低音量", +"Lower-resolution preview; finish it if you like it": "先出低解析度預覽,滿意再繼續", +"MIT License": "MIT 授權條款", +"MOSS-Image needs an NVIDIA graphics card, which this computer does not have. Choose another model": "MOSS-Image 需要 NVIDIA 顯示卡,這台電腦沒有。請選別的模型", +"Made": "時間", +"Made by the assistant": "助手生成", +"Made in one run, without parts": "不分段,一次生成整段", +"Made in {parts} parts and joined": "分 {parts} 段生成並拼接", +"Magic wand": "魔棒", +"Maintenance": "維護", +"Make a 1-minute vertical short film: a day in a coffee shop": "做一條 1 分鐘的直向短片:咖啡店的一天", +"Make a 10-second video: a rainy night, a girl squeezes onto the last bus": "生成一段 10 秒的影片:雨夜,女孩擠上末班車", +"Make a 15-second sneaker ad.": "做一條 15 秒的球鞋廣告。", +"Make a card or link to send": "做成可傳送的卡片或連結", +"Make a copy next to it": "在旁邊複製一份", +"Make a larger copy as a new creation": "生成一個更大的新作品,原作品不變", +"Make a larger copy of a finished video as a new creation. The original stays as it is.": "把生成好的影片放大成一個更大的新作品,原影片保留不變。", +"Make a longer video": "連續的長影片", +"Make a longer video from its end": "從結尾繼續生成更長的影片", +"Make a lower-resolution preview first, then the full video when it looks right.": "先出低解析度預覽,滿意後再生成完整影片。", +"Make a new tag for it": "新增一個標籤", +"Make a new version: it becomes Image 1": "以這張為圖 1,描述要改的地方", +"Make a reference image from words": "用一句話生成一張參考圖", +"Make a tag to group creations": "新增一個標籤來歸類作品", +"Make a video": "做成影片", +"Make a video from one sentence": "寫一句話,生成一段影片", +"Make a video from reference images": "參考圖生成影片", +"Make a video from text": "文字生成影片", +"Make a video from the prompt and settings": "按提示詞和設定生成影片", +"Make a video from this scene": "用這個場景生成影片", +"Make a video of “{prompt}”": "用「{prompt}」作為提示詞生成影片", +"Make an image": "生成圖片", +"Make an image from a prompt in the Images view, or ask the assistant for one in Autopilot.": "在圖片檢視中用一段描述生成圖片,也可以在 AI 全自動中請助手出圖。", +"Make an image from reference images": "用參考圖生成圖片", +"Make an image from the prompt": "按提示詞生成圖片", +"Make an image of “{prompt}”": "用「{prompt}」作為描述生成圖片", +"Make an image or clip to share": "生成可分享的圖片或短片", +"Make and edit images␟生成和修改图片": "生成和修改圖片", +"Make and edit images␟生成和编辑图片": "生成和編輯圖片", +"Make it in one run, even past 30 seconds": "超過 30 秒也一次生成,不分段", +"Make it the next to start": "讓它下一個開始", +"Make music for the chosen range": "為選中的範圍生成配樂", +"Make one to mention with @ later": "新增後可在描述裡用 @ 引用", +"Make separate copies when reusing models": "重複使用模型時建立獨立副本", +"Make several takes with the same settings in a row, or try several prompts at once.": "用同一組設定連續生成多個版本,或一次試幾種寫法。", +"Make sure FreeVideo is running, then try again": "確認 FreeVideo 已經啟動後再試", +"Make sure the \"Snapping\" button (magnet icon) in the toolbar is on. The S key turns it on and off.": "確認工具列的「貼齊」按鈕(磁鐵圖示)已開啟,也可按 S 鍵切換。", +"Make the chosen part from the prompt": "按提示詞生成選中的這一段", +"Make the face close-up, front, side and back from a prompt": "按提示詞生成臉部特寫、正面、側面和背面", +"Make the face close-up, front, side and back from one photo of the person": "用一張人物照片生成臉部特寫、正面、側面和背面", +"Make the face close-up, front, side and back from the prompt": "按提示詞生成臉部特寫、正面、側面和背面", +"Make the face close-up, side and back again from the new front": "用新的正面重新生成臉部特寫、側面和背面", +"Make the four views from the image, in its style": "用圖片按原圖風格生成四個視角", +"Make the four views from the photo": "用照片生成四個視角", +"Make the front, side and back again from the new face": "用新的臉部特寫重新生成正面、側面和背面", +"Make the full size in one go": "一次生成全解析度", +"Make the full-size video from this preview": "從這個預覽生成全尺寸影片", +"Make the image smaller, then try again": "縮小圖片後再試", +"Make the images from a prompt": "按提示詞生成圖片", +"Make the next part from its last frame": "從最後一影格接著生成下一段", +"Make the next part from the end": "從結尾生成下一段", +"Make the next shot from its last frame": "從最後一影格接著生成下一段", +"Make the selected part from its prompt": "按提示詞生成選中的這一段", +"Make the sneaker red.": "把球鞋改成紅色。", +"Make the video from this white model": "按這個白模生成影片", +"Make the whole length at once, no parts": "不分段,一次生成整段", +"Make this block again from its prompt": "按這一段的提示詞重新生成", +"Make this clip again from its prompt": "按這段提示詞重新生成這一段", +"Make this view again; the others stay": "重新生成這個視角,其餘不變", +"Make videos from a prompt": "用提示詞生成影片", +"Make your first video": "做出第一部影片", +"Makes a {size} image": "生成一張 {size} 的圖片", +"Makes images.": "生成圖片。", +"Makes images. Can be added later in the app.": "生成圖片。以後可在應用程式內新增。", +"Makes videos.": "生成影片。", +"Makes videos. Can be added later in the app.": "生成影片。以後可在應用程式內新增。", +"Making": "生成中", +"Making music": "製作配樂", +"Making the video": "合成影片", +"Male": "男", +"Mannequin": "人偶", +"Mark all as read": "全部標為已讀", +"Mark as read": "標為已讀", +"Mark it done and move on": "標記完成,看下一步", +"Mark the playhead position": "在播放頭處做一個記號", +"Mark this moment to find it later": "在這一刻做標記,方便回找", +"Marker": "標記", +"Marker / previous / next": "標記 / 上一個 / 下一個", +"Marker at {minutes}:{seconds}": "標記 {minutes}:{seconds}", +"Marquee": "選框", +"Mask": "建立遮罩", +"Match image": "跟隨圖片", +"Match the first part": "跟隨第一段", +"Match the first reference image": "畫面比例跟第一張參考圖一致", +"Match the image": "跟隨圖片", +"Match the selected part": "跟隨選中的一段", +"Max": "極致", +"Max {limited} s": "最長 {limited} 秒", +"Max {most} s": "最長 {most} 秒", +"May not fit this computer; it would be made at about {size}": "這台電腦可能放不下,會自動改為約 {size}", +"Measure each download source again": "重新測量各下載來源的速度", +"Measure the actual generation speed.": "測試實際的生成速度。", +"Measure this computer; about 30 min per pass": "測量本機效能,每輪約 30 分鐘", +"Measures this computer and writes a report; no setting changes.": "測量本機效能並生成報告,不改變任何設定。", +"Measuring loudness": "測量響度", +"Measuring performance": "正在測量效能", +"Media": "素材", +"Media comes from the connected inputs; no upload is needed.": "素材來自已連接的輸入,無需上傳。", +"Media group": "素材分組", +"Media role": "素材用途", +"Medium␟中": "中", +"Medium␟中粗": "中粗", +"Medium␟标准": "標準", +"Memory": "記憶體", +"Memory is low or its limit was reached": "記憶體不足或已達到上限", +"Memory is low; closing memory-heavy applications will speed this up.": "可用記憶體較少,關閉佔用記憶體較多的程式可以更快。", +"Memory is unavailable for this step": "這一步可用記憶體不足", +"Memory limit reached": "已達到記憶體上限", +"Memory usage could not be read": "暫時無法讀取記憶體用量", +"Mention an image or character": "提及圖片或角色", +"Mention␟引用": "引用", +"Mention␟提及": "提及", +"Menu": "選單", +"Menu of the focused item": "焦點所在項的選單", +"Merge or regenerate the parts shorter than 10 seconds, then try again": "把短於 10 秒的段合併或重新生成後再試", +"Message": "提示", +"MiB retained": "MiB 已保留", +"Microphone access was not granted.": "未獲得麥克風權限。", +"Microphone {number}": "麥克風 {number}", +"Microphone␟话筒": "話筒", +"Microphone␟麦克风": "麥克風", +"Middle": "中", +"Middle frame": "中間影格", +"Middle frame (up to 3)": "中間影格(最多 3 張)", +"Middle frames": "中間影格", +"Middle frames apply to the first part only.": "中間影格只用於第一段。", +"Middle frames need both a first and a last frame, and each time must fall within the video.": "中間影格需要同時有首影格和尾影格,時間需在影片時長以內。", +"Middle frames need both a first and a last frame.": "中間影格需要同時有首影格和尾影格。", +"MiniMax H3 Community License Agreement": "MiniMax H3 社群授權合約", +"MiniMax H3 Community License Agreement, with the Qwen3-VL Apache License 2.0 notice": "MiniMax H3 社群授權合約,附 Qwen3-VL 的 Apache 2.0 聲明", +"MiniMax H3 model": "MiniMax H3 模型", +"Minutes": "分鐘", +"Minutes, 0 to 1440": "分鐘,0 到 1440", +"Mirror": "鏡子", +"Mirror the picture left to right": "畫面左右鏡像", +"Mirror this part left to right": "左右鏡像這段畫面", +"Missing characters": "缺字", +"Mixed": "不同", +"Mode": "方式", +"Model": "模型", +"Model and toolkit licenses · {count}": "模型與工具包許可證 · {count}", +"Model download incomplete": "模型下載未完成", +"Model downloaded": "模型已下載", +"Model files": "模型檔案", +"Model files assembling": "正在合併模型檔案", +"Model files not in use; about {size} can be freed.": "有沒在使用的模型檔案,刪除可釋放約 {size}。", +"Model files preparing": "正在準備模型檔案", +"Model files ready": "模型檔案已就緒", +"Model files verifying": "正在校驗模型檔案", +"Model licenses␟查看模型许可证": "查看模型授權", +"Model licenses␟模型许可证": "模型授權條款", +"Model loading": "模型載入", +"Model package": "模型包", +"Model packages also saved for the next step: {count}": "同時匯入的模型包將在下一步使用:{count}", +"Model packages: {count}": "已匯入模型包:{count}", +"Model source": "模型下載來源", +"Model upgrade": "模型升級", +"Model version": "模型版本", +"Model, prompt, size and more": "模型、提示詞、尺寸等", +"ModelScope": "魔搭", +"ModelScope parallel": "魔搭", +"Models": "模型", +"Models & downloads": "模型與下載", +"Models already in place are reused and take no extra disk space. Files cut short by an interrupted download are completed.": "已裝好的模型直接沿用,不重複佔用硬碟空間;下載中斷留下的不完整檔案會自動補齊。", +"Models are being prepared in the background. Setup will continue when they are ready.": "正在背景準備模型,完成後會繼續安裝", +"Models, downloads, storage, look": "模型、下載、儲存和外觀", +"Models, storage, language and notifications": "模型、儲存位置、語言和通知", +"Models, storage, network and more": "模型、儲存、網路等設定", +"Mono": "等寬", +"Monologue": "人物獨白", +"Mood": "情緒", +"More beats": "更多節拍", +"More detail, slower": "細節更多,較慢", +"More detail, takes longer": "細節更多,用時更長", +"More options": "更多選項", +"More room for the conversation": "給對話留出更多空間", +"More room for the image": "給畫面騰出空間", +"More room for the picture": "給畫面騰出空間", +"More shapes": "更多畫面比例", +"More shots take longer.": "鏡頭越多,耗時越長。", +"More sizes": "更多尺寸", +"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": "更多工具", +"More: {title}": "更多:{title}", +"More␟增加": "增加", +"More␟更多": "更多", +"Most detail, takes longest": "細節最多,用時最長", +"Move / marquee / lasso / brush / eraser / text tool": "移動 / 選框 / 套索 / 畫筆 / 橡皮擦 / 文字工具", +"Move down": "下移", +"Move earlier": "向前移動", +"Move it to Recently deleted": "移到最近刪除,可恢復", +"Move later": "向後移動", +"Move or remove a sound clip here first": "先挪開或刪除這裡的一段聲音", +"Move queued video {number} to front": "把排隊的第 {number} 個排到最前", +"Move the compare line": "移動對比分界線", +"Move the picture left or right, in percent": "左右移動畫面,按百分比", +"Move the picture up or down, in percent": "上下移動畫面,按百分比", +"Move the picture's sound to its own track": "把畫面自帶的聲音拆到單獨的軌道", +"Move the playhead to the first frame": "播放頭回到第一影格", +"Move the playhead to the last frame": "播放頭到最後一影格", +"Move the selected text to the clipboard": "把選中的文字移到剪貼簿", +"Move this video to Recently deleted": "把影片移到最近刪除", +"Move to front": "排到最前", +"Move to recently deleted; can be undone": "移到最近刪除,可以復原", +"Move up": "上移", +"Moved right after the previous part.": "已接在上一段後面。", +"Moved to front": "已排到最前", +"Moved to the nearest available spot.": "已挪到最近的可用位置。", +"Moved to the next empty spot.": "已挪到後面的空位。", +"Move␟移动": "移動", +"Move␟选择": "選擇", +"Multiply": "正片疊底", +"Music cannot be generated on this computer yet.": "這台電腦暫不能生成配樂。", +"Music style": "配樂風格", +"Music␟配乐": "配樂", +"Music␟音乐": "音樂", +"Must be between {min} and {max} s.": "時間需在 {min} 到 {max} 秒之間。", +"Mute": "靜音", +"Mute the sound": "關閉聲音", +"Mute this track": "靜音這條軌道", +"NVIDIA CUDA Toolkit End User License Agreement": "NVIDIA CUDA 工具包終端使用者授權合約", +"NVIDIA cuDNN Software License Agreement": "NVIDIA cuDNN 軟體授權合約", +"Name these settings": "為目前設定命名", +"Name␟名字": "名字", +"Name␟名称": "名稱", +"Nanjing University mirror": "南京大學鏡像", +"Narration": "旁白", +"Narrow the history": "收窄歷史", +"Needs 8 first-pass steps": "第一階段需 8 步", +"Needs a download of about {size}": "需下載約 {size}", +"Needs a second video in the history": "歷史裡還要有另一部影片", +"Needs repair": "需要修復", +"Needs replacing": "需要替換", +"Needs your OK · ": "要確認 · ", +"Neon signs reflect on a rain-soaked street at night, a taxi passes slowly, the camera tracks along the sidewalk, rain and distant music.": "雨夜的街道倒映著霓虹招牌,一輛計程車緩緩駛過,鏡頭沿人行道平移,雨聲和遠處的音樂。", +"Network unreachable": "無法連上網路", +"Never use the proxy": "不使用代理", +"New character": "新增角色", +"New chat": "新對話", +"New each run": "每次隨機", +"New each run, kept, or stepped": "每次隨機、保持或按次遞增", +"New edit": "新增剪輯", +"New engine {version} is ready": "新版引擎 {version} 已就緒", +"New image": "生成一張", +"New in {version}": "{version} 新功能", +"New installation": "全新安裝", +"New line␟换行": "換行", +"New line␟新台词": "新台詞", +"New paint layer": "新增繪畫圖層", +"New password": "新密碼", +"New prop": "新增道具", +"New scene": "新增場景", +"New tag": "新增標籤", +"New tag…": "新增標籤…", +"New takes until stopped or this page closes": "一直生成新版本,直到停止或關閉網頁", +"New voice": "新聲", +"Newer": "較新", +"Newer video": "較新的一條", +"Newest first": "最新在前", +"New␟新": "新", +"New␟新声": "新聲", +"New␟新建": "新增", +"New␟新选区": "新選區", +"Next frame": "下一格", +"Next image": "下一張", +"Next marker": "下一個標記", +"Next page": "下一頁", +"Next page; the last one closes the tour": "看下一頁,最後一頁結束介紹", +"Next subtitle while editing": "編輯時新增下一條字幕", +"Next␟下一个": "下一個", +"Next␟下一张": "下一張", +"Next␟下一步": "下一步", +"Next␟下一篇": "下一篇", +"Next␟下一页": "下一頁", +"No LAN address found. Connect to Wi-Fi or a wired network first.": "未找到區域網路位址,請先連接 Wi-Fi 或有線網路。", +"No LoRA files yet": "還沒有 LoRA 檔案", +"No LoRA matches": "沒有匹配的 LoRA", +"No NVIDIA driver was found": "未找到 NVIDIA 顯示卡驅動程式", +"No assistant has connected since FreeVideo started.": "FreeVideo 啟動後還沒有助手連線。", +"No audio is connected": "未接入音訊", +"No chat matches.": "沒有匹配的對話。", +"No chats yet. Say what you want to make; the chat is kept here.": "還沒有對話。說一句想做什麼,對話會留在這裡。", +"No conversion on this computer": "無需本機轉換", +"No creation has this tag yet. Select creations and press Tag.": "還沒有作品帶這個標籤。選中作品後點一下「標籤」。", +"No data received for a long time": "長時間沒有收到資料", +"No details": "沒有更多資訊", +"No details for this video.": "這部影片沒有詳情。", +"No details were sent.": "頁面沒有傳送詳情。", +"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 image with that number": "沒有這個編號的參考圖", +"No images to clean up": "沒有需要清理的圖片", +"No images yet": "還沒有圖片", +"No language found": "沒有找到這種語言", +"No lines were found in this part.": "這一段沒有識別到台詞。", +"No matching characters or media": "沒有匹配的角色或素材", +"No matching language": "沒有找到這種語言", +"No model folders found; add one above.": "沒有發現模型資料夾,可在上方新增。", +"No name matches this search.": "沒有符合搜尋的名稱。", +"No other notices": "沒有其他通知", +"No picture could be read from this video file. Choose another video.": "無法從這個影片檔案裡讀出畫面,請換一個影片。", +"No prompt matches.": "沒有匹配的提示詞。", +"No reference images yet": "還沒有參考圖", +"No release notes were included with this version.": "此版本未附帶更新說明。", +"No result yet.": "目前還沒有結果。", +"No results for “{q}”": "沒有找到「{q}」", +"No room left when extending": "接續段位置已滿", +"No saved creations yet.": "作品庫裡還沒有作品。", +"No saved images yet.": "作品庫裡還沒有圖片。", +"No saved videos yet.": "作品庫裡還沒有影片。", +"No setting matches": "沒有找到相關設定", +"No shortcut matches.": "沒有匹配的快捷鍵。", +"No shortcuts here yet.": "這裡還沒有快捷鍵。", +"No sound": "無聲", +"No source can be reached. Check the network or the connection mode.": "下載來源均無法連線,請檢查網路或切換連線方式。", +"No sources reachable. Check your network or connection mode.": "下載來源均無法連線,請檢查網路或切換連線模式。", +"No speech found": "沒有聽到說話聲", +"No speech recognition model is installed on this computer": "這台電腦上沒有安裝語音識別模型", +"No speech was found in the selection": "所選範圍內沒有找到說話聲", +"No speech was heard in this voice. Choose another voice.": "這個音色裡沒有聽到說話聲,請換一個音色。", +"No subtitles found. Only SRT files can be imported.": "未找到字幕。僅支援匯入 SRT 字幕檔案。", +"No task matches": "沒有匹配的任務", +"No tasks are running.": "目前沒有在執行的任務", +"No tasks yet": "還沒有任務", +"No template matches.": "沒有匹配的範本。", +"No token for this session. Credentials already on this computer still apply.": "未填寫本次權杖;仍可使用本機已有的憑據。", +"No version of the required packages is available for this computer": "所需的軟體包沒有適用於這台電腦的版本", +"No video was changed": "沒有影片被修改", +"No voice available. Record or import a voice clip first.": "沒有可用的音色。請先錄音或匯入一段人聲。", +"Node": "節點", +"Nodes": "節點檢視", +"None": "無", +"Normal": "正常", +"Normal speed": "正常速度", +"Not available on the recording track␟录音轨不能单独试听": "錄音軌不能單獨試聽", +"Not available on the recording track␟录音轨不能锁定": "錄音軌不能鎖定", +"Not available on this computer": "這台電腦不支援", +"Not available right now␟暂时无法读取": "暫時無法讀取", +"Not available right now␟现在不能用": "現在不能用", +"Not available with first and last frames": "首尾影格不能和替換人物同時使用", +"Not checked": "未能檢查", +"Not checked yet": "尚未檢查", +"Not connected": "未連線", +"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 enabled. Your prompt is unchanged.": "未啟用,原文已保留。", +"Not enough GPU memory": "顯示卡記憶體不足", +"Not enough GPU memory for depth": "顯示卡記憶體不足,無法提取深度", +"Not enough GPU memory to load the model. Close other apps using the GPU, then try again.": "顯示卡記憶體不足,無法載入模型。請關閉其他佔用顯示卡的程式後重試。", +"Not enough GPU memory to load the reference images. Use fewer reference images, or close other apps using the GPU, then try again.": "顯示卡記憶體不足,無法載入參考圖。請減少參考圖,或關閉其他佔用顯示卡的程式後重試。", +"Not enough GPU memory to upscale": "顯示卡記憶體不足,放大沒能完成", +"Not enough GPU memory, even at the smallest size. Close other apps using the GPU, then try again.": "顯示卡記憶體不足,最小尺寸也無法生成。請關閉其他佔用顯示卡的程式後重試。", +"Not enough GPU memory, even at {width} × {height}. Close other apps using the GPU, then try again.": "顯示卡記憶體不足,{width} × {height} 也無法生成。請關閉其他佔用顯示卡的程式後重試。", +"Not enough GPU memory. Made at {width} × {height} instead.": "顯示卡記憶體不足,已改為 {width} × {height} 生成。", +"Not enough GPU memory. Retrying at {width} × {height}": "顯示卡記憶體不足,改用 {width} × {height} 重試", +"Not enough RAM, so this will be slow.": "記憶體不足,這次會很慢。", +"Not enough Windows memory": "Windows 記憶體不足", +"Not enough disk space": "磁碟空間不足", +"Not enough disk space for the faster model": "磁碟空間不夠,暫時無法升級到更快的模型", +"Not enough disk space for the optional model.␟可选模型的磁盘空间不足,请清理后重试。": "可選模型的磁碟空間不足,請清理後重試。", +"Not enough disk space for the optional model.␟磁盘空间不足,无法安装可选模型。": "磁碟空間不足,無法安裝可選模型。", +"Not enough disk space for the upscaled video": "磁碟空間不足,放大後的影片沒能儲存", +"Not enough disk space to download the Fast level. Free up space and try again.": "磁碟空間不足,無法下載極⁠速⁠檔。請釋放空間後重試。", +"Not enough disk space to download the Replace person model.": "磁碟空間不足,無法下載替換人物模型。", +"Not enough disk space to install the image model.": "磁碟空間不足,無法安裝圖片模型。", +"Not enough disk space.": "磁碟空間不足。", +"Not enough disk space. Free up space, then export again.": "磁碟空間不足,請釋放空間後再匯出。", +"Not enough free memory to prepare this model. Close other programs, then resume.": "可用記憶體不足,無法準備這個模型。請關閉其他程式後點選「繼續」。", +"Not enough graphics memory to rewrite. In use: {programs}. Close the listed programs and rewrite again, or use the original.": "顯示卡記憶體不足,無法改寫。正在佔用:{programs}。關閉上述程式後可重新改寫,或使用原文。", +"Not enough graphics memory to rewrite. In use: {programs}. Close the listed programs before rewriting again.": "顯示卡記憶體不足,無法改寫。正在佔用:{programs}。關閉上述程式後可重新改寫。", +"Not enough graphics memory to separate this sound.": "顯示卡記憶體不足,無法分離這段聲音。", +"Not enough graphics memory, so this will be slow.": "顯示卡記憶體不足,這次會很慢。", +"Not enough graphics memory. Close other GPU apps and try again.": "顯示卡記憶體不足,請關閉其他顯示卡程式後再試。", +"Not enough graphics memory. In use: {programs}. Close them and try again.": "顯示卡記憶體不足,無法生成提示詞。正在佔用:{programs}。關閉後再試。", +"Not enough memory": "記憶體不足", +"Not enough memory for this video": "可用顯示卡記憶體或記憶體不足,無法生成這段影片", +"Not enough memory to convert the reference video": "記憶體不足,參考影片未能轉換完成", +"Not enough memory to finish dubbing. The edited lines are kept. Close other programs using the GPU, then redub.": "顯示卡記憶體或記憶體不足,配音未完成,所改台詞已保留。請關閉其他佔用顯示卡的程式後重新配音。", +"Not enough memory to generate the music. Close other programs that use the graphics card, then generate again.": "生成配樂時記憶體不足,請關閉其他佔用顯示卡的程式後重新生成。", +"Not enough memory to generate the voice. Close other programs that use the graphics card, then generate again.": "生成旁白時記憶體不足,請關閉其他佔用顯示卡的程式後重新生成。", +"Not enough memory to rewrite. Close other GPU apps before rewriting again.": "改寫時記憶體不足,關閉其他顯示卡程式後可再改寫。", +"Not enough memory to rewrite. Close other GPU apps or use the original.": "改寫時記憶體不足,請關閉其他顯示卡程式或使用原文。", +"Not enough memory, even at the smallest size. Close other apps, then try again.": "記憶體不足,最小尺寸也無法生成。請關閉其他程式後重試。", +"Not enough space": "空間不夠", +"Not enough unified memory": "統一記憶體不足", +"Not enough video memory": "顯示卡記憶體不足", +"Not enough virtual memory to load the image model. Close other apps, or increase virtual memory in system settings, then try again.": "虛擬記憶體不足,無法載入圖片模型。請關閉其他程式,或在系統設定中調大虛擬記憶體,然後重試。", +"Not finished": "未完成", +"Not generated": "未生成", +"Not generated yet": "還沒生成", +"Not installed": "未安裝", +"Not installed: Generate installs it first, {size}": "未安裝:點生成會先安裝,{size}", +"Not installed: another model is downloading; this one installs after it, or when you press Generate": "未安裝:另一個模型正在下載,完成後才會安裝這個,也可點生成", +"Not measured yet. Test again to compare the sources.": "尚未測速,按一下「重新測速」比較各下載來源。", +"Not now␟先不": "先不", +"Not now␟先不下载": "先不下載", +"Not now␟先不拍": "先不拍", +"Not now␟暂不删除": "暫不刪除", +"Not now␟暂不启用": "暫不啟用", +"Not now␟暂不安装": "暫不安裝", +"Not on ModelScope": "魔搭暫無", +"Not on this computer": "這台電腦不支援", +"Not saved": "未儲存", +"Not saved yet": "尚未儲存", +"Not sent. Click \"Retry\".": "沒有發出,請點一下「重試」。", +"Not sent: ": "沒發出去:", +"Not set": "未設定", +"Not used with frames": "不與首尾影格同用", +"Nothing found": "沒有找到", +"Nothing here yet": "這裡還沒有內容", +"Nothing is downloaded": "不下載任何內容", +"Nothing is generating": "沒有正在生成的任務", +"Nothing is running.": "沒有進行中的任務。", +"Nothing is selected.": "還沒有選區。", +"Nothing matches these filters.": "沒有符合篩選條件的作品。", +"Nothing matches this search.": "沒有符合搜尋的作品。", +"Nothing matches␟没有符合条件的图片": "沒有符合條件的圖片", +"Nothing matches␟没有符合条件的视频": "沒有符合條件的影片", +"Nothing new": "沒有新通知", +"Nothing that a creation, character, conversation or open page uses": "作品、角色、對話和開啟的頁面都不再使用", +"Nothing to bring back.": "沒有可以恢復的作品。", +"Nothing to clean up": "沒有可清理的檔案", +"Nothing to clean.": "暫無可清理的下載快取。", +"Nothing to clear up": "沒有可清理的檔案", +"Nothing to clear up now": "現在沒有可清理的檔案", +"Nothing to do; submit a new task when needed": "無需操作,需要時再提交新任務", +"Nothing to pick here: this part is transparent.": "這裡是透明的,沒有可吸取的顏色。", +"Nothing to redo": "沒有可以重做的變更", +"Nothing to redo.␟没有可以重做的改动。": "沒有可以重做的變更。", +"Nothing to redo.␟没有可重做的步骤。": "沒有可重做的步驟。", +"Nothing to undo yet": "還沒有可以復原的變更", +"Nothing to undo.␟没有可以撤销的改动。": "沒有可以復原的變更。", +"Nothing to undo.␟没有可撤销的步骤。": "沒有可復原的步驟。", +"Nothing was deleted just now": "最近沒有刪除的圖片", +"Nothing was recorded.": "沒有錄到聲音。", +"Nothing yet. Tell the Agent what to make in Chat.": "還沒有作品,在對話裡說想做什麼。", +"Notices are here": "通知在這裡", +"Notices␟提醒": "提醒", +"Notices␟通知": "通知", +"Notice␟提示": "提示", +"Notice␟提醒": "提醒", +"Notifications": "通知", +"Now {width} × {height} px": "目前 {width} × {height} 像素", +"Now: Favorites first": "目前:收藏在前", +"Now: Newest first": "目前:最新在前", +"Now: Oldest first": "目前:最早在前", +"Now: {order}": "目前:{order}", +"Number of videos": "生成數量", +"OK␟知道了": "知道了", +"OK␟确定": "確定", +"Objects to reuse": "可重複使用的道具", +"Off keeps it listed but unused": "關閉後保留在列表裡但不使用", +"Off · automatic performance": "關閉 · 自動效能", +"Off. Click to turn on": "已停用,點選啟用", +"Off: only in the tutorial": "關掉後只在教學裡看", +"Offline package ZIPs": "離線安裝包壓縮檔", +"Offline packages": "離線安裝包安裝", +"Off␟关": "關", +"Off␟关闭": "關閉", +"Old versions removed · %s freed": "已清理舊版本 · 釋放 %s", +"Older": "較早", +"Older video": "較早的一條", +"Oldest first": "最早在前", +"On a Mac, a request uses either characters or first and last frames.": "Mac 上角色與首影格、尾影格請選其一使用。", +"On a Mac, a request uses either first and last frames, or reference images and characters.": "Mac 上首影格、尾影格與參考圖、角色請選其一使用。", +"On a Mac, a request uses either scenes and props or first and last frames.": "Mac 上場景、道具與首影格、尾影格請選其一使用。", +"On a Mac, keep one of the two: turn off the media cards or inputs you are not using, then generate again.": "在 Mac 上請保留其中一種:關閉本次不用的素材卡片或輸入,再重新生成。", +"On an audio card, choose \"Use as is\" to put that audio into the result unchanged. The duration follows the audio, and only one audio file can be used as is.": "音訊卡片上選「原樣使用」時,成片直接使用這段聲音,時長隨音訊而定;一次只能有一段音訊原樣使用。", +"On an empty canvas, the shape list sets the shape of the blank canvas.": "畫布為空時,比例清單用來設定空白畫布的比例。", +"On layer": "畫在圖層", +"On mask": "畫在遮罩", +"On the \"Connect an assistant\" card, choose the button to copy the connection details and paste them to the assistant you use.": "點一下「連線助手」卡片中的按鈕複製連線資訊,貼上給所使用的助手。", +"On the Installation page in the sidebar, select New installation, change Install location to a new folder, then click Replace package… under Import environment package and choose the downloaded environment package; if you are online, you can instead choose Automatic as the install method there. The models and videos in the current folder are not deleted.": "請在左側「安裝」頁選擇「全新安裝」,把「安裝位置」改為一個新資料夾,然後在「匯入執行環境包」中點選「更換環境包…」並選擇下載的執行環境包;能連上網路時,也可以在那裡把安裝方式改為「自動安裝」。原資料夾裡的模型和作品不會被刪除。", +"On the computer that runs FreeVideo, open {address}, then retry.": "請在執行 FreeVideo 的電腦上開啟 {address},然後重試。", +"On the left of Creations, choose \"New tag\", type a name and press Enter.": "在作品庫左側點一下「新增標籤」,輸入名稱後按 Enter。", +"On the picture track, drag a long range. It is divided into numbered parts.": "在「畫面」軌上拖出一段較長的範圍,它會分成帶編號的多段。", +"On the picture track, drag a range along the sound.": "在「畫面」軌上,對著聲音拖出一段。", +"Once connected, describe the video you want. It generates and edits it for you.": "連上後,說想做什麼影片,它來生成和剪輯。", +"Once, a batch, or a loop": "單次、批次或循環生成", +"Once, a batch, or keep going until stopped": "單次、批次或一直生成", +"One clear image of the character, in any style; the views keep its style": "一張清晰的角色圖片,任何畫風都可以,各視角保持原圖風格", +"One clear photo of the person; the face decides the likeness": "一張清晰的人物照片,長相以臉部為準", +"One continuous shot can have up to {limit} parts. Make it shorter.": "一個連續鏡頭最多 {limit} 段,請縮短。", +"One continuous shot can have up to {maxParts} parts.": "一個連續鏡頭最多 {maxParts} 段。", +"One continuous shot has a limit on the number of parts; see \"Make a longer video\".": "一個連續鏡頭的段數有上限,見「連續的長影片」。", +"One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds. A separate shot does not count toward them.": "同一個連續鏡頭最多 8 段,有短於 10 秒的段時最多 4 段;另起的獨立鏡頭不計入。", +"One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds; a new shot started later on the timeline does not count.": "同一個連續鏡頭最多 8 段,有短於 10 秒的段時最多 4 段;在時間軸後面另起的新鏡頭不計入。", +"One creation large, thumbnails beside it": "大圖檢視,旁邊是縮圖", +"One of FreeVideo's own record files in the image model folder (image_gen) is a link or leads outside that folder, so it was not written; delete that link and try again.": "圖片模型目錄(image_gen)裡 FreeVideo 自己的記錄檔案是連結或指向目錄之外,所以沒有寫入;請刪掉這個連結後重試。", +"One over the other, drag the divider": "疊在一起,拖曳分界線", +"One over the other, drag to reveal": "疊在一起,拖曳分界線檢視", +"One piece": "強制單次生成", +"One prompt per line": "每行一條提示詞", +"One run": "一次生成", +"One second longer␟加长 1 秒": "加長 1 秒", +"One second longer␟时长增加 1 秒": "時長增加 1 秒", +"One second shorter␟时长减少 1 秒": "時長減少 1 秒", +"One second shorter␟缩短 1 秒": "縮短 1 秒", +"One video per press": "每按一次生成一個", +"Only": "只看", +"Only .safetensors files are listed.": "只列出 .safetensors 格式的檔案。", +"Only 24 fps videos can be upscaled. Choose another video.": "只有 24 fps 的影片可以放大,請另選一個影片。", +"Only SRT subtitle files can be imported, up to 500 subtitles at a time.": "字幕檔案只支援 SRT,一次最多匯入 500 則。", +"Only ZIP files saved on this computer can be imported. Download the package first, then drag it here.": "只能匯入已儲存到本機的 ZIP 檔案。請先下載離線安裝包,再把它拖到這裡。", +"Only a short drama whose shots were joined successfully gets an edit.": "只有收尾時拼接成功的短劇才有剪輯專案。", +"Only for a single part": "只能對單獨一段調整", +"Only images and videos can be turned into a prompt.": "只能用圖片或影片生成提示詞。", +"Only images can be added.": "只能新增圖片。", +"Only images made today": "只看今天生成的", +"Only images made with H3 Image": "只看 H3 Image 生成的", +"Only images made with MOSS-Image": "只看 MOSS-Image 生成的", +"Only images made with Qwen-Image": "只看 Qwen-Image 生成的", +"Only music on the \"Audio 2\" track has beats. Music without a clear pulse shows no beat lines.": "只有「聲音 2」軌上的音樂有拍點;節奏不明顯的音樂沒有拍點線。", +"Only one audio file can be set to \"Use as is\".": "只能有一段音訊選「原樣使用」。", +"Only the creation, over the whole screen": "全螢幕只看作品", +"Only the first 500 subtitles were imported.": "只匯入了前 500 條字幕。", +"Only the generated images": "只看生成的圖片", +"Only the generated videos": "只看生成的影片", +"Only the old model's own files are removed.": "只刪除舊模型自己的檔案。", +"Only the prompt, preview and Create in the creation panel": "創作面板只顯示描述、預覽和生成", +"Only the starred ones": "只看收藏的圖片", +"Only things to do": "只看可執行的操作", +"Only what you hear here, not the export": "只調這裡聽到的,不影響匯出", +"On␟已设置": "已設定", +"On␟开启": "開啟", +"Opacity": "不透明度", +"Open ": "開啟 ", +"Open \"Create\" and write one sentence under the prompt: who is where and doing what.": "開啟「創作面板」,在「描述畫面」中寫一句話,說明誰在什麼地方做什麼。", +"Open \"Edit image\", click \"Generate with AI\" at the top left and choose \"New image\".": "開啟「編輯圖片」,點左上角的「AI 生成」,選擇「生⁠成⁠一⁠張」。", +"Open ComfyUI": "開啟 ComfyUI", +"Open Creations": "開啟作品庫", +"Open FreeVideo": "開啟 FreeVideo", +"Open FreeVideo in a window without extensions, such as a private window, or in another browser.": "用不執行擴充功能的視窗(例如無痕視窗)或另一個瀏覽器開啟 FreeVideo。", +"Open FreeVideo on a phone on this network␟在同一网络的手机上打开": "在同一網路的手機上開啟", +"Open FreeVideo on a phone on this network␟在同一网络的手机上打开 FreeVideo": "在同一網路的手機上開啟 FreeVideo", +"Open FreeVideo on this computer with a localhost address, then retry.": "請在本機使用 localhost 位址開啟 FreeVideo,然後重試。", +"Open FreeVideo workflow": "開啟 FreeVideo 工作流程", +"Open Images": "開啟圖片檢視", +"Open Images to see the download": "開啟圖片檢視查看下載", +"Open Images to try again": "開啟圖片檢視重試", +"Open Settings": "開啟設定", +"Open a FreeVideo workflow first.": "請先開啟 FreeVideo 工作流程。", +"Open a creation workflow to view the guide.": "請先開啟創作工作流程,再檢視指引。", +"Open a prefilled report; the file itself is not sent": "開啟預填好的問題報告,不會傳送檔案本身", +"Open a report, or export diagnostics when something fails.": "開啟報告;遇到問題時匯出診斷包。", +"Open chat": "開啟對話", +"Open creations library": "開啟作品庫", +"Open creative workspace": "開啟創作面板", +"Open editor": "開啟剪輯", +"Open every chapter": "開啟全部章節", +"Open folder": "開啟資料夾", +"Open for the reason": "點開檢視原因", +"Open image in a new tab": "在新分頁開啟圖片", +"Open in Creations: ": "在作品中開啟:", +"Open in Creations␟在作品库打开": "在作品庫開啟", +"Open in Creations␟在作品库里打开": "在作品庫裡開啟", +"Open in Images␟在图像视图打开": "在圖片檢視開啟", +"Open in Images␟在图像视图里打开": "在圖片檢視裡開啟", +"Open install folder": "開啟安裝目錄", +"Open it": "開啟它", +"Open it alone on the stage": "在中間單獨顯示", +"Open it from the launcher. For an automatic installation, go back to Setup and choose another folder.": "請在啟動頁直接開啟這份安裝。如需自動安裝,請回到安裝設定,換一個安裝位置。", +"Open it in Edit": "放進剪輯檢視繼續改", +"Open it in Edit to cut and add sound": "在剪輯視圖裡繼續剪輯和配音", +"Open it in your creations": "在作品庫裡開啟", +"Open it over the whole window": "鋪滿視窗檢視", +"Open latest video report": "開啟最近影片報告", +"Open launcher logs": "開啟啟動器日誌", +"Open link in a new tab": "在新分頁開啟連結", +"Open on a phone on this network": "在同一網路的手機上開啟", +"Open output folder": "開啟輸出資料夾", +"Open settings": "開啟設定", +"Open the FreeVideo launcher to add the video model.": "請開啟 FreeVideo 啟動器新增影片模型。", +"Open the FreeVideo launcher to update, or download the new version.": "請在 FreeVideo 啟動器中更新,或下載新版。", +"Open the FreeVideo page in the browser, then do this there": "在瀏覽器中開啟 FreeVideo 頁面後再操作", +"Open the chapter about this": "開啟講這個功能的那一章", +"Open the chat list": "開啟對話列表", +"Open the create view first, then run the second pass": "請先開啟創作頁,再繼續第二階段", +"Open the examples page": "開啟教學的範例頁", +"Open the exported video in the library": "在作品庫裡開啟匯出的影片", +"Open the feedback form with this error filled in": "開啟意見回饋表,已填好這個錯誤", +"Open the feedback page to attach the report": "開啟意見回饋頁面,附上報告提交", +"Open the feedback page with your text filled in": "開啟意見回饋頁面,文字已填好", +"Open the generation in progress": "開啟正在進行的生成畫面", +"Open the guide to writing a good prompt": "開啟提示詞寫法指南,寫得更準", +"Open the launcher, make sure FreeVideo is running, then generate again.": "請開啟啟動器,確認 FreeVideo 正在執行後重新生成。", +"Open the library to place clips": "開啟素材庫,把素材放進時間軸", +"Open the next chapter": "開啟下一篇", +"Open the previous chapter": "開啟上一篇", +"Open the result␟打开生成结果": "開啟生成結果", +"Open the result␟打开结果": "開啟結果", +"Open the settings at this group": "展開設定欄並跳到這一組", +"Open the source": "開啟來源", +"Open the tutorial": "展開教學", +"Open these results where they were made": "開啟這組結果,回到它的畫面", +"Open this cast member": "開啟這個角色", +"Open this chapter": "開啟這一章", +"Open where this feature lives": "開啟這個功能所在的位置", +"Open where this link goes": "開啟這個連結", +"Open your creations to sort and manage them": "開啟作品庫,篩選和管理", +"Open ↗": "開啟 ↗", +"Opened": "已開啟", +"Opening": "正在開啟", +"Opening \"{name}\"": "正在開啟「{name}」", +"Opening the edit…": "正在開啟…", +"Opening…": "正在開啟…", +"Opens the account page in the browser": "在瀏覽器中開啟帳號頁面", +"Opens the feedback page": "開啟意見回饋頁面", +"Open␟去看看": "去看看", +"Open␟张开": "張開", +"Open␟打开": "開啟", +"Open␟进入": "進入", +"Optimize model storage": "準備模型", +"Optimize once": "最佳化一次", +"Option {number}": "方案 {number}", +"Optional · kept for this session only": "可選 · 只在本次執行中有效", +"Optional. Once set, other devices enter it the first time they open FreeVideo. Not needed on this computer.": "可選。設定後,其他裝置第一次開啟時要輸入,本機不用。", +"Or Alt-click the image": "也可以按住 Alt 點選畫面", +"Order": "排序", +"Organize creations: tags, filters and compare": "整理作品:標籤、篩選和比較", +"Original file kept": "原檔案保留", +"Original␟原图": "原圖", +"Original␟原图比例": "原圖比例", +"Original␟原声": "原聲", +"Original␟原文": "原文", +"Original␟恢复原图": "恢復原圖", +"Other": "其他", +"Other disks…": "其他硬碟…", +"Other edits came after it; use Undo in the tool row.": "之後又有變更,請用工具列的復原。", +"Other error": "其他錯誤", +"Other model folders": "其他模型資料夾", +"Other model folders (optional, one per line)": "其他模型資料夾(可選,每行一個)", +"Other programs are using {ram_gib} GB of RAM.": "其他程式佔用了 {ram_gib} GB 記憶體。", +"Other programs are using {ram_gib} GB of RAM, so this generation will be slower. Closing them speeds up generation.": "其他程式佔用了 {ram_gib} GB 記憶體,這次生成會變慢。關閉這些程式可加快生成。", +"Other programs are using {vram_gib} GB of GPU memory and {ram_gib} GB of RAM.": "其他程式佔用了 {vram_gib} GB 顯示卡記憶體和 {ram_gib} GB 記憶體。", +"Other programs are using {vram_gib} GB of GPU memory.": "其他程式佔用了 {vram_gib} GB 顯示卡記憶體。", +"Other programs are using {vram_gib} GB of GPU memory and {ram_gib} GB of RAM, so this generation will be slower. Closing them speeds up generation.": "其他程式佔用了 {vram_gib} GB 顯示卡記憶體和 {ram_gib} GB 記憶體,這次生成會變慢。關閉這些程式可加快生成。", +"Other programs are using {vram_gib} GB of GPU memory, so this generation will be slower. Closing them speeds up generation.": "其他程式佔用了 {vram_gib} GB 顯示卡記憶體,這次生成會變慢。關閉這些程式可加快生成。", +"Other programs were using about {percent}% of the GPU.": "其他程式佔用了約 {percent}% 的顯示卡。", +"Other shapes": "其他比例", +"Other shapes and Image 1": "其他比例和「同圖 1」", +"Otherwise change the prompt or the seed and generate a new preview.": "不滿意時,修改提示詞或種子,再生成新的預覽。", +"Out of GPU memory": "顯示卡記憶體不足", +"Out of RAM": "記憶體不足", +"Out of memory": "顯示卡記憶體或記憶體不足", +"Outline": "描邊", +"Outline or fill": "描邊或填充", +"Outside usual range": "超出常用範圍", +"Over two lines": "超過兩行", +"Overall": "整體進度", +"Overhead": "俯拍", +"Overlay": "疊加", +"Package files": "離線安裝包檔案", +"Packages installed": "元件已安裝", +"Packages installing": "正在安裝元件", +"Packages preparing": "正在準備元件", +"Packages ready": "元件已就緒", +"Packages removing": "正在移除舊元件", +"Packages resolving": "正在檢查元件", +"Pad to video shape": "補邊到影片比例", +"Page check": "頁面檢查", +"Page didn't open? Open the feedback page": "頁面沒有開啟?點此前往意見回饋頁面", +"Page files": "頁面檔案", +"Page {page} of {count}": "第 {page} 頁,共 {count} 頁", +"Pages␟翻页": "翻頁", +"Pages␟页面": "頁面", +"Paint on": "繪製位置", +"Paint over a caption. Only the white letters and outline are removed; the image between them stays.": "塗過字幕,只去掉白字和描邊,字間的畫面保留。", +"Paint over the whole mark in one stroke; it is filled with texture from around it.": "一筆塗滿要去掉的部分,鬆開後用周圍的紋理補上。", +"Paint {n}": "繪畫 {n}", +"Pan": "平移", +"Paper": "畫紙", +"Parallel HTTP": "並行下載", +"Part 1": "第 1 段", +"Part 1: A fox walks through a sunlit forest.": "第 1 段:狐狸走過灑滿陽光的森林。", +"Part 2": "第 2 段", +"Part 2: A fox walks through snow.": "第 2 段:狐狸走過雪地。", +"Part length back to the automatic choice": "每段時長回到自動選擇", +"Part length · seconds": "每段時長 · 秒", +"Part of the faster second pass: pause after the half-resolution first pass and save it as a preview. Run the second pass from the result when it looks right; it continues from the same latents.": "先出低解析度預覽,滿意後在結果裡點一下「繼續第二階段」,最終影片與直接生成的結果一致。", +"Part {index} / {total}": "第 {index} / {total} 段", +"Part {index} of {total}": "第 {index} 段,共 {total} 段", +"Part {number}": "第 {number} 段", +"Part {number}/{count}": "第 {number}/{count} 段", +"Part {part} could not be generated. See the details on the picture.": "第 {part} 段未能生成,原因見畫面上的說明。", +"Part {part} of {count}": "第 {part} 段,共 {count} 段", +"Part {part} prompt": "第 {part} 段提示詞", +"Part {part}: ": "第 {part} 段:", +"Partly applied␟此 LoRA 部分生效": "此 LoRA 部分生效", +"Partly applied␟部分生效": "部分生效", +"Parts are generating. Wait, or cancel them in the queue.": "分段影片生成中,完成或在佇列裡取消後可再生成", +"Parts can also be added one by one in \"Edit\".": "也可在「剪輯檢視」中逐段接續。", +"Passes": "輪數", +"Password": "密碼", +"Password: not set": "密碼:未設定", +"Password: on": "密碼:已設定", +"Paste": "貼上", +"Paste a read token": "貼上唯讀權杖", +"Paste an image as reference": "貼上圖片作為參考圖", +"Paste it in a prompt to use this one": "貼到提示詞裡即可引用", +"Paste it to your assistant": "貼給助手", +"Path to python": "python 的路徑", +"Path to python.exe": "python.exe 的路徑", +"Paths and typed text are removed.": "已去掉路徑和輸入的文字。", +"Paths in the report are anonymized.": "報告中的路徑已匿名化。", +"Pause": "暫停", +"Pause ": "暫停 ", +"Pause and close": "暫停並結束", +"Pause and close?": "暫停並結束?", +"Pause both␟一起暂停": "一起暫停", +"Pause both␟同时暂停": "同時暫停", +"Pause download": "暫停下載", +"Pause installation before changing the token.": "請先暫停安裝,再修改 Token。", +"Pause the video": "暫停影片", +"Pause; downloaded files are kept": "暫停安裝,已下載的檔案會保留", +"Paused": "已暫停", +"Paused while FreeVideo installs, updates or cleans up": "FreeVideo 正在安裝、更新或清理,已暫停", +"Paused while FreeVideo installs, updates or cleans up; resumes after it": "FreeVideo 正在安裝、更新或清理,下載已暫停,結束後自動繼續", +"Paused while FreeVideo uses the graphics card for another task": "FreeVideo 正在用顯示卡做別的任務,已暫停", +"Paused while FreeVideo uses the graphics card for another task; resumes after it, or continue now": "FreeVideo 正在用顯示卡做別的任務,下載已暫停,之後自動繼續,也可以現在繼續下載", +"Paused while a video generates": "影片生成中,已暫停", +"Paused while a video generates; resumes after it, or continue now": "影片生成中,下載已暫停,之後自動繼續,也可以現在繼續下載", +"Paused while an image is made": "正在出圖,已暫停", +"Paused while an image is made; resumes after it, or continue now": "正在出圖,下載已暫停,出完自動繼續,也可以現在繼續下載", +"Paused {percent}%": "已暫停 {percent}%", +"Paused: the graphics card is busy": "顯示卡忙,已暫停", +"Paused; existing data kept␟下载已停止,进度已保留": "下載已停止,進度已保留", +"Paused; existing data kept␟已暂停,下载进度已保留": "已暫停,下載進度已保留", +"Peak RAM": "最高記憶體", +"Peak VRAM": "最高顯示卡記憶體", +"Peak disk ~{size}": "磁碟峰值約 {size}", +"People to keep the same across shots": "在多個鏡頭裡保持一致的人物", +"Performance measurement": "效能測量", +"Person image": "人物圖", +"Person image {number}": "人物圖 {number}", +"Person images are matched to the people in the video from left to right.": "人物圖按畫面中人物從左到右的順序對應。", +"Phone": "手機", +"Phone access": "手機連線", +"Phone access QR code": "手機連線 QR Code", +"Phone access could not be opened.": "手機連線無法開啟。", +"Phone access has not opened yet. Make sure the FreeVideo launcher is running.": "手機連線尚未開啟。請確認 FreeVideo 啟動器正在執行。", +"Phone access needs FreeVideo started from its launcher on this computer.": "手機連線需要透過本機的 FreeVideo 啟動器啟動。", +"Phone access requires FreeVideo installed with the launcher": "手機連線需要用啟動器安裝的 FreeVideo", +"Phone can't open it? Set this computer's Wi-Fi to \"Private\", then in Windows Security allow Python on private networks under \"Allow an app through firewall\".": "手機打不開?請把電腦連的 Wi-Fi 設為「私人網路」,並在 Windows 安全性的「允許應用程式通過防火牆」裡勾選 Python 的「私人」。", +"Phone, version, tutorial, feedback and settings": "手機、版本、教學、意見回饋和設定", +"Phones will need this password": "儲存後手機要輸入這個密碼", +"Photo of the person": "人物照片", +"Photo, tall": "照片豎", +"Photo, wide": "照片橫", +"Piano": "鋼琴", +"Pick": "選中", +"Pick a sound clip…": "選一個聲音片段…", +"Pick a style add-on to use": "選一個附加模型加入生成", +"Pick a video to play it, or choose \"Extend\" to add the next part in the Edit view. To download several at once, choose the check box at the top right of a creation, choose the others to add them, then choose \"Download\" to save them as one zip file.": "選擇一段影片即可播放,或點一下「接著生成」在剪輯檢視中繼續;要一次下⁠載多個作品,點作品右上角的核取方塊選取它,再點其他作品一併選取,然後點一下「下載」,存成一個壓縮檔。", +"Pick a voice and generate": "選音色並生成", +"Pick an earlier video in the recent videos below the preview, or choose \"Creations\" at its start and pick one there.": "在預覽下方的最近作品中點一段以前的影片,或點開頭的「作品庫」從中選擇。", +"Pick an image first": "先選中圖片", +"Pick an image or paint layer first.": "請先選擇圖片圖層或繪畫圖層。", +"Pick an image or paint layer to work on its pixels.": "請選擇圖片圖層或繪畫圖層再處理像素。", +"Pick an image or video; its prompt fills the box": "選一張圖片或一段影片,生成的提示詞填入提示詞框", +"Pick an image to see its facts": "選一張圖片檢視資訊", +"Pick every image shown": "選中目前顯示的全部圖片", +"Pick layer by clicking": "點選自動選擇圖層", +"Pick one to see it on the real screen": "選一項,在真實介面上示範", +"Pick several creations to act on": "選中多個作品一起操作", +"Pick several creations to compare": "多選作品即可對比", +"Pick several images to delete together": "多選圖片一起刪除", +"Pick several to compare or delete": "選幾張來對比或刪除", +"Pick something you said before": "選一句最近說過的話", +"Pick the frame and the size": "選畫面比例和尺寸", +"Pick to compare": "選中以對比", +"Pick two videos to compare them side by side": "選兩段影片並排對比", +"Pick up the long video where it stopped": "從停下的位置接著生成長影片", +"Picked {hex}.": "已吸取 {hex}。", +"Picking one fills the box; it is not sent": "選取後放進輸入框,不會直接傳送", +"Picture, sound and speed of the selection": "調整選中片段的畫面、聲音和速度", +"Pin": "置頂", +"Place an image from the creations, or use it as a reference": "從作品庫放入一張圖,或用作參考圖", +"Place on the canvas": "放入畫布", +"Places to reuse": "可重複使用的場景", +"Placing on the timeline": "放入時間軸", +"Planning segments…": "正在規劃分段…", +"Planning the shots": "正在拆分鏡頭", +"Plans each part of a long video": "下載後自動規劃長影片各段", +"Play": "播放", +"Play ": "播放 ", +"Play / pause": "播放 / 暫停", +"Play backward": "向後播放", +"Play backward / pause / forward": "向後播放 / 暫停 / 向前播放", +"Play both␟一起播放": "一起播放", +"Play both␟同时播放": "同時播放", +"Play example": "播放範例", +"Play faster, slower or backward": "加速、減速或倒放", +"Play forward": "向前播放", +"Play from the playhead": "從播放頭開始播放", +"Play it here, with sound": "在這裡播放,帶聲音", +"Play latest generated video": "播放最近生成的影片", +"Play only the selected part or range": "只播選中的片段或範圍", +"Play only the selected range": "只播放選中的那一段", +"Play or pause": "播放或暫停", +"Play or pause from the playhead": "從播放頭開始播放或暫停", +"Play or pause the example video": "播放或暫停範例影片", +"Play position": "播放位置", +"Play range": "只播範圍", +"Play selection": "播放選中範圍", +"Play the range over and over": "反覆播放選中的範圍", +"Play the seam before part {part}": "播放第 {part} 段的接縫", +"Play the selected range only": "只播選中的範圍", +"Play the tour of this version": "播放這一版的新功能介紹", +"Play the video": "播放影片", +"Play the video in progress as a loop": "把進行中的影片循環播放", +"Play this example": "播放這段範例", +"Play this example with sound": "有聲播放這段範例", +"Play this line": "播放這一句", +"Play this part of the example": "播放範例裡的這一段", +"Play this version with sound": "有聲播放這一版", +"Play with sound": "播放聲音", +"Playback": "播放", +"Playhead␟播放位置": "播放位置", +"Playhead␟播放头": "播放頭", +"Please drag the downloaded report into \"Diagnostic report\", then select Submit new issue.": "請將下載的診斷報告拖入「診斷報告」,再點選 Submit new issue。", +"Please drag {savedName} into \"Diagnostic report\", then select Submit new issue.": "請將 {savedName} 拖入「診斷報告」,再點選 Submit new issue。", +"Please try again.": "請重試。", +"Point": "指向", +"Polygonal": "多邊形套索", +"Pop": "流行", +"Port %1 is in use by another program, so FreeVideo now uses port %2 and will keep using this address.": "埠 %1 已被其他程式佔用,FreeVideo 改用埠 %2,以後也使用這個位址。", +"Portrait 9:16": "直向 9:16", +"Portrait␟竖屏": "直向", +"Portrait␟纵向": "縱向", +"Pose": "姿勢", +"Position, size and crop of the picture": "畫面的位置、大小和裁切", +"Position␟位置": "位置", +"Position␟播放位置": "播放位置", +"Preferences": "偏好", +"Preload ahead": "積極預載入", +"Prepare ": "準備 ", +"Prepare ComfyUI": "準備 ComfyUI", +"Prepare ComfyUI GPU packages": "準備 ComfyUI 加速元件", +"Prepare FP8 ": "準備模型檔案 ", +"Prepare Python": "準備執行環境", +"Prepare all quality levels": "提前下載全部品質等級", +"Prepare an isolated environment for FreeVideo": "建立 FreeVideo 執行環境", +"Prepare compact FP8 weights for your GPU": "準備適合顯示卡的模型", +"Prepare dependencies": "準備執行元件", +"Prepare download tools": "準備下載工具", +"Prepare model source files while runtime packages download": "下載模型元件", +"Prepare source files for installation": "準備安裝檔案", +"Prepare the model weights for your GPU": "準備適合顯示卡的模型", +"Prepare the runtime environment.": "準備執行環境。", +"Prepare verified source files": "準備元件檔案", +"Prepared ahead, so switching levels needs no download; applies at the next check": "提前準備,切換等級不用再等下載;下次檢查安裝時生效", +"Preparing components": "正在準備元件", +"Preparing download tools": "正在準備下載工具", +"Preparing images": "準備圖片", +"Preparing installation": "準備安裝", +"Preparing installation…": "正在準備安裝…", +"Preparing model files": "正在準備模型檔案", +"Preparing preview…": "正在準備預覽…", +"Preparing report…": "正在整理報告…", +"Preparing the font": "正在準備字型", +"Preparing the prompt model": "正在準備提示詞模型", +"Preparing the white model…": "正在準備白模…", +"Preparing this clip. It goes on the timeline when ready.": "素材準備好後會自動放到時間軸上。", +"Preparing video": "正在準備影片", +"Preparing video output": "正在準備輸出影片", +"Preparing your video": "正在準備影片", +"Preparing; it is placed when ready": "正在準備,好了會自動放入", +"Preparing…␟准备中…": "準備中…", +"Preparing…␟正在准备…": "正在準備…", +"Preparing…␟正在整理…": "正在整理…", +"Preparing␟准备中": "準備中", +"Preparing␟准备生成": "準備生成", +"Preparing␟正在准备": "正在準備", +"Preset applied: {name}": "已套用預設集:{name}", +"Preset name": "預設名稱", +"Preset saved": "預設集已儲存", +"Presets␟参数预设": "參數預設", +"Presets␟预设": "預設", +"Press Ctrl+C": "請按 Ctrl+C", +"Press Enter to start.": "按回車開始生成。", +"Press to generate as soon as it is installed": "按下後,安裝完成即自動生成", +"Press to not generate after it": "再按一次取消自動生成", +"Press {key} to paste here": "請按 {key} 貼上", +"Pressing Esc or choosing \"×\" on the recording bar during a take keeps what has been recorded on the track. One undo removes it.": "錄音中按 Esc 或點錄音條上的「×」,已錄的部分保留在軌道上;復原一次即可移除。", +"Preview": "預覽", +"Preview a whitebox first": "先生成白模預覽", +"Preview could not load": "預覽載入失敗", +"Preview during generation": "生成中的預覽", +"Preview first": "先出預覽", +"Preview first needs 8 first-pass steps": "先出預覽需第一階段 8 步", +"Preview first was turned off for \"Use as is\".": "已為「原樣使用」關閉「先出預覽」。", +"Preview first, then run the second pass": "先出預覽,再繼續第二階段", +"Preview saved": "預覽已儲存", +"Preview the motion as a white model first": "先用白模預覽動作", +"Preview unavailable. Close and try again.": "預覽暫時無法讀取,請關閉後重試。", +"Preview volume": "預覽音量", +"Previous / next cut": "上一個 / 下一個剪輯點", +"Previous / next frame": "上一格 / 下一格", +"Previous / next image": "上一張 / 下一張", +"Previous attempt did not finish": "上一次嘗試沒有完成", +"Previous frame": "上一格", +"Previous inputs reused": "已使用上次的輸入", +"Previous marker": "上一個標記", +"Previous version": "上一版", +"Previous version of this part": "這一段換回上一版", +"Previous␟上一个": "上一個", +"Previous␟上一张": "上一張", +"Previous␟上一篇": "上一篇", +"Privacy": "隱私", +"Problem": "問題", +"Process peak RAM": "處理程序最高記憶體", +"Processing": "處理中", +"Processing reference images and videos": "正在處理參考圖片和影片", +"Processing the prompt": "正在處理提示詞", +"Processing the prompt and references": "正在處理提示詞和參考素材", +"Product": "產品展示", +"Product close-up": "產品特寫", +"Product showcase": "產品展示", +"Progress": "進度", +"Progress has not updated recently; generation is still running.": "進度暫未更新,仍在生成中。", +"Prompt and run details": "提示詞和執行詳情", +"Prompt copied.": "已複製提示詞。", +"Prompt copied. Paste it into the prompt box.": "已複製提示詞,請貼上到提示詞框。", +"Prompt enhancement": "提示詞增強", +"Prompt filled in": "已填入提示詞", +"Prompt filled in.": "已填入提示詞。", +"Prompt from an image or video": "從圖片或影片生成提示詞", +"Prompt history": "提示詞歷史", +"Prompt history and templates": "歷史與範本", +"Prompt history, templates and presets": "提示詞歷史、範本和預設", +"Prompt model": "提示詞模型", +"Prompt model download paused · {done} / {total}": "提示詞模型下載已暫停 · {done} / {total}", +"Prompt model not installed. The prompt is split across the parts by sentence.": "未安裝提示詞模型,提示詞按句子順序分到各段", +"Prompt model ready": "提示詞模型已就緒", +"Prompt model still preparing": "提示詞模型仍在準備", +"Prompt not saved": "提示詞未能儲存", +"Prompt not saved. Click to retry": "提示詞未能儲存,點此重試", +"Prompt templates": "提示詞範本", +"Prompt version": "提示詞版本", +"Prompt, model, size and time": "提示詞、模型、尺寸和用時", +"Prompt, model, size and time of the shown image": "目前圖片的提示詞、模型、尺寸和用時", +"Prompts": "提示詞", +"Prompts are not kept in this browser; one shows while the page that made the image is open.": "提示詞不儲存在瀏覽器裡,只在生成它的頁面開啟期間顯示。", +"Prompts show here once used.": "用過的提示詞會出現在這裡。", +"Prompts used before": "用過的提示詞", +"Prompts you generate appear here.": "生成過的提示詞會出現在這裡。", +"Prompts you generate with show here.": "生成過的提示詞會出現在這裡。", +"Prompts you generated before": "以前生成用過的提示詞", +"Prompts you generated, newest first": "生成過的提示詞,最新在前", +"Prompt␟描述": "描述", +"Prompt␟提示词": "提示詞", +"Prop": "道具", +"Props": "道具", +"Protect this track from edits": "防止誤改這條軌", +"Proxy connection failed": "代理連線失敗", +"Proxy only": "僅代理", +"Pull the clips together over empty space": "把片段之間的空白收攏", +"Put .safetensors files in models/loras, then check again": "把 .safetensors 檔案放進 models/loras 資料夾,再點一下「重新檢查」", +"Put LoRA files (.safetensors) in the models/loras folder, then choose \"Add LoRA\".": "把 LoRA 檔案(.safetensors)放進 models/loras 資料夾,再點一下「新增 LoRA」。", +"Put LoRA files (.safetensors) in the models/loras folder, then choose \"Add\".": "把 LoRA 檔案(.safetensors)放進 models/loras 資料夾,再點一下「新增」。", +"Put a clip on the timeline first␟先在时间线上放一个片段": "先在時間軸上放一個片段", +"Put a clip on the timeline first␟先在时间线上放一段素材": "先在時間軸上放一段素材", +"Put a clip that only has sound into the Edit view.": "在剪輯檢視中放入一段只有聲音的素材。", +"Put a title or subtitles over the picture in the Edit view.": "在剪輯檢視裡給畫面加標題文字,或加上字幕。", +"Put back the image as it was before editing": "換回編輯前的原圖", +"Put it back in creations": "放回作品裡", +"Put it back where it was": "放回原來的位置", +"Put it in the box to edit, then send": "放進輸入框,改好再發送", +"Put it in the box; fill the marked words": "放進輸入框,替換標出的詞", +"Put it in the prompt box; nothing is generated yet": "放進提示詞框,還不會生成", +"Put it on the stage": "在中間顯示", +"Put its prompt back in the box": "把它的提示詞填回提示詞框", +"Put its prompt in the box of the image view": "把它的提示詞填回圖片檢視的提示詞框", +"Put the LoRA file (.safetensors) in the models/loras folder.": "把 LoRA 檔案(.safetensors)放進 models/loras 資料夾。", +"Put the copied text here": "把複製的文字放到這裡", +"Put the image back as it was made": "換回生成時的樣子", +"Put the image itself in as the face close-up": "把原圖作為臉部特寫", +"Put the images back": "把圖片放回去", +"Put the original image back": "換回編輯前的原圖", +"Put the original sound back under the picture": "把原聲放回畫面下面", +"Put the other one first": "交換兩邊的位置", +"Put the person from an image into a video, keeping the motion and camera of the source video.": "把影片裡的人換成人物圖中的人,動作和鏡頭沿用來源影片。", +"Put the person from an image into a video.": "把影片裡的人換成圖中的人物。", +"Put the person from your image in the video": "把影片裡的人換成你圖裡的人", +"Put the photo itself in as the face close-up": "把原照片作為臉部特寫", +"Put the playhead inside a clip first": "先把播放頭放到片段中間", +"Put the playhead on a clip first": "先把播放頭放到片段上", +"Put the prompt in the box to change": "把提示詞放進輸入框修改", +"Put the style back": "把這套樣式放回去", +"Put these creations back on the shelf": "把這些作品放回作品庫", +"Put these settings back to default": "把這些設定恢復為預設值", +"Put this prompt in the view in front": "把這段提示詞填進目前檢視", +"Put this sentence in the box": "把這句話放進輸入框", +"Puts it in the Create prompt box": "填進創作面板的提示詞框", +"Puts it in the Images prompt box": "填進圖片檢視的提示詞框", +"Puts it in the prompt box": "填入提示詞框", +"Python downloading": "正在下載執行環境", +"Python environment": "Python 環境", +"Python packages": "Python 依賴", +"Python ready": "執行環境已就緒", +"Qt notices & licenses ↗": "Qt 元件與授權條款 ↗", +"Quality and second pass settings for this clip": "這一段的品質和第二階段", +"Quality level": "品質等級", +"Quality level and the second pass choice for this part": "這一段的品質等級和第二階段", +"Quality␟画质": "畫質", +"Quality␟质量": "品質", +"Quark download ↗": "夸克網盤下載 ↗", +"Quark model pack · ": "夸克模型包 · ", +"Queue": "佇列", +"Queue operation": "佇列操作", +"Queued · starts in {time}": "排隊中 · {time}後開始", +"Queued · waiting for the previous one": "排隊中 · 等前一個完成", +"Queued · {ahead} ahead": "排隊中 · 前面還有 {ahead} 個", +"Queued · {waiting}": "排隊 {waiting} 個", +"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. It starts when the video finishes.": "已排隊,影片生成完後自動開始。", +"Queued…": "排隊中…", +"Queued␟已加入队列": "已加入佇列", +"Queued␟排队中": "排隊中", +"Quick size: {made} at this shape": "快捷尺寸:目前畫面比例下 {made}", +"Quick test": "快速測試", +"Quick, for trying ideas": "速度較快,適合試效果", +"RAM available": "可用記憶體", +"RIFE frame interpolation code and weights": "RIFE 補影格程式碼和權重", +"ROCm component licenses": "ROCm 各元件授權", +"Radial": "徑向", +"Raise a hand": "舉手", +"Raise automatically": "自動提高", +"Raise the level after an unexpected interruption": "意外中斷後自動提高等級", +"Raise the level automatically after an unexpected interruption␟异常中断后自动提高兼容档位": "異常中斷後自動提高相容等級", +"Raise the level automatically after an unexpected interruption␟意外中断后自动提高档位": "意外中斷後自動提高等級", +"Random seed␟随机换一个": "隨機換一個", +"Random seed␟随机种子": "隨機種子", +"Range": "範圍", +"Ranks: ": "Rank:", +"Ratio free": "比例不鎖", +"Ratio locked": "比例鎖定", +"Read": "已看過", +"Read and convert source weights": "正在準備模型", +"Read or edit the prompt in a large box": "在大視窗裡看或改提示詞", +"Read the LoRA folder and check every file again": "重新讀取 LoRA 資料夾並逐個檢查", +"Read the creations again": "重新讀取作品", +"Read the error message first. It names what to try.": "先閱讀錯誤訊息,其中已寫明可嘗試的操作。", +"Read the licenses before confirming installation.": "確認安裝前請閱讀對應的授權條款。", +"Read the message and save a diagnostic report.": "閱讀訊息並儲存診斷報告。", +"Read the next creations again": "重新讀取後面的作品", +"Read the recent videos again": "重新讀取最近作品", +"Read the terms of the rewriting model": "檢視改寫模型的使用條款", +"Read the tutorial": "看教學", +"Read this chat and keep talking": "檢視這段對話並繼續", +"Read your chats; connect later": "先看對話,稍後再連線", +"Reading all creations…": "正在讀取全部作品…", +"Reading installation settings…": "正在讀取安裝設定…", +"Reading prompt": "讀取提示詞", +"Reading prompt and media": "讀取提示詞和素材", +"Reading reference images": "讀取參考圖", +"Reading the LoRA folder…": "正在讀取 LoRA 資料夾…", +"Reading the frames…": "正在讀取畫面…", +"Reading the prompt": "讀取提示詞", +"Reading the prompt model": "正在讀取提示詞模型", +"Reading the references": "讀取參考圖", +"Reading the request": "正在理解要求", +"Reading version information…": "正在讀取版本資訊…", +"Reading…": "正在讀取…", +"Ready scene": "現成場景", +"Ready scenes": "現成場景", +"Ready to generate": "已就緒,可以開始生成", +"Ready to generate.␟准备就绪,可以开始生成。": "準備就緒,可以開始生成。", +"Ready to generate.␟已就绪,可以开始生成。": "已就緒,可以開始生成。", +"Ready to install": "確認安裝", +"Ready to launch": "準備就緒", +"Ready to use": "可以使用了", +"Ready · {live} images": "就緒 · {live} 張", +"Ready-made": "現成場景", +"Ready␟准备就绪": "準備就緒", +"Ready␟就绪": "就緒", +"Ready␟已就绪": "已就緒", +"Real-ESRGAN realesr-general-x4v3 code and weights": "Real-ESRGAN realesr-general-x4v3 程式碼和權重", +"Reason, what to do, and the report": "原因、可做的事和診斷報告", +"Reattach audio": "放回原聲", +"Receiving objects:.*": "正在下載元件", +"Recent creations": "最近作品", +"Recent results": "最近作品", +"Recent videos": "最近作品", +"Recent videos could not be loaded": "無法讀取最近作品", +"Recent videos could not be loaded. FreeVideo tries again when the next video finishes.": "暫時無法讀取最近作品,下一個影片生成完成後會自動再試。", +"Recently deleted": "最近刪除", +"Recently used": "最近使用", +"Recent␟最近使用": "最近使用", +"Recent␟最近完成": "最近完成", +"Recent␟最近说过": "最近說過", +"Recommended · now the {autoBest}": "推薦 · 目前用{autoBest}", +"Recommended · picks the fastest measured source": "推薦 · 依測速選擇最快的來源", +"Reconnect": "重新連線", +"Reconnecting…": "等待恢復連線…", +"Record": "錄音", +"Record from the microphone at the playhead": "用麥克風從播放頭處錄一段", +"Record from the microphone␟用麦克风开始录制": "用麥克風開始錄製", +"Record from the microphone␟用麦克风录音": "用麥克風錄音", +"Record or stop": "錄音或停止", +"Record versions for future diagnostics": "儲存安裝資訊", +"Record your own voice, or redub lines that already exist.": "直接錄音,或對已有的台詞重新配音。", +"Record your voice onto the timeline": "錄一段聲音放到時間軸上", +"Record: onto an audio track": "錄音:錄製到音軌", +"Recording": "錄音", +"Recording needs permission to use the microphone.": "錄音需要允許使用麥克風。", +"Recording {take}": "錄音 {take}", +"Recordings": "錄音", +"Rectangle": "矩形", +"Red": "紅", +"Redirect refused": "重定向被拒絕", +"Redo": "重做", +"Redo (Ctrl+Shift+Z)": "重做(Ctrl+Shift+Z)", +"Redo from here": "從這段重新生成", +"Redo from part {number}": "從第 {number} 段重新生成", +"Redraw the others to match␟按新正面重画其余三张": "按新正面重畫其餘三張", +"Redraw the others to match␟按新脸重画其余三张": "按新臉重畫其餘三張", +"Redub": "重新配音", +"Redub 1 line": "重新配音 1 句", +"Redub {count} lines": "重新配音 {count} 句", +"Redubbing": "重新配音", +"Reduces drift.": "減小漂移", +"Refer to an image or character in the text": "在描述裡引用圖片或人物", +"Reference audio": "參考音訊", +"Reference generation is experimental, so a character may look different between runs. A clearer, front-facing image helps.": "參考圖生成仍屬實驗性功能,人物外觀可能每次不同;清晰的正面圖效果更穩定。", +"Reference image": "參考圖", +"Reference image {number}": "參考圖片 {number}", +"Reference images": "參考圖", +"Reference images are numbered in the order they were added: \"Image 1\", \"Image 2\" and so on. Say in the prompt what each one is for, for example \"the person in Image 1 holds the pocket watch from Image 2\". Choose a thumbnail to crop or retouch it.": "參考圖按加入的順序編號為「圖 1」「圖 2」……在提示詞中寫明每張圖的用途,例如「圖 1 的人物手裡托著圖 2 的懷錶」。點參考圖的縮圖,可以裁切或修圖。", +"Reference images for this card are already being made": "這張卡片的參考圖正在生成", +"Reference images, first and last frame, sound": "參考圖、首尾影格和參考音訊", +"Reference media": "參考素材", +"Reference media (@)": "引用素材(@)", +"Reference video": "參考影片", +"Reference, first frame or last frame": "作參考圖、首影格或尾影格", +"References": "參考圖", +"Reference␟参考": "參考", +"Reference␟参考图": "參考圖", +"Refresh": "重新整理", +"Regenerate": "重新生成", +"Regenerate preview": "重新生成預覽", +"Regular": "常規", +"Relaxed": "放鬆", +"Release installation cache": "釋放安裝快取", +"Release notes": "更新說明", +"Release the range first": "先鬆開拖曳的範圍", +"Reload": "重新整理", +"Reload now": "立即重新載入", +"Reload page": "重新整理頁面", +"Reload the page and check the task list; submit again if needed": "重新整理頁面後檢視任務列表,必要時重新提交", +"Reload the page and choose a take that this shot has": "重新整理頁面後選擇這個鏡頭裡現有的一條", +"Reload the page and choose an existing shot": "重新整理頁面後選擇現有的鏡頭", +"Reload the page and make sure it still exists, then try again": "重新整理頁面後確認它還在,再重試", +"Reload the page and repeat the action": "重新整理頁面後再操作一次", +"Reload the page in the chosen language": "以所選語言重新載入頁面", +"Reload the page in the other language? Generations keep running.": "重新載入頁面並切換語言?正在進行的生成不受影響。", +"Reload the page to see the latest content, then change it again": "重新整理頁面檢視最新內容後再改", +"Reload the page. If it happens again, use Report a problem.": "請重新整理頁面。仍然出現時,請點一下「提交問題」。", +"Reloads the page; generations keep running": "會重新載入頁面,生成不受影響", +"Remove Audio 2": "移除聲音 2", +"Remove LoRA": "移除 LoRA", +"Remove every prompt in this list from this browser; presets stay": "從這個瀏覽器刪掉列表裡所有提示詞;預設保留", +"Remove from compare": "移出對比", +"Remove from favorites": "取消收藏", +"Remove from history": "從歷史移除", +"Remove from queue": "取消排隊", +"Remove from the queue?": "取消排隊?", +"Remove from this request; keep the uploaded file": "從本次請求移除,保留已上傳檔案", +"Remove gaps": "移除空隙", +"Remove image␟移除人物图": "移除人物圖", +"Remove image␟移除图片": "移除圖片", +"Remove person image {number}": "移除人物圖 {number}", +"Remove queued video {number}": "移除排隊的第 {number} 個", +"Remove reference": "移除參考圖", +"Remove scale, position, rotation and crop": "去掉縮放、位置、旋轉和裁切", +"Remove some reference images, then try again": "減少參考圖後再試", +"Remove sound track": "移除音軌", +"Remove tag": "去掉標籤", +"Remove tag {name}": "去掉標籤「{name}」", +"Remove the old model?": "刪除舊模型?", +"Remove the selected clips": "刪除選中的片段", +"Remove the selection and leave its gap": "刪掉選中的內容,留下空隙", +"Remove the tag; the creations stay": "只刪除標籤,作品保留", +"Remove these for good, without waiting": "不再等待,永久刪除這些圖片", +"Remove this image. Generate makes this view.": "移除這張圖片,生成時補上這個視角。", +"Remove this import from the library (asks first)": "從素材庫刪除這個檔案(會先確認)", +"Remove this notice": "移除這條通知", +"Remove this saved look (can be undone)": "刪掉這套儲存的樣式(可復原)", +"Remove unused model files?": "刪除沒在使用的模型檔案?", +"Removed from Favorites.": "已移出收藏。", +"Removed {removed} files, {size}": "已刪除 {removed} 個檔案,共 {size}", +"Removes the old model files FreeVideo no longer uses, about ": "將刪除不再使用的舊模型檔案,釋放約 ", +"Remove…": "刪除…", +"Remove␟删除": "刪除", +"Remove␟取消排队": "取消排隊", +"Remove␟移除": "移除", +"Removing": "正在刪除", +"Removing the old model": "正在刪除舊模型", +"Removing the old model after the current video": "目前影片完成後刪除舊模型", +"Removing unused model files frees about {size}; the model in use is not touched.": "刪除未使用的模型檔案可釋放約 {size},正在使用的模型不受影響。", +"Rename or delete this chat": "重新命名或刪除這段對話", +"Rename or open another edit": "改名或開啟其他剪輯", +"Rename this edit": "給這個剪輯專案改名", +"Rename␟改名": "改名", +"Rename␟重命名": "重新命名", +"Rendering the audio": "正在輸出音訊", +"Rendering the video": "正在輸出影片", +"Rendering the white model…": "正在渲染白模…", +"Repair": "修復", +"Repair FreeVideo": "修復 FreeVideo", +"Repair also updates the engine to {version}.": "修復時會一併更新到新版引擎 {version}。", +"Repair model files by importing the offline packages again": "重新匯入離線安裝包修復模型檔案", +"Repair the installation in the launcher or in Settings": "在啟動器或設定中修復安裝", +"Repairing": "正在修復", +"Repeat the last two steps for more pictures, up to 3, each at a different time.": "需要更多中間畫面時重複上兩步,最多 3 張,各張時間不能相同。", +"Replace": "更換", +"Replace audio": "替換聲音", +"Replace music": "替換配樂", +"Replace music · about 30 s": "替換配樂 · 約 30 秒", +"Replace music: from a text prompt": "替換配樂:根據文字提示詞重新生成", +"Replace package…": "更換環境包…", +"Replace person": "替換人物", +"Replace person model": "替換人物模型", +"Replace the music": "換一段配樂", +"Replace two people": "替換兩個人物", +"Replaced": "已被替換", +"Replaced the earlier recording in this range.": "已替換這一段原有的錄音。", +"Replaced the oldest": "已替換最早的一套", +"Replay the three steps here": "在目前介面重放三步指引", +"Report a mistake": "報告誤判", +"Report a problem": "提交問題", +"Report expired": "報告已過期", +"Report saved locally: {path}": "報告已儲存到本機:{path}", +"Report unavailable · fetch again": "報告暫不可用 · 重新取得", +"Report unavailable · retry": "報告暫不可用 · 重試", +"Reports": "報告", +"Report␟报告": "報告", +"Report␟提交问题": "提交問題", +"Required before installing": "安裝前需要同意", +"Reserved VRAM": "預留顯示卡記憶體", +"Reserved unified memory": "預留統一記憶體", +"Reset adjustments": "重置調整", +"Reset size": "原始大小", +"Reset speed": "恢復原速", +"Reset style": "恢復預設樣式", +"Reset to defaults": "恢復預設", +"Reset␟全部重置": "全部重置", +"Reset␟恢复原样": "恢復原樣", +"Reset␟重置": "重置", +"Reshoot this shot, or continue the short film": "重拍這個鏡頭,或繼續這部短劇", +"Reshoots this long ask first": "重拍達到這個時長時先詢問", +"Resize parts": "調整段長", +"Resize␟改长短": "改長短", +"Resize␟缩放": "縮放", +"Resolution in megapixels": "清晰度(百萬畫素)", +"Resolution␟分辨率": "解析度", +"Resolution␟清晰度": "清晰度", +"Resolving deltas:.*": "正在整理元件", +"Restart & update": "重新啟動並更新", +"Restart ComfyUI to load FreeVideo": "需要重新啟動 ComfyUI 才能載入 FreeVideo", +"Restart FreeVideo": "請重新啟動 FreeVideo", +"Restart FreeVideo after the update, then select \"Connect again\".": "更新後需重新啟動 FreeVideo,再點一下「重新連線」。", +"Restart FreeVideo after updating to open the creations.": "更新後重新啟動 FreeVideo,可開啟作品。", +"Restart FreeVideo and generate again.": "請重新啟動 FreeVideo 後重新生成。", +"Restart FreeVideo and try again. If it happens again, choose \"Report a problem\" to send us the report.": "請重新啟動 FreeVideo 後重試。再次出現時,請點選「提交問題」,把報告發給我們。", +"Restart FreeVideo from the launcher, then try again": "在啟動器裡重新啟動 FreeVideo 後再試", +"Restart FreeVideo to generate.": "請重新啟動 FreeVideo 後再生成。", +"Restart explicitly allowed␟已允许重新下载未完成文件": "已允許重新下載未完成檔案", +"Restart explicitly allowed␟重新下载此文件": "重新下載此檔案", +"Restart the computer, then click \"Retry installation\". If it still fails after the restart, reinstall the NVIDIA driver.": "請重新啟動電腦後點選「重試安裝」。重新啟動後仍然失敗時,請重新安裝 NVIDIA 顯示卡驅動程式。", +"Restarted": "已重新啟動", +"Restarting FreeVideo to finish the update. The page refreshes by itself.": "正在重新啟動 FreeVideo 完成更新,頁面會自動重新整理。", +"Restarting FreeVideo…": "正在重新啟動 FreeVideo…", +"Restarting this file; incompatible fragments retained on disk": "正在重新下載檔案", +"Restore creations": "恢復作品", +"Restore default": "恢復預設", +"Restore defaults": "恢復預設", +"Restore draft": "恢復草稿", +"Restore line": "恢復原句", +"Restore or regenerate the previous video, then extend it": "找回或重新生成上一段影片後再接續", +"Restore or replace the source file, then export again": "找回或替換原始檔後再匯出", +"Restore original": "恢復原圖", +"Restored the original image.": "已恢復原圖。", +"Restored the original image. Edit it again to reapply the changes.": "已恢復原圖;再次編輯可以重新應用修改。", +"Restored, but {lost} could not be brought back.": "已恢復,其中 {lost} 個沒能恢復。", +"Restored.": "已恢復。", +"Restore␟恢复": "恢復", +"Restore␟恢复原图": "恢復原圖", +"Restore␟恢复原样": "恢復原樣", +"Result": "結果", +"Results": "結果", +"Results for each file": "各檔案的測速結果", +"Resume": "繼續", +"Resume download": "繼續下載", +"Resume not supported": "不支援續傳", +"Resume queue": "繼續佇列", +"Resume unavailable; checking another source␟正在尝试其他下载源": "正在嘗試其他下載來源", +"Resume unavailable; checking another source␟此源无法续传,检查其他源": "此來源無法續傳,正在檢查其他來源", +"Resuming ([\\d.]+ MiB) retained": "繼續下載,已保留 \\1", +"Retry": "重試", +"Retry at Standard": "改用標準並重試", +"Retry download␟重新下载": "重新下載", +"Retry download␟重试下载": "重試下載", +"Retry hardware detection. If it still fails, export the report; it includes the GPU identity and the raw driver query.": "請點一下「重新檢查」。仍然失敗時,可以匯出報告。", +"Retry import": "重試匯入", +"Retry installation": "重試安裝", +"Retry installation to repair the tool automatically. If it still fails, export the report for the complete tool diagnostics.": "請點一下「重試安裝」,啟動器會自動修復下載工具。仍然失敗時,可以匯出報告。", +"Retry launch": "重試啟動", +"Retry update": "重試更新", +"Retrying same source with configured proxy": "透過代理伺服器重試", +"Retrying same source with direct connection": "改用直接連線重試", +"Retrying same source␟正在重试": "正在重試", +"Retrying same source␟正在重连原下载源": "正在重連原下載來源", +"Return to Installation and check the same folder to restore missing dependencies.": "返回安裝設定,檢查目前安裝目錄,補齊執行所需元件。", +"Return to the generation; nothing restarts": "展開回生成畫面,進度不中斷", +"Return to this generation": "回到這項生成", +"Reuse a prompt you generated with": "重用以前生成時寫過的提示詞", +"Reuse a prompt, a template or saved settings": "重複使用描述、範本或儲存的設定", +"Reuse a sentence or start from a template": "用說過的話或範本開始", +"Reuse local model": "複用模型", +"Reuse models / download missing files": "沿用模型並補齊檔案", +"Reuse models · optional": "複用已有模型(可選)", +"Reuse settings": "沿用設定", +"Reuse verified FP8 ": "使用已有模型檔案 ", +"Reused from this computer": "複用本機模型", +"Reused locally": "本機複用", +"Reused previous result": "已複用上次結果", +"Reuses work between similar sampling steps to finish sooner, with a small change to the result.": "重複使用相近取樣步之間的計算,更快完成,結果會有細微變化。", +"Reverse": "倒放", +"Reverse audio can be heard after export.": "倒放的聲音在匯出後才能聽到。", +"Revert": "還原", +"Review plan": "檢視計畫", +"Review the plan, then install.": "請確認計劃後安裝。", +"Review them": "逐段檢視", +"Rewrite": "改寫", +"Rewrite again": "重新改寫", +"Rewrite the prompt again": "重新改寫一次提示詞", +"Rewrite the prompt in more detail": "把提示詞自動改寫得更詳細", +"Rewrite the prompt in more detail first, on this computer": "生成前在本機把提示詞改寫得更具體", +"Rewrites the prompt in more detail before generating, on this computer, using your reference images.": "生成前在本機結合參考圖,把提示詞改寫得更具體。", +"Rewriting does not support this model or aspect ratio.": "目前模型或畫面比例不支援改寫。", +"Rewriting does not support this model or aspect ratio. Change it or use the original.": "目前模型或畫面比例不支援改寫,請更換或使用原文。", +"Rewriting is available after FreeVideo installation is complete.": "FreeVideo 安裝完成後才能改寫。", +"Rewriting needs the optional model. Download it to enable rewriting.": "改寫需要可選模型,下載後可用。", +"Rewriting supports prompts of up to 12,000 characters.": "改寫只支援不超過 12,000 字元的提示詞。", +"Rewriting took too long.": "改寫逾時。", +"Rewriting took too long. Retry or use the original.": "改寫逾時,請重試或使用原文。", +"Rewritten": "改寫", +"Right": "右", +"Right hand": "右手", +"Right-click an empty spot on a sound track and choose \"Narration\".": "在音軌的空白處按一下右鍵,選擇「配⁠音」。", +"Right-click an empty spot on a sound track, choose \"Narration\", write a line and choose \"Generate\".": "在音軌的空白處點右鍵,選「旁白」,寫下一句話,點一下「生成」。", +"Ripple delete": "波紋刪除", +"Rotate left 90°␟向左旋转 90°": "向左旋轉 90°", +"Rotate left 90°␟左转 90°": "左轉 90°", +"Rotate right 90°␟右转 90°": "右轉 90°", +"Rotate right 90°␟向右旋转 90°": "向右旋轉 90°", +"Rotation␟旋转": "旋轉", +"Rotation␟旋转角度": "旋轉角度", +"Run": "奔跑", +"Run details": "執行詳情", +"Run in background": "背景執行", +"Run mode, seed, steps and parts": "生成方式、種子、步數和分段", +"Run second pass": "繼續第二階段", +"Run setup/repair with this launcher first.": "請先使用此版本啟動器完成安裝/修復。", +"Run small checks on your GPU": "檢查 GPU 加速是否可用", +"Run status": "執行狀態", +"Running from source. Update with Git.": "目前從原始碼執行,請透過 Git 更新。", +"Running tasks": "進行中的任務", +"Running the first step (it takes longer the first time a size is used or after an update)": "正在進行第一步(首次使用這個尺寸或更新後,第一步要多花一些時間)", +"Running videos are not interrupted. FreeVideo restarts on its own afterwards.": "不會中斷正在生成的影片,完成後自動重新啟動更新。", +"Running; progress is under Models. Closing Settings keeps it running.": "正在執行,進度見「模型」。關閉設定不會中斷。", +"Runtime": "環境", +"Runtime components": "執行元件", +"Runtime components need updating": "執行元件需要更新", +"Runtime files have been changed": "執行元件已被更改", +"Runtime libraries importing": "正在載入執行元件", +"Runtime libraries verifying": "正在驗證執行元件", +"Runtime packages": "執行環境", +"Sad": "悲傷", +"Same as the edit": "與剪輯相同", +"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": "同樣的設定,再生成一版", +"Same time as another middle frame. Choose a different time.": "和另一張中間影格的時間相同,請錯開。", +"Sample once at full size": "直接按成片尺寸取樣一遍", +"Sampling caches": "取樣快取", +"Sampling data for all quality levels": "全部品質等級的取樣資料", +"Sampling steps": "取樣步數", +"Sampling␟正在采样": "正在取樣", +"Sampling␟采样": "取樣", +"Sans": "黑體", +"Saturation": "飽和度", +"Save": "儲存", +"Save (Ctrl+Enter)": "儲存(Ctrl+Enter)", +"Save a character once, then mention it with @ in any prompt.": "角色儲存一次,之後在任意提示詞中用 @ 引用。", +"Save a person as a character, then mention it with @ in later prompts.": "把人物儲存為角色,之後在提示詞中用 @ 引用。", +"Save a place or an object once, then mention it with @ in later prompts.": "把常用的地點和物品存進素材庫,在提示詞中用 @ 引用。", +"Save again": "重新儲存", +"Save details that help us fix problems": "儲存幫助我們排查問題的資訊", +"Save failed: ": "儲存失敗:", +"Save folders": "儲存資料夾", +"Save frame": "儲存目前影格", +"Save image": "儲存分享圖", +"Save installed versions": "儲存安裝資訊", +"Save preset": "儲存預設集", +"Save style": "儲存樣式", +"Save the MP4 to this computer␟把 MP4 保存到这台电脑": "把 MP4 儲存到這台電腦", +"Save the MP4 to this computer␟把视频文件保存到电脑": "把影片檔案儲存到電腦", +"Save the current frame": "儲存目前影格", +"Save the current frame as an image": "把目前影格存成圖片", +"Save the current settings to use them again in one step.": "把目前設定存成預設集,下次一步套用。", +"Save the current settings under this name": "用這個名稱儲存目前設定", +"Save the details so this can be fixed": "附上診斷資訊,便於修復", +"Save the diagnostic report of this run": "儲存這次生成的診斷報告", +"Save the diagnostic report to send us␟保存诊断报告,可发给我们": "儲存診斷報告,可發給我們", +"Save the diagnostic report to send us␟保存诊断报告,方便发给我们": "儲存診斷報告,方便發給我們", +"Save the edit": "儲存編輯", +"Save the error summary as a file": "把錯誤摘要儲存為檔案", +"Save the file to this computer": "把檔案存到這台電腦", +"Save the finished video as an MP4": "把成片匯出為 MP4 檔案", +"Save the full-size image": "儲存原尺寸圖片", +"Save the image to this computer␟把图片保存到本机": "把圖片儲存到本機", +"Save the image to this computer␟把图片保存到电脑": "把圖片儲存到電腦", +"Save the image to this computer␟把图片保存到这台电脑": "把圖片儲存到這台電腦", +"Save the latest changes once more": "再儲存一次最近的變更", +"Save the picked creations as a zip file": "將所選作品儲存為壓縮檔", +"Save the picture at the playhead": "把播放頭處的畫面存成圖片", +"Save the report; sharing it gets this computer optimized": "儲存診斷報告,提交可獲專門最佳化", +"Save the video to this computer": "把影片儲存到本機", +"Save the whole edit as one video": "把整段剪輯存成一個影片", +"Save the whole edit as one video in the library": "把整段剪輯存成一個影片,放進作品庫", +"Save this frame as an image": "把這一影格存成圖片", +"Save video": "儲存分享影片", +"Saved": "已儲存", +"Saved characters, scenes and props appear here. Press New to add one from images.": "儲存的角色、場景和道具會出現在這裡。點一下「新增」用圖片新增。", +"Saved creations": "已儲存的作品", +"Saved image": "已儲存的圖片", +"Saved model, shape and size": "儲存的模型、畫面比例和尺寸", +"Saved the current frame to Edit image > Generate with AI > Creations.": "已儲存目前影格,位於「編輯圖片 > AI 生成 > 作品庫」。", +"Saved the tracks to {folder}": "分軌已儲存到 {folder}", +"Saved to your creations": "已存入作品", +"Saved video": "已儲存的影片", +"Saved · applies to the next generation": "已儲存 · 下次生成生效", +"Saved.": "已儲存。", +"Saved. Importing will start when the current task finishes.": "已記下,處理完目前任務後自動匯入", +"Saved. This folder was not found:": "已儲存。找不到這個資料夾:", +"Saved. {count} folders were not found:": "已儲存。有 {count} 個資料夾找不到:", +"Saved: {path}": "已儲存:{path}", +"Saving": "儲存中", +"Saving changes failed because of an unexpected error. Your changes stay in this page and are saved again automatically.": "儲存變更時出現意外錯誤。變更仍在這個頁面裡,會自動再次儲存。", +"Saving changes failed. Please export again.": "儲存變更時出錯,請再匯出一次。", +"Saving changes failed: the disk is full. Free some space, then export again.": "儲存變更時出錯:磁碟空間不夠,空出空間後再匯出。", +"Saving changes…": "正在儲存變更…", +"Saving image": "儲存圖片", +"Saving model folders…": "正在儲存模型資料夾…", +"Saving the changes, then switching…": "正在儲存變更,儲存後切換…", +"Saving the image failed: the disk is full": "磁碟空間不夠,圖片沒能儲存", +"Saving the image failed: the disk is full. Free some space, then generate again.": "儲存圖片時出錯:磁碟空間不夠,空出空間後再生成。", +"Saving the image…": "正在儲存圖片…", +"Saving the image␟保存图片": "儲存圖片", +"Saving the image␟正在保存图片": "正在儲存圖片", +"Saving the share image…": "正在儲存分享圖…", +"Saving the video": "正在儲存影片", +"Saving this frame…": "正在儲存這個影格…", +"Saving video and audio": "儲存影片與音訊", +"Saving…": "正在儲存…", +"Say the changed lines again": "把改過的台詞重新配音", +"Say the words in the chosen voice": "用選中的音色說出這段話", +"Say what to film in a chat; the AI plans the shots and makes them one by one.": "用對話說明想拍的內容,由 AI 分鏡頭並逐個生成。", +"Say who is where, doing what. Type @ to use added images and videos.": "說清誰在哪裡做什麼。輸入 @ 可引用新增的圖片和影片。", +"Scale": "縮放", +"Scale %": "縮放比例", +"Scene": "場景", +"Scenes": "場景", +"Scenes and props": "場景和道具", +"Scope": "切換範圍", +"Screen": "濾色", +"ScriptCat": "腳本貓 ScriptCat", +"Scroll the chat to this card": "把對話滾到這張卡片", +"Scroll the chat to what is being made": "把對話滾到正在生成的內容", +"Search": "搜尋", +"Search actions, creations, prompts and cast": "搜尋操作、作品、提示詞和角色", +"Search and commands": "搜尋與命令", +"Search characters": "搜尋角色", +"Search chats": "搜尋對話", +"Search chats and shots": "搜尋對話和鏡頭", +"Search creations": "搜尋作品", +"Search creations and run any action": "搜尋作品、提示詞並執行操作", +"Search creations, images and cast": "搜尋作品、圖片和角色", +"Search creations, prompts and actions": "搜尋作品、提示詞和操作", +"Search languages": "搜尋語言", +"Search media": "搜尋素材", +"Search names": "搜尋名稱", +"Search prompts": "搜尋提示詞", +"Search prompts and names": "搜尋提示詞和名稱", +"Search settings": "搜尋設定", +"Search tasks": "搜尋任務", +"Search tutorials": "搜尋教學", +"Search, phone, version, tutorials, feedback, settings": "搜尋、手機、版本、教學、意見回饋和設定", +"Searching": "正在搜尋", +"Second pass": "第二階段", +"Second pass did not start · retry": "第二階段沒有開始 · 重試", +"Second pass did not start. Try again": "第二階段沒有開始,請重試", +"Second pass of preview": "繼續第二階段", +"Second pass only: a smaller factor starts from a larger first pass, for more detail and a longer run.": "第二階段時最終影片相對於第一階段的放大倍數。", +"Second pass · upscaling": "第二階段 · 放大", +"Second pass · upscaling to {width} × {height}": "第二階段 · 放大到 {width} × {height}", +"Second-pass steps": "第二階段步數", +"Seconds": "時長(秒)", +"Security software or a Windows protection feature is blocking the Python file of the FreeVideo environment. Allow the FreeVideo folder there (for Windows Security: Virus & threat protection → Manage ransomware protection → Controlled folder access, and the exclusions list), then click Retry installation.": "安全軟體或 Windows 的保護功能攔截了 FreeVideo 執行環境中的 Python 檔案。請在其中允許 FreeVideo 所在的資料夾(Windows 安全性:病毒與威脅防護 → 管理勒索軟體防護 → 受控資料夾存取,以及排除項目),然後點一下「重試安裝」。", +"Security software or another program is holding a file that setup needs. Wait a moment and click Retry installation; if it happens again, allow the FreeVideo folder in the security software.": "安全軟體或其他程式正在佔用安裝所需的檔案。請稍候後點一下「重試安裝」;仍然失敗時,請在安全軟體中允許 FreeVideo 所在的資料夾。", +"See all {total}": "檢視全部 {total} 項", +"See and change the full workflow": "檢視和修改完整的節點流程", +"See and manage every running and queued video and image from any page": "在任何頁面都能看到和管理所有生成中、排隊的影片和圖片", +"See and switch your chats": "檢視和切換對話", +"See every chapter": "看全部章節", +"See every image and video, with their details": "檢視全部圖片和影片及其資訊", +"See every keyboard shortcut": "檢視全部鍵盤操作", +"See how it is connected, or connect another": "檢視連線方式,或再連一個", +"See more of the timeline at once": "時間軸顯示更長一段", +"See problems": "檢視問題", +"See results; fill one in␟看成品,一键填入": "看成品,一鍵填入", +"See results; fill one in␟看成品,一键填入示例": "看成品,一鍵填入範例", +"See running tasks and notices": "看進行中的任務和通知", +"See the enhanced prompt": "檢視增強後的提示詞", +"See the image by itself": "單獨檢視這張圖片", +"See the next one": "看下一個功能", +"See the next step": "看下一步", +"See the prompt as you wrote it": "檢視你寫的原始提示詞", +"See the timeline in more detail": "時間軸顯示得更細", +"See the video memory and graphics card temperature in the top bar and this computer in the Run status panel, and stop a generation when needed.": "在頂欄看顯示卡記憶體和顯示卡溫度,在「執行狀態」面板裡看本機詳情,必要時停止生成。", +"See this example": "看這個範例", +"See this version and install updates": "檢視目前版本,安裝更新", +"See two creations side by side or with a slider": "並排或用滑桿對比兩個作品", +"See updates and what is new": "檢視更新和新功能", +"See what is being made and its details": "檢視正在生成的內容和詳情", +"See what the assistant is making": "檢視助手正在生成的內容", +"See what this update changes": "檢視這次更新改了什麼", +"See what was made": "檢視這次生成的成品", +"See what will be installed and agree": "檢視要安裝的內容並確認", +"See why": "檢視原因", +"See why and what to do": "檢視原因和可以做的事", +"See why it failed and what to do": "檢視失敗原因和可以做的事", +"See why, and connect again": "檢視原因並重新連線", +"See, reorder or remove waiting videos": "檢視、調整或移除排隊的影片", +"Seed": "種子", +"Seed and fine settings": "種子和細節設定", +"Seed and length details": "種子、分段等細節設定", +"Seed {value}": "種子 {value}", +"Select": "選擇", +"Select \"Download report\" in the preview to save the full diagnostic information.": "可在預覽區點一下「下載報告」儲存完整診斷資訊。", +"Select \"Repair\" in the launcher under Settings > Environment, then retry.": "可在啟動器「設定 → 環⁠境」裡點一下「修復」後重試。", +"Select \"Repair\" in the launcher under Settings > Environment. If it still fails, export the report and send it to us.": "可在啟動器「設定 → 環境」裡點一下「修復」。仍然失敗時,請匯出報告並發給我們。", +"Select a clip and move the playhead onto it.": "先選中片段,再把播放頭移到片段上。", +"Select a clip first": "先選中一個片段", +"Select a clip on the dialogue track and change the words of one line under \"Lines\".": "選取「人聲」軌上的片段,在「台詞」中修改某一句的文字。", +"Select a clip on the dialogue track. Change the words of a line here.": "選中「人聲」軌上的片段,在這裡修改某一句的文字。", +"Select a clip on the music track, write the music you want in the prompt box and choose \"Replace music\".": "選取「音樂」軌上的片段,在提示詞框中寫下想要的音樂,點一下「替⁠換⁠配⁠樂」。", +"Select a clip on the music track.": "選中「音樂」軌上的片段。", +"Select a clip or draw a range first": "先選中片段或畫一段範圍", +"Select a clip with sound first": "先選中一段有聲音的片段", +"Select a clip with sound in the Edit view.": "在剪輯檢視中選取帶聲音的片段。", +"Select a clip with sound.": "請選中帶聲音的片段。", +"Select a finished picture clip": "先選中一段已生成的畫面", +"Select a part first": "先選中一段", +"Select a part on the timeline first": "先在時間軸上選出一段", +"Select a part on the timeline, describe it and extend the video.": "在時間軸上選取一段,描述它,並接著生成。", +"Select a part on the timeline.": "在時間軸上選取要處理的一段。", +"Select a part or draw a range to describe first": "先選中一段或畫出範圍,再寫描述", +"Select a range first": "先選出一段範圍", +"Select a range on a sound track and describe the music.": "在音軌上選一段,描述想要的音樂。", +"Select a video clip first": "先選取一個影片片段", +"Select all": "全選", +"Select all (Ctrl+A)": "全選(Ctrl+A)", +"Select all / deselect / invert": "全選 / 取消選擇 / 反選", +"Select all the text in this box": "選中這個框裡的全部文字", +"Select all while selecting": "多選時全選", +"Select an area in the image editor and let the AI change only that area, leaving the rest as it is.": "在編輯圖片中框出一塊區域,只讓 AI 修改這一塊,其餘部分保持不變。", +"Select an existing MP4 video generated by FreeVideo, kept inside its output or input folder.": "請選擇 FreeVideo 生成且仍存在的 MP4 影片,並把它放在 FreeVideo 的輸出或輸入資料夾內。", +"Select an existing MP4 video generated by FreeVideo. In ComfyUI, keep it inside the output or input folder.": "請選擇 FreeVideo 生成且仍存在的 MP4 影片;在 ComfyUI 中,請把它放在輸出或輸入資料夾內。", +"Select another part and write its own prompt. Each part keeps its own.": "再點選另一段,寫下它的內容;每段的提示詞儲存在這一段上。", +"Select creations first": "先選擇作品", +"Select creations on the shelf": "點作品來選擇", +"Select day": "選擇這一天", +"Select each LoRA only once. Remove the duplicate.": "同一個 LoRA 只能選擇一次,請移除重複項。", +"Select every creation of this day": "選中這一天的全部作品", +"Select every creation shown": "選中目前顯示的全部作品", +"Select exactly two creations": "正好選中兩個作品時可用", +"Select exactly two creations first": "先正好選中兩個作品", +"Select it to change its length": "選中後可以改長度", +"Select none": "全不選", +"Select one part and write what happens in it in the prompt box.": "點選其中一段,在提示詞框中寫下這一段的內容。", +"Select one sound clip": "先選中一段聲音", +"Select only one part": "只選一段", +"Select parts between two points": "選中兩處之間的段", +"Select parts in a box": "框選多段", +"Select several images": "多選圖片", +"Select some text first": "先選中文字", +"Select the area to change on the image with \"Marquee\", \"Lasso\" or \"Magic wand\". Hold Shift while dragging to add an area, or Alt to take one away.": "用「選框」「套索」或「魔棒」在圖片上選出要修改的區域;按住 Shift 拖曳可以新增區域,按住 Alt 拖曳可以減去一塊。", +"Select the highlighted part": "選中高亮的段", +"Select the part added after it and write what happens next in the prompt box at the bottom. The part is 10 seconds by default, or 5 seconds on a Mac and on devices that cannot make 10 seconds at once.": "選取後面自動加上的那一段,在底部提示詞框寫明接下來發生什麼。這一段預設 10 秒,在 Mac 和一次生成不了 10 秒的裝置上為 5 秒。", +"Select the part to extend.": "選中要接續的一段。", +"Selected range": "選中的範圍", +"Send": "傳送", +"Send again": "再發一次", +"Send the changed message": "傳送修改後的訊息", +"Send the diagnostic report": "提交診斷報告", +"Send the problem and diagnostics to us": "把問題和診斷資訊發給我們", +"Send the problem with its diagnostics": "附上診斷資訊提交問題", +"Send the same words again": "把同樣的話再發一次", +"Send this to the assistant": "把這句話發給助手", +"Send us the report so we can look": "把報告發給我們檢視原因", +"Sending the generation first, then switching…": "正在傳送生成請求,傳送後切換…", +"Sending…": "正在傳送…", +"Separate and replace sound": "分離與替換聲音", +"Separate copies": "獨立副本", +"Separate tracks": "分離音軌", +"Separate tracks and replace sound": "分離音軌和替換聲音", +"Separate tracks: dialogue, music, ambience": "分離音軌:人聲、音樂、環境聲", +"Separating audio is not available on this computer.": "這台電腦暫不支援分離音軌。", +"Separating the sound": "正在分離聲音", +"Separating tracks": "分離音軌", +"Separating tracks · clip {clip} / {clips}": "分離音軌 · 第 {clip} / {clips} 段", +"Sequence": "成片", +"Serif": "宋體", +"Server address": "伺服器位址", +"Server returned HTTP {status}": "伺服器傳回 HTTP {status}", +"Set by connected nodes": "由連接的節點決定", +"Set by the Run second pass button: the preview video to continue. The second pass uses the preview's own prompt, seed, size and inputs.": "從這個預覽繼續生成全解析度影片。", +"Set by the number of lines": "按描述的行數生成", +"Set password": "設定密碼", +"Set source": "設定取樣點", +"Set the audio to \"Reference\" or \"Use as is\".": "音訊只能選「參考」或「原樣使用」。", +"Set the audio to \"Reference\".": "請把音訊改選「參考」。", +"Set the first-pass steps to 8, or turn off Preview first, then generate again.": "請將第一階段步數改為 8,或關閉「先出預覽」,再重新生成。", +"Set the opening and closing frames, and the motion in between is generated.": "給出開頭和結尾,生成中間的畫面。", +"Set the strength between -2 and 2, then try again": "把強度調到 -2 到 2 之間後再試", +"Set up FreeVideo": "安裝 FreeVideo", +"Set up your models": "準備模型", +"Sets model, shape and size": "設定模型、畫面比例和尺寸", +"Setting things up": "正在準備 FreeVideo", +"Settings": "設定", +"Settings / installation": "設定/安裝", +"Settings added to {embedded} videos": "已為 {embedded} 個影片補上生成設定", +"Settings are kept in Documents across updates.": "設定儲存在「文件」資料夾中,更新後保留。", +"Settings changed": "設定已更改", +"Settings changed. Click Check installation again.": "設定已更改,請重新點一下「檢查安裝」。", +"Settings pages": "設定頁面", +"Settings saved under a name": "按名稱儲存的一組設定", +"Setup": "安裝", +"Setup complete": "安裝完成", +"Setup failed": "安裝未完成", +"Setup interrupted": "安裝已暫停", +"Setup stopped so that the video being generated is not interrupted. When it has finished, click \"Retry installation\" and confirm the installation again. Completed steps are kept.": "安裝已停止,以免打斷正在生成的影片。影片生成完成後,請點選「重試安裝」,並再次確認安裝。已完成的步驟會保留。", +"Set␟已设置": "已設定", +"Set␟设置": "設定", +"Several at once: batch, one prompt per line, loop": "一次生成多段:批次、每行一條描述和循環", +"Several videos in a row, each a new take": "連續生成多個不同版本", +"Shadow": "陰影", +"Shadows": "陰影", +"Shape free": "比例不限", +"Shape kept": "保持比例", +"Shape lock": "比例鎖定", +"Shape, length and quality are on this row; progress shows on the picture.": "畫面比例、時長和品質在這一行;進度顯示在畫面上。", +"Shape␟形状": "形狀", +"Shape␟比例": "比例", +"Shaping it into a video prompt…": "正在整理成影片提示詞…", +"Share": "分享", +"Share a diagnostic report?": "歡迎提交診斷報告", +"Sharing image preview": "分享圖預覽", +"Sharpen": "銳化", +"Short drama scene": "短劇場景", +"Short dramas finished before this version have no edit.": "在此版本之前拍完的短劇沒有剪輯專案。", +"Shortcut ready": "捷徑已就緒", +"Shortcuts": "快捷鍵", +"Shortcuts of every view": "所有檢視的快捷鍵", +"Shorten the prompt or use fewer reference images, then try again": "縮短提示詞或減少參考圖後再試", +"Shorten the prompt, then try again": "縮短圖片提示詞後再試", +"Shorten this line": "改短這句", +"Shorten to {seconds} s": "縮短到 {seconds} 秒", +"Shorten what you extend, or use fewer parts, then try again": "縮短接續的內容,或減少段數後再試", +"Shortening": "正在改短", +"Shorter": "縮短", +"Shorter than the original, with a pause after it": "比原句短,句尾留有空白", +"Shot {number} ({time}): {text}": "鏡頭 {number}({time}):{text}", +"Show / hide details": "展開/收起詳情", +"Show again": "再看一遍", +"Show all": "看全部", +"Show chats": "展開對話欄", +"Show creations": "展開作品欄", +"Show creations with this tag; right-click to rename or delete": "顯示帶這個標籤的作品;右鍵可改名或刪除", +"Show dates and sizes": "顯示時間和尺寸", +"Show every image": "顯示全部圖片", +"Show every job in progress": "展開全部進行中的任務", +"Show everything again": "恢復顯示全部", +"Show feature hints": "自動顯示功能說明", +"Show folder": "開啟資料夾", +"Show how this image is used": "檢視這張圖的用法", +"Show in chat": "在對話中定位", +"Show in folder": "在資料夾中顯示", +"Show it on the right": "在右側檢視", +"Show it on the stage; pick several to compare": "在中間顯示;多選即可對比", +"Show its details and find it in the chat": "檢視詳情並在對話裡定位", +"Show its progress": "檢視進度", +"Show layer": "顯示圖層", +"Show more of the timeline": "時間軸顯示得更長", +"Show only creations that match": "只顯示符合條件的作品", +"Show only tasks in this state": "只看這個狀態的任務", +"Show or fold the results of this run": "展開或收起這次生成的結果", +"Show or hide the strip of recent videos": "顯示或收起最近作品欄", +"Show or hide what you typed": "顯示或隱藏輸入的密碼", +"Show password": "顯示密碼", +"Show recent videos": "顯示最近作品", +"Show settings": "展開設定欄", +"Show several frames of the video in progress": "同時顯示進行中影片的多個影格", +"Show tasks": "展開任務欄", +"Show terminal": "檢視終端機", +"Show the clips and images you can add": "顯示可加入的素材", +"Show the creation after": "檢視後一個作品", +"Show the creation before": "檢視前一個作品", +"Show the creation this image was made from": "顯示這張圖的來源作品", +"Show the file in its folder": "在資料夾裡找到這個檔案", +"Show the image after this one": "檢視後一張圖片", +"Show the image before this one": "檢視前一張圖片", +"Show the images in the file manager": "在檔案管理器裡開啟圖片所在資料夾", +"Show the images on this computer": "在電腦上開啟儲存圖片的資料夾", +"Show the interface in Chinese": "介面顯示為中文", +"Show the interface in English": "介面顯示為英文", +"Show the layer only inside the selection": "只顯示選區內的圖層內容", +"Show the newer video": "顯示較新的一部影片", +"Show the next page": "看下一頁", +"Show the older video": "顯示較早的一部影片", +"Show the other actions": "顯示其餘操作", +"Show the prompt as written": "顯示原始提示詞", +"Show the rest of the outline": "展開剩下的分鏡", +"Show the rewritten prompt": "顯示改寫後的提示詞", +"Show the timeline in more detail": "時間軸看得更細", +"Show the videos in the file manager": "在檔案管理器裡開啟影片所在資料夾", +"Show these clips and images": "切換到這一組素材", +"Show these files ({count})": "檢視這些檔案({count} 個)", +"Show these settings for the selection": "切換到這一組調整", +"Show this computer": "顯示本機資料", +"Show this computer in the status": "在執行狀態中顯示本機資料", +"Show this group": "展開這一組", +"Show this image large␟大图查看这张图片": "大圖檢視這張圖片", +"Show this image large␟放大显示这张图片": "放大顯示這張圖片", +"Show this one": "只看這張", +"Show this page": "開啟這一頁", +"Show this track in preview and export": "在預覽和匯出裡顯示", +"Show this video on the stage": "在畫面裡顯示這段影片", +"Show what was made last": "開啟最近一次生成的結果", +"Show why it cannot be used": "檢視不能使用的原因", +"Showing the last completed part.": "正在顯示最後完成的一段。", +"Show␟显示": "顯示", +"Show␟筛选": "篩選", +"Side": "側面", +"Side by side": "並排", +"Side by side or with a divider, with another video": "和另一段影片並排或滑動對比", +"Silence this track": "這條軌不出聲", +"Silence this track for now": "讓這條軌暫時沒有聲音", +"Single": "單次", +"Single run: under 30 s": "單次不到 30 秒", +"Single, random seed, standard steps, auto parts": "單次、隨機種子、預設步數、自動分段", +"Sit": "坐下", +"Size from connected nodes": "尺寸來自已連接節點", +"Sizes and lengths this computer can make": "這台電腦能生成的尺寸和時長", +"Size␟大小": "大小", +"Size␟字号": "字號", +"Size␟尺寸": "尺寸", +"Size␟粗细": "粗細", +"Sketch mannequin": "草圖人偶", +"Sketch␟画草图": "畫草圖", +"Sketch␟草图": "草圖", +"Skipped": "已跳過", +"Skipped 1 unsupported file": "已跳過 1 個不支援的檔案", +"Skipped 1 unsupported file ({types})": "已跳過 1 個不支援的檔案({types})", +"Skipped {count} unsupported files": "已跳過 {count} 個不支援的檔案", +"Skipped {count} unsupported files ({types})": "已跳過 {count} 個不支援的檔案({types})", +"Skip␟跳过": "跳過", +"Skip␟跳过演示": "跳過演示", +"Slide clips together to close empty space": "把片段前移,填掉中間的空白", +"Slider": "滑桿", +"Slim FP8": "精簡 FP8 版", +"Slim int8": "精簡 int8 版", +"Slower, steadier": "更慢,更穩", +"Slowest, steadiest": "最慢,最穩", +"Small file": "省空間", +"Smaller than the {vsize} video; the result will look softer.": "比 {vsize} 的影片小,生成的畫面會變模糊。", +"Smaller tiles, more at once": "縮圖更小,一次顯示更多", +"Smart App Control in Windows blocked these files. Search Windows for \"Smart App Control\", or open Windows Security → App & browser control → Smart App Control settings.": "Windows 的「智慧型應用程式控制」攔截了這些檔案。在 Windows 中搜尋「智慧型應用程式控制」,或開啟「Windows 安全性 → 應用程式與瀏覽器控制 → 智慧型應用程式控制設定」。", +"Snap": "貼齊", +"Snap to cuts and markers while dragging": "拖曳時對齊剪輯點和標記", +"Snap to this usual size": "回到這個常用尺寸", +"Snapping": "貼齊", +"Sofa": "沙發", +"Soft light": "柔光", +"Solid panels, fewer animations, no autoplay": "實體背景,減少動畫,影片不自動播放", +"Solo": "獨奏", +"Solo this track": "只聽這條軌道", +"Some computers cannot separate tracks. The button does not appear on them.": "部分電腦暫不支援分離音軌,此時按鈕不會出現。", +"Some installed plugins are not compatible with FreeVideo, so only FreeVideo was loaded this time.": "部分已裝的外掛與 FreeVideo 不相容,這次只載入了 FreeVideo。", +"Some layers apply on this model version": "在目前模型版本上部分層生效", +"Some model files are not in use": "有沒在使用的模型檔案", +"Some of the model files FreeVideo needs are missing or damaged.": "FreeVideo 需要的部分模型檔案缺失或已損壞。", +"Some of the model files FreeVideo needs are missing.": "FreeVideo 需要的部分模型檔案缺失。", +"Some of the model files are missing or damaged. ": "部分模型檔案缺失或已損壞。", +"Some of the selection have it; choose to add to all": "選中的部分作品帶著它,點一下全部加上", +"Some of the text encoder files FreeVideo needs are missing.": "FreeVideo 需要的部分文字編碼器檔案缺失。", +"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 at {time}": "{time} 處的聲音", +"Sound off␟关闭声音": "關閉聲音", +"Sound off␟声音已关闭": "聲音已關閉", +"Sound off␟已静音": "已靜音", +"Sound on␟声音已打开": "聲音已開啟", +"Sound on␟打开声音": "開啟聲音", +"Sound on␟有声音": "有聲音", +"Sound: {text}": "聲音:{text}", +"Source": "來源", +"Source video": "來源影片", +"Source · route": "來源 · 連線", +"Source: ": "下載來源:", +"Space": "空格", +"Space saver (automatic)": "極限省空間(自動啟用)", +"Speaker {number}": "說話人 {number}", +"Speakers": "說話人", +"Speed": "速度", +"Speed can be adjusted after generation is complete.": "生成完成後可以調整速度。", +"Speeds are a guide; actual downloads may differ.": "測速只作參考,實際下載速度可能不同。", +"Split": "剪開", +"Split at the playhead": "在播放頭處剪開", +"Split the clip at the playhead": "在播放頭處把片段剪成兩段", +"Split the sound into dialogue, music and ambience and replace each one.": "把聲音分成人聲、音樂和環境聲,並分別替換。", +"Split the sound into dialogue, music and ambience, then replace each one.": "把聲音分成人聲、音樂和環境聲,再分別替換。", +"Split voice and background into two tracks": "把人聲和背景聲分成兩條軌", +"Split voice, music and ambience onto their own tracks": "把人聲、音樂和環境聲拆到各自的軌道", +"Splits dialogue, music and ambience.": "分離出人聲、音樂和環境聲。", +"Spot healing": "汙點修復", +"Square": "方形", +"Square 1:1": "方形 1:1", +"Square frame for feeds and avatars": "適合動態消息和頭像", +"Stages {done} / {total} · {label}": "階段 {done} / {total} · {label}", +"Stage␟大图": "大圖", +"Stage␟阶段": "階段", +"Stand": "站立", +"Standard": "標準", +"Standard test": "標準測試", +"Start / end": "開頭 / 結尾", +"Start ComfyUI": "啟動 ComfyUI", +"Start a new chat; this one is full": "這段對話已滿,開始新對話", +"Start a new drama when needed": "需要時新增一部短劇", +"Start a new film from a blank chat": "從空白對話開始一部新片", +"Start a new image from this one": "以這張為參考再生成", +"Start a new line in the prompt with minutes:seconds, for example \"0:02\".": "在提示詞中另起一行,以「分:秒」開頭,例如「0:02」。", +"Start from a ready-made request": "從常用說法裡選一句", +"Start from a ready-made scene": "從現成的場景開始", +"Start from a ready-made white-model scene": "用現成的白模場景開始", +"Start from the last frame of the part before": "從上一段的最後一影格接著生成", +"Start it again from the FreeVideo launcher.": "請從 FreeVideo 啟動器重新啟動。", +"Start loop": "開始循環", +"Start measuring": "開始測量", +"Start over when playback reaches the end": "播到結尾後從頭再來", +"Start recording": "開始錄音", +"Start selecting with this one": "從這一個開始多選", +"Start the stopped parts again": "把停下的段接著生成", +"Start the waiting tasks again": "讓排隊的任務繼續開始", +"Start this view's generation": "開始這個檢視的生成", +"Started␟已开始": "已開始", +"Started␟开始": "開始", +"Starting ComfyUI": "啟動 ComfyUI", +"Starting FreeVideo": "正在啟動 FreeVideo", +"Starting generation": "正在啟動生成", +"Starting installation…": "正在開始安裝…", +"Starting points to edit": "可修改的起點描述", +"Starting · {minutes} min": "正在開始 · {minutes} 分", +"Starting · {minutes} min {seconds} s": "正在開始 · {minutes} 分 {seconds} 秒", +"Starting · {s} s": "正在開始 · {s} 秒", +"Starting…␟正在启动…": "正在啟動…", +"Starting…␟正在开始…": "正在開始…", +"Starting␟启动中": "啟動中", +"Starting␟正在开始": "正在開始", +"Starts after the one before it": "等前一項完成後開始", +"Starts when the current video finishes": "目前影片完成後自動開始", +"Startup interrupted": "啟動未完成", +"Start␟入门": "入門", +"Start␟开头": "開頭", +"Start␟开始": "開始", +"Steam rises from a bowl of hand-pulled noodles as chopsticks lift them, warm kitchen light, sizzling and gentle chatter.": "筷子夾起一碗手拉麵,熱氣升騰,廚房暖光,滋滋聲和輕聲交談。", +"Step back one frame": "後退一影格", +"Step back to an earlier take (now take {position} of {count})": "換到更早生成的一版(現在是第 {position}/{count} 版)", +"Step back to an earlier take of this clip": "換回這一段更早的版本", +"Step cache": "步間快取", +"Step forward one frame": "前進一影格", +"Step through it on the real screen␟在真实界面上一步步演示": "在真實介面上一步步示範", +"Step through it on the real screen␟在真实界面上一步步走一遍": "在真實介面上一步步走一遍", +"Step {done} / {total}": "生成 {done} / {total}", +"Step {step} of {total}": "第 {step} / {total} 步", +"Step-by-step guides with examples": "帶範例的分步教學", +"Steps": "步驟", +"Step␟正在生成 · 第 ": "正在生成 · 第 ", +"Step␟步骤": "步驟", +"Still loading. This may take a few more minutes.": "仍在載入,可能還需要幾分鐘", +"Still stopping. Try deleting again in a moment.": "正在停止,請稍後再刪除。", +"Still to download: {count} files ({size})": "還需下載:{count} 個檔案({size})", +"Still working: {named}": "仍在進行:{named}", +"Stop": "停止", +"Stop ": "停止 ", +"Stop after this video": "完成目前後停止", +"Stop all": "全部停止", +"Stop and delete": "停止並刪除", +"Stop at a lower-resolution preview first": "先出低解析度預覽,滿意再繼續", +"Stop auto subtitles": "停止自動字幕", +"Stop download": "停止下載", +"Stop downloading this update": "停止下載這次更新", +"Stop dubbing?": "停止配音?", +"Stop everything the assistant is making": "停止助手正在生成的全部內容", +"Stop generating?": "停止生成?", +"Stop it now; nothing is kept": "立即停止,不保留結果", +"Stop its work, then delete the chat": "先停止生成,再刪除對話", +"Stop making the views": "停止生成", +"Stop making this; nothing is kept": "停止生成這一條,不保留結果", +"Stop now and keep the lines already dubbed": "立即停止,保留已配好的台詞", +"Stop or continue this drama on the page": "在頁面上手動停止或繼續這部短劇", +"Stop rewriting; keep the prompt as written": "停止改寫,保留原來的提示詞", +"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 task and close? All files are retained.": "停止目前任務並結束?所有檔案會保留。", +"Stop the current video? What is being made is not kept.": "停止目前影片?正在生成的不會保留。", +"Stop the current video? What is being made is not kept; the {waiting} waiting will pause.": "停止目前影片?正在生成的不會保留,排隊的 {waiting} 個會暫停。", +"Stop the download; the part downloaded is kept": "停止下載,已下載的部分會保留", +"Stop the reply that is being written": "停止助手正在寫的回覆", +"Stop the video being made now": "停止正在生成的影片", +"Stop this export; no partial file is kept": "停止匯出,不留下不完整的檔案", +"Stop this generation (asks first)": "停止這次生成(會先確認)", +"Stop this generation?": "停止這個生成?", +"Stop this one; asks first␟停止这一个,会先确认": "停止這一個,會先確認", +"Stop this one; asks first␟停止这一项,会先确认": "停止這一項,會先確認", +"Stop this part; it stays as a draft": "停止生成,這一段留作草稿", +"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 image": "不再使用這張人物圖", +"Stop waiting": "停止等待", +"Stop what runs and pause the queue; asks first": "停止正在生成的並暫停佇列,會先確認", +"Stopped": "已停止", +"Stopped waiting for FreeVideo to reconnect.": "已停止等待 FreeVideo 恢復連線。", +"Stopped · {done} of {total} GiB kept": "已停止 · 已下載 {done} / {total} GiB", +"Stopped. Files retained for resuming.": "已停止,檔案保留,可繼續安裝。", +"Stopped. Files retained.": "已停止,檔案已保留。", +"Stopped. The next queued video is starting.": "已停止,佇列中的下一個開始生成。", +"Stopped. The queue is paused.": "已停止,佇列已暫停。", +"Stopped. Your prompt is unchanged.": "已停止,原文已保留。", +"Stopped; downloaded files are kept": "已停止,已下載的檔案保留", +"Stopped; files retained": "已暫停,下載進度已保留", +"Stopping": "正在停止", +"Stopping generation…": "正在停止生成…", +"Stopping workers; retaining files…": "正在停止工作處理程序並保留檔案…", +"Stopping…": "正在停止…", +"Stops at a lower-resolution preview. Choose \"Run second pass\" in the result when it looks right; the video matches a direct run.": "先出低解析度預覽,滿意後在結果裡點一下「繼續第二階段」,最終影片與直接生成的結果一致。", +"Storage": "儲存空間", +"Storage ready": "模型檔案已就緒", +"Story": "故事短片", +"Strategy follows your available VRAM and RAM.": "策略隨目前可用顯示卡記憶體與記憶體自動調整。", +"Strength": "強度", +"Stroke": "描邊", +"Stroke width": "描邊粗細", +"Strong · the GPU handles the least at a time; slowest": "加強 · 顯示卡每次處理的資料最少,生成最慢", +"Style deleted.": "已刪除樣式。", +"Style for all subtitles": "全部字幕的樣式", +"Style {number}": "樣式 {number}", +"Style␟样式": "樣式", +"Style␟风格": "風格", +"Subfolders are scanned. Missing files download during setup.": "自動掃描子目錄,缺少的檔案在安裝時下載。", +"Subject {number}": "主體 {number}", +"Submit a new task": "重新提交一個新任務", +"Submit feedback␟前往反馈页面提交": "前往意見回饋頁面提交", +"Submit feedback␟提交反馈": "提交意見回饋", +"Submit it again": "重新提交一次", +"Submit it again when needed": "需要時重新提交", +"Submitting task": "提交任務", +"Subtitle": "字幕", +"Subtitle files can be up to 4 MB.": "字幕檔案不能超過 4 MB。", +"Subtitle lines and their style": "字幕內容和樣式", +"Subtitles": "字幕", +"Subtract · Alt": "減去 · Alt", +"Swap": "左右互換", +"Swap / default colors": "交換顏色 / 預設顏色", +"Swap colors (X)": "交換顏色(X)", +"Swap this part back to its earlier take": "把這一段換回之前生成的版本", +"Switch between light and dark": "在淺色和深色之間切換", +"Switch every view's colours": "切換所有檢視的顏色", +"Switch to newest first": "改為最新在前", +"Switch to sorting by name": "改為按名稱排列", +"Switch to the Light level and generate again.": "請改用輕⁠量⁠檔後重新生成。", +"Switch version": "換版本", +"Switch view": "切換檢視", +"Switched current download to ": "已切換至 ", +"Switched to Light for \"Use as is\".": "已為「原樣使用」改用輕量檔。", +"Switching after FreeVideo is closed": "關閉 FreeVideo 後切換", +"Switching after the current video": "目前影片完成後切換", +"Switching pages keeps generation running, along with your prompt and references": "切換頁面不會中斷生成,提示詞和參考圖都還在", +"Switching sources; downloaded parts are kept where possible.": "正在切換下載來源,能續傳的部分會保留。", +"Switching the download source or connection mode gives the same result. Choose \"Export report\", then \"Report a problem\", and attach the report.": "更換下載來源或連線方式後結果相同。請先點選「匯出報告」,再點選「提交問題」並附上報告。", +"Switching to the faster model": "正在切換到更快的模型", +"Switching to the faster model. This page reconnects by itself.": "正在切換到更快的模型,頁面會自動恢復。", +"Sword": "劍", +"System memory headroom is too low": "系統可用記憶體不足", +"System memory ran out while loading the model": "載入模型時系統記憶體不足", +"System status": "執行狀態", +"TEMP": "[暫存資料夾]", +"Table": "桌子", +"Tag": "標籤", +"Tag name": "標籤名稱", +"Tags": "標籤", +"Tags are kept in this browser and show only here.": "標籤儲存在目前瀏覽器中,只在這個瀏覽器裡顯示。", +"Tags for {count} creations": "{count} 個作品的標籤", +"Take \"{name}\" off this creation": "從這個作品上去掉「{name}」", +"Take away the second audio track": "去掉第二條音軌", +"Take back the last change": "撤回上一步變更", +"Take back the last edit": "退回上一步變更", +"Take back what just happened": "撤回剛才的操作", +"Take it off the list; the file stays": "從清單移除,檔案不刪", +"Take it off this list␟从列表里去掉": "從列表裡移除", +"Take it off this list␟从列表里移除": "從列表裡移除", +"Take it out of favorites": "移出收藏", +"Take it out of the queue␟从队列里拿掉这一项": "從佇列裡拿掉這一項", +"Take it out of the queue␟移出队列": "移出佇列", +"Take me there": "帶我去", +"Take these out of favorites": "把選中的移出收藏", +"Take this image out of the message": "從這條訊息裡拿掉這張圖", +"Take this image out␟去掉这张参考图": "去掉這張參考圖", +"Take this image out␟拿掉这张图片": "拿掉這張圖片", +"Take this notice off the list": "把這則通知從列表移除", +"Take this video out of favorites": "把這條影片移出收藏", +"Take {take}": "第 {take} 次", +"Taking longer than expected": "比預計久,仍在生成", +"Tall": "直向", +"Tall frame for phones and short videos": "適合手機和短影片", +"Task": "任務", +"Tasks": "任務", +"Tasks in this chat": "這段對話裡的任務", +"Tasks the AI assistant started": "AI 助手發起的任務", +"Technical details": "技術詳情", +"Tell the assistant": "對助手說", +"Tell the assistant…": "對助手說…", +"Tell us a problem or an idea": "把問題或想法告訴我們", +"Tell us what to improve": "告訴我們哪裡需要改進", +"Tell us what went wrong or could be better": "告訴我們問題或建議", +"Temperature␟温度": "溫度", +"Temperature␟色温": "色溫", +"Template": "範本", +"Templates": "範本", +"Temporary files": "暫存檔案", +"Temporary files from generating": "生成過程中的暫存檔案", +"Temporary setup files removed · %s freed": "已清理安裝時的暫存檔案 · 釋放 %s", +"Tense": "緊張", +"Terminal": "終端", +"Test & tune": "測試與最佳化", +"Test GPU acceleration": "檢查 GPU 加速", +"Test again": "重新測速", +"Test speed": "測速", +"Testing acceleration": "正在測試加速元件", +"Testing download sources": "正在測試下載來源", +"Testing download sources (\\d+ / \\d+)": "正在測試下載來源 \\1", +"Testing sources: {done}/{total}": "正在測速:{done}/{total}", +"Testing sources… ": "正在測速… ", +"Testing…␟正在测速…": "正在測速…", +"Testing…␟测速中…": "測速中…", +"Text and shape layers scale too and stay editable.": "文字和形狀圖層會一起縮放,仍然可以編輯。", +"Text encoder␟提示词模型": "提示詞模型", +"Text encoder␟文本编码器": "文本編碼器", +"Text fonts could not be loaded": "文字字型沒能載入", +"Text in images, such as poster titles": "圖中可寫文字,如海報標題", +"Text in the image": "寫進畫面的字", +"Text in the project contains characters the built-in fonts cannot display": "專案中的文字含有內建字型無法顯示的字元", +"Text named in the prompt may not appear exactly in the picture.": "提示詞中的文字內容不一定能準確顯示在畫面裡。", +"Text to video": "文字生成影片", +"Text understanding": "文本理解", +"Text␟文字": "文字", +"Text␟文字内容": "文字內容", +"That image could not be read.": "這張圖讀不了。", +"That spot is taken. Use an empty spot.": "這裡已經有片段了,請放到空白處。", +"That task is no longer in this conversation.": "這條任務已經不在目前對話裡了。", +"The 1.5 times size appears when this computer can generate that size and length. A merged or imported video can be upscaled to 4K.": "本機能生成該尺寸和時長時,才出現放大 1.5 倍的一項;合併或匯入的影片可放大到 4K。", +"The Edit view: crop, describe, extend": "剪輯檢視:裁切、描述、接續", +"The Fast level could not be saved to disk. Check the disk and try again.": "極⁠速⁠檔未能儲存到磁碟,請檢查磁碟後重試。", +"The Fast level did not finish": "極⁠速⁠檔未能完成生成", +"The Fast level did not finish downloading. Check the network and try again.": "極⁠速⁠檔沒有下載完成,請檢查網路後重試。", +"The Fast level did not finish downloading. Try again.": "極⁠速⁠檔沒有下載完成,請重試。", +"The Fast level files are not published yet, so they cannot be downloaded. Switched back to Light.": "極⁠速⁠檔的檔案尚未釋出,目前無法下載。已改回輕⁠量⁠檔。", +"The Fast level is already downloading. Try again shortly.": "極⁠速⁠檔正在下載,請稍後重試。", +"The Fast level is ready.": "極⁠速⁠檔已就緒。", +"The FreeVideo Python environment cannot start": "FreeVideo 的 Python 環境無法啟動", +"The FreeVideo model is already accelerated and does not need an acceleration LoRA. Turn this LoRA off or remove it, then generate again.": "FreeVideo 的模型已經加速,無需加速 LoRA。請關閉或移除此 LoRA 後重新生成。", +"The FreeVideo node was off in Nodes view. It has been turned back on.": "FreeVideo 節點在節點檢視裡是關閉的,已自動開啟。", +"The FreeVideo service did not respond": "FreeVideo 服務沒有響應", +"The FreeVideo toolbar could not be added": "FreeVideo 工具列沒有載入", +"The FreeVideo toolbar that opens the creative workspace cannot be seen: its stylesheet view_navigation.css did not load.": "看不到開啟創作面板的 FreeVideo 工具列:樣式檔案 view_navigation.css 沒有載入。", +"The FreeVideo toolbar that opens the creative workspace is hidden or covered by other page elements.": "開啟創作面板的 FreeVideo 工具列被頁面上的其他元素隱藏或遮擋了。", +"The FreeVideo toolbar that opens the creative workspace is missing from the page.": "頁面上沒有開啟創作面板的 FreeVideo 工具列。", +"The FreeVideo workflow did not open": "FreeVideo 工作流程沒有開啟", +"The GPU is not available for depth": "暫時無法用顯示卡提取深度", +"The GPU spent most of this video in thermal slowdown ({detail}), so it took much longer than usual. Improve cooling; on a laptop, plug in and choose a high-performance power mode.": "生成這段影片時,顯示卡大部分時間因過熱降頻({detail}),所以比平時慢很多。請改善散熱;筆電請接通電源並選擇高效能模式。", +"The GPU spent most of this video in thermal slowdown, so it took much longer than usual. Improve cooling; on a laptop, plug in and choose a high-performance power mode.": "生成這段影片時,顯示卡大部分時間因過熱降頻,所以比平時慢很多。請改善散熱;筆電請接通電源並選擇高效能模式。", +"The LAN access port cannot be used": "區域網路存取的連接埠無法使用", +"The LoRA file could not be found. Choose it again.": "LoRA 檔案找不到,請重新選擇。", +"The LoRA folder could not be read. Check again.": "無法讀取 LoRA 資料夾,請重新檢查。", +"The LoRA list cannot be read. Add the LoRAs again.": "LoRA 清單無法讀取,請重新新增 LoRA。", +"The LoRA selection is invalid. Choose the files again.": "LoRA 設定有誤,請重新選擇檔案。", +"The MiniMax H3 Community License Agreement grants rights only outside the European Union, the United Kingdom, the Republic of Korea and the United States, and restricts how the model and its outputs may be used (for example, content posted publicly must be disclosed as AI-generated). See the agreement and its Exhibit A.": "MiniMax H3 社群授權協議只授權在歐盟、英國、韓國和美國以外的地區使用,並對模型及其生成內容的用途有限制(例如公開發布生成的內容時須標明由 AI 生成),詳見協議原文及附件 A。", +"The NVIDIA driver is installed but not running": "NVIDIA 顯示卡驅動程式已安裝但未執行", +"The NVIDIA driver is installed. Restart the computer, then open FreeVideo again. If it still fails, export the report.": "NVIDIA 顯示卡驅動程式已安裝。請重新啟動電腦,然後重新開啟 FreeVideo。仍然失敗時,可以匯出報告。", +"The NVIDIA driver is too old": "NVIDIA 顯示卡驅動程式版本過低", +"The Python program that the environment relies on is missing, possibly removed by security software or a cleanup tool. Click \"Retry installation\": FreeVideo sets the environment up again.": "執行環境所依賴的 Python 程式已經不在,可能被安全軟體或清理工具刪除。請點一下「重試安裝」,FreeVideo 會重新增立執行環境。", +"The Replace person model could not be saved to disk.": "替換人物模型無法儲存到磁碟。", +"The Replace person model download didn't finish. Check the network and try again.": "替換人物模型沒有下載完成,請檢查網路後重試。", +"The Replace person model download didn't finish. Try again.": "替換人物模型沒有下載完成,請重試。", +"The Replace person model is being downloaded elsewhere. Try again shortly.": "替換人物模型正在別處下載,請稍後重試。", +"The Replace person model is ready.": "替換人物模型已就緒。", +"The Replace person model is still downloading. Generate when it finishes.": "替換人物模型正在下載,下載完成後才能生成。", +"The ZIPs used for importing are no longer needed. Deleting them frees %s.": "匯入用的壓縮檔已不再需要,刪除後可釋放 %s。", +"The assistant connection service is not ready. Restart FreeVideo, then retry.": "助手連線服務尚未就緒,請重新啟動 FreeVideo 後重試。", +"The assistant features are turned off on this computer, so the character library is unavailable. Turn that setting back on and restart FreeVideo to use it.": "這台電腦關閉了助手功能,角色庫因此不可用。重新開啟該設定並重新啟動 FreeVideo 後可以使用。", +"The assistant first writes a one-page outline, one line per beat. It then sets the staging of each scene, that is where each person is in the picture, sitting or standing, which way they face and where the camera is, and uses it in every shot of that scene.": "助手先寫一頁大綱,每拍一行;再按場寫好站位,即每個人在畫面中的位置、坐或站、朝向和機位,並用在這一場的每個鏡頭中。", +"The assistant has not contacted FreeVideo for {span}; it may have finished or been closed.": "助手已有 {span}沒有聯絡 FreeVideo,可能已經結束或被關閉。", +"The assistant is not connected.": "助手未連線。", +"The assistant makes films in the Autopilot view.": "助手在「AI 全自動」檢視中拍片。", +"The assistant used a connection key that is no longer valid, so FreeVideo refused it.": "助手使用的連線金鑰已失效,FreeVideo 拒絕了它。", +"The assistant waits for an answer first": "助手先等確認再繼續", +"The attention speed-up component on this computer needs an update. Run freevideo setup --fa4-guard in a terminal, then restart FreeVideo.": "注意力加速元件需要更新。請在終端機執行 freevideo setup --fa4-guard,然後重新啟動 FreeVideo。", +"The background task is busy. You can do this when it finishes.": "背景工作正在進行,完成後即可操作", +"The box is empty": "框裡沒有文字", +"The browser did not open. Copy the release page address below and open it in your browser.": "瀏覽器未能開啟。請複製下面的發布頁網址,在瀏覽器裡開啟。", +"The browser extension \"{extension}\" interfered with this page, so this action did not finish.": "瀏覽器擴充功能「{extension}」干擾了頁面,這次操作沒有完成。", +"The browser has not opened FreeVideo": "瀏覽器還沒有開啟 FreeVideo", +"The browser has not opened FreeVideo yet. If no browser window appeared, click “Open FreeVideo”. If the page stays blank or keeps loading, open %s in a current Chrome or Edge.": "瀏覽器還沒有開啟 FreeVideo。如果沒有彈出瀏覽器視窗,請點選「開啟 FreeVideo」;如果頁面空白或一直在載入,請用最新版 Chrome 或 Edge 開啟 %s。", +"The browser mixed files from two FreeVideo versions. Press Ctrl+F5 to reload without the cache.": "瀏覽器混用了新舊兩個版本的 FreeVideo 檔案。請按 Ctrl+F5 強制重新整理。", +"The browser page did not load FreeVideo completely.": "瀏覽器頁面沒有完整載入 FreeVideo。", +"The browser page names the files that failed and what to do. Follow it, then reload the page; if it happens again, export the report.": "請按瀏覽器頁面上的提示處理後重新整理;仍然出現時,可以匯出報告。", +"The button is unavailable while the timeline is empty.": "時間軸為空時按鈕不可用。", +"The cache could not be cleared.": "快取未能清除。", +"The cache is empty": "快取是空的", +"The canvas is empty. Add or generate an image first.": "畫布是空的,請先新增或生成一張圖片。", +"The card has changed since it was read": "卡片在讀取後已有變更", +"The cat jumps down from the windowsill and trots across the wooden floor toward the kitchen.": "小貓從窗台跳下,沿著木地板小跑向廚房。", +"The cause could not be identified automatically. The original error is in Technical details.": "未能自動識別原因,原始錯誤見「技術詳情」。", +"The character library could not be read. Try Refresh.": "角色庫暫時無法讀取,請點選重新整理。", +"The check did not answer; check again later": "檢查沒有回應,請稍後重新檢查", +"The check did not finish.": "這次檢查沒有完成。", +"The chosen font is missing some characters. Choose another font.": "所選字型缺少部分字元,請換一種字型。", +"The chosen take cannot be found in this shot": "這個鏡頭中找不到指定的那一條", +"The clean up did not finish. Try again.": "清理沒有完成,請再試一次。", +"The click-select model is not installed. Download it first.": "點選模型尚未安裝,請先下載點選模型。", +"The connection dropped.": "網路連線中斷了。", +"The connection dropped; resuming the download and keeping what was already downloaded": "連線中斷,正在繼續下載,已下載的部分會保留", +"The connection is unstable. Click \"Retry\".": "網路不穩,請點一下「重試」。", +"The connection steps have been updated. If you connected an assistant before, copy them and paste them to it again.": "連線說明已更新。以前連線過的助手,請重新複製並貼上給它。", +"The connection to FreeVideo was lost and did not come back within 2 minutes.": "與 FreeVideo 的連線中斷,2 分鐘內沒有恢復。", +"The creations could not be loaded.": "作品暫時無法讀取。", +"The creations could not be read. Try again.": "沒能讀取作品,請再試一次。", +"The creative workspace could not open": "創作面板打不開", +"The creative workspace did not open.": "創作面板沒有開啟。", +"The creative workspace is open but cannot be seen on the page.": "創作面板已經開啟,但頁面上看不到。", +"The current generation mode cannot extend a video": "目前生成方式不支援接續影片", +"The current model cannot use this example's settings.": "目前模型用不了這個範例的設定", +"The current task will stop. Downloaded files and your setup are retained for next time.": "會停止目前任務,已下載檔案和安裝進度會保留,下次可以繼續。", +"The depth model could not be downloaded": "深度模型未能下載", +"The disk is full, so the joined video could not be saved. Free up disk space and try again.": "磁碟空間不足,接合後的影片沒能儲存。請清理磁碟空間後重試。", +"The disk is full, so the long video could not be saved. Free up disk space and try again.": "磁碟空間不足,長影片沒能儲存。請清理磁碟空間後重試。", +"The disk is full, so this part could not be saved. Free up disk space, then continue from this part.": "磁碟空間不足,這一段沒能儲存。請清理磁碟空間,然後從這段繼續。", +"The disk is full. Free some space, then generate again.": "磁碟空間不足,請清理出空間後再生成。", +"The disk is full. Free some space, then import again.": "磁碟空間不足,請清理出空間後再匯入。", +"The disk is full. Free some space, then save the frame again.": "磁碟空間不足,請清理出空間後再儲存。", +"The disk is full. Free some space, then try again.␟磁盘空间不足,请清理出空间后重试。": "磁碟空間不足,請清理出空間後重試。", +"The disk is full. Free some space, then try again.␟磁盘空间已满,请释放空间后重试。": "磁碟空間已滿,請釋放空間後重試。", +"The disk is not connected": "這顆硬碟沒有連接", +"The download did not finish; select \"Copy error\" to copy the report below.": "下載未完成,可點一下「複製錯誤」複製下方報告。", +"The download did not start. Try again; if it keeps failing, report the problem.": "下載沒有開始。請重試;仍然失敗請提交問題。", +"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 folder no longer exists. Export the list again.": "下載目錄已不存在,請重新匯出清單", +"The download list could not be generated. Restart the launcher and try again.": "下載清單未能生成,請重新啟動啟動器後再試。", +"The download list could not be saved in this folder: {reason}": "下載清單未能儲存到這個資料夾:{reason}", +"The download list is not ready yet. Choose \"Check again\".": "下載清單尚未生成,請點一下「重新檢查」。", +"The download stopped. Resume to continue; if it stops again, export the report and use \"Report a problem\".": "下載中斷。請點選「繼續」;如再次中斷,請匯出報告,再點選「提交問題」並附上報告。", +"The download stopped: a downloaded file did not pass the check. Resume to download it again.": "下載中斷:下載的檔案沒有通過驗證。請點選「繼續」重新下載。", +"The download stopped: the connection to the download server was lost. Resume to continue.": "下載中斷:與下載伺服器的連線斷開。請點選「繼續」接著下載。", +"The download stopped: the model files could not be written to this folder. Check the folder, then resume.": "下載中斷:模型檔案無法寫入這個資料夾。請檢查資料夾後點選「繼續」。", +"The download stopped; press Retry": "下載中斷了,點重試", +"The download tool could not be prepared": "下載工具自動補齊失敗", +"The download tool is unavailable": "下載工具不可用", +"The downloaded Fast level did not pass verification. Try again.": "下載的極⁠速⁠檔未通過校驗,請重試。", +"The downloaded Replace person model did not pass verification. Try again.": "下載的替換人物模型未通過驗證,請重試。", +"The downloaded update files are incomplete or damaged.": "下載的更新檔案不完整或已損壞。", +"The dubbing model could not be downloaded. Check the connection and try again.": "配音模型下載失敗,請檢查網路後重試。", +"The dubbing model could not be installed. Try again; if it keeps failing, report the problem.": "配音模型未能安裝。請重試;仍然失敗時,請提交問題。", +"The dubbing model is not fully installed. ": "配音模型沒有裝全。", +"The dubbing model is not fully installed. Generate again to download it.": "配音模型沒有裝全,重新生成會再下載。", +"The dubbing model is not installed yet": "配音模型還沒有安裝好", +"The edit changed meanwhile. Try again.": "編輯內容已變化,請重試。", +"The edit could not be saved yet. Try again.": "編輯內容尚未儲存,請稍後重試。", +"The edit of a finished short drama": "短劇成品的剪輯專案", +"The edited image could not be saved. Try again; if it keeps failing, report the problem.": "編輯後的圖片沒能儲存。請重試;仍然失敗時,請提交問題。", +"The edited image is saved, and the original is kept.": "編輯後的圖片已儲存,原圖已保留。", +"The editor did not open, so the start clip was not placed. Open the editor, then select the example again.": "剪輯檢視沒有開啟,起始片段沒有放上去;開啟剪輯檢視後再點一次範例", +"The engine stopped unexpectedly at {time} and has been restarted.": "引擎於 {time} 意外停止,已重新啟動。", +"The environment needs repair": "執行環境需要修復", +"The estimated time for the chosen level appears under \"Generate video\". Then choose it to start.": "選好品質等級後,「生⁠成⁠影⁠片」按鈕下方會顯示預估時間;然後點它開始生成。", +"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 example was not filled in: {detail}": "範例沒有填入:{detail}", +"The existing file is open in another program or is read-only, so it was not replaced. Close that program, or choose another name.": "原檔案正被其他程式開啟或為唯讀,未被替換。請關閉該程式,或換一個檔名。", +"The export window always opens with \"Video and audio\" as the content and \"High\" as the quality; when it has no \"Frame rate\", this computer cannot export at 48 or 60 fps.": "匯出視窗每次開啟時,「內容」預設選「畫面和聲音」,「畫質」預設選「高」;視窗裡沒有「影格速率」時,這台電腦不支援以 48 或 60 fps 匯出。", +"The extended video has more parts than supported": "接續後的影片超過了支援的段數", +"The faster model is in use; the old model files are kept for now.": "已在使用更快的模型,舊模型檔案暫時保留。", +"The faster model is not in use, so the old model is kept.": "沒有在用更快的模型,舊模型保留。", +"The faster model is ready. FreeVideo switches after the current video.": "更快的模型已下載好,目前影片完成後自動切換。", +"The faster model is {speed} and closer to the original quality. It downloads {size}": "更快的模型{speed},畫質也更接近原版。需要下載約 {size}", +"The faster model's files are incomplete, so the old model is kept.": "更快的模型檔案不完整,舊模型保留。", +"The faster second pass needs 8 first-pass steps. This video uses a single {n}-step pass.": "只有第一階段為 8 步時才會使用第二階段加速,這次按 {n} 步只取樣一遍。", +"The fastest is 4×; set to 4×.": "最快 4×,已設為 4×。", +"The favorite was not saved. Try again.": "收藏未能儲存,請重試。", +"The feedback page is open and the screenshot is copied. Paste it in, then submit.": "已開啟意見回饋頁面,截圖已複製,貼上後提交。", +"The feedback page is open with your text filled in, but the screenshot couldn't be copied. Submit it there without it.": "已開啟意見回饋頁面,文字已填好,但截圖沒能複製,可不帶截圖提交。", +"The feedback page is open with your text filled in. Submit it there.": "已開啟意見回饋頁面,文字已填好,確認後提交。", +"The feedback page is open, but the text was too long and was cut short there. The full text is copied; paste it in.": "已開啟意見回饋頁面,但文字過長,那邊被截短了,完整文字已複製,請貼上補全。", +"The feedback page is open, but the text was too long and was cut short there. Your full text stays here.": "已開啟意見回饋頁面,但文字過長,那邊被截短了,完整文字仍留在這裡。", +"The file changed after the check, so it was kept.": "檔案在檢查後有變更,已保留。", +"The file could not be read. It may be incomplete; download it again.": "檔案無法讀取,可能未下載完整,請重新下載。", +"The file is no longer in the LoRA folder.": "此檔案已不在 LoRA 資料夾中。", +"The file is open in another program. Close that program, then try again.": "檔案正被其他程式佔用,請關閉該程式後重試。", +"The files for the new version are still being published.": "新版本的檔案還在發布中。", +"The first 200 files are listed.": "只列出前 200 個檔案。", +"The first line downloads the dubbing model ({size}) before it is made.": "第一次配音要先下載配音模型({size}),下載完再生成。", +"The first pass sets the composition; the second adds detail. Choose \"Preview first\" to see a half-size preview, then \"Run second pass\" when it looks right.": "第一遍定構圖,第二遍補細節。選「先出預覽」,可先看半解析度預覽,滿意後點一下「繼續第二階段」。", +"The first run downloads the music model.": "首次生成需要下載配樂模型。", +"The first run loads the models and takes longer. Later runs are faster.": "首次生成需要載入模型,耗時較長;之後會更快。", +"The first time, the Replace person model of about 80 MB downloads on its own. The panel shows the progress, and generation can start when it finishes.": "首次使用時會自動下載約 80 MB 的替換人物模型,面板中顯示進度,下載完成後才能生成。", +"The folder could not be opened automatically. Open it in a file manager.": "無法自動開啟該資料夾,請在檔案管理器中手動開啟", +"The folder could not be opened. Open it in a file manager: ": "無法自動開啟資料夾,請在檔案管理器中開啟:", +"The folder that keeps the images cannot be written": "儲存圖片的資料夾無法寫入", +"The folder that keeps the images cannot be written (freevideo-image in the ComfyUI input folder). Check that it exists, is writable and has no file of the same name, then try again.": "無法寫入儲存圖片的資料夾(ComfyUI 的 input 目錄下的 freevideo-image)。請確認該目錄存在、可寫,且沒有同名檔案,然後重試。", +"The four quality levels": "四個品質等級", +"The fox in {image1} walks through a sunlit forest.": "{image1} 中的狐狸走過灑滿陽光的森林。", +"The full video matches a direct run.": "完整影片與直接生成的結果一致。", +"The generated character reference video could not be read": "生成的角色參考影片無法讀取", +"The generation environment is not installed yet": "生成所需的環境還沒有安裝好", +"The generation record needed to extend the video is no longer available": "接續所需的生成記錄已經不在", +"The generation service cannot use these settings": "生成服務無法使用這組參數", +"The generation service no longer has the result of this task": "生成服務沒有保留這次任務的結果", +"The generation settings are outside the supported range": "生成參數不符合支援的範圍", +"The generation settings did not pass validation; see the error details below.": "生成設定未通過檢查,可檢視下方錯誤詳情。", +"The generation was ended by another program.": "生成已被其他程式結束。", +"The graphics card is not available right now. Try again later.": "顯示卡暫時用不了,稍後再試。", +"The graphics card's computation check did not pass. Update the graphics card driver, then restart FreeVideo. If the check still does not pass, download the report and report the problem.": "顯示卡的計算檢查未通過。請更新顯示卡驅動後重新啟動 FreeVideo;如仍未通過,請下載報告並提交問題。", +"The image could not be added. Choose another one.": "圖片沒能新增,請換一張。", +"The image could not be saved. Try a smaller canvas or reload the page.": "圖片沒能儲存,請縮小畫布或重新整理頁面後重試。", +"The image did not finish.": "這張圖沒有完成。", +"The image didn't finish": "這張圖沒有完成", +"The image edit settings are invalid": "圖片編輯的設定有誤", +"The image editor did not load. Reload the page and try again.": "圖片編輯器沒有載入。請重新整理頁面後再試。", +"The image engine returned an unreadable answer. Try again; if it keeps failing, report the problem.": "圖片引擎傳回了無法讀取的結果。請重試;仍然失敗請提交問題。", +"The image exceeds the 50-megapixel limit": "圖片超過了 5000 萬畫素的上限", +"The image folder cannot be written to. Check that the folder can be written to, then save the frame again.": "圖片資料夾不可寫。請檢查這個資料夾的寫入權限後再儲存。", +"The image generation model files could not be read. Repair them in the launcher and try again.": "圖片生成模型的檔案讀不出來。在啟動器裡修復後再試。", +"The image generation service cannot find this task": "圖片生成服務找不到這次任務", +"The image generation service has closed": "圖片生成服務已經關閉", +"The image generation service has not started yet": "圖片生成服務還沒有啟動", +"The image has changed since it was read": "圖片在讀取後已有變更", +"The image is no larger than the video": "圖片已經不比影片大", +"The image is {ow} × {oh} px. Add space on each side:": "畫面 {ow} × {oh} 畫素,在四周補充空間:", +"The image model can be installed on its own": "可只安裝圖片模型", +"The image model download didn't finish. Check your network and try again.": "圖片模型沒有下載完成,請檢查網路後重試。", +"The image model files are in use or cannot be written or deleted. Close programs that may be using them (for example an antivirus scan), check that the model folder can be written to, then try again.": "圖片模型檔案被佔用,或無法寫入/刪除。請關閉可能正在使用它們的程式(例如防毒軟體掃描),確認模型資料夾可以寫入,然後重試。", +"The image model files are incomplete or damaged. Repair them in the launcher.": "圖片模型檔案不完整或已損壞,請在啟動器裡修復。", +"The image model files are incomplete or damaged; repair them in the launcher.": "圖片模型檔案不完整或已損壞,請在啟動器裡修復。", +"The image model files changed during the check; they were kept, so check again.": "圖片模型檔案在檢查期間發生變化,已保留,請重新檢查。", +"The image model is not installed yet": "圖片模型還沒有安裝好", +"The image model operation stopped because of an unexpected error. Export the report, then use \"Report a problem\" and attach it.": "圖片模型操作因意外錯誤停止。請先匯出報告,再點選「提交問題」並附上報告。", +"The image model package version is incompatible; update FreeVideo and try again.": "圖片模型套件版本不相符,請更新 FreeVideo 後重試。", +"The image prompt is empty or too long": "圖片提示詞為空或超過了支援的長度", +"The image queue is full. Wait for the earlier images to finish, then try again.": "等待生成的圖片已滿,請等前面的圖片完成後再試。", +"The image seed is outside the supported range": "圖片的隨機種子超出了支援的範圍", +"The image settings are invalid. Adjust them and try again.": "圖片設定有誤,請調整後重試。", +"The image size is outside the supported range": "圖片尺寸超出了支援的範圍", +"The image size is outside what the chosen model supports. Change the size and try again.": "圖片尺寸超出所選模型支援的範圍。請調整尺寸後重試。", +"The image was cancelled.": "已取消這張圖片。", +"The image was not made": "這張沒有生成出來", +"The images are in {folder}": "圖片在 {folder}", +"The imported offline package ZIPs are still on the drive, and FreeVideo no longer needs them. Deleting them does not affect models, the runtime or your videos.": "匯入過的離線安裝包壓縮檔仍保留在磁碟上,FreeVideo 已不再需要。刪除後,模型、執行環境和作品都不受影響。", +"The installation files are incomplete": "安裝檔案不完整", +"The installation folder's path is too long": "安裝資料夾的路徑太長", +"The installation folder's path is too long. Install FreeVideo in a folder with a shorter path, such as D:\\FreeVideo.": "安裝資料夾的路徑太長。請把 FreeVideo 安裝到路徑較短的資料夾,例如 D:\\FreeVideo。", +"The installation in this folder is not finished. ": "該資料夾中的安裝尚未完成。", +"The installation plan is ready": "安裝計劃已就緒", +"The installed generation component version is not supported": "已安裝的生成元件版本不受支援", +"The int8 version cannot merge the layers this LoRA changes yet. Turn it off or remove it, then generate again.": "int8 版本暫時無法合併此 LoRA 修改的層。請關閉或移除後重新生成。", +"The interface opened another workspace; FreeVideo is in another tab.": "介面開啟了另一個工作區,FreeVideo 在其他分頁中。", +"The language of this part is not supported for dubbing yet.": "這一段的語言暫不支援配音。", +"The largest on this computer is {capped}; that size is used.": "本機最大 {capped},已按最大生成。", +"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 line goes on the Voice track (or on the Dialogue track after separating tracks), which is added if missing. The range runs from the click to the next clip, up to 5 s.": "配音放在「錄⁠音」軌上(分離過音軌時放在「人⁠聲」軌),沒有錄音軌時會自動加上;選區從點選處到下一個片段,最長 5 秒。", +"The lines could not be recognized. Select this part again.": "未能識別台詞。請重新選中這一段再試。", +"The list cannot be read now.": "暫時無法讀取清單。", +"The list is empty": "列表是空的", +"The list is filtered for this GPU, so the whole model repository is not needed. When the download finishes, choose \"Use downloaded folder\"; FreeVideo checks every file before using it.": "清單已按顯示卡篩選,無需下載整個模型儲存庫。下載完成後點一下「使用已下載的資料夾」,FreeVideo 會逐一驗證後使用。", +"The long side is already 2048 px or less": "長邊已經不超過 2048 像素", +"The long video request is not valid. Reload the page and try again; if it happens again, send a report.": "長影片請求無效。請重新整理頁面後重試;如果再次出現,請傳送診斷報告。", +"The mannequin cannot load right now. Reload the page and try again.": "人偶暫時無法載入,請重新整理頁面後重試。", +"The maximum length is unknown for these settings.": "目前設定下無法確定最長時長。", +"The media list cannot be read. Add the media again.": "素材清單無法讀取,請重新新增素材。", +"The media list is full (32 items, including disabled ones). Remove some to add more.": "素材已滿 32 個(含未啟用的),請先移除不用的素材。", +"The media this part uses is missing. Import it again from the library.": "找不到這一段用到的素材,請在素材庫重新匯入。", +"The message changed. Click \"Retry\" to send the original.": "訊息已修改,點一下「重試」傳送原訊息。", +"The model download did not finish.": "模型下載沒有完成。", +"The model download lost its connection. Check the network first.": "模型下載時網路連線中斷。請先檢查網路。", +"The model download sources cannot be reached": "無法連線到模型下載來源", +"The model files FreeVideo does not use are removed, about ": "將刪除 FreeVideo 沒在使用的模型檔案,釋放約 ", +"The model folder is linked to another location, and FreeVideo never deletes through a link.": "模型資料夾被連結到了別的位置,FreeVideo 不會透過連結刪除檔案。", +"The model in use is not a standard FreeVideo model, so nothing was deleted.": "目前使用的模型不是標準安裝的模型,為安全起見沒有刪除任何檔案。", +"The model is not fully installed": "模型沒有裝全", +"The model is not fully installed. ": "模型沒有裝全。", +"The model switch stopped before it finished. Select Retry on the setup page; if it cannot finish, the previous model is restored.": "模型切換未完成。請在安裝頁點選「重試」;無法完成時會恢復原來的模型。", +"The model that reads pictures can read only images": "讀取畫面的模型只能讀取圖片", +"The model that reads pictures has not started yet": "讀取畫面的模型服務還沒有啟動", +"The more parts are joined, the more the joins may change. Where a cut fits, cut to a new shot and start a fresh part.": "段數越多,銜接處越容易出現變化;適合切換鏡頭處,可直接開始新的一段。", +"The most detail, slowest": "細節最多,最慢", +"The music could not be generated. Generate again; if it keeps failing, report the problem.": "無法生成配樂。請重新生成;仍然失敗時,請提交問題。", +"The music model could not be downloaded": "配樂模型未能下載", +"The music model needs about 20 GB of free disk space and a network connection; check both, then try again": "配樂模型需要約 20 GB 磁碟空間和網路連線,確認後再試", +"The name was empty, so it was not changed.": "名稱為空,已保留原名。", +"The network is slow. Downloading again; this may take a while.": "網路較慢,正在重試", +"The network is unavailable, so the Fast level could not be downloaded. Connect to the network and try again.": "網路未連線,無法下載極⁠速⁠檔。請連線網路後重試。", +"The network is unavailable, so the Replace person model could not be downloaded.": "網路不通,無法下載替換人物模型。", +"The network is unavailable; the image model could not be downloaded.": "網路不通,無法下載圖片模型。", +"The new part follows the original and is joined into one video.": "新的一段會接在原影片之後,並自動合併成一段影片。", +"The new version did not start on this Mac, so the previous version was put back. Download the new version from the release page; if it does not start either, use \"Report a problem\".": "新版本在這台 Mac 上未能啟動,已換回原來的版本。請去發布頁下載新版本;如果仍然無法啟動,請點選「提交問題」。", +"The new video keeps the original sound": "新影片沿用原影片的聲音", +"The offline package could not be imported. Choose another folder and import again.": "離線安裝包未能匯入。請換一個資料夾再匯入。", +"The offline package could not be imported: a file disappeared during the import, or the drive was disconnected. Check that the package and the folder are still there, then import again.": "離線安裝包未能匯入:匯入過程中有檔案不見了,或磁碟已中斷連線。請確認離線安裝包和資料夾都還在,再匯入。", +"The offline package could not be imported: a file is in use by another program. Close programs that may be using the folder (for example an antivirus scan), then import again.": "離線安裝包未能匯入:有檔案被其他程式佔用。請關閉可能正在使用該資料夾的程式(例如防毒軟體掃描),再匯入。", +"The offline package could not be imported: reading it failed, so the file or the drive may be damaged. Download the package again or copy it to another drive, then import again.": "離線安裝包未能匯入:讀取時出錯,檔案或磁碟可能已損壞。請重新下載離線安裝包,或複製到其他磁碟後再匯入。", +"The offline package could not be imported: the drive is full. Free up space or choose a folder on another drive, then import again.": "離線安裝包未能匯入:磁碟空間不足。請騰出空間或換一個磁碟上的資料夾,再匯入。", +"The offline package could not be imported: the path of the chosen folder is too long to save some of the files. Choose a folder with a shorter path%s and import again.": "離線安裝包未能匯入:所選資料夾的路徑太長,部分檔案無法儲存。請換一個路徑更短的資料夾再匯入%s。", +"The offline package could not be imported: this account cannot write to the chosen folder. Choose another folder and import again.": "離線安裝包未能匯入:目前帳戶沒有所選資料夾的寫入權限。請換一個資料夾再匯入。", +"The offline package was not imported": "離線安裝包未能匯入", +"The old model could not be removed.": "舊模型未能刪除。", +"The old model is no longer used; about {size} can be freed.": "舊模型已不再使用,刪除可釋放約 {size}。", +"The old model is still on disk": "舊模型還佔著磁碟空間", +"The old model was not removed": "舊模型沒有刪除", +"The old model was removed": "舊模型已刪除", +"The oldest goes first when it is full": "滿了先刪最久沒用的", +"The optional model download paused. Retry to resume.": "可選模型下載已暫停,重試可繼續下載。", +"The original image is locked. Click another layer to move it.": "原圖圖層已鎖定;點選其他圖層可移動。", +"The other side follows the chosen shape": "改一邊,另一邊按比例跟著變", +"The outline and staging of a short drama": "短劇的大綱和站位", +"The output folder cannot be accessed.": "無法存取輸出資料夾", +"The output folder cannot be read. Check that its disk is connected, then try again.": "無法讀取輸出資料夾,請確認磁碟已連接後重試。", +"The output folder cannot be written to": "輸出目錄不可寫", +"The output folder cannot be written to, so the video was not saved. Check that the folder can be written to, then retry.": "輸出目錄不可寫,影片沒能儲存。請檢查這個資料夾的寫入權限後重試。", +"The page did not finish loading. Reload and try again.": "頁面沒有載入完成,請重新整理後再試。", +"The page session is no longer valid": "頁面會話已失效", +"The part before did not finish, so this one did not start.": "上一段沒有完成,這一段沒有開始。", +"The part length is longer than one run allows at this size. Set a shorter part length.": "每段時長超過目前畫面大小的單次上限,請縮短。", +"The part length is too short. Set a longer part length.": "每段時長過短,請加長。", +"The part-by-part generation service has not started yet": "分段生成服務還沒有啟動", +"The parts could not be joined into one video. Try again; if it fails again, send a report.": "各段沒能接合成一個影片。請重試;如果再次失敗,請傳送診斷報告。", +"The parts were generated, but joining them into one video failed": "片段已生成,但拼接成片時出錯", +"The performance measurement stopped because the computer ran out of available memory. Close memory-heavy programs, then start measuring again under Performance measurement in Advanced.": "效能測量因電腦可用記憶體不足而停止。請關閉佔用記憶體較多的程式,再到「進階」中的「效能測量」重新開始測量。", +"The picture could not be read": "沒能讀出畫面", +"The picture has the length of the selected range.": "畫面時長以所選的一段為準。", +"The picture track is cut where each shot starts. Each part shows the shot number at its top left and the shot's note along its bottom.": "畫面軌在每個鏡頭的起點切開;每一段左上角是鏡頭編號,底部是該鏡頭的說明。", +"The pictures are matched to the people in the video from left to right: image 1 replaces the person on the left, image 2 the person on the right.": "人物圖按畫面中人物從左到右的順序對應:人物圖 1 替換左邊的人,人物圖 2 替換右邊的人。", +"The ports for LAN access and the ports after them are in use or reserved by the system. Close the programs using these ports, then turn on LAN access again.": "區域網路存取要用的連接埠和後面的連接埠都已被佔用或被系統保留。請關閉佔用這些連接埠的程式,再重新開啟區域網路存取。", +"The ports for phone access are in use or reserved by the system.": "手機連線所需的連接埠已被佔用或被系統保留。", +"The preset also fills in the prompt": "應用預設時也填入提示詞", +"The preview can be set to loop in FreeVideo Settings on the computer.": "預覽可在電腦上的 FreeVideo 設定中改為循環播放。", +"The preview can be set to loop in Settings.": "預覽可在設定中改為循環播放。", +"The previous FreeVideo did not close within 10 minutes. Quit FreeVideo completely, then update again.": "舊版 FreeVideo 在 10 分鐘內未結束。請完全結束 FreeVideo 後再更新。", +"The previous model's files are all kept. Select \"Retry\" on the setup page to restore it.": "原來的模型檔案都還在,在安裝頁點一下「重試」可恢復。", +"The previous video cannot be read": "無法讀取上一段影片", +"The previous video cannot be read.": "接續的上一段影片無法讀取", +"The previous video is too short": "上一段影片太短", +"The previous video is too short to extend; it needs to be at least 1.7 s long.": "接續的上一段影片太短,至少需要 1.7 秒", +"The previous video lacks the data needed to extend it. Generate it again with this version of FreeVideo.": "上一段影片缺少可用的接續資料", +"The previous video needed to extend it is no longer available": "接續所需的上一段影片已經不在", +"The previous video's frame rate is too low": "上一段影片影格速率太低", +"The previous video's frame rate is too low to extend; it needs at least 10 frames per second.": "接續的上一段影片影格速率太低,每秒至少需要 10 影格", +"The process could not close. Restart FreeVideo before generating.": "生成提示詞的程序未能結束,請重新啟動 FreeVideo 後再生成。", +"The project has changed since it was read": "專案在讀取後已有變更", +"The prompt and character prompts have {number} characters; enhancement supports up to 12,000. Shorten it or use the original.": "提示詞連同角色提示詞共 {number} 字元,增強最多支援 12,000 字元,請精簡或使用原文。", +"The prompt and character prompts have {number} characters; rewriting supports up to 12,000. Shorten it before rewriting again.": "提示詞連同角色提示詞共 {number} 字元,改寫最多支援 12,000 字元,精簡後可再改寫。", +"The prompt and reference images are too long": "提示詞和參考圖太長", +"The prompt can stay empty or describe more of the picture. Then choose \"Generate video\".": "描述可以留空,也可以補充畫面要求;然後點一下「生⁠成⁠影⁠片」。", +"The prompt cannot be rewritten while the queue is running.": "佇列未完成時不能改寫。", +"The prompt has only image references and no words. Describe the image you want, then try again.": "提示詞裡只有圖片引用,沒有文字。請寫上要生成的畫面後重試。", +"The prompt has {number} characters; enhancement supports up to 12,000. Shorten it or use the original.": "提示詞共 {number} 字元,增強最多支援 12,000 字元,請精簡或使用原文。", +"The prompt has {number} characters; rewriting supports up to 12,000. Shorten it before rewriting again.": "提示詞共 {number} 字元,改寫最多支援 12,000 字元,精簡後可再改寫。", +"The prompt is empty, or longer than 2,000 characters once the image references are counted. Shorten it and try again.": "提示詞為空,或加上圖片引用後超過 2000 字。請縮短提示詞後重試。", +"The prompt is empty.": "提示詞為空。", +"The prompt is in. Press Ctrl+Enter to generate.": "提示詞已填入,按 Ctrl+回車 生成。", +"The prompt is over 2,000 characters. Shorten it by {count} and try again.": "提示詞超過 2000 字。請縮短 {count} 字後重試。", +"The prompt is split across the parts by sentence.": "提示詞按句子順序分到各段", +"The prompt is too long. Shorten it to %d characters or fewer.": "提示詞過長,請縮短到 %d 字以內。", +"The prompt model file differs from the tested one, so results and speed may differ.": "提示詞模型檔案和測試過的版本不同,效果和速度可能不一樣。", +"The prompt model is not installed, so the prompt will be split across the parts by sentence.": "未安裝提示詞模型,提示詞將按句子順序分到各段。", +"The prompt or references changed. Rewrite again to use the current scene.": "原文或素材已更改,可按目前內容重新改寫。", +"The queue may have changed.": "佇列狀態可能已變化。", +"The queue operation did not complete": "佇列操作未完成", +"The rain seems to be letting up.": "雨好像小了。", +"The recommended size": "推薦尺寸", +"The recording track is locked.": "錄音軌已鎖定。", +"The redo did not start": "沒有重新開始生成", +"The reference audio is longer than the output, so only its first {seconds} s is used.": "參考音訊比生成的影片長,只使用了前 {seconds} 秒。", +"The reference audio is longer than the output, so only the first {seconds} s of each is used.": "參考音訊比生成的影片長,只使用了每段的前 {seconds} 秒。", +"The reference media are longer than the output, so only its first {seconds} s is used.": "參考素材比生成的影片長,只使用了前 {seconds} 秒。", +"The reference media are longer than the output, so only the first {seconds} s of each is used.": "參考素材比生成的影片長,只使用了每段的前 {seconds} 秒。", +"The reference media could not be read": "參考素材無法讀取", +"The reference slots are full; remove one": "參考圖已滿,先移除一張", +"The reference video cannot be read": "無法讀取參考影片", +"The reference video changed": "參考影片在轉換時被修改", +"The reference video could not be converted": "參考影片未能轉換", +"The reference video file changed while FreeVideo was converting it.": "轉換參考影片的過程中,這個檔案被修改了。", +"The reference video is longer than the output, so only its first {seconds} s is used.": "參考影片比生成的影片長,只使用了前 {seconds} 秒。", +"The reference video is too short": "參考影片太短", +"The reference video is too short; it needs to be at least about 1 s long.": "參考影片太短,至少需要約 1 秒", +"The reference videos are longer than the output, so only the first {seconds} s of each is used.": "參考影片比生成的影片長,只使用了每段的前 {seconds} 秒。", +"The reply could not be read": "回覆讀不出來", +"The reply was incomplete. Try again.": "回覆不完整,請重試。", +"The report could not be saved. Choose another folder, or use \"Copy details\" and paste them into the issue.": "報告未能儲存。請換一個資料夾,或改用「複製詳情」,把內容貼到問題裡。", +"The report is large, so it was saved as {savedName}. Please drag it into \"Diagnostic report\", then select Submit new issue.": "報告較大,已儲存為 {savedName}。請將它拖入「診斷報告」,再點選 Submit new issue。", +"The report is unavailable. Try again.": "報告暫不可用,請重試。", +"The request exceeds available memory": "目前任務的可用記憶體不足", +"The required files have changed. Choose \"Check again\", then export the download list.": "所需檔案有變化。請點一下「重新檢查」,再匯出下載清單。", +"The result could not be read or saved": "生成的結果無法讀取或儲存", +"The result was incomplete. Try again.": "結果不完整,請重試。", +"The rewrite failed.": "改寫失敗。", +"The rewrite failed: {reason}.": "改寫失敗,原因:{reason}。", +"The rewrite model needs about {size} GiB of available RAM to load.": "改寫模型載入需約 {size} GiB 可用記憶體。", +"The rewrite process could not close. Restart FreeVideo before generating.": "改寫處理程序未能結束,請重新啟動 FreeVideo 後再生成。", +"The rewrite was incomplete.": "改寫結果不完整。", +"The rewrite was incomplete. Retry or use the original.": "改寫結果不完整,請重試或使用原文。", +"The rewrite was incomplete: {reason}.": "改寫結果不完整:{reason}。", +"The rewrite was incomplete: {reason}. Retry or use the original.": "改寫結果不完整:{reason}。請重試或使用原文。", +"The runner reaches the top of the hill, stops, and looks out over the valley as the sun comes up.": "跑步的人登上山頂,停下腳步,望著山谷中升起的太陽。", +"The same character stays consistent across scenes.": "換了場景,角色仍是同一個。", +"The same part limits apply. An NVIDIA graphics card or a Mac is required.": "段數限制相同;需要 NVIDIA 顯示卡或 Mac。", +"The same size as now.": "和現在一樣大。", +"The saved ComfyUI folder could not be opened. It may have been moved or renamed, or its drive may be disconnected. Choose its current location below, or choose New installation.": "無法開啟已儲存的 ComfyUI 資料夾,它可能已被移動、改名,或所在磁碟未連接。請在下方選擇它現在的位置,或選擇「全新安裝」。", +"The saved picture is the same as this moment of the exported video.": "儲存的圖片與匯出影片中這一刻的畫面相同。", +"The saved setting was damaged, so Automatic optimization is in use. The original file was renamed and kept.": "儲存的設定已損壞,現按「自動最佳化」執行,原檔案已改名保留。", +"The scene is too long for the rewrite model.": "內容超出改寫模型容量。", +"The scene is too long for this model. Shorten it or use the original.": "內容超出改寫模型容量,請精簡或使用原文。", +"The screenplay contains invalid content": "劇本中有不符合要求的內容", +"The script \"{script}\" in the browser extension \"{extension}\" interfered with this page, so this action did not finish.": "瀏覽器擴充功能「{extension}」裡的指令碼「{script}」干擾了頁面,這次操作沒有完成。", +"The seed is not valid. Clear it or use a smaller whole number, then try again.": "隨機種子無效。請清空種子或改用較小的整數後重試。", +"The selected audio is longer than this part. Make the part longer or select less audio.": "所選音訊比這一段長,請把這一段拉長,或少選一些音訊。", +"The selected audio is too short. Select at least 2 seconds.": "所選音訊太短,請至少選 2 秒。", +"The selected range is outside the audio. Select it again.": "所選範圍超出了這段音訊,請重新選擇。", +"The separation model could not be downloaded. Check the network and try again.": "分離模型下載失敗,請檢查網路後重試。", +"The server port cannot be used": "服務連接埠無法使用", +"The server port is in use": "服務連接埠被佔用", +"The server port is not valid.": "服務連接埠無效。", +"The service stopped during submission, so it is not confirmed whether the task started": "提交生成時服務中斷,尚未確認任務是否開始", +"The setting could not be read: ": "無法讀取設定:", +"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 settings, GPU or free disk space changed after you confirmed.": "確認之後設定、顯示卡或磁碟空間有變化。", +"The shape is \"Match image\" unless you choose another. Then choose \"Generate\".": "比例預設為「跟隨圖片」,也可以改選其他比例;然後點一下「生成」。", +"The shape list beside it starts at the current canvas shape. When the canvas is not one of the usual shapes, its size is listed first.": "旁邊的比例清單預設是目前畫布的比例;畫布不是常用比例時,第一項顯示它的尺寸。", +"The share video could not be exported: ": "分享影片匯出未完成:", +"The short film settings are invalid": "短劇設定有誤", +"The size comes from a connected node, so the Fast level is checked when you generate.": "寬高來自連線的節點,生成時再確認極⁠速⁠檔能否生成。", +"The sketch canvas cannot open right now.": "草圖畫布暫時打不開。", +"The slowest is 0.25×; set to 0.25×.": "最慢 0.25×,已設為 0.25×。", +"The sneaker in {image1} follows the motion and camera of {video1}: it tilts and turns slowly on a clean studio tabletop, soft light sweeping across the upper, sharp detail on the stitching and sole.": "{image1} 中的運動鞋沿用 {video1} 的動作和鏡頭:在乾淨的攝影檯面上緩緩傾斜、轉動,柔和的光掃過鞋面,縫線和鞋底清晰銳利。", +"The sound could not be separated. Try again; if it keeps failing, report the problem.": "聲音分離失敗。請重試;仍然失敗時,請提交問題。", +"The sound in a clip cannot be read.": "有素材的聲音無法讀取。", +"The sound separation model could not be downloaded": "聲音分離模型未能下載", +"The source is no longer in the creations": "來源作品已不在作品裡", +"The source task has no finished video yet": "來源任務還沒有生成完成的影片", +"The source video must be at least 1 second long.": "來源影片至少需要 1 秒。", +"The source video must be at least 1 second long. A source video without sound has no sound to keep.": "來源影片至少 1 秒;來源影片沒有聲音時,不能保留聲音。", +"The source video sound could not be kept. The video uses generated sound.": "未能保留來源影片聲音,成片使用生成的聲音。", +"The speech model could not be downloaded. Check the connection and try again.": "語音模型沒能下載。請檢查網路後再試一次。", +"The speech model could not be used, so the lines could not be recognized.": "語音識別模型無法使用,未能識別台詞。", +"The speech model could not be used, so the voice could not be generated.": "語音識別模型無法使用,未能生成旁白。", +"The speech recognition model does not support the language of this sound": "語音識別模型不支援這段聲音的語言", +"The speed test could not reach any download source. Check the network or proxy, then click \"Test speed\" again.": "測速無法連線到任何下載來源。請檢查網路或代理,再點選「測速」。", +"The speed test did not finish. Click \"Test again\".": "測速沒有完成,請點一下「重新測速」。", +"The speed test did not finish. Click \"Test speed\" again.": "測速未完成,請再點選「測速」。", +"The speed test timed out. The network may be slow; click \"Test speed\" again.": "測速逾時,網路可能較慢。請再點選「測速」。", +"The subtitles heard replaced the ones there.": "識別出的字幕已替換原有字幕。", +"The switch needs more files than were downloaded; check again.": "切換還需要未下載的檔案,請重新檢查。", +"The switch to the faster model did not finish.": "切換到更快的模型沒有完成。", +"The system closed FreeVideo, most likely because the computer ran out of memory. FreeVideo has restarted.": "FreeVideo 被系統關閉,很可能是因為電腦記憶體不足。FreeVideo 已重新啟動。", +"The system ended FreeVideo, possibly because the computer ran out of memory. FreeVideo has restarted.": "FreeVideo 被系統結束,可能是因為電腦記憶體不足。FreeVideo 已重新啟動。", +"The system or another program ended FreeVideo. It has restarted.": "FreeVideo 被系統或其他程式結束,已重新啟動。", +"The task could not be submitted": "任務提交失敗", +"The task may already have been accepted.": "任務可能已被接收。", +"The task record or media could not be written to disk": "任務記錄或素材無法寫入磁碟", +"The text encoder is not fully installed": "文本編碼器沒有裝全", +"The time \"{time}\" on line {line} is not valid. Write it as minutes:seconds, for example 0:05.": "第 {line} 行的時間「{time}」無法辨識,請按「分:秒」書寫,例如 0:05。", +"The timeline has no clip with sound yet. Import or generate one first.": "時間軸上還沒有帶聲音的片段,請先匯入或生成一段。", +"The timeline is empty": "時間軸是空的", +"The timeline is empty. Add a clip first.": "時間軸是空的,請先放入素材。", +"The timeline is empty; add a clip first": "時間軸是空的,先放入素材", +"The tracks for the separated sound are not free here.": "這裡沒有空閒的分軌位置。", +"The traveler steps into the market square. Lanterns glow above the stalls.": "旅人走進集市廣場,攤位上方燈籠亮著。", +"The two videos have different aspect ratios": "兩段影片的畫面比例不同", +"The two videos keep the same time": "兩段影片保持同一時間", +"The undo time has passed.": "已超過復原時限。", +"The update could not be installed. You can keep using the current version.": "無法安裝更新。目前版本可以照常使用。", +"The update did not finish": "這次更新沒有完成", +"The update installs as soon as the current video finishes.": "目前影片生成完成後會自動更新。", +"The update is installed. Click Connect again after the job finishes to restart FreeVideo with it.": "更新已裝好。等目前任務完成後點一下「重新連線」,FreeVideo 會重新啟動並使用新版。", +"The update service could not be reached.": "無法連線到更新服務。", +"The update service is busy.": "更新服務繁忙。", +"The update stopped because of an error in FreeVideo. If it happens again, use \"Report a problem\".": "更新因 FreeVideo 自身的錯誤而中斷。如果再次出現,請點選「提交問題」。", +"The update will start after the current task finishes.": "目前任務完成後會自動更新", +"The upgrade stopped": "升級未完成", +"The upload did not finish. Try again.": "上傳沒有完成,請再試一次。", +"The upload stopped: the disk is full. Free some space, then try again.": "上傳中斷:磁碟空間不足,請清理出空間後重試。", +"The upload stopped: the input folder cannot be written to. Check its write permission, then try again.": "上傳中斷:輸入資料夾無法寫入,請檢查它的寫入權限後重試。", +"The upscale is queued and appears in Creations as a new creation when done.": "放大任務加入佇列,完成後作為新作品出現在作品庫中。", +"The upscale model could not be downloaded": "放大模型未能下載", +"The upscaled video keeps the original sound.": "放大後保留影片原有的聲音。", +"The upscaled video needs about {megabytes} MB on the drive of the output folder.": "放大後的影片需要輸出資料夾所在磁碟約 {megabytes} MB 空間。", +"The upscaled video needs more space on the drive of the output folder.": "放大後的影片需要輸出資料夾所在磁碟更多空間。", +"The video and its files will be deleted.": "影片和相關檔案都會刪除。", +"The video could not be saved.": "影片沒能儲存。", +"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 file is missing or cannot be read.": "找不到這個影片檔案,或檔案無法讀取。", +"The video is too short": "影片時長太短", +"The video is too short. Set a longer duration.": "影片時長過短,請加長時長。", +"The video must be at least 1.625 s long.": "影片時長不能短於 1.625 秒。", +"The video must be at least {seconds} seconds long. Set a longer duration.": "影片時長至少為 {seconds} 秒,請加長時長。", +"The video starts from this image": "影片從這張圖開始", +"The voice could not be generated. Generate again; if it keeps failing, report the problem.": "無法生成旁白。請重新生成;仍然失敗時,請提交問題。", +"The white model could not be made. Try again.": "白模沒有做成。請重試。", +"The white model could not be made: ": "白模沒有做成:", +"The white model could not be made: rendering did not finish within 3 minutes. Try again.": "白模沒有做成:渲染三分鐘內沒有完成。請重試。", +"The white model could not be made: rendering did not start within 3 minutes. Try again.": "白模沒有做成:三分鐘內渲染沒有開始。請重試。", +"The white model could not be made: the renderer is not running in this page. Reload the page and try again.": "白模沒有做成:這個頁面裡的渲染沒有執行。請重新整理頁面後重試。", +"The width and height typed last": "上次輸入的寬和高", +"The words in the layout are too long. Shorten the lines in the boxes, then generate again.": "佈局裡的文字太長。請把框裡的話寫短一些,再生成。", +"The workflow behind the views": "各檢視背後的工作流程", +"The {level} quality level is not downloaded yet": "「⁠{level}⁠」⁠等級尚未下載", +"The {system} environment is prepared automatically. Import model packages in the next step.": "{system} 執行環境由安裝器自動準備,請在下一步匯入模型包。", +"Theme": "主題", +"Then pick a sound in the library or drop one here": "然後在素材庫裡選一段聲音,或拖到這裡", +"Then press Save": "輸入後點儲存", +"There are more reference images than supported": "參考圖片數量超過了支援的範圍", +"There are more reference images than the chosen model supports. Remove some and try again.": "參考圖超過所選模型支援的數量。請減少參考圖後重試。", +"There are more than 32 references; remove some before generating.": "參考素材超過 32 個,可移除部分後再生成。", +"There is no free sound track here": "這裡沒有空閒的音軌", +"There is no gap that can close": "沒有可以收攏的空隙", +"There is no installation information yet. Complete installation first.": "還沒有安裝資訊,請先完成安裝", +"There is no picture at this position. Move the playhead onto a clip.": "這個位置沒有畫面,請把播放頭移到片段上。", +"There is no picture to save yet": "還沒有可以儲存的畫面", +"There is no unfinished task to cancel": "沒有可以取消的未完成任務", +"There is not enough disk space to download the update.": "磁碟空間不足,無法下載更新。", +"There is not enough disk space. The dubbing model needs about {size}.": "磁碟空間不足,配音模型需要約 {size}。", +"There is not enough free disk space for the model files. Free some space first.": "磁碟可用空間不足,放不下模型檔案。請先騰出空間。", +"There is not enough free graphics or system memory for this generation": "可用顯示卡記憶體或記憶體不足,無法生成這段內容", +"There is not enough free graphics or system memory for this image": "可用顯示卡記憶體或記憶體不足,無法生成這張圖片", +"There is not enough free memory to continue installing": "可用記憶體不足,無法繼續安裝", +"There must be a clip under the playhead. A part that is still being generated can be saved once it is done.": "播放頭下方須有片段;正在生成的一段完成後才能儲存。", +"These creations cannot be downloaded.": "這些作品無法下載。", +"These creations cannot be read.": "無法讀取這些作品。", +"These files are downloaded or reused. Closing Settings does not stop the installation.": "將下載或重複使用以下檔案。關閉設定不會中斷安裝。", +"These settings cannot generate in parts.": "目前設定不能分段生成。", +"These settings need more memory than the device can provide.": "這組設定需要的記憶體超過裝置上限。", +"They can be brought back for 10 seconds.": "10 秒內可以復原。", +"Thick": "粗", +"Thinking": "正在思考", +"Third-party download": "第三方下載", +"Third-party notices": "第三方元件說明", +"This Environment ZIP is for Windows": "這個執行環境包只能用於 Windows", +"This GPU is not supported": "這張顯示卡不受支援", +"This LoRA cannot be used": "此 LoRA 無法使用", +"This LoRA cannot be used for images.": "此 LoRA 不適用於圖片生成。", +"This LoRA cannot be used for images. Choose another one.": "此 LoRA 不適用於圖片生成,請換一個。", +"This LoRA is not made for the FreeVideo model. Turn it off or remove it, then generate again.": "此 LoRA 不適用於 FreeVideo 的模型。請關閉或移除後重新生成。", +"This LoRA stores one alpha value, but its layers have different ranks, so the scale of each layer cannot be determined. Turn it off or remove it, then generate again, or use a version that stores an alpha for every layer.": "此 LoRA 只記錄了一個 alpha 值,而各層的 rank 不同,無法確定每層的縮放比例。請關閉或移除後重新生成,或換用每層都記錄了 alpha 的版本。", +"This Mac can read the disk but not write to it, as with NTFS disks. Choose a folder on another disk.": "這顆硬碟只能讀取、不能寫入,請選擇其他硬碟上的資料夾。", +"This Mac does not have enough free memory right now to start this generation.": "這台 Mac 目前可用的記憶體不足以開始這次生成。", +"This Mac has less than 16 GB of memory and cannot generate images.": "這台 Mac 的記憶體不足 16 GB,無法生成圖片。", +"This Mac has {free} GiB of {total} GiB memory available. A generation needs at least {needed} GiB to start.": "這台 Mac 共 {total} GiB 記憶體,目前可用 {free} GiB,開始生成至少需要 {needed} GiB。", +"This action came from a different web address and was refused": "這次操作來自其他網址,已被拒絕", +"This action changes a locked layer": "這次操作要修改已鎖定的圖層", +"This action conflicts with the current state of the task": "這項操作與任務的目前狀態衝突", +"This action is available only on the computer running FreeVideo": "這項操作只能在執行 FreeVideo 的電腦上進行", +"This action needs approval first": "這項操作需要先確認", +"This action needs the FreeVideo page open in a browser": "這項操作需要在瀏覽器中開啟 FreeVideo 頁面", +"This action was declined": "這項操作已被拒絕", +"This action would overlap clips that cannot move": "這次操作會與不能移動的片段重疊", +"This aspect ratio and resolution are out of range. Use a custom width and height.": "這個比例和清晰度超出範圍,請改用自訂寬高。", +"This audio could not be used as is.": "無法原樣使用這段音訊。", +"This audio is longer than 2 hours. Use an audio file of 2 hours or less.": "這段音訊超過 2 小時,請換一段 2 小時以內的音訊。", +"This audio is longer than 30 seconds. Generate it in the Create view, or use an audio file of 30 seconds or less.": "這段音訊超過 30 秒,請到創作面板裡生成,或換一段 30 秒以內的音訊。", +"This audio needs the faster second pass": "這段音訊需要第二階段加速", +"This box cannot be changed": "這個框不能修改", +"This browser cannot run FreeVideo. Open the same address in a current Chrome or Edge.": "目前瀏覽器無法執行 FreeVideo。請用最新版 Chrome 或 Edge 開啟同一個網址。", +"This chat has reached its message limit": "這個對話的訊息已達到上限", +"This chat is full. Click \"New chat\".": "這個對話已滿,請點一下「新對話」。", +"This chat is still loading": "這段對話還在讀取", +"This chat still has work in progress, so it was not deleted.": "這段對話裡還有在生成的內容,沒有刪除。", +"This clip cannot be played.": "這段素材無法播放。", +"This clip has no earlier version": "這一段還沒有更早的版本", +"This clip has no sound of its own": "這一段沒有自帶的聲音", +"This clip has no sound. Please choose one with sound.": "這個素材沒有聲音,請選一段有聲音的。", +"This clip is locked.": "這個片段已鎖定。", +"This clip is still being made.": "這個片段還在生成。", +"This clip is still being prepared. Try again in a moment.": "素材還在處理,請稍後再試。", +"This computer": "本機", +"This computer can make {sizes} right now. Change the duration or resolution and generate again; closing other programs that use the GPU also frees memory.": "現在可以生成:{sizes}。請調整時長或解析度後重新生成;關閉其他佔用顯示卡的程式也可以騰出顯示卡記憶體。", +"This computer can't extend a video": "這台電腦無法接續影片", +"This computer does not have enough graphics memory for the Fast level at {seconds} s.": "這台電腦的顯示卡記憶體不足以用極⁠速⁠檔生成 {seconds} 秒影片。", +"This computer does not have enough graphics memory for the Fast or Light level at this size. Use a smaller size, then generate again.": "這台電腦的顯示卡記憶體不足以用極⁠速⁠檔或輕⁠量⁠檔生成這個尺寸的影片。請縮小尺寸後重新生成。", +"This computer does not have enough graphics memory or memory for the Fast level at {seconds} s.": "這台電腦的顯示卡記憶體或記憶體不足以用極⁠速⁠檔生成 {seconds} 秒影片。", +"This computer does not have enough graphics memory or memory for the Fast or Light level at this size. Use a smaller size, then generate again.": "這台電腦的顯示卡記憶體或記憶體不足以用極⁠速⁠檔或輕⁠量⁠檔生成這個尺寸的影片。請縮小尺寸後重新生成。", +"This computer does not have enough memory for the Fast level at {seconds} s.": "這台電腦的記憶體不足以用極⁠速⁠檔生成 {seconds} 秒影片。", +"This computer does not have enough memory for the Fast or Light level at this size. Use a smaller size, then generate again.": "這台電腦的記憶體不足以用極⁠速⁠檔或輕⁠量⁠檔生成這個尺寸的影片。請縮小尺寸後重新生成。", +"This computer does not support the chosen image model": "這台電腦不支援所選的圖片模型", +"This computer does not support the chosen image model. Use Qwen-Image 2.1.": "這台電腦不支援所選的圖片模型。請改用 Qwen-Image 2.1。", +"This computer needs no compatibility level": "這台電腦不需要相容等級", +"This device cannot make longer videos in parts.": "此裝置不支援分段生成長影片。", +"This disk cannot hold the FreeVideo environment": "這顆硬碟裝不了 FreeVideo 的執行環境", +"This disk cannot hold the models": "這顆硬碟放不下模型", +"This disk is read-only": "這顆硬碟是唯讀的", +"This disk uses exFAT, so %s of models had to be copied instead of shared with your model library.": "這顆硬碟是 exFAT 格式,有 %s 的模型只能複製,不能和模型庫共用。", +"This edit changed elsewhere. Your changes here were saved as a copy.": "這條剪輯在別處改過,這裡的變更已存為副本", +"This edit is open in another window. Close it there first.": "這個剪輯在另一個視窗中開啟,請先在那裡關閉。", +"This edit is still generating. You can delete it when it finishes.": "正在生成,完成後才能刪除。", +"This example is not available yet.": "這個範例暫時不能用", +"This file cannot be opened. Supported formats: ": "這個檔案打不開。支援的格式:", +"This file is empty. Choose another file.": "這個檔案是空的,請換一個檔案。", +"This file is over 2 GiB. Trim or compress it, then try again.": "檔案超過 2 GiB,請先剪短或壓縮後再上傳。", +"This file is over 8 GiB. Trim or compress it, then try again.": "檔案超過 8 GiB,請先剪短或壓縮後再匯入。", +"This file name cannot be used. Rename the file and try again.": "這個檔名不能使用,請改名後再試。", +"This folder cannot be written to. Choose another folder.": "該資料夾無法寫入,請換一個位置儲存。", +"This folder has no finished FreeVideo installation. ": "該資料夾中沒有已安裝的 FreeVideo。", +"This folder holds an offline installation": "這個位置是離線安裝包安裝", +"This font is missing {chars}. Choose another font.": "這款字型缺少:{chars},請換一種字型。", +"This format cannot be used as is. Try a WAV, FLAC or M4A file.": "這個格式不能原樣使用,請換成 WAV、FLAC 或 M4A 檔案。", +"This frees %s of disk space. If the files are needed later, they will be downloaded again automatically.": "可釋放 %s 磁碟空間。以後如需要,會自動重新下載。", +"This generation exceeded the configured memory limit.": "本次生成超過了設定的記憶體上限。", +"This image can no longer be read. It may have been moved or deleted.": "這張圖片已無法讀取,可能已被移動或刪除。", +"This image cannot be read or is larger than 4096×4096 pixels. Choose another image.": "這張圖片讀不出來,或超過 4096×4096 畫素。請換一張圖片。", +"This image could not be deleted.": "這張圖片無法刪除。", +"This image could not be opened for editing. Choose another image.": "這張圖片無法開啟編輯。請重新選擇一張。", +"This image could not be read. Choose another image.": "這張圖無法讀取。請重新選擇一張。", +"This image is still used by a creation or workflow, so it was kept.": "這張圖片仍被作品或工作流程使用,已保留。", +"This image kept no prompt": "這張圖片沒有儲存提示詞", +"This image kept no prompt.": "這張圖片沒有儲存提示詞。", +"This image took too long and was stopped.": "本次生成用時過長,已停止。", +"This image took too long and was stopped. Try again.": "這一張用時太長,已停止。請再試一次。", +"This image will not be kept.": "這張圖不會保留。", +"This installation has not checked the GPU yet. ": "該安裝尚未檢查顯示卡。", +"This installation is missing its runtime. ": "該安裝缺少執行環境。", +"This installation needs about {size}.\n": "這次安裝需要約 {size}。\n", +"This installation was moved from another folder. ": "該安裝是從其他資料夾移動過來的。", +"This is not a FreeVideo offline package": "這不是 FreeVideo 離線安裝包", +"This is the first image": "已經是第一張", +"This is the first installation of the native runtime for this computer, so the runtime components are downloaded again \\(about (.+)\\)\\.": "首次安裝適用於這台電腦的原生執行環境,需要重新下載執行元件(約 \\1)。", +"This is the first installation of the native runtime for this computer, so the runtime components are downloaded again\\.": "首次安裝適用於這台電腦的原生執行環境,需要重新下載執行元件。", +"This is the last image": "已經是最後一張", +"This item is not available here. Follow the steps above.": "目前介面中找不到這一項,請按上面的步驟操作。", +"This launcher already includes engine ": "啟動器已帶有新版引擎 ", +"This layer is locked. Choose another layer, or duplicate it first.": "這一層已鎖定,請選擇其他圖層,或複製後再改。", +"This length is beyond a single run.": "這個長度超出了單次能生成的範圍。", +"This level needs a download (about {size}) that did not finish this time. Generate again when online and it downloads automatically.": "這個等級需要先下載(約 {size}),這次未能完成下載。連上網路後再生成一次,會自動下載。", +"This location cannot be used": "無法使用這個位置", +"This long video is busy with another action. Wait until it finishes, then try again.": "這個長影片正在進行另一項操作。請等它完成後再試。", +"This long video was not found. Reload the page to see the current list.": "找不到這個長影片。請重新整理頁面查看目前清單。", +"This message is being sent": "這條訊息正在傳送", +"This message is too long; shorten it or send it in two parts": "這條訊息太長,請縮短或分成兩條傳送", +"This model needs about {size} GiB of available RAM to load. You can keep using the original.": "此模型載入需約 {size} GiB 可用記憶體,可先使用原文生成。", +"This model needs an NVIDIA graphics card, which this computer does not have. Choose another model": "這個模型需要 NVIDIA 顯示卡,這台電腦沒有。請選別的模型", +"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 changed during dubbing, so the new voice was not placed. Redub it.": "這一段在配音期間有變更,新聲未放入。請重新配音。", +"This part could not be generated. Continue from this part; if it fails again, send a report.": "這一段沒能生成。請從這段繼續;如果再次失敗,請傳送診斷報告。", +"This part has no audio": "這一段沒有聲音", +"This part has no earlier take": "這一段沒有更早的版本", +"This part has no video": "這一段沒有畫面", +"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 generating; Cancel stops it": "這一段正在生成,可按「取消」停止", +"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 part is still generating": "這一段還在生成", +"This part was changed by hand": "這部分內容已被手動修改", +"This port and the next ones are in use or reserved by the system. Change the server address in Settings, then start again.": "這個連接埠和後面的連接埠都已被佔用或被系統保留。請在設定裡換一個服務位址,再重新啟動。", +"This redo was already submitted with the earlier settings.": "這次重新生成已按之前的設定提交過。", +"This redo was already submitted with the earlier settings. Check the queue first. If you still want the current settings, choose \"Redo from here\" again.": "這次重新生成已按之前的設定提交過。請先檢視佇列;仍需要按現在的設定生成時,再點一次「從這段重新生成」。", +"This request was abandoned": "這次請求已被放棄", +"This run used the low-memory mode, so it was slower. A lower resolution or a shorter video is faster.": "這次用了省顯示卡記憶體方式,所以較慢。降低解析度或縮短時長會更快。", +"This saved video cannot be read.": "無法讀取這個已儲存的影片。", +"This short film can be stopped or continued only by hand on the page": "這部短劇只能在頁面上手動停止或繼續", +"This short film has already ended": "這部短劇已經結束", +"This short film has reached its task limit": "這部短劇已達到可生成的任務數量上限", +"This shot cannot be found": "找不到這個鏡頭", +"This shot has reached its generation limit": "這個鏡頭已達到可生成的次數上限", +"This shot has too many parts": "這個鏡頭的段數太多", +"This shot is too long. Choose a shorter duration. ": "這個鏡頭太長,請縮短時長。", +"This shot was chosen by hand and is not changed automatically": "這個鏡頭已手動選定,不會自動更改", +"This speed cannot be used here.": "這裡不能用這個速度。", +"This step count needs a download (about {size}) that did not finish this time. Generate again when online and it downloads automatically.": "這個步數要先下載(約 {size}),這次未能完成下載。連上網路後再生成一次,會自動下載。", +"This step did not finish. Try again; if it keeps failing, report the problem.": "這一步沒有完成。請重試;仍然失敗時,請提交問題。", +"This take belongs to a short film and cannot be continued on its own": "這一條屬於一部短劇,不能單獨繼續生成", +"This take is out of date or did not succeed": "這一條已過期或沒有生成成功", +"This task cannot be continued": "此任務無法繼續生成", +"This task or media file cannot be found": "找不到這次任務或素材", +"This track is locked": "這條軌道已鎖定", +"This track is locked.": "這條軌道已鎖定。", +"This track is locked. Unlock it to change this part.": "這條軌道已鎖定,解鎖後才能修改。", +"This track is locked. Unlock it with the lock on its head.": "這條軌道已鎖定,點軌道頭上的鎖解鎖。", +"This track is locked; unlock it first": "這條軌道已鎖定,先解鎖", +"This video already has the maximum of {count} parts and cannot be extended.": "這個影片已達 {count} 段上限,無法再接著生成。", +"This video cannot be extended␟这个视频暂时不能接续": "這個影片暫時不能接續", +"This video cannot be extended␟这条视频不能接着生成": "這個影片不能接著生成", +"This video cannot be opened. If you moved the file, refresh the page.": "影片打不開,如果移動過檔案,請重新整理頁面。", +"This video cannot be upscaled": "這個影片不能放大", +"This video could not be read": "無法讀取這個影片", +"This video kept no prompt": "這個影片沒有儲存提示詞", +"This video kept no prompt to reuse.": "這個影片沒有儲存可重複使用的提示詞。", +"This video's format cannot be upscaled.": "這個影片的格式不能放大。", +"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 and the keys of every view": "這個檢視加全域按鍵", +"This view has nothing to generate yet.": "這個視圖裡還沒有可生成的內容。", +"This will be slow.": "這次會很慢。", +"Three steps around Create or Edit": "三步認識創作面板或剪輯檢視", +"Three steps around the screen": "三步認識介面", +"Three-quarter": "四分之三", +"Thumbnails only, a larger picture": "只留縮圖,畫面更大", +"Tick \"I accept the installation plan and model / toolkit licenses.\" and choose \"Confirm & continue\".": "勾選「我同意安裝計畫及模型/工具套件授權條款。」,點一下「確⁠認⁠並⁠繼⁠續」。", +"Tick the agreement to enable Install.": "勾選同意後,可點選「安裝」。", +"Time and memory this generation used": "這次生成的用時和記憶體", +"Time depends on the graphics card; use the estimate shown on the Generate button.": "預估時間因顯示卡而異,以生成按鈕上顯示的為準。", +"Time left": "預計剩餘", +"Time, memory and notes for this video": "用時、顯示卡記憶體和這個影片的說明", +"Timed lines cannot be split into separate videos. Turn off One prompt per line.": "帶時間的台詞不能拆成多個影片,請關閉「每行一條提示詞」。", +"Timeline zoom": "軌道縮放", +"Timeline␟剪辑轨道": "剪輯軌道", +"Timeline␟时间线": "時間軸", +"Time␟时间": "時間", +"Time␟用时": "用時", +"Tint": "色調", +"To background color": "到背景色", +"To carry the picture on from the previous part, choose \"Extend\" below a finished video. The new part follows right after it, carries a link mark, and joins the earlier part as one shot.": "要讓畫面接著上一段往下發展,在生成好的影片下方點一下「接著生成」:新的一段緊接在後面,帶有連結標記,與前面拼成同一個鏡頭。", +"To change it, choose another take on the page": "要更換時,請在頁面上手動改選", +"To change scene or cut to another picture, drag out a part in an empty place on the timeline, describe it and choose \"Generate\". It is a separate shot and does not continue the earlier picture.": "要換場景或切到另一個畫面,在時間軸的空白處拖出一段,寫下描述再點一下「生⁠成」:它是獨立鏡頭,不接前面的畫面。", +"To connect it again, choose Reconnect, or ask it in its own window to continue.": "如需重新連線,請點一下「重新連線」,或在助手的視窗中讓它繼續。", +"To continue a video with audio used as is, select audio that starts at least 1 second into the file: the first second overlaps the saved video.": "續接已儲存的影片並原樣使用音訊時,所選音訊要從檔案第 1 秒之後開始:前 1 秒與已儲存的影片重疊。", +"To download: {count} files ({size})": "需要下載:{count} 個檔案({size})", +"To download␟需下载": "需下載", +"To download␟需要下载": "需要下載", +"To export, update FreeVideo and restart it.": "請更新 FreeVideo 並重新啟動後再匯出。", +"To keep the sound of the source video, check \"Keep source video sound\".": "需要來源影片的聲音時,勾選「保⁠留⁠來⁠源⁠影⁠片⁠聲⁠音」。", +"To layer": "複製為圖層", +"To make it longer, drag the part out; each part is at least 5 seconds. Then choose \"Generate\".": "需要更長時,拖長這一段,每段至少 5 秒,然後點一下「生⁠成」。", +"To remove a reference image, point to its thumbnail and choose \"×\" at its top right.": "把滑鼠移到縮圖上,點右上角的「×」,可移除這張參考圖。", +"To replace separated music, select a clip on the music track. The button then reads \"Replace music\".": "要換掉分離後的音樂,請選取「音樂」軌上的片段,按鈕會變為「替⁠換⁠配⁠樂」。", +"To save a frame, update FreeVideo and restart it.": "請更新 FreeVideo 並重新啟動後再儲存畫面。", +"To stop the video being generated, choose \"Stop\" at the bottom of the panel (there while a task runs or waits), then \"Stop\" again under the question. What is being made is not kept and waiting tasks pause; choose \"Resume queue\" to go on.": "要停下正在生成的影片,點面板底部的「停止」(有任務進行或排隊時才有),再在詢問下方點一下「停止」確認;正在生成的不會保留,排隊的任務會暫停,點一下「繼續佇列」恢復。", +"To transparent": "到透明", +"To try several prompts at once, turn on \"One prompt per line\" and write one prompt per line in the prompt box. Each line becomes one video.": "要一次試幾種寫法,開啟「每行一條提示詞」,在提示詞框中每行寫一條,每行生成一個影片。", +"To undo a change, choose \"Undo\" or press Ctrl+Z.": "改錯了可點一下「復原」,或按 Ctrl+Z。", +"Today": "今天", +"Today {time}": "今天 {time}", +"Token set for this session": "本次已設定權杖", +"Tolerance": "容差", +"Too many attempts. Try again in {count} s.": "嘗試次數過多,請 {count} 秒後再試。", +"Too many attempts. Try again in {minutes} min.": "嘗試次數過多,請 {minutes} 分鐘後再試。", +"Took": "用時", +"Took too long. Try again.": "生成提示詞逾時,請重試。", +"Tools that do not fit in the bar": "顯示工具列放不下的工具", +"Tools␟安装工具": "安裝工具", +"Tools␟工具": "工具", +"Top": "上", +"Top bar": "頂欄", +"Total frames": "影格數", +"Total time": "總用時", +"Tour page": "介紹頁", +"Track tools": "軌道工具", +"Track zoom": "軌道縮放", +"Tracks": "音軌", +"Trade speed for detail": "在速度和畫面細節之間取捨", +"Transcribing": "識別中", +"Triangle": "三角形", +"Trigger words": "觸發詞", +"Trim": "裁短", +"Trim after playhead": "裁掉後面", +"Trim before / after the playhead": "裁掉播放頭前面 / 後面", +"Trim before playhead": "裁掉前面", +"Trim the edges of the picture": "裁掉畫面邊緣不要的部分", +"Trim, reorder, add music or subtitles as in any other edit, then choose \"Export\" at the top right. The film in Creations does not change.": "可以像其他剪輯一樣修剪、調整順序、加配樂或字幕,再點右上角的「匯⁠出」;作品庫中的成品影片不會改變。", +"Try a clearer image, or try again": "換一張更清晰的圖片,或再試一次", +"Try again after the source video finishes": "等來源影片生成完成後再試", +"Try again in a moment.": "請稍後再試。", +"Try again when it finishes. If nothing else is running, close duplicate FreeVideo instances, then try again.": "請在它完成後重試。若沒有其他任務在進行,請關閉重複執行的 FreeVideo 後重試。", +"Try again when that task finishes": "等該任務完成後再試", +"Try again when the clip finishes generating": "等片段生成完成後再試", +"Try again when the reference images are finished": "等參考圖生成完成後再試", +"Try again with the same request": "用同樣的要求再試一次", +"Try again, and leave the file unchanged until the video is generated.": "請重試,並在生成完成前保持該檔案不變。", +"Try again, or write the subtitles by hand": "再試一次,或手動填寫字幕", +"Try again. If it happens again, choose \"Report a problem\" to send us the report.": "請重試。再次出現時,請點選「提交問題」,把報告發給我們。", +"Try again. If it still fails, choose \"Report a problem\" to send us the report.": "請重試。仍然失敗時,請點選「提交問題」傳送報告。", +"Try again. If it still fails, export the report and send it to us.": "請重試。仍然失敗時,請匯出報告並傳送給我們。", +"Try again; if it happens again, use \"Report a problem\"": "再試一次;再次出現時,請點選「提交問題」", +"Try again; if it happens again, use a shorter length or a smaller size": "再試一次;再次出現時,請縮短時長或降低尺寸", +"Try again␟再试一次": "再試一次", +"Try again␟重试": "重試", +"Try another word, or see \"When something goes wrong\".": "換個詞,或看「出錯了怎麼辦」。", +"Try another word, or use it as a prompt.": "換個詞,或直接用它作為提示詞生成。", +"Try another word.": "換個詞試試。", +"Try it": "試一試", +"Try other words or another filter.": "換個詞或換個篩選試試。", +"Try saving the changes now": "現在再試一次儲存變更", +"Try saying:": "可以這樣說:", +"Try sending this image again": "再上傳一次這張圖片", +"Try this prompt": "試試這條提示詞", +"Try to read your last prompt again": "再次讀取上次的提示詞", +"Try what failed once more": "再試一次剛才失敗的操作", +"Tsinghua mirror": "清華鏡像", +"Tune once, then test again. Only validated settings are kept.": "最佳化一次,再測一次;僅儲存通過驗證的設定。", +"Turn a whitebox and a product image into a product video.": "用白模和一張產品圖,生成產品影片。", +"Turn off compatibility view": "關閉相容介面", +"Turn off references": "停用參考", +"Turn on \"Faster second pass\" and turn off the first-pass preview.": "請開啟「第二階段加速」,並關閉先出預覽。", +"Turn on \"Faster second pass\" or set the audio to \"Reference\".": "請開啟「第二階段加速」,或把音訊改選「參考」。", +"Turn on Compatibility view": "開啟相容檢視", +"Turn on compatibility view": "開啟相容介面", +"Turn on the assistant interface in Settings": "先在設定裡開啟助手介面", +"Turn on the faster second pass to use this setting.": "開啟第二階段加速後生效。", +"Turn sound on": "開啟聲音", +"Turn the extension off for this page, or set its site access to \"On click\".": "在這個頁面關閉這個擴充功能,或把它的網站存取權限改成「點選時」。", +"Turn the picture a quarter turn left": "畫面逆時針轉四分之一圈", +"Turn the picture a quarter turn right": "畫面順時針轉四分之一圈", +"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 off": "關閉聲音", +"Turn the sound on": "開啟聲音", +"Turn the sound on or off": "開啟或關閉聲音", +"Turn this part upside down": "上下翻轉這段畫面", +"Turn this preview into the final video": "把預覽做成全解析度成片", +"Turn this preview part into the full-resolution video, in place": "把這段預覽原地做成全解析度成片", +"Tutorial": "教學", +"Tutorials": "教學", +"Two friends sit by a café window at dusk. She says: \"You came back.\" He smiles: \"I promised.\" Warm light, quiet street sounds.": "黃昏,兩位朋友坐在咖啡館窗邊。她說:「你回來了。」他笑著說:「我答應過。」暖色光,安靜的街道聲。", +"Two people talking": "兩人對話", +"Type": "類型", +"Type @ in the prompt and choose an image, then say what it does in the scene, for example \"The girl in runs along the beach\".": "在提示詞中輸入 @ 選擇圖片,並寫明它在畫面中的作用,例如「 裡的女孩在海邊奔跑」。", +"Type @ in the prompt and choose an image, then say what it does in the scene.": "在提示詞中輸入 @ 選擇圖片,並寫明它在畫面中的作用。", +"Type @{name} in a prompt to use it in a shot.": "在提示詞中輸入 @{name} 即可在鏡頭裡使用。", +"Type a height; snaps to 32": "輸入高度,自動對齊到 32 的倍數", +"Type a message to the assistant": "在對話框裡告訴助手要做什麼", +"Type a number or use − and +": "輸入數值,或用 − 和 + 調整", +"Type a prompt first; enhancement rewrites it before generating.": "請先輸入提示詞,生成前會自動改寫。", +"Type a value from 10 to 1000 %": "輸入 10 至 1000 的百分比", +"Type a width; snaps to 32": "輸入寬度,自動對齊到 32 的倍數", +"Type an angle from −180° to 180°": "輸入 −180° 至 180° 的角度", +"Type to filter": "輸入文字篩選", +"Unavailable␟不可用": "不可用", +"Unavailable␟未连通": "未連通", +"Under \"At\", enter the second at which this image appears. The default lies halfway between its neighbors and can be changed.": "在「時間」中填寫這張圖出現在第幾秒;預設值位於前後兩影格的正中,可直接修改。", +"Under \"Frame & size\", choose landscape, portrait or square, then choose a size in the \"Size\" row.": "在「畫面比例與尺寸」中選擇橫向、直向或方形,再在「尺寸」一行選擇大小。", +"Under \"Frame & size\", choose the shape, then choose \"4M\" (about 4 megapixels) or \"16M\" (about 16 megapixels) under \"Size\". On a graphics card with 8 GB of memory, choose \"4M\".": "在「畫面比例與尺寸」中選擇比例,再在「尺寸」中選擇「4M」(約 400 萬畫素)或「16M」(約 1600 萬畫素)。顯示卡記憶體為 8 GB 的顯示卡,選「4M」。", +"Under \"Generation mode\", choose \"Batch\", set \"Number of videos\", then generate: that many videos are made in a row with the current settings, each with a new seed.": "在「生成方式」中選「批次」,填寫「生成數量」,再點生成:用目前設定連續生成這麼多個影片,每個換一個種子。", +"Under \"Media\", add a first frame and a last frame, as in the chapter \"First and last frames\".": "在「素材」中新增首影格和尾影格兩張圖片,做法見「首影格和尾影格」一章。", +"Under \"Media\", choose \"Add\", pick the starting image and set its role dropdown to \"First frame\".": "在「素材」中點一下「新增」,選擇起始圖片,並將它的用途下拉式選單選為「首影格」。", +"Under \"Source video\" choose \"Add video\", and under \"Person image\" choose \"Add image\".": "在「來源影片」中點一下「新增影片」,在「人物圖」中點一下「新增圖片」。", +"Under \"Video\" on the right, adjust scale, position and rotation, or choose \"Crop\". On a window narrower than 1280 pixels, choose \"Adjust\" first to open the panel.": "在右側「畫面」中可調整縮放、位置和旋轉,或點一下「裁⁠切」;視窗窄於 1280 時,先點一下「調⁠整」開啟該面板。", +"Under \"Voice\", choose a speaker, an imported clip or a recording. \"Pick a sound clip…\" lets you click one on the timeline, and ▶ plays a sample.": "在「音⁠色」中選說話者、匯入的片段或錄音。「選一個聲音片段…」可在時間軸上點選,▶ 可試聽。", +"Under 1 min": "不到 1 分鐘", +"Under 1 min left": "不到 1 分鐘", +"Undo": "復原", +"Undo (Ctrl+Z)": "復原(Ctrl+Z)", +"Undo / redo": "復原 / 重做", +"Undo rotation, flip and crop on this clip": "撤掉這段的旋轉、翻轉和裁切", +"Unfinished": "未完成", +"Unified memory": "統一記憶體總量", +"Unlock the layer, then try again": "解鎖該圖層後再試", +"Unlock the track before changing this part.": "先解鎖軌道,再改這一段。", +"Unlock the track, then try again": "解鎖該軌道後再試", +"Unlock␟解锁": "解鎖", +"Unlock␟解除锁定": "解除鎖定", +"Unmute": "取消靜音", +"Unpick it; compare the others": "取消選中這張,只對比其餘幾張", +"Unpin": "取消置頂", +"Untitled": "未命名作品", +"Untitled edit": "未命名剪輯", +"Unused model files were removed": "沒在使用的模型檔案已刪除", +"Up to 2 people can be replaced in one request.": "一次最多替換 2 個人物。", +"Up to 2 props": "最多 2 個道具", +"Up to 3 characters": "最多 3 個角色", +"Up to 3 images when extending": "接續時最多 3 張", +"Up to 32 LoRAs can be used at a time.": "一次最多使用 32 個 LoRA。", +"Up to 32 images": "最多 32 張", +"Up to 32 references": "參考素材最多 32 個", +"Up to 4 images per message.": "一條訊息最多 4 張圖片。", +"Up to 64 megapixels; reduce the width or height.": "最多 6400 萬像素,請減小寬或高。", +"Up to {limit} boxes": "最多 {limit} 個框", +"Up to {max} s": "單次最長 {max} 秒", +"Up to {seconds} s in one run at this size.": "目前畫面大小單次最長 {seconds} 秒。", +"Upbeat": "明快", +"Update & launch": "更新並啟動", +"Update ComfyUI packages": "更新 ComfyUI 元件", +"Update FreeVideo": "更新 FreeVideo", +"Update checks could not start": "更新檢查無法啟動", +"Update incomplete": "更新未完成", +"Update now": "立即更新", +"Update the NVIDIA driver to version 580 or newer, restart the computer, then click \"Retry installation\".": "請將 NVIDIA 顯示卡驅動程式更新到 580 或更新版本,重新啟動電腦後點選「重試安裝」。", +"Updates": "更新", +"Update␟更新": "更新", +"Update␟有更新": "有更新", +"Updating after the current video finishes": "目前影片生成完成後自動更新", +"Updating files:.*": "正在準備檔案", +"Updating…": "正在更新…", +"Upgrade": "升級", +"Upgraded to the faster model": "已升級到更快的模型", +"Upload again": "重新上傳", +"Upload image": "上傳圖片", +"Upload images": "上傳圖片", +"Upload one file at a time.": "一次只能上傳一個檔案。", +"Upload or select the missing media file again, then generate.": "請重新上傳或選擇缺少的素材後再生成。", +"Uploading reference images": "正在上傳參考圖", +"Uploading reference image…": "正在上傳參考圖…", +"Uploading the edited image": "正在上傳編輯後的圖片", +"Uploading the edited image…": "正在上傳編輯後的圖片…", +"Uploading the image": "正在上傳圖片", +"Uploading␟上传中": "上傳中", +"Uploading␟正在上传": "正在上傳", +"Uploads and images no longer used": "不再使用的上傳和圖片", +"Upscale a video": "放大影片", +"Upscale factor": "放大倍數", +"Upscale to {size}": "放大到 {size}", +"Upscaling needs about 1.5 GB of free GPU memory, and other programs were using it.": "放大需要約 1.5 GB 空閒顯示卡記憶體,當時被其他程式佔用。", +"Upscaling the video": "正在放大畫面", +"Upscaling uses a small model (about 5 MB), which could not be downloaded or verified this time.": "放大要用一個約 5 MB 的小模型,這次沒能下載,或下載後驗證未通過。", +"Usable": "可用", +"Use": "使用", +"Use 3 second-pass steps, or fewer than the first-pass steps.": "第二階段步數須為 3,或少於第一階段步數。", +"Use 39, 56, 73, 90, or another value reached by adding 17. This includes the 22 repeated frames when continuing a video.": "請把「影格數」設為 0,按時長生成。", +"Use 39, 56, 73, 90, or another value reached by adding 17. This includes the 22 repeated frames when extending a video.": "請使用 39、56、73、90 等每次增加 17 的影格數;接續時,這個數包含開頭重複的 22 影格。", +"Use Download report in the preview and send it to us.": "請點預覽區的「下載報告」,發給我們。", +"Use Light": "改用輕量檔", +"Use Run in the node view": "節點檢視裡請用執行按鈕", +"Use a file that plays normally, then try again": "換一個能正常播放的檔案後再試", +"Use a smaller size, or close other programs that use memory, then generate again.": "請縮小尺寸,或關閉其他佔用記憶體的程式後重新生成。", +"Use a sound in a supported language, or write the subtitles by hand": "換一段受支援語言的聲音,或手動填寫字幕", +"Use again": "再用一次", +"Use an image instead, then try again": "換一張圖片後再試", +"Use an image of your own for this view": "這個視角用自己的圖片", +"Use another image of your own for this view": "這個視角換成自己的另一張圖片", +"Use as is": "原樣使用", +"Use as reference␟当作参考图": "當作參考圖", +"Use as reference␟用作参考图": "用作參考圖", +"Use at least {count} characters.": "至少 {count} 個字元。", +"Use at most 32 LoRAs": "最多使用 32 個 LoRA", +"Use at most 32 media items": "最多使用 32 個素材", +"Use at most eight LoRAs per image.": "一張圖片最多使用 8 個 LoRA,請減少數量。", +"Use at most {IMAGE_LORA_LIMIT} LoRAs": "最多使用 {IMAGE_LORA_LIMIT} 個 LoRA", +"Use automatic download": "改用自動下載", +"Use downloaded folder": "使用已下載的資料夾", +"Use earlier videos directly as references": "以前生成的影片也能直接用作參考", +"Use existing": "使用已有安裝", +"Use existing ComfyUI": "使用已有 ComfyUI", +"Use existing Python": "使用已有環境", +"Use image generation on a Mac with 16 GB of memory or more": "在記憶體 16 GB 及以上的 Mac 上使用圖片生成", +"Use images from this computer": "用電腦上的圖片", +"Use it as a reference image": "作為參考圖放進目前檢視", +"Use it as a reference or make more like it there": "在那裡用作參考圖,或接著生成", +"Use media": "使用素材", +"Use models already on this computer": "直接用本機上已有的模型", +"Use new images as␟新图片用作": "新圖片用作", +"Use new images as␟新图片用途": "新圖片用途", +"Use people, objects or places from reference images in a video.": "讓參考圖裡的人物、物品或場景出現在影片中。", +"Use prompt": "使用提示詞", +"Use reference images to guide the next part.": "用參考圖引導接著生成的那一段。", +"Use references or first and last frames": "參考素材與首尾影格請選其一", +"Use style {number}": "套用樣式 {number}", +"Use the current proxy. No direct fallback.": "沿用目前代理,不嘗試直連。", +"Use the image": "用原圖", +"Use the original image again; the edit can be reopened": "改回原圖;之後仍可重新編輯", +"Use the page served by FreeVideo": "在 FreeVideo 提供的頁面中操作", +"Use the photo": "用原照片", +"Use the same aspect ratio as the previous video.": "接續的畫面比例與上一段影片不同", +"Use the shape of the added image": "用新增的圖片的比例", +"Use the sketch as a reference (Ctrl+Enter)": "把草圖用作參考圖(Ctrl+Enter)", +"Use the video's sound": "使用影片聲音", +"Use this LoRA": "使用這個 LoRA", +"Use this level from the next generation": "下次生成起使用這個等級", +"Use this look on every subtitle": "把這套樣式用到所有字幕", +"Use this prompt␟使用这条提示词": "使用這條提示詞", +"Use this prompt␟用这段提示词": "用這段提示詞", +"Use token": "應用權杖", +"Use up to 8 reference images for enhancement.": "增強暫支援最多 8 張參考圖。", +"Use your account's download quota. Kept for this session only.": "使用帳號下載額度,僅本次開啟有效。", +"Use your account’s download quota on the international source instead of the anonymous limit.": "在國際來源上使用帳戶的下載額度,避開匿名限速。", +"Use your own LoRA": "使用自己的 LoRA", +"Use {model}": "改用 {model}", +"Used": "已用", +"Used by a character card. Remove the image from the card, or delete the card, then delete it here.": "這張圖正被角色卡使用。先從角色卡中移除這張圖,或刪除角色卡後再刪。", +"Used by the character card {cards}. Remove the image from the card, or delete the card, then delete it here.": "這張圖正被角色卡 {cards} 使用。先從角色卡中移除這張圖,或刪除角色卡後再刪。", +"Used in 1 edit": "已用於 1 個剪輯", +"Used in {count} edits": "已用於 {count} 個剪輯", +"Used the latest prompt.": "沿用了最近一次的提示詞。", +"Used the prompt of the part before.": "沿用了上一段的提示詞。", +"Used {count} times": "用過 {count} 次", +"User guide": "使用說明", +"Uses a depth version of this video as the reference.": "轉成深度影片後再作參考。", +"Uses a line drawing of this video, so the new video follows its layout, not its motion or colours.": "轉成線稿後作參考:新影片沿用它的構圖,不沿用動作和顏色。", +"Uses extra disk space": "額外佔用磁碟空間", +"Uses models already on this computer; original files stay in place": "使用電腦上已有的模型,不移動原檔案", +"Uses your existing Python when available. A separate environment loads only FreeVideo.": "優先使用已有 Python;獨立環境僅載入 FreeVideo。", +"Usually faster on networks in China": "中國大陸網路通常更快", +"Usually faster: generates at a lower resolution, then upscales and refines.": "通常更快:先用低解析度生成,再放大細化。", +"VRAM": "顯示卡記憶體", +"VRAM budget": "可用顯示卡記憶體預算", +"VRAM free": "空閒顯示卡記憶體", +"Verified ": "已校驗", +"Verified and ready": "已就緒", +"Verify ": "正在校驗", +"Verify / reuse local models": "檢查並複用已有模型", +"Verify CUDA and the Windows runtime libraries": "檢查執行元件", +"Verify bundled files": "校驗離線安裝包", +"Verify cached weights": "驗證模型快取", +"Verify dependency compatibility": "檢查執行元件", +"Verify existing models": "校驗已有模型", +"Verify installation on your GPU": "檢查 GPU 加速", +"Verify local model": "校驗已有模型", +"Verify prepared weights and apply your storage choice": "檢查模型檔案", +"Verify that the text encoding library loads": "檢查提示詞模型", +"Verify the compiler before building GPU acceleration": "檢查編譯工具", +"Verifying": "正在校驗", +"Verifying ": "正在校驗", +"Verifying the files {percent}%; usable when done": "正在驗證檔案 {percent}%,完成後即可使用", +"Verifying the files; usable when done": "正在驗證檔案,完成後可以使用", +"Verifying {name}": "正在校驗{gap}{name}", +"Verifying {percent}%": "正在驗證 {percent}%", +"Verifying {short}": "正在驗證 {short}", +"Verifying {short}; it generates when done": "正在驗證 {short},完成後自動生成", +"Version": "版本", +"Version & release notes": "版本與更新說明", +"Version & updates": "版本與更新", +"Version information": "版本資訊", +"Version information is not available: FreeVideo on this computer did not return it. Click Retry; if it still fails, report a problem.": "暫時無法取得版本資訊:本機的 FreeVideo 服務沒有傳回結果。請點一下「重試」;仍然失敗時請提交問題。", +"Version {number}": "第 {number} 版", +"Vertical position": "垂直位置", +"Vibrance": "自然飽和度", +"Video & audio decoder": "影片與音訊解碼器", +"Video & audio decoders": "影片與音訊解碼器", +"Video and audio": "畫面和聲音", +"Video decoder": "影片解碼元件", +"Video folder": "影片資料夾", +"Video length planning": "影片分段規劃", +"Video memory": "顯示卡記憶體", +"Video memory at 95% or more, or a temperature of 85 °C or more, is shown in red.": "顯示卡記憶體達到 95% 或溫度達到 85 °C 時,數值以紅色顯示。", +"Video memory {used} / {total} GB": "顯示卡記憶體 {used} / {total} GB", +"Video model": "影片模型", +"Video model not installed.": "影片模型未安裝。", +"Video models": "影片模型", +"Video models are not installed yet": "影片模型還沒有安裝", +"Video preview": "影片預覽", +"Video saved": "影片已儲存", +"Video size": "影片尺寸", +"Video unavailable": "影片不可用", +"Video {width} × {height}": "影片 {width} × {height}", +"Video, audio and timings appear here after generation.": "生成後在這裡檢視影片、音訊和耗時。", +"Videos": "影片", +"Videos and audio can be references too: add them the same way with \"Add\" and mention them in the prompt with @.": "影片和音訊也可作為參考:同樣點一下「新⁠增」,在描述中輸入 @ 引用。", +"Videos and audio can be references too: add them the same way with \"Add\" and mention them in the prompt with @. On a video card, check \"Composition only\" to follow its layout but not its motion or colors.": "影片和音訊也可作為參考:同樣點一下「新⁠增」,在描述中輸入 @ 引用;影片卡片上勾選「僅參考構圖」時,只沿用它的構圖,不沿用動作和顏色。", +"Videos and images made here": "生成過的影片和圖片", +"Videos and images show here once made.": "生成的影片和圖片會出現在這裡。", +"Videos made by the assistant": "由助手生成的影片", +"Videos made here, ready to place": "在這裡生成的影片,可直接放入", +"Videos made in parts are made one at a time; \"Batch\" and \"Loop\" are for single-part videos.": "分段影片一次只生成一段,「批次」和「循環」用於單段影片。", +"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": "還沒有繼續第二階段的影片", +"Videos you generate appear here.": "生成的影片會顯示在這裡。", +"Video␟生成视频": "生成影片", +"Video␟画面": "畫面", +"Video␟视频": "影片", +"Video␟视频任务": "影片任務", +"View": "檢視", +"View ": "檢視 ", +"View it large": "開啟大圖檢視", +"View large": "檢視大圖", +"View licenses": "檢視授權條款", +"View the image full size": "檢視大圖", +"View {number}": "視角 {number}", +"View ↗": "檢視 ↗", +"Viewer": "檢視大圖", +"Views": "檢視", +"Vignette": "暗角", +"Voice change needs the dubbing model (about {size}).": "換人聲需要配音模型,約 {size}。", +"Voice reference": "聲音參考", +"Voice-over": "旁白", +"Voice-over and recording": "配音與錄音", +"Voice␟声音": "聲音", +"Voice␟录音": "錄音", +"Voice␟配音": "配音", +"Voice␟音色": "音色", +"Volume": "音量", +"Volume, fades and the sound of the part": "音量、淡入淡出和這一段的聲音", +"Volume, speed, picture and text": "聲音、速度、畫面和文字", +"Volume, speed, picture and text of the selection": "調整選中片段的聲音、速度、畫面和文字", +"W": "寬", +"Wait a moment and try again; if it still fails, restart FreeVideo from the launcher": "稍等片刻後再試;仍不行時,在啟動器裡重新啟動 FreeVideo", +"Wait for media uploads to finish before running": "請等待素材上傳完成後再生成", +"Wait for the current generation to finish": "等目前生成完成", +"Wait for the current setup task to finish": "請等待目前安裝任務完成", +"Wait for the current task to end, or reload the page, then try again": "等目前任務結束,或重新整理頁面後再試", +"Wait for the current task to finish": "請等待目前任務完成", +"Wait for the drama to end, or stop it first, then change this card": "等短劇結束,或先停止它後再改這張卡片", +"Wait for the file check to finish.": "請等待檔案檢查完成。", +"Wait for the four images to finish": "等待四張圖生成完成", +"Wait for the images to finish": "等待圖片生成完成", +"Wait for the images to finish uploading": "等圖片上傳完", +"Wait for {task} to finish; its progress is under Models.": "請等待{task}完成,進度見「模型」。", +"Waiting for a reply · {minutes} min": "正在等待回覆 · {minutes} 分", +"Waiting for a reply · {minutes} min {seconds} s": "正在等待回覆 · {minutes} 分 {seconds} 秒", +"Waiting for a reply · {s} s": "正在等待回覆 · {s} 秒", +"Waiting for earlier tasks": "等待前面的任務", +"Waiting for generation to be ready": "正在等生成服務就緒", +"Waiting for scan": "等待檢查", +"Waiting for the GPU": "等待顯示卡", +"Waiting for the video to finish": "等待影片生成完成", +"Waiting for the workspace to be ready. The guide will start automatically.": "正在等待創作面板就緒,隨後會自動開始指引。", +"Waiting for {short} GiB more graphics memory to rewrite.": "顯示卡記憶體不足,再空出 {short} GiB 後自動改寫。", +"Waiting for {short} GiB more graphics memory to rewrite. In use: {names}.": "顯示卡記憶體不足,再空出 {short} GiB 後自動改寫。正在佔用:{names}。", +"Waiting in queue": "正在排隊", +"Waiting in queue · Part {index} of {total}": "正在排隊 · 第 {index} 段,共 {total} 段", +"Waiting in queue · Part {part} of {count}": "正在排隊 · 第 {part} 段,共 {count} 段", +"Waiting to download": "等待下載", +"Waiting, {position} ahead": "排隊中,前面 {position} 個", +"Waiting␟排队": "排隊", +"Waiting␟排队中": "排隊中", +"Waiting␟等待开始": "等待開始", +"Walk": "行走", +"Walkthrough": "演示", +"Wall and door": "牆和門", +"Wall and window": "牆和窗", +"Warm": "溫暖", +"Watch the preview filling the screen": "全螢幕檢視預覽", +"We'll optimize specifically for your setup, and it helps other users too.": "我們會針對您的硬體配置進行專門最佳化,也能幫助其他使用者。", +"Weight": "字重", +"What could be better?": "哪裡可以做得更好?", +"What finished, failed or is installing": "完成、失敗和安裝中的任務", +"What fits": "可生成範圍", +"What goes here": "放什麼", +"What happened": "發生了什麼", +"What has been made so far is not kept. Queued jobs go on.": "已生成的部分不會保留,排隊的任務照常進行。", +"What is being made, and the details": "正在生成的內容和詳情", +"What is generating in every view": "各個檢視正在生成和排隊的任務", +"What the connected AI assistant is doing": "已連線的 AI 助手正在做什麼", +"What this part should show": "寫下這一段要生成的內容", +"What this step has made so far is not kept. Finished creations stay.": "這一步做到一半的不會保留,已經完成的作品不受影響。", +"What to change": "要改什麼", +"What to change in the selection": "要改選區裡的什麼", +"What to generate": "生成什麼", +"What to make or change": "要畫什麼或要改什麼", +"What went wrong and what to do": "出了什麼問題、可以怎麼做", +"What would you like to make?": "想做什麼影片?", +"What you asked for": "你提出的要求", +"What you send shows up here.": "發過的話會出現在這裡。", +"What's new␟新功能": "新功能", +"What's new␟更新内容": "更新內容", +"What’s new": "更新內容", +"Wheel": "滾輪", +"When": "時間", +"When Autopilot finishes a short drama, the film is saved to Creations and an edit named after the film is made with it.": "AI 全自動拍完一部短劇後,影片儲存到作品庫,同時建好一個以片名命名的剪輯專案。", +"When a short drama is finished, an edit cut into its shots is made along with the film, ready for further changes.": "短劇拍完後,除了完成的影片,還會建好一個按鏡頭分段的剪輯專案,可以接著修改。", +"When asked to restart, restart FreeVideo.": "提示需要重新啟動時,重新啟動 FreeVideo。", +"When depth extraction started, the graphics driver did not make the GPU available.": "開始提取深度時,顯示卡驅動程式未提供可用的顯示卡。", +"When done, choose \"Export\" at the top right.": "完成後點右上角的「匯⁠出」儲存。", +"When every download source fails, the error card lists each source and the reason it failed.": "全部下載來源都失敗時,錯誤卡片會逐個列出下載來源和失敗原因。", +"When extending a video, middle frames are not used, and the first and last frames are used as references.": "接續影片時不使用中間影格,首尾影格會用作參考圖。", +"When extending a video, middle frames are not used; the first and last frames are used as references.": "接續影片時不使用中間影格,首尾影格會用作參考圖。", +"When extending a video, the first and last frames are used as references.": "接續影片時,首尾影格會用作參考圖。", +"When extending, only the first 3 images are used.": "接續時只用前 3 張圖片。", +"When it finishes, play it in the preview and choose \"Download video\" to save it.": "完成後在預覽區播放,點一下「下載影片」儲存。", +"When it shows \"Assistant connected\" or the assistant's name, describe the video under \"Tell the assistant…\", for example \"Make a 1-minute vertical short film: a day in a coffee shop\".": "狀態顯示「助手已連線」或所連助手的名字後,在「對助手說…」中描述想做的影片,例如「做一部 1 分鐘的直式短片:咖啡店的一天」。", +"When model files are incomplete or changed, import the same offline packages again in the launcher; only the files with problems are completed or replaced.": "模型檔案不完整或被修改時,在啟動器裡把同一份離線安裝包再匯入一次,只補齊和替換有問題的檔案。", +"When off, nothing takes VRAM before a generation; models already used stay loaded for the next one.": "關閉後不會在生成前主動佔用顯示卡記憶體;用過的模型仍會保留,改提示詞繼續生成不受影響。", +"When on, other devices on the same network can open FreeVideo with the link below and enter the password the first time.": "開啟後,同一網路中的其他裝置可以用下面的連結開啟 FreeVideo,第一次開啟時要輸入密碼。", +"When on, other devices on the same network can open FreeVideo with the link below. Anyone with the link can use it, so keep it private.": "開啟後,同一網路中的其他裝置可以用下面的連結開啟 FreeVideo。拿到連結的人都能使用,請勿公開。", +"When something goes wrong": "出錯了怎麼辦", +"When the assistant wrote no outline, the card shows only the size, length and estimated time.": "助手沒有寫大綱時,卡片上只有尺寸、時長和預估時間。", +"When the canvas already has images, \"New image\" can use the current canvas or start a canvas of another shape.": "畫布上已有圖片時,「生成一張」可以沿用目前畫布,也可以換一種比例另開一塊畫布。", +"When the current task ends, a Repair button appears here; after you click it and confirm, FreeVideo renames and keeps this file, then downloads the tested version.": "目前任務結束後,這裡會出現「修復」按鈕;點選並確認後,FreeVideo 會把這個檔案改名保留,再下載測試過的版本。", +"When the current task ends, a Repair button appears here; it checks this installation and restores what is missing.": "目前任務結束後,這裡會出現「修復」按鈕,點選後會補裝缺失的元件。", +"When the current task ends, a Repair button appears here; it reinstalls a complete copy of PyTorch and keeps your models and videos.": "目前任務結束後,這裡會出現「修復」按鈕,點選後會重新安裝執行元件,模型和影片都會保留。", +"When the launcher window is closed, choose to stop FreeVideo and exit, or keep FreeVideo running in the background.": "關閉啟動器視窗時,可以選擇結束 FreeVideo,或讓 FreeVideo 在背景繼續執行。", +"When the loop is off, a frame sheet is shown.": "關閉循環時顯示多影格拼圖。", +"When the page reports incomplete model files, import again as this chapter describes.": "網頁裡提示模型檔案不完整時,同樣按本章重新匯入。", +"When the picture is right, choose \"Run second pass\" in the result, or right-click the preview in Creations and choose \"Run second pass\".": "畫面滿意時,點結果中的「繼續第二階段」;也可以在作品庫中這段預覽上按一下右鍵,選擇「繼續第二階段」。", +"When the prompt names no image, all reference images are used in order.": "提示詞中沒有寫編號時,所有參考圖按順序一起使用。", +"When the source video has two people, replace each with its own image.": "來源影片裡有兩個人時,用兩張人物圖分別替換。", +"When the start or end of the clip comes near a beat, it lines up with that beat. Release the mouse to leave it there.": "片段的開頭或結尾靠近拍點時會對齊到該拍點,鬆開滑鼠後片段停在這裡。", +"Where FreeVideo keeps its models": "FreeVideo 存放模型的位置", +"Where should the models come from?": "選擇模型來源", +"Where the models are first published": "模型的原始發布網站", +"Whether an AI assistant is connected": "檢視 AI 助手是否已連線", +"Whether the assistant asks before starting a film or a long reshoot is set under \"AI assistant\" in Settings.": "助手開拍整部片前、重拍耗時較長時是否先詢問,可在「設定」的「AI 助手」中選擇。", +"Which model to install?": "選擇模型", +"While exploring, use Light to check the picture and motion quickly.": "構思階段用「輕量」,快速確認畫面和動作。", +"While it runs in the background, click the tray icon (the menu bar icon on macOS) or choose \"Open FreeVideo\" in its menu to bring the window back.": "在背景執行時,按一下系統匣圖示(macOS 為選單列圖示)或在它的選單中選「開啟 FreeVideo」,重新開啟視窗。", +"While the audio is set to \"Use as is\", the duration matches it.": "音訊選「原樣使用」時,時長與音訊相同。", +"White": "白", +"White model": "白模", +"Whitebox": "白模", +"Whitebox preview": "白模預覽", +"Whole edit": "整條", +"Whole stroke": "整個塗抹區域", +"Wide": "橫向", +"Wide frame for screens and video sites": "適合電腦和影片網站", +"Widen the history": "展開歷史", +"Width (px)": "寬(px)", +"Width to height of the image␟图片的宽高比例": "圖片的寬高比例", +"Width to height of the image␟画面的宽高比例": "畫面的寬高比例", +"Width {width} and height {height} of the original": "寬為原來的 {width}、高為原來的 {height}", +"Width␟宽": "寬", +"Width␟宽度": "寬度", +"Will be replaced with the version from the offline package": "換成離線安裝包裡的版本", +"Will send when the assistant connects": "等助手連上後自動傳送", +"Will send when the assistant is back": "等助手回來後自動傳送", +"Windows PowerShell could not start": "Windows PowerShell 無法啟動", +"Windows blocked some runtime files": "Windows 攔截了執行元件", +"Windows blocked the download tool": "下載工具啟動或儲存被拒絕", +"Windows cannot provide enough memory for generation right now.": "Windows 暫時無法提供生成所需的記憶體。", +"Windows denies this account access to them, usually because they were created while FreeVideo ran as administrator. Open FreeVideo normally and import the offline packages again; the files already there are reused.": "Windows 不允許目前帳戶讀取它們,通常是因為這些檔案是在「以系統管理員身分執行」時建立的。請正常開啟 FreeVideo,重新匯入一次離線安裝包,已有的檔案會直接重複使用。", +"Windows does not let this account create folders in this location. Choose a folder in the user folder or on another drive.": "Windows 不允許目前帳戶在這個位置建立資料夾。請改選使用者資料夾或其他硬碟上的資料夾。", +"Windows is low on available memory": "Windows 可用記憶體不足", +"Windows refused to run the Python program": "Windows 拒絕執行 Python 程式", +"Windows will ask for permission. Check \"Private networks\", then click \"Allow access\".␟Windows 会弹出确认框,": "Windows 會跳出確認視窗,", +"Windows will ask for permission. Check \"Private networks\", then click \"Allow access\".␟Windows 会弹出确认框,请勾选“专用网络”,再点“允许访问”。": "Windows 會跳出確認視窗,請勾選「私人網路」,再點一下「允許存取」。", +"With \"Ask before the assistant starts a film\" turned off under \"AI assistant\" in Settings, no card appears and the assistant starts at once.": "在「設定」的「AI 助手」中取消「助手開拍整部片前先詢問」後,不再出現確認卡片,助手直接開拍。", +"With \"Enhance\" on, each line is sent as written, without enhancement.": "開啟「增強」時,每行一條描述按原文傳送,不做增強。", +"With \"Prompt enhancement\" on, the prompt is rewritten in more detail on this computer.": "開啟「提示詞增強」後,提示詞會在本機被改寫得更詳細。", +"With \"Use as is\", choose another level.": "選擇「原樣使用」時,請使用其他等級。", +"With \"Use as is\", each part can be up to 30 seconds.": "用「原樣使用」時,每一段最長 30 秒。", +"With 0.0.0.0 or this computer's LAN IP, devices on the same network can open FreeVideo without the access link.": "填 0.0.0.0 或本機的區域網路 IP 後,同一網路中的裝置不需要存取連結就能開啟 FreeVideo。", +"With 0.0.0.0 or this computer's LAN IP, devices on the same network can open FreeVideo without the password.": "填 0.0.0.0 或本機的區域網路 IP 後,同一網路中的裝置不用密碼就能開啟 FreeVideo。", +"With a part shorter than 10 seconds, the extended video has more parts than supported": "有短於 10 秒的段時,接續後的影片超過了支援的段數", +"With a part shorter than {fullSeconds} seconds, one continuous shot can have up to {shortMaxParts} parts.": "有短於 {fullSeconds} 秒的段時,一個連續鏡頭最多 {shortMaxParts} 段。", +"With a part shorter than {full} seconds, one continuous shot can have up to {most} parts. Make every part at least {full} seconds long, or use fewer parts.": "有短於 {full} 秒的段時,一個連續鏡頭最多 {most} 段。請把每段加長到至少 {full} 秒,或減少段數。", +"With a proxy, the faster route is chosen": "有代理時自動選擇更快的一種", +"With a voice": "有聲音的角色", +"With an SRT subtitle file, select a subtitle and choose \"Import subtitle file\".": "已有 SRT 字幕檔案時,選取字幕後點一下「匯入字幕檔案」。", +"With another shape chosen, the new image is placed on a new blank canvas of that shape.": "選擇其他比例時,新圖放在該比例的一塊新空白畫布上。", +"With exactly two creations selected, they are compared in the middle; switch between \"Side by side\" and \"Slider\".": "正好選取兩個作品時,畫面中間比較顯示它們,可切換「並⁠排」或「滑⁠桿」。", +"With music on the \"Audio 2\" track, clips you drag snap to its beats.": "「聲音 2」軌上有音樂時,拖曳片段會貼齊到音樂的拍點。", +"With no task running, the status in the top bar shows the video memory in use and the graphics card temperature; while a task runs it shows the task's progress instead.": "沒有任務時,頂欄的執行狀態顯示顯示卡記憶體佔用和顯示卡溫度;有任務時改為顯示任務進度。", +"With the current shape kept, the new image is added to the canvas as a new layer.": "保持目前比例時,新圖作為一個新圖層加入目前畫布。", +"With the image references counted, the prompt is over 2,000 characters. Shorten it by {count} and try again.": "加上圖片引用後,提示詞超過 2000 字。請縮短 {count} 字後重試。", +"With the proportions changed, images and shapes stretch; text keeps its shape.": "比例改變後,圖片和形狀會拉伸,文字保持原樣。", +"With this setting off, the top bar shows no figures for this computer and nothing is read in the background; \"This computer\" in the Run status panel is shown as usual.": "不開啟這項設定時,頂欄不顯示本機資料,也不在背景讀取;「執行狀態」面板裡的「本機」照常顯示。", +"Without \"Cut:\", the shot does not change.": "沒有寫「切:」的地方不會切鏡。", +"Without a selection, \"Edit this\" changes the whole image according to the prompt.": "沒有選區時,「改這張」會按提示詞修改整張圖片。", +"Without a system tray, the window goes to the taskbar.": "系統沒有系統匣時,視窗會縮到工作列。", +"Without an image model installed, \"Generate\" reads \"Download model\"; choose it to download. Files shared with video are not downloaded again.": "未安裝影像模型時,「生成」顯示為「下載模型」,點它下載;和影片共用的檔案不重複下載。", +"Words, font and place of the text": "文字內容、字型和位置", +"Working out what this computer can generate; try again shortly": "正在計算這台電腦的生成能力,稍後再試", +"Working…": "正在處理…", +"Working␟正在处理": "正在處理", +"Working␟运行中": "執行中", +"Working␟进行中": "進行中", +"Works with the video model": "可用於影片模型", +"Write a line and have it spoken in a voice from the project or a recording.": "寫下一句話,用片中的聲音或一段錄音說出來。", +"Write a long prompt in a large box␟在大文本框里写长提示词": "在大文本框裡寫長提示詞", +"Write a long prompt in a large box␟在大窗口里写长提示词": "在大視窗裡寫長提示詞", +"Write a prompt and get a video.": "寫一段提示詞,生成一段影片。", +"Write a prompt first": "先寫提示詞", +"Write a prompt first.": "先寫一句提示詞。", +"Write a prompt or add an image first": "先寫提示詞或新增圖片", +"Write a prompt, generate, and find the video in Creations.": "寫一段提示詞,生成,再到作品中找到它。", +"Write a prompt, or wait for the run to end": "先寫提示詞,或等目前生成結束", +"Write a scene and generate a video": "寫一段描述,生成影片", +"Write a sentence or add an image first": "先寫一句話或加一張圖片", +"Write a separate prompt for each part in the Edit view.": "為剪輯檢視中的每一段單獨寫提示詞。", +"Write a shorter line by hand": "手動改寫較短的台詞", +"Write each video's settings into it, keeping a backup": "給每個影片寫入生成設定,並保留備份", +"Write in a large box": "在大視窗裡寫", +"Write lines and cuts by time": "按時間寫台詞和鏡頭", +"Write lines and cuts with times in the prompt, and the shot changes at the times you set.": "在提示詞中按時間寫台詞和切鏡,鏡頭會在寫定的時間切換。", +"Write one prompt per line, then add them.": "每行寫一條提示詞後再新增。", +"Write one sentence": "寫一句描述", +"Write one sentence and keep the default settings.": "只寫一句描述,其餘使用預設設定。", +"Write the prompt and click \"Generate\". To return to the previous canvas, click \"Undo\" once.": "寫好描述後點一下「生⁠成」。要回到原來的畫布,點一次「復⁠原」。", +"Write the subject, action, place and camera in the prompt, for example \"the camera slowly moves closer\".": "在「描述畫面」中寫明主體、動作、場景和鏡頭,例如「鏡頭緩緩推近」。", +"Write the subtitles by hand": "請手動填寫字幕", +"Write what happens in this part in the prompt box below and choose \"Generate\" to extend the video.": "在下方提示詞框中填寫這一段的內容,點一下「生⁠成」接續下一段。", +"Write what the sketch shows, for example: a person raising both hands": "寫下草圖畫的是什麼,例如:一個人舉起雙手", +"Write what to say": "寫下要說的話", +"Write what to say and choose the generate button.": "寫下要說的話,點生成按鈕。", +"Write without enhancement; turn on later": "先不下載,之後可再開啟", +"Writing guide": "提示詞寫法", +"Writing part prompts": "正在寫各段提示詞", +"Writing prompt": "生成提示詞", +"Writing the prompt": "正在生成提示詞", +"Writing the prompt. One moment.": "正在生成提示詞,請稍候", +"Writing the script": "正在寫劇本", +"Writing the shot prompts": "正在寫提示詞", +"Yellow": "黃", +"Yesterday": "昨天", +"Yesterday {hm}": "昨天 {hm}", +"You can also delete them later in Settings › Preferences › Storage.": "以後也可以在「設定 → 偏好 → 儲存」裡刪除。", +"You can also download the prompt model ({size}) to refine prompts before generating.": "可以再下載提示詞模型({size}),生成前會自動完善提示詞。", +"You can enlarge up to 200% of the original.": "最多放大到原來的 200%。", +"You disconnected the assistant.": "已中斷與助手的連線。", +"You're up to date.": "已是最新版本。", +"Your edit was not saved.": "變更沒有儲存", +"Your images, newest first": "你的圖片,最新在前", +"Your models and environment are connected.": "已連接模型與執行環境。", +"Your previous model is unchanged and still works. Select \"Try again\", or report a problem.": "原來的模型沒有變化,可以繼續使用。可以點一下「重試」,或提交問題。", +"Your results stay on this computer.": "結果始終保留在本機。", +"Your video is ready": "生成好了", +"Your workspace": "工作空間", +"ZIP files deleted · %s freed": "已刪除壓縮檔 · 釋放 %s", +"Zoom": "縮放", +"Zoom in": "放大", +"Zoom in (Ctrl +)": "放大(Ctrl +)", +"Zoom in / out": "放大 / 縮小", +"Zoom out": "縮小", +"Zoom out (Ctrl −)": "縮小(Ctrl −)", +"[Feedback] Generation did not finish": "[Feedback] 生成未完成", +"[Feedback] LoRA compatibility misjudged": "[Feedback] LoRA 相容判斷有誤", +"[Feedback] LoRA compatibility misjudged: ": "[Feedback] LoRA 相容判斷有誤:", +"[Removed reference]": "[素材已移除]", +"[network share]": "[網路共享]", +"[person] at [place] says to the camera: “[line]”, in [shots] shots.": "【人物】在【地點】對著鏡頭說:「【台詞】」,共【鏡頭數】個鏡頭。", +"a file there is in use by another program. Close that program, then try again.": "該資料夾中有檔案被其他程式佔用。請關閉該程式後再試。", +"a media reference was left out or wrong": "漏掉或寫錯了素材引用", +"a time point was lost or went past the end of the video": "時間點遺失或超出影片時長", +"a user script manager": "使用者指令碼管理器", +"about": "約", +"about (.+) across (\\d+) files": "約 \\1,共 \\2 個檔案", +"about 10–30% faster on this GPU": "在這張顯示卡上預計快約 10–30%", +"about 30 s": "約 30 秒", +"about 6 s": "約 6 秒", +"about twice as fast on this GPU": "在這張顯示卡上預計快約 2 倍", +"about {est} s": "約 {est} 秒", +"about {minutes} min": "約 {minutes} 分鐘", +"about {minutes} min left": "約 {minutes} 分鐘", +"about {minutes} minutes": "約 {minutes} 分鐘", +"about {seconds} s": "約 {seconds} 秒", +"about {seconds} s": "約 {seconds} 秒", +"about {size} GB": "約 {size} GB", +"about {size} GB, files shared with video are not downloaded again": "約 {size} GB,和影片共用的檔案不重複下載", +"about {s} s": "約 {s} 秒", +"added {start}": "{start} 加入", +"aerial shot": "航拍", +"an acceleration LoRA made for the original model. The FreeVideo model is already accelerated and does not need one": "這是為原版模型製作的加速 LoRA。FreeVideo 的模型已經加速,無需此類 LoRA", +"attempt": "正在連線", +"cancel": "取消", +"cat-catch": "貓抓", +"chat": "對話", +"close-up": "特寫", +"crane down": "降鏡頭", +"crane up": "升鏡頭", +"current connection": "目前連線", +"custom source": "自訂來源", +"decode_save": "解碼與影片儲存", +"decoding": "解碼", +"direct": "直連", +"does not match the current model": "和目前模型的結構不匹配", +"dolly in": "推鏡頭", +"dolly out": "拉鏡頭", +"download": "下載", +"downloading files": "下載檔案", +"encoding": "編碼", +"expected {expected}, file has {actual}": "期望 {expected},檔案是 {actual}", +"fallback": "正在切換下載來源", +"fills the prompt box": "填入提示詞框", +"finishing checks": "完成檢查", +"first pass": "第一階段", +"from the creations": "從作品庫選擇", +"from this computer": "從電腦選擇", +"fv-ed-source-add": "+", +"generates": "生成", +"handheld shot": "手持鏡頭", +"high angle": "俯拍", +"history": "提示詞", +"incomplete files may restart": "未完成檔案可能重新下載", +"initialize": "初始化", +"installing packages": "安裝元件", +"it came out too long or empty": "過長或為空", +"latent_save": "儲存潛變數", +"launch": "啟動", +"library": "素材", +"loading the model": "載入模型", +"low angle": "仰拍", +"macOS did not allow the app in its folder to be replaced. Move FreeVideo to the Applications folder, or download the new version from the release page.": "macOS 不允許替換所在資料夾裡的應用程式。請把 FreeVideo 移到「應用程式」資料夾,或去發布頁下載新版本。", +"made for another model": "這是為其他模型製作的 LoRA", +"min": "分鐘", +"minutes": "分鐘", +"model files": "模型檔案", +"model_load": "影片模型準備與載入", +"no ready-made scene fits this sentence. Describe the shot another way.": "沒有適合這句話的現成場景。請換一種說⁠法描述鏡頭。", +"no-progress": "下載無進展", +"not a LoRA file FreeVideo can read": "不是 FreeVideo 能讀取的 LoRA 檔案", +"not made for the FreeVideo model": "不適用於 FreeVideo 的模型", +"now": "現在", +"official source": "官方來源", +"or turn a story into a short film.": "也可以把一個故事拍成短片。", +"orbit shot": "環繞鏡頭", +"original kept": "原聲已保留", +"original weights retained": "保留原始權重", +"originals stay in place": "原檔案保留在原目錄", +"other model files": "其他模型檔案", +"pan left": "左搖鏡頭", +"pan right": "右搖鏡頭", +"plan_failed␟故事或镜头数量不合适,请补充后再试。": "故事或鏡頭數量不合適,請補充後再試。", +"plan_failed␟没能把故事排成合格剧本,请补充镜头内容后再试。": "沒能把故事排成合格劇本,請補充鏡頭內容後再試。", +"preparing downloads": "準備下載", +"preset": "預設", +"preview": "預覽", +"queue operation": "佇列操作", +"quoted text was left out or changed": "漏掉或變更了引號裡的文字", +"resume-refused": "目前下載來源不支援續傳", +"retry": "重試", +"retry (\\d+) in (\\d+)s": "正在重試下載", +"route-retry": "正在切換連線", +"runtime components": "執行元件", +"s": "秒", +"sampling": "取樣", +"sampling caches": "取樣快取", +"sampling data": "取樣資料", +"saving the video": "儲存影片", +"second pass": "第二階段", +"second pass model": "第二階段模型", +"send": "傳送", +"setup": "安裝", +"shard (\\d+ / \\d+)": "正在下載", +"slow motion": "慢動作", +"slow-transfer": "持續低速", +"some sections were missing or out of place": "分段缺失或錯位", +"start": "開始", +"start a new chat": "新增對話", +"started {start}": "{start} 開始", +"static shot": "固定鏡頭", +"stopped at: {stage}": "停在:{stage}", +"submitting the task": "提交任務", +"switching": "正在切換下載來源", +"switching source": "正在切換下載來源", +"switching to streaming": "繼續下載", +"text encoder": "提示詞模型", +"text_encoding": "文字編碼(含載入)", +"the drive is full. Free up space, or choose a folder on another drive.": "磁碟空間不足。請騰出空間,或換一個其他磁碟上的資料夾。", +"the file below": "下面這個檔案", +"the file could not be read. It may be incomplete; download it again.": "檔案無法讀取,可能未下載完整,請重新下載", +"the file stores one alpha value but its layers have different ranks, so the scale of each layer cannot be determined": "檔案只記錄了一個 alpha 值,而各層的 rank 不同,無法確定每層的縮放比例", +"the first build takes longer": "首次準備需要一些時間", +"the folder is no longer there, or its drive was disconnected. Choose the folder again.": "這個資料夾已不存在,或所在磁碟已中斷連線。請重新選擇資料夾。", +"the installation": "安裝", +"the installation check": "安裝檢查", +"the path is too long. Choose a folder closer to the top of the drive.": "路徑太長,請選擇層級更淺的資料夾。", +"the performance measurement": "效能測量", +"the setup task": "安裝任務", +"the spoken lines were out of order": "台詞順序被打亂", +"the system did not allow the file to be written. Choose another folder and try again.": "系統不允許寫入檔案。請換一個資料夾再試一次。", +"then generates": "完成後生成", +"this account cannot write to it. Choose another folder.": "目前帳戶沒有寫入權限,請換一個資料夾。", +"this file": "這個檔案", +"tilt down": "下搖鏡頭", +"tilt up": "上搖鏡頭", +"tomorrow": "明天", +"took {time}": "耗時 {time}", +"tracking shot": "跟拍鏡頭", +"trying another source": "正在嘗試其他下載來源", +"type @{name} in a prompt": "在提示詞裡輸入 @{name}", +"unclear": "請說明要改哪一鏡,以及畫面或時長要怎樣改?", +"under 1 min": "不到 1 分鐘", +"under 1 min left": "不到 1 分鐘", +"under 1 {unit}": "不到 1 {unit}", +"up to {seconds} s": "單次最長 {seconds} 秒", +"upbeat acoustic guitar": "輕快的原聲吉他", +"used {count}×": "用過 {count} 次", +"verifying": "正在檢查", +"video decoder": "影片解碼元件", +"video memory": "顯示卡記憶體", +"video model": "影片模型", +"wide shot": "遠景", +"with prompt": "含提示詞", +"your Python mirror": "自訂 Python 鏡像", +"your configured source": "自訂來源", +"zoom in": "變焦推近", +"zoom out": "變焦拉遠", +"{:,} checked": "已檢查 {} 項", +"{active} waiting": "{active} 個等待中", +"{bad} cannot be used; open a row for the reason.": "{bad} 個不能使用,點開該行檢視原因。", +"{count} boxes": "{count} 個框", +"{count} conversations could not be read": "另有 {count} 個對話無法讀取", +"{count} could not be deleted; they are back.": "有 {count} 個沒能刪除,已放回。", +"{count} creations": "{count} 個作品", +"{count} creations could not be read": "另有 {count} 個作品無法讀取", +"{count} d ago": "{count} 天前", +"{count} earlier videos can get the settings they were made with, so dropping them back onto FreeVideo brings those settings back. Nothing changes before confirming, and each original is kept as a backup (about {size} GB).": "有 {count} 個之前生成的影片可以補上生成時的設定,之後拖回 FreeVideo 即可還原。確認前不會變更任何檔案,每個原影片都會另存一份備份(約 {size} GB)。", +"{count} edits could not be read": "另有 {count} 個剪輯無法讀取", +"{count} files": "{count} 個檔案", +"{count} files could not be loaded. Reload the page; if it stays, report it.": "{count} 個檔案無法載入。請重新整理頁面;仍然出現時請提交問題。", +"{count} files need repair": "有 {count} 個檔案需要修復", +"{count} files · {size}": "{count} 個檔案 · {size}", +"{count} files, {size}": "{count} 個檔案,共 {size}", +"{count} h ago": "{count} 小時前", +"{count} images": "{count} 張圖", +"{count} images deleted": "已刪除 {count} 張圖片", +"{count} imported files": "{count} 個匯入素材", +"{count} imported files could not be read": "另有 {count} 個匯入的檔案無法讀取", +"{count} items could not be read": "另有 {count} 項無法讀取", +"{count} jobs": "{count} 項任務", +"{count} jobs could not be read": "另有 {count} 個任務無法讀取", +"{count} layers do not match": "共 {count} 層不相符", +"{count} lines could not be dubbed. Redub them.": "有 {count} 句無法配音,請重新配音。", +"{count} min ago": "{count} 分鐘前", +"{count} more": "另有 {count} 項", +"{count} music tracks": "{count} 段配樂", +"{count} other LoRA files in the folder are not in .safetensors format and not listed.": "資料夾中另有 {count} 個 LoRA 檔案不是 .safetensors 格式,未列出。", +"{count} parts": "分 {count} 段", +"{count} parts selected": "已選 {count} 段", +"{count} parts · about {minutes} min": "分 {count} 段 · 約 {minutes} 分鐘", +"{count} results": "{count} 個結果", +"{count} selected␟已选 {count} 个": "已選 {count} 個", +"{count} selected␟已选 {count} 个作品": "已選 {count} 個作品", +"{count} sound effects": "{count} 段音效", +"{count} stem sets": "{count} 組分軌", +"{count} tasks": "{count} 個任務", +"{count} tasks, {active} under way": "{count} 個任務,{active} 個進行中", +"{count} videos from this task": "同一任務的 {count} 個影片", +"{count} voiceovers": "{count} 段配音", +"{done} / {total} files": "{done} / {total} 個檔案", +"{done} / {total} frames": "{done} / {total} 影格", +"{done} / {total} layers": "{done} / {total} 層", +"{done} / {total} parts": "{done} / {total} 段", +"{done} / {total} stages complete": "{done} / {total} 階段已完成", +"{done} / {total} · you can keep generating": "{done} / {total} · 可以繼續生成", +"{done} done": "{done} 項已完成", +"{done} of {total} GB": "已下載 {done} / {total} GB", +"{elapsed} so far": "已進行 {elapsed}", +"{extraCount} more folders": "另 {extraCount} 個模型資料夾", +"{failed} could not be changed. Try again.": "有 {failed} 個沒能更改,請重試。", +"{failed} did not finish": "{failed} 項沒有完成", +"{failed} videos were left unchanged and will be offered again.": "另有 {failed} 個影片未變更,之後會再次提示。", +"{failure} Try again.": "{failure}請再試一次。", +"{file} ({size}) differs from the tested version: it will be renamed to {keep_as} and kept, and the tested version ({expected_size}) will be downloaded.": "{file}({size})與 FreeVideo 測試過的版本不同:將改名為 {keep_as} 保留,再下載測試過的版本({expected_size})。", +"{file} ({size}) differs from the version FreeVideo tests: it will be renamed to {keep_as} and kept, then replaced with the version in the offline package ({expected_size}).": "{file}({size})與 FreeVideo 測試過的版本不同:將改名為 {keep_as} 保留,再換成離線安裝包裡的版本({expected_size})。", +"{file} differs from the tested version and was left unchanged.": "{file} 與 FreeVideo 測試過的版本不同,這次沒有修改它。", +"{file} differs from the tested version and was left unchanged. Click Check installation, then Install. After you confirm, the original is renamed and kept, and the tested version is downloaded.": "{file} 和測試過的版本不同,這次沒有變更。請先點一下「檢查安裝」,再點一下「安裝」,確認後原檔案改名保留,再下載測試過的版本。", +"{file} differs from the tested version and was left unchanged. Click Retry installation below: the confirmation page will list this file, and after you confirm, it is renamed and kept, and the tested version is downloaded.": "{file} 與 FreeVideo 測試過的版本不同,這次沒有修改它。請點選下方的「重試安裝」:確認頁會列出這個檔案,確認後會將它改名保留,再下載測試過的版本。", +"{file} differs from the tested version and was left unchanged. Click {entry} again: the confirmation page will list this file, and after you confirm, it will be renamed and kept, and the tested version will be downloaded.": "{file} 與 FreeVideo 測試過的版本不同,這次沒有修改它。請再次點選「{entry}」:確認頁會列出這個檔案,確認後將它改名保留,再下載測試過的版本。", +"{free} available": "可用 {free}", +"{generating} failed. Try again; if it keeps failing, download the report and report the problem.": "{generating}時出錯。請重試;仍然失敗請下載報告並提交問題。", +"{generating} failed. Try again; if it keeps failing, download the report and report the problem. Error code: {code}": "{generating}時出錯。請重試;仍然失敗請下載報告並提交問題。錯誤程式碼:{code}", +"{generating} failed: {received}": "{generating}時出錯:{received}", +"{hours} hours": "{hours} 小時", +"{kept} kept: {using} in use, 1 folder has other files.": "{kept} 個已保留:{using} 個正在使用,1 個資料夾裡有別的檔案。", +"{kept} kept: {using} in use, {other} folders have other files.": "{kept} 個已保留:{using} 個正在使用,{other} 個資料夾裡有別的檔案。", +"{keys} tensors": "共 {keys} 個張量", +"{kind} failed": "{kind}生成失敗", +"{kind} finished": "{kind}生成完成", +"{kind} stopped": "{kind}生成中斷", +"{label}: enter a number from {min} to {max}{suffix}.": "{label}:請輸入 {min} 至 {max}{suffix}。", +"{left} s left": "還剩 {left} 秒", +"{length} longer than the selection and would cover the next clip. Shorten the line or extend the selection.": "比選區長 {length},會蓋住後面的片段。請縮短這句或拉長選區。", +"{length} longer than the selection. Placed at full length.": "比選區長 {length},已按完整長度放入。", +"{level}": "「{level}」等級", +"{minutes} min": "{minutes} 分鐘", +"{minutes} min {seconds} s": "{minutes} 分 {seconds} 秒", +"{minutes} minutes": "{minutes} 分鐘", +"{model} download failed. Retry to continue; if it keeps failing, report the problem.": "{model} 下載失敗。請重試以繼續下載;仍然失敗時,請提交問題。", +"{model} download failed: {reason}. Retry to continue; if it keeps failing, report the problem.": "{model} 下載失敗:{reason}。請重試以繼續下載;仍然失敗時,請提交問題。", +"{more} more after this": "後面還有 {more} 則", +"{more} more queued": "另有 {more} 條排隊", +"{m} min {seconds} s": "{m} 分 {seconds} 秒", +"{name} copy": "{name} 副本", +"{name} did not install": "{name} 安裝失敗", +"{name} is installed": "{name} 已安裝", +"{name} is longer than this video: only its first {used} s were used {rule}": "{name} 比生成的影片長,已擷取前 {used} 秒{rule}", +"{name} is {seconds} s: only its first {used} s were used {rule}": "{name} 時長 {seconds} 秒,已擷取前 {used} 秒{rule}", +"{name} part": "{name} 局部", +"{name} · Completed {done} / {total}": "{name} · 已完成 {done} / {total}", +"{name} · clip {number}": "{name} · 第 {number} 段", +"{name} · {free} available": "{name} · 可用 {free}", +"{name}, clip {number}, {seconds} s, {status}{seamText}": "{name},第 {number} 段,{seconds} 秒,{status}{seamText}", +"{name}, edited. Crop or retouch it again": "{name}(已編輯):繼續裁切或修圖", +"{name}, {count}": "{name},{count}", +"{name}, {count} unread": "{name},{count} 則未讀", +"{name}: {state}. Click to choose another": "{name}:{state}。按一下可換用其他模型", +"{name}: {use}": "{name}:{use}", +"{n} characters": "{n} 字", +"{others} could not be deleted.": "有 {others} 張沒能刪除。", +"{other} files of other formats are not read.": "另有 {other} 個其他格式的檔案不會被讀取。", +"{other} folders have other files, kept.": "{other} 個資料夾裡有別的檔案,已保留。", +"{position} ahead": "前面 {position} 個", +"{queued} queued": "{queued} 項排隊中", +"{reason}; retrying in a mode that uses less memory.␟{reason},正在换一种更省内存的运行方式重试。": "{reason},正在換一種更省記憶體的執行方式重試。", +"{reason}; retrying in a mode that uses less memory.␟{reason},正在换一种更省显存的运行方式重试。": "{reason},正在換一種更省顯示卡記憶體的執行方式重試。", +"{reason}; retrying in another mode.": "{reason},正在換一種執行方式重試。", +"{reason}; the generated result is kept, and a retry is in progress.": "{reason},已保留生成結果,正在重試。", +"{rest} more": "另外 {rest} 拍", +"{rest} s": "{rest} 秒", +"{running} generating": "生成中 {running} 個", +"{seconds} s": "{seconds} 秒", +"{seconds} s still generating; that part exports as black.": "有 {seconds} 秒還在生成,匯出後這部分是黑屏", +"{seconds} s this time · made in {count} parts and joined": "這次 {seconds} 秒 · 分 {count} 段生成後接起來", +"{seconds} s · {status}": "{seconds} 秒 · {status}", +"{share}% of its peak clock": "時脈只有峰值的 {share}%", +"{short} does not take reference images.": "{short} 不使用參考圖。", +"{short} does not take reference images. Remove {extra}.": "{short} 暫不支援參考圖,請移除 {extra} 張。", +"{short} does not take reference images; choose the other model": "{short} 不使用參考圖,請換另一個模型", +"{short} is not installed; Generate installs it first": "{short} 未安裝,按「生成」會先安裝", +"{short} takes at most {limit}. Remove {extra}.": "{short} 最多 {limit} 張,請移除 {extra} 張。", +"{short} takes no references; choose the other model": "{short} 不用參考圖,請換另一個模型", +"{short} takes {limit}; remove this one": "{short} 最多 {limit} 張,請移除這張", +"{short}: {state}": "{short}:{state}", +"{shown} s": "{shown} 秒", +"{shown} s, set by connected nodes": "{shown} 秒,由連線的節點決定", +"{shown} s, set by the audio": "{shown} 秒,由音訊決定", +"{sign}{seconds} s": "{sign}{seconds} 秒", +"{size} at {seconds} s": "{size} 生成 {seconds} 秒", +"{size} could not be deleted. Try again.": "還有 {size} 個沒能刪除,請重試。", +"{size} of the original␟放大到原来的 {size}": "放大到原來的 {size}", +"{size} of the original␟缩到原来的 {size}": "縮到原來的 {size}", +"{size} selected": "已選 {size} 張", +"{size} up to {seconds} s": "{size} 最長 {seconds} 秒", +"{size} · {seconds} s": "{size} · {seconds} 秒", +"{size}.": "{size}。", +"{size}; enlarging makes the image softer.": "{size},畫面會變模糊。", +"{size}; fills a {vsize} video.": "{size},剛好鋪滿 {vsize} 的影片。", +"{skipped} subtitles could not be read and were skipped.": "{skipped} 條字幕無法讀取,已跳過。", +"{stage} timed out. Try again.": "{stage}時等待逾時,請再試一次。", +"{stage}: not enough GPU memory.": "{stage}時顯示卡記憶體不足。", +"{started} s": "{started} 秒", +"{steps} + 3 steps from a larger first pass: more detail": "兩遍 {steps} + 3 步,第一階段更大、細節更多", +"{steps} + 3 steps in two passes: fastest": "兩遍 {steps} + 3 步,最快", +"{steps} + 3 steps in two passes: quick": "兩遍 {steps} + 3 步,速度較快", +"{steps} + {refine} steps": "{steps} + {refine} 步", +"{steps} steps": "{steps} 步", +"{steps} steps in one pass: finer, slower": "一遍 {steps} 步,更細也更慢", +"{steps} {step} of {total}": "{steps}{step} / {total} 步", +"{steps} {step} of {total} ({pass})": "{steps}{step} / {total} 步({pass})", +"{s} s": "{s} 秒", +"{time} so far": "已用 {time}", +"{types} and more": "{types} 等", +"{using} in use, kept.": "{using} 個正在使用,已保留。", +"{value}{NBSP}s": "{value}{NBSP}秒", +"{value}{NBSP}s too long. Original voice kept.": "超出 {value}{NBSP}秒,已保留原聲", +"{value}{NBSP}s too long. Original voice kept. Shorten this line.": "超出 {value}{NBSP}秒,已保留原聲。請縮短這句。", +"{waiting} queued": "排隊 {waiting} 個", +"{waiting} waiting": "排隊 {waiting}", +"✓ Done": "✓ 已完成", +"✓ Environment imported": "✓ 執行環境已匯入", +"✓ Environment ready · now the models": "✓ 執行環境已就緒 · 接下來準備模型", +"✕ Stopped": "✕ 已停止" +} diff --git a/web/lora_check.js b/web/lora_check.js index a6176801..b73f556f 100644 --- a/web/lora_check.js +++ b/web/lora_check.js @@ -1,4 +1,5 @@ // What the LoRA check found, as words for the row; the check itself is /freevideo/lora/check. +import { translatorFor } from './i18n.js'; const FAMILIES = {wan: true, hunyuan: true, ltx: true, sd: true, llm: true}; const size = shape => Array.isArray(shape) ? shape.join('×') : ''; @@ -22,20 +23,20 @@ export function describeVerdict(verdict, t) { const summary = verdict.summary || {}; const lines = []; if (verdict.reason === 'shape') { - const where = Number.isInteger(verdict.block) ? t(`Layer ${verdict.block}: `, `第 ${verdict.block} 层:`) : ''; - lines.push(where + t(`expected ${size(verdict.expected)}, file has ${size(verdict.actual)}`, `期望 ${size(verdict.expected)},文件是 ${size(verdict.actual)}`)); + const where = Number.isInteger(verdict.block) ? t('Layer {block}: ', '第 {block} 层:', { block: verdict.block }) : ''; + lines.push(where + t('expected {expected}, file has {actual}', '期望 {expected},文件是 {actual}', { expected: size(verdict.expected), actual: size(verdict.actual) })); } if (verdict.layer) lines.push(t('Layer: ', '层:') + verdict.layer); if (Array.isArray(verdict.ranks) && verdict.ranks.length) lines.push(t('Ranks: ', 'Rank:') + verdict.ranks.join(', ')); - if (verdict.count > 1) lines.push(t(`${verdict.count} layers do not match`, `共 ${verdict.count} 层不匹配`)); - if (Number.isInteger(summary.keys)) lines.push(t(`${summary.keys} tensors`, `共 ${summary.keys} 个张量`)); + if (verdict.count > 1) lines.push(t('{count} layers do not match', '共 {count} 层不匹配', { count: verdict.count })); + if (Number.isInteger(summary.keys)) lines.push(t('{keys} tensors', '共 {keys} 个张量', { keys: summary.keys })); for (const [key, shape] of summary.first || []) lines.push(`${key} ${size(shape)}`); for (const [key, value] of Object.entries(summary.base || {})) lines.push(`${key}: ${value}`); return {reason, lines}; } /** The text and header summary for a prefilled issue; never the file or its path. */ -export function feedbackDraft(name, verdict, described, t = (en) => en) { +export function feedbackDraft(name, verdict, described, t = translatorFor(null, false)) { const base = String(name).split('/').pop(); const text = ['FreeVideo marked this LoRA as unusable. The verdict is reported as a misjudgment.', `File: ${base}`, `Check result: ${verdict.reason || 'unknown'}${verdict.family ? ` (${verdict.family})` : ''}${described ? `, ${described.reason}` : ''}`].join('\n'); diff --git a/web/middle_frames.js b/web/middle_frames.js index 9a9a0af8..f561b4f9 100644 --- a/web/middle_frames.js +++ b/web/middle_frames.js @@ -44,7 +44,7 @@ export function timeProblems(times, seconds) { export function problemText(problem, seconds, t) { if (problem.code === 'same') return t('Same time as another middle frame. Choose a different time.', '和另一张中间帧的时间相同,请错开。'); const range = timeRange(seconds); - return range ? t(`Must be between ${shown(range.min)} and ${shown(range.max)} s.`, `时间需在 ${shown(range.min)} 到 ${shown(range.max)} 秒之间。`) + return range ? t('Must be between {min} and {max} s.', '时间需在 {min} 到 {max} 秒之间。', { min: shown(range.min), max: shown(range.max) }) : t('Enter a time in seconds.', '请填写时间(秒)。'); } export const labels = { @@ -55,9 +55,10 @@ export const labels = { tooMany: t => t('Enable up to 3 middle frames.', '中间帧最多启用 3 张图片。'), needsBoth: t => t('Middle frames need both a first and a last frame.', '中间帧需要同时有首帧和尾帧。'), firstPartOnly: t => t('Middle frames apply to the first part only.', '中间帧只用于第一段。'), - continuing: t => t('When continuing a video, middle frames are not used; the first and last frames are used as references.', + continuing: t => t('When extending a video, middle frames are not used; the first and last frames are used as references.', '接续视频时不使用中间帧,首尾帧会用作参考图。'), - mode: (count, t) => t(`First + last frame · ${count} middle ${count === 1 ? 'frame' : 'frames'}`, `首尾帧生成 · ${count} 张中间帧`), + mode: (count, t) => count === 1 ? t('First + last frame · 1 middle frame', '首尾帧生成 · 1 张中间帧') + : t('First + last frame · {count} middle frames', '首尾帧生成 · {count} 张中间帧', { count }), chipTitle: (at, t) => `${t('Middle frame', '中间帧')} · ${shown(at)} ${t('s', '秒')}`, }; // The sentence for the notice line when the middle frames cannot be used as they are; '' when they can. diff --git a/web/notifications.js b/web/notifications.js index de7e6e8f..dd4d6764 100644 --- a/web/notifications.js +++ b/web/notifications.js @@ -78,8 +78,8 @@ const NOTE_STATES = new Set(['done', 'failed', 'interrupted']); // A person-readable cause only: the raw code is never shown, so an unknown one gives nothing and the line says where to look. const reasonOf = failure => { const code = failure?.code; - if (code === 'engine_closed') return words(['The engine was closed', '引擎已关闭']); - if (code === 'engine_restarted') return words(['The engine restarted', '引擎已重启']); + if (code === 'engine_closed') return words(['Connection lost', '连接中断']); + if (code === 'engine_restarted') return words(['FreeVideo restarted', 'FreeVideo 已重新启动']); return ''; }; export function noteFromJob(row, previous, now = Date.now()) { @@ -110,13 +110,17 @@ export function installChanges(before = {}, after = {}) { return notes; } // What the worker says about each model, reduced to {state, done, total, label, ready, reason}. -export function installState(info, cn = CN) { +export function installState(info, cn = null) { + // The worker's reason comes in English and Chinese: the page's language reads it through t() (its language file); a + // caller may still ask for one of the two (true: Chinese, false: English). + const say = typeof cn === 'boolean' ? (en, zh) => cn ? zh : en : t; const out = {}; for (const model of info?.models || []) { const install = model.install || {}; const state = model.ready ? 'done' : install.state === 'running' || install.state === 'paused_for_generation' || model.downloading ? 'running' : install.state || 'idle'; out[model.id] = {state, ready: Boolean(model.ready), done: install.done ?? model.bytes_done ?? 0, total: install.total ?? model.bytes_total ?? 0, label: model.label || model.id, - paused: install.state === 'paused_for_generation', reason: clean(cn ? install.message_zh || install.message_en : install.message_en || install.message_zh)}; + paused: install.state === 'paused_for_generation', + reason: clean(install.message_en && install.message_zh ? say(install.message_en, install.message_zh) : install.message_en || install.message_zh || '')}; } return out; } @@ -127,24 +131,25 @@ export function latestFinished(list = jobs.list()) { } // ── Words ── -const KIND = {image: ['Picture', '图像'], video: ['Video', '视频'], chain: ['Long video', '长视频']}; +const KIND = {image: ['Image', '图像'], video: ['Video', '视频'], chain: ['Long video', '长视频']}; const ago = (at, cn = CN) => { const s = Math.max(0, Math.round((Date.now() - at) / 1000)); - if (s < 60) return cn ? '刚刚' : 'Just now'; - if (s < 3600) return cn ? `${Math.floor(s / 60)} 分钟前` : `${Math.floor(s / 60)} min ago`; - if (s < 86400) return cn ? `${Math.floor(s / 3600)} 小时前` : `${Math.floor(s / 3600)} h ago`; - return cn ? `${Math.floor(s / 86400)} 天前` : `${Math.floor(s / 86400)} d ago`; + if (s < 60) return words(['Just now', '刚刚'], cn); + if (s < 3600) return words(['{count} min ago', '{count} 分钟前', { count: Math.floor(s / 60) }], cn); + if (s < 86400) return words(['{count} h ago', '{count} 小时前', { count: Math.floor(s / 3600) }], cn); + return words(['{count} d ago', '{count} 天前', { count: Math.floor(s / 86400) }], cn); }; export function noteWords(note, cn = CN) { const w = pair => words(pair, cn); if (note.type === 'toast') return {title: note.title || w(['Notice', '提醒']), sub: note.reason || (note.status === 'notice' ? '' : w(['Did not finish', '没有完成']))}; if (note.type === 'agent') return {title: note.title || w(['Assistant task', '助手任务']), sub: note.reason || w(['See why', '查看原因'])}; if (note.type === 'install') { - return note.status === 'done' ? {title: w([`${note.label} is installed`, `${note.label} 已安装`]), sub: w(['Ready to use', '可以使用了'])} - : {title: w([`${note.label} did not install`, `${note.label} 安装失败`]), sub: note.reason || w(['Open Images to try again', '打开图像视图重试'])}; + return note.status === 'done' ? {title: w(['{name} is installed', '{name} 已安装', { name: note.label }]), sub: w(['Ready to use', '可以使用了'])} + : {title: w(['{name} did not install', '{name} 安装失败', { name: note.label }]), sub: note.reason || w(['Open Images to try again', '打开图像视图重试'])}; } const kind = w(KIND[note.view === 'editor' ? 'video' : note.kind] || KIND.video); - const head = note.status === 'done' ? w([`${kind} finished`, `${kind}生成完成`]) : note.status === 'failed' ? w([`${kind} failed`, `${kind}生成失败`]) : w([`${kind} stopped`, `${kind}生成中断`]); + const head = note.status === 'done' ? w(['{kind} finished', '{kind}生成完成', { kind }]) : note.status === 'failed' ? w(['{kind} failed', '{kind}生成失败', { kind }]) + : w(['{kind} stopped', '{kind}生成中断', { kind }]); return {title: note.prompt || head, sub: note.prompt ? head : note.status === 'done' ? w(['In Creations', '已放进作品库']) : note.reason || w(['See why', '查看原因'])}; } const ICON = {done: 'check', failed: 'alert', interrupted: 'alert', notice: 'alert'}; @@ -162,7 +167,7 @@ function syncBells() { bell.dataset.unread = String(count); bell.dataset.live = String(liveRows.length > 0); const name = t('Notifications', '通知'); - bell.setAttribute('aria-label', count ? t(`${name}, ${count} unread`, `${name},${count} 条未读`) : name); + bell.setAttribute('aria-label', count ? t('{name}, {count} unread', '{name},{count} 条未读', { name, count }) : name); } } @@ -222,7 +227,7 @@ function liveItems() { for (const [id, item] of Object.entries(installs)) { if (item.state !== 'running') continue; const gb = bytes => (bytes / 1e9).toFixed(1); - items.push({type: 'install', id, title: t(`Installing ${item.label}`, `正在安装 ${item.label}`), fraction: item.total ? Math.min(1, item.done / item.total) : null, + items.push({type: 'install', id, title: t('Installing {label}', '正在安装 {label}', { label: item.label }), fraction: item.total ? Math.min(1, item.done / item.total) : null, state: item.paused ? t('Paused while a video generates', '视频生成中,已暂停') : item.total ? `${gb(item.done)} / ${gb(item.total)} GB` : t('Downloading', '正在下载')}); } return items; @@ -517,7 +522,7 @@ function buildToast(item, more) { act.onclick = () => { queue.close(item); try { spec.action.run(); } catch (error) { console.warn('FreeVideo notice action:', error); } }; box.append(act); } - if (more > 0) { const chip = document.createElement('span'); chip.className = 'fv-toast-more'; chip.textContent = `+${more}`; setTip(chip, {name: t(`${more} more after this`, `后面还有 ${more} 条`)}); box.append(chip); } + if (more > 0) { const chip = document.createElement('span'); chip.className = 'fv-toast-more'; chip.textContent = `+${more}`; setTip(chip, {name: t('{more} more after this', '后面还有 {more} 条', { more })}); box.append(chip); } if (!spec.sticky) { const ring = lifeRing(); ring.style.setProperty('--life', `${spec.ms}ms`); box.append(ring); } const close = document.createElement('button'); close.type = 'button'; close.className = 'fv-toast-x'; close.innerHTML = glyph('close', 14); close.setAttribute('aria-label', t('Close', '关闭')); diff --git a/web/optional_inputs.js b/web/optional_inputs.js index a5802b1b..d669d2ff 100644 --- a/web/optional_inputs.js +++ b/web/optional_inputs.js @@ -2,7 +2,7 @@ // shape. A workflow restored from an older version, or a widget list that moved, // can leave an empty or missing value in them, and Comfy then rejects the whole // request. Keep each of them to a value the server accepts. -const DEFAULTS = {refine_from: '', continue_from: '', frames: 0, first_frame_reference: false, force_regenerate: false, preview: false, voice_reference: false, hide_tail: false, step_cache: 'none', upscale_factor: '2'}; +const DEFAULTS = {refine_from: '', continue_from: '', frames: 0, first_frame_reference: false, force_regenerate: false, preview: false, voice_reference: false, hide_tail: false, step_cache: 'none', fast_mode: 'none', upscale_factor: '2'}; // A workflow saved before Step cache existed holds '' where it now sits. const STEP_CACHE_OPTIONS = ['none', 'easycache-av', 'fbcache']; // Likewise for Upscale factor, appended after Step cache. @@ -31,6 +31,7 @@ export function optionalInputValue(name, value) { if (name === 'refine_from' || name === 'continue_from') return optionalText(value); if (BOOLEANS.has(name)) return value === true; if (name === 'step_cache') return STEP_CACHE_OPTIONS.includes(value) ? value : 'none'; + if (name === 'fast_mode') return value === 'fast2' ? value : 'none'; if (name === 'upscale_factor') return UPSCALE_OPTIONS.includes(value) ? value : '2'; return value; } diff --git a/web/other_usage.js b/web/other_usage.js index ffa94042..98b70eb9 100644 --- a/web/other_usage.js +++ b/web/other_usage.js @@ -20,6 +20,21 @@ export function otherUsageText(notice, t, fact = false) { return t(...OTHER_USAGE_COPY[key]).replaceAll('{vram_gib}', notice.vram_gib.toFixed(1)) .replaceAll('{ram_gib}', notice.ram_gib.toFixed(1)); } +// The engine's failure reason and its next step, each looked up whole. A memory reason the engine wrote with the note +// on other programs (agent/errors.py reasons(): reason_en/reason_zh hold it without the note) gets the note from the +// template above, so no language file needs a sentence per number. +export function engineReason(error, t) { + // Only when the template reads exactly as the engine's note in both languages (the engine rounds half to even, so + // 5.25 GB is 5.2 there and 5.3 here); otherwise the engine's whole sentence, as before. + const same = [[error.error_en, en => en], [error.error_zh, (en, zh) => zh]].every(([text, pick]) => { + const note = otherUsageText(error.other_usage, pick, true); + return note && typeof text === 'string' && text.endsWith(note); + }); + const note = error.reason_en && error.reason_zh && same ? otherUsageText(error.other_usage, t, true) : ''; + const said = note ? t(error.reason_en, error.reason_zh) : t(error.error_en, error.error_zh || error.error_en); + const step = error.next_en || error.next_zh ? t(error.next_en || '', error.next_zh || '') : ''; + return [said, note, step].filter(Boolean).reduce((text, more) => text.replace(/[。.]$/, '') + t('. ', '。') + more); +} export function claimOtherUsage(notice, storage) { try { storage ??= globalThis.sessionStorage; diff --git a/web/palette.js b/web/palette.js index 87b9e0af..e7f995ee 100644 --- a/web/palette.js +++ b/web/palette.js @@ -198,7 +198,7 @@ export async function openCreations({selectedWork = null} = {}) { if (own && !selectedWork && own.getClientRects().length) { own.click(); return; } const {openLibrary} = await import('./library.js'); const name = words(VIEW_NAMES[view] || VIEW_NAMES.studio); - openLibrary(t, {selectedWork, back: view === 'studio' ? null : t(`Back to ${name}`, `返回${name}`)}); + openLibrary(t, {selectedWork, back: view === 'studio' ? null : t('Back to {name}', '返回{name}', { name })}); } const THEME_KEY = 'freevideo.theme'; function setTheme(theme) { @@ -245,8 +245,9 @@ const G = {views: ['Views', '视图'], generate: ['Generate', '生成'], works: export function builtinCommands() { const viewCommands = VIEW_KEYS.map((view, index) => ({ id: `view.${view}`, group: G.views, icon: VIEW_ICONS[view], key: `Alt+${index + 1}`, - title: [`Go to ${words(VIEW_NAMES[view], false)}`, `切换到${/^[A-Za-z]/.test(words(VIEW_NAMES[view], true)) ? ' ' : ''}${words(VIEW_NAMES[view], true)}`], - use: {studio: ['Make videos from a description', '用描述生成视频'], image: ['Make and edit pictures', '生成和编辑图片'], nodes: ['The workflow behind the views', '各视图背后的工作流'], + title: {studio: ['Go to Create', '切换到创作面板'], image: ['Go to Images', '切换到图像视图'], nodes: ['Go to Nodes', '切换到节点视图'], + editor: ['Go to Edit', '切换到剪辑视图'], autopilot: ['Go to Autopilot', '切换到 AI 全自动']}[view], + use: {studio: ['Make videos from a prompt', '用提示词生成视频'], image: ['Make and edit images', '生成和编辑图片'], nodes: ['The workflow behind the views', '各视图背后的工作流'], editor: ['Cut, join and add sound', '剪辑、拼接和配声音'], autopilot: ['Let the assistant make a film', '让助手做一部片子']}[view], keywords: {studio: ['create', 'video', 'chuangzuo', 'czmb'], image: ['picture', 'tuxiang', 'txst'], nodes: ['workflow', 'graph', 'jiedian', 'jdst'], editor: ['edit', 'cut', 'timeline', 'jianji', 'jjst'], autopilot: ['agent', 'assistant', 'ai', 'quanzidong', 'qzd']}[view], when: () => currentView() !== view, @@ -261,7 +262,7 @@ export function builtinCommands() { keywords: ['progress', 'task', 'jindu', 'renwu'], when: () => jobs.active().length > 0, run: goToRunning}, {id: 'jobs.latest', group: G.works, icon: 'clock', title: ['Go to the latest generation', '跳到最近生成'], use: ['Show what was made last', '打开最近一次生成的结果'], keywords: ['recent', 'last', 'result', 'zuijin', 'zjsc'], run: goToLatest}, - {id: 'library.open', group: G.works, icon: 'grid', title: ['Open Creations', '打开作品库'], use: ['Every video and picture made here', '生成过的全部视频和图片'], + {id: 'library.open', group: G.works, icon: 'grid', title: ['Open Creations', '打开作品库'], use: ['Every video and image made here', '生成过的全部视频和图片'], keywords: ['library', 'works', 'gallery', 'zuopin', 'zpk'], run: () => openCreations()}, {id: 'library.trash', group: G.works, icon: 'trash', title: ['Recently deleted', '最近删除'], use: ['Bring back deleted creations', '找回删掉的作品'], keywords: ['trash', 'bin', 'restore', 'undo', 'shanchu', 'zjsc'], run: async () => { await openCreations(); dispatchEvent(new CustomEvent('freevideo-command', {detail: {id: 'library.trash', view: 'library', handled: false}})); }}, @@ -335,8 +336,8 @@ function build() { for (const item of SCOPES) { const chip = document.createElement('button'); chip.type = 'button'; chip.className = 'fv-pal-chip'; chip.tabIndex = -1; chip.setAttribute('role', 'tab'); chip.dataset.scope = item.id; chip.textContent = words(item.label); - Object.assign(chip.dataset, {fvTipName: words(item.label), fvTipUse: words({all: ['Everything at once', '一次看全部'], actions: ['Only things to do', '只看可执行的操作'], works: ['Videos and pictures made here', '生成过的视频和图片'], - prompt: ['Prompts used before', '用过的描述'], cast: ['Characters, scenes and props', '角色、场景和道具'], settings: ['Appearance, language, settings', '外观、语言和设置']}[item.id]), fvTipKey: formatKeys('Tab')}); + Object.assign(chip.dataset, {fvTipName: words(item.label), fvTipUse: words({all: ['Everything at once', '一次看全部'], actions: ['Only things to do', '只看可执行的操作'], works: ['Videos and images made here', '生成过的视频和图片'], + prompt: ['Prompts used before', '用过的提示词'], cast: ['Characters, scenes and props', '角色、场景和道具'], settings: ['Appearance, language, settings', '外观、语言和设置']}[item.id]), fvTipKey: formatKeys('Tab')}); chip.onclick = () => { setScope(item.id); ui.input.focus({preventScroll: true}); }; ui.scopes.append(chip); } @@ -426,8 +427,8 @@ function makeOfQuery(q) { const text = q.trim(); if (!text) return []; const short = text.length > 24 ? text.slice(0, 23) + '…' : text; return [ - {id: 'make.image', icon: 'image', title: [`Make a picture of “${short}”`, `用“${short}”作为描述生成图像`], use: ['Puts it in the Images prompt', '填进图像视图的描述框'], key: '', run: () => fillPrompt(text, {view: 'image', fallbackView: 'image'})}, - {id: 'make.video', icon: 'film', title: [`Make a video of “${short}”`, `用“${short}”作为描述生成视频`], use: ['Puts it in the Create prompt', '填进创作面板的描述框'], key: '', run: () => fillPrompt(text, {view: 'studio', fallbackView: 'studio'})}, + {id: 'make.image', icon: 'image', title: ['Make an image of “{prompt}”', '用“{prompt}”作为提示词生成图像', { prompt: short }], use: ['Puts it in the Images prompt box', '填进图像视图的提示词框'], key: '', run: () => fillPrompt(text, {view: 'image', fallbackView: 'image'})}, + {id: 'make.video', icon: 'film', title: ['Make a video of “{prompt}”', '用“{prompt}”作为提示词生成视频', { prompt: short }], use: ['Puts it in the Create prompt box', '填进创作面板的提示词框'], key: '', run: () => fillPrompt(text, {view: 'studio', fallbackView: 'studio'})}, ].map((command, order) => ({command, section: 'make', ranges: [], order: 1e6 + order})); } @@ -457,7 +458,7 @@ function draw() { const addResults = (id, {limit = Infinity, label = null, gridded = false} = {}) => { const found = group(id); if (!found?.items.length) return 0; const items = found.items.slice(0, limit); - const more = scope === 'all' && found.total > items.length ? {scope: id === 'prompt' ? 'prompt' : id, label: t(`See all ${found.total}`, `查看全部 ${found.total} 项`)} : null; + const more = scope === 'all' && found.total > items.length ? {scope: id === 'prompt' ? 'prompt' : id, label: t('See all {total}', '查看全部 {total} 项', { total: found.total })} : null; heading(label || words(found.label), more); if (gridded) { const grid = document.createElement('div'); grid.className = 'fv-pal-grid'; grid.setAttribute('role', 'group'); const gridId = ++grids; @@ -504,8 +505,8 @@ function draw() { const head = document.createElement('b'); const line = document.createElement('span'); if (searchState === 'error' && scope !== 'actions') { head.textContent = t('Could not search the creations', '暂时无法搜索作品'); line.textContent = t('Try again in a moment.', '请稍后再试。'); } - else if (q) { head.textContent = t(`No results for “${q}”`, `没有找到“${q}”`); line.textContent = onlyMake ? t('Try another word, or use it as a prompt.', '换个词,或直接用它作为描述生成。') : t('Try another word.', '换个词试试。'); } - else { head.textContent = t('Nothing here yet', '这里还没有内容'); line.textContent = {works: t('Videos and pictures show here once made.', '生成的视频和图片会出现在这里。'), prompt: t('Prompts show here once used.', '用过的描述会出现在这里。'), cast: t('Characters show here once created.', '创建的角色会出现在这里。')}[scope] || ''; } + else if (q) { head.textContent = t('No results for “{q}”', '没有找到“{q}”', { q }); line.textContent = onlyMake ? t('Try another word, or use it as a prompt.', '换个词,或直接用它作为提示词生成。') : t('Try another word.', '换个词试试。'); } + else { head.textContent = t('Nothing here yet', '这里还没有内容'); line.textContent = {works: t('Videos and images show here once made.', '生成的视频和图片会出现在这里。'), prompt: t('Prompts show here once used.', '用过的提示词会出现在这里。'), cast: t('Characters show here once created.', '创建的角色会出现在这里。')}[scope] || ''; } empty.append(art, head, line); if (onlyMake) ui.list.replaceChildren(empty, fragment); else { ui.list.replaceChildren(empty); } active = Math.min(active, Math.max(0, rows.length - 1)); mark(false); @@ -621,7 +622,7 @@ export function commandFailure(command, error, report = openIssue) { const server = /\bHTTP\s*\d{3}\b/.test(String(error?.message ?? error ?? '')) || Number.isInteger(error?.status); if (reason && !server) return [reason, {tone: 'fail'}]; // The pill holds one short line beside the button; the server's sentence goes in the detail (the bell keeps both). - return [t(`Failed: “${name}”`, `“${name}”没有完成`), {tone: 'fail', ...(reason ? {detail: reason} : {}), action: { + return [t('Failed: “{name}”', '“{name}”没有完成', { name }), {tone: 'fail', ...(reason ? {detail: reason} : {}), action: { label: t('Report', '提交问题'), use: t('Open the feedback form with this error filled in', '打开反馈表,已填好这条错误'), run: () => report(t, {where: ['Command palette', '命令面板'], message: `${name}: ${String(error?.message ?? error ?? '')}`, kind: 'command', facts: {command: command.id}})}}]; } @@ -671,7 +672,7 @@ export function paletteButton(translate = t, className = 'fv-cmd-entry') { button.innerHTML = glyph('search'); const name = translate('Search and commands', '搜索与命令'); button.setAttribute('aria-label', name); button.setAttribute('aria-keyshortcuts', MAC ? 'Meta+K' : 'Control+K'); - Object.assign(button.dataset, {fvTipName: name, fvTipUse: translate('Search works and run any action', '搜索作品、提示词并执行操作'), fvTipKey: formatKeys('Mod+K')}); + Object.assign(button.dataset, {fvTipName: name, fvTipUse: translate('Search creations and run any action', '搜索作品、提示词并执行操作'), fvTipKey: formatKeys('Mod+K')}); button.onclick = () => togglePalette(); return button; } diff --git a/web/panel_shell.css b/web/panel_shell.css new file mode 100644 index 00000000..c98784d5 --- /dev/null +++ b/web/panel_shell.css @@ -0,0 +1,157 @@ +/* Three columns for the creation panel (settings | stage | works); body[data-cols=3] is set by studio.js. */ +.fv-studio.fv-create .fv-body[data-cols="3"]{--ps-l:var(--fv-col-w,300px);--ps-r:var(--fv-col-w,300px);--ps-rail:56px;display:grid;grid-template-columns:var(--ps-l) minmax(0,1fr) var(--ps-r);grid-template-rows:minmax(0,1fr);position:relative} +.fv-studio.fv-create .fv-body[data-cols="3"][data-left=rail]{--ps-l:var(--ps-rail)} +.fv-studio.fv-create .fv-body[data-cols="3"][data-right=rail]{--ps-r:var(--ps-rail)} +.fv-studio.fv-create .fv-body[data-cols="3"]:not([data-hx-wcol]){grid-template-columns:var(--ps-l) minmax(0,1fr)} +.fv-studio.fv-create .fv-body[data-cols="3"]>.fv-controls{grid-row:1;grid-column:1;justify-self:stretch;width:auto;padding:var(--fv-sp-16);overflow:auto} +.fv-studio.fv-create .fv-body[data-cols="3"]>.fv-preview-column{grid-row:1;grid-column:2} +.fv-studio.fv-create .fv-body[data-cols="3"]>.fv-work-column{grid-row:1;grid-column:3;min-width:0;overflow:auto;position:relative} +@media(min-width:720px){.fv-studio.fv-create .fv-body[data-cols="3"]>.fv-work-column:not([hidden]){display:flex;flex-direction:column;overflow:hidden}} +.fv-body[data-cols="3"] .fv-iv-rail{display:none} +.fv-body[data-cols="3"] [data-collapsed=true]>.fv-iv-rail{display:flex;position:absolute;inset:0;flex-direction:column;align-items:center;gap:8px;padding:12px 0;background:inherit} +.fv-body[data-cols="3"] [data-collapsed=true]>:not(.fv-iv-rail){visibility:hidden;display:none} +/* The right column's parts are the image view's (image_view.css writes them for .fv-iv and .fv-work-column alike); the tokens they read are set here. */ +.fv-body[data-cols="3"]>.fv-work-column{--fv-ink:var(--fv-fg);--fv-muted:var(--fv-fg2);--fv-disabled:var(--fv-fg3);--fv-border:var(--fv-line2);--fv-sheen:var(--fv-line2);--fv-canvas:rgb(var(--fv-tint));--fv-card:rgb(var(--fv-solid2));--fv-raised:rgb(var(--fv-solid3));--fv-hover:var(--fv-ctl-hover);--fv-accent:var(--fv-accent-ink);--fv-danger:var(--fv-warn);--fv-danger-subtle:var(--fv-warn-soft); + --iv-well:rgb(0 0 0 / .22);--iv-hair:rgb(255 255 255 / .08);--iv-gut:12px;--iv-rail:56px;--iv-dur:var(--fv-dur-2,200ms);--iv-ease:var(--fv-ease-out,cubic-bezier(.2,.8,.2,1));color:var(--fv-fg);font-size:var(--fv-fs-2,13px);line-height:1.45;-webkit-user-select:none;user-select:none} +:root[data-theme=light] .fv-body[data-cols="3"]>.fv-work-column{--iv-well:rgb(20 24 32 / .045);--iv-hair:rgb(0 0 0 / .06)} +/* Works page extras: a run's cover, the check that picks two videos to compare, the mark of a failed read, the info page's button. */ +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile.fv-task-head:not(.fv-task-open){box-shadow:3px -3px 0 0 var(--fv-line2)} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile-n{position:absolute;left:4px;bottom:4px;z-index:1;min-width:16px;height:16px;padding:0 4px;box-sizing:border-box;border-radius:var(--fv-r-pill,999px);background:rgb(0 0 0 / .55);color:#fff;font-size:11px;font-weight:600;line-height:16px;text-align:center;pointer-events:none} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile>span.fv-recent-check{position:absolute;top:4px;left:4px;z-index:2;display:inline-grid;place-items:center;box-sizing:border-box;width:16px;height:16px;border:1.5px solid #fff;border-radius:var(--fv-r-pill,999px);background:rgb(0 0 0 / .4);color:#fff;font-size:11px;font-weight:600;line-height:1;opacity:0;transition:opacity var(--fv-dur-1,120ms) var(--fv-ease-out,ease-out);cursor:pointer} +.fv-body[data-cols="3"] .fv-work-column :is(.fv-iv-tile:hover,.fv-iv-tile:focus-within) .fv-recent-check,.fv-body[data-cols="3"] .fv-work-column[data-picking=true] .fv-recent-check,.fv-body[data-cols="3"] .fv-work-column .fv-iv-works[data-selecting=true] .fv-recent-check,.fv-body[data-cols="3"] .fv-work-column .fv-iv-works[data-picking=true] .fv-recent-check{opacity:1} +@media(hover:none){.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile>span.fv-recent-check{opacity:1}} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile[data-picked] .fv-recent-check{border-color:var(--fv-accent-fill);background:var(--fv-accent-fill)} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile[data-picked="1"] .fv-recent-check::after{content:"1"} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile[data-picked="2"] .fv-recent-check::after{content:"2"} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-tile[data-picked]{box-shadow:0 0 0 2px var(--fv-accent-fill)} +.fv-body[data-cols="3"] .fv-work-column .fv-recent-fail{display:inline-flex;align-items:center;justify-content:center;flex:none;width:24px;height:24px;margin-right:4px;padding:0;border:0;border-radius:var(--fv-rad-ctl,12px);background:none;color:var(--fv-warn)} +.fv-body[data-cols="3"] .fv-work-column button.fv-recent-fail:not(:disabled){cursor:pointer} +.fv-body[data-cols="3"] .fv-work-column button.fv-recent-fail:hover:not(:disabled){background:var(--fv-ctl-hover)} +.fv-body[data-cols="3"] .fv-work-column button.fv-recent-fail:disabled{opacity:.6} +.fv-body[data-cols="3"] .fv-work-column span.fv-recent-fail{cursor:default} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-info-error{margin:8px 0 0;color:var(--fv-warn);overflow-wrap:anywhere} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-info-reuse{display:inline-flex;align-items:center;height:32px;margin-top:12px;padding:0 12px;border-radius:var(--fv-rad-ctl,12px);background:var(--fv-ctl-bg);box-shadow:inset 0 0 0 1px var(--fv-line);color:var(--fv-fg);cursor:pointer} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-info-reuse:hover{background:var(--fv-ctl-hover)} +/* The works column's rail sits outside .fv-iv, so the image view's rail sizes are given here. */ +.fv-body[data-cols="3"] [data-collapsed=true]>.fv-iv-rail{opacity:1;pointer-events:auto} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-rail .fv-iv-icon-btn{width:var(--fv-h,36px);height:var(--fv-h,36px)} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-rail-sep{width:24px;height:1px;background:var(--fv-line2);margin:4px 0} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-rail-thumbs{display:flex;flex-direction:column;gap:8px;overflow:hidden;min-height:0} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-rail-thumb{flex:none;width:40px;height:40px;padding:0;border:0;border-radius:var(--fv-rad-ctl,12px);overflow:hidden;cursor:pointer;background:rgb(var(--fv-tint))} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-rail-thumb img{width:100%;height:100%;object-fit:cover;display:block} +.fv-body[data-cols="3"] .fv-work-column .fv-iv-rail-thumb.fv-iv-current{box-shadow:0 0 0 2px var(--fv-accent-ink)} +.fv-body[data-cols="3"] [data-collapsed=false]>.fv-iv-collapse{position:absolute;top:8px;right:8px;z-index:2} +@media(min-width:720px) and (max-width:1279px){ + .fv-studio.fv-create .fv-body[data-cols="3"],.fv-studio.fv-create .fv-body[data-cols="3"]:not([data-hx-wcol]){grid-template-columns:var(--ps-rail) minmax(0,1fr) var(--ps-rail)} + .fv-body[data-cols="3"][data-drawer]>:is(.fv-controls,.fv-work-column){z-index:4} + .fv-studio.fv-create .fv-body[data-cols="3"][data-drawer=left]>.fv-controls,.fv-studio.fv-create .fv-body[data-cols="3"][data-drawer=right]>.fv-work-column{position:absolute;top:var(--ps-gut,12px);bottom:var(--ps-gut,12px);width:var(--fv-col-w,300px);background:rgb(var(--fv-solid2))} + .fv-studio.fv-create .fv-body[data-cols="3"][data-drawer=left]>.fv-controls{left:var(--ps-gut,12px)}.fv-studio.fv-create .fv-body[data-cols="3"][data-drawer=right]>.fv-work-column{right:var(--ps-gut,12px)} +} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section[data-section=size] .fv-iv-sec-inner>.fvp-chip{background:var(--fv-ctl-bg)} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section[data-section=size] .fv-iv-sec-inner>.fvp-chip:is(:hover:not(:disabled),[aria-expanded=true]){background:var(--fv-ctl-hover)} +/* the stage takes the middle column's width (a 12 px gutter a side, as the picture view's grid does), whatever the window's width */ +.fv-studio.fv-create .fv-body[data-cols="3"]>.fv-preview-column,.fv-studio.fv-create .fv-body[data-cols="3"][data-recent]>.fv-preview-column,.fv-studio.fv-create .fv-body[data-cols="3"][data-tall]>.fv-preview-column{padding-inline:var(--ps-gut,12px)} +/* panels: glass cards with a gutter, like the picture view's */ +.fv-studio.fv-create .fv-body[data-cols="3"]{--ps-gut:12px;padding:var(--ps-gut);gap:var(--ps-gut);box-sizing:border-box} +.fv-studio.fv-create .fv-body[data-cols="3"]>:is(.fv-controls,.fv-work-column){border-radius:var(--fv-rad-dock,20px);overflow:hidden;min-width:0} +.fv-studio.fv-create .fv-body[data-cols="3"]>.fv-controls{display:flex;flex-direction:column;gap:0;padding:0;width:auto;position:relative} +.fv-body[data-cols="3"] .fv-sc-head{flex:none;display:flex;align-items:center;justify-content:space-between;height:52px;padding:0 8px 0 16px} +.fv-body[data-cols="3"] .fv-sc-head-title{font-size:var(--fv-fs-3,16px);font-weight:600} +.fv-body[data-cols="3"] .fv-sc-head .fv-iv-collapse{position:static;width:32px;height:32px;display:grid;place-items:center;border:0;border-radius:var(--fv-r-sm,8px);background:none;color:var(--fv-fg2,inherit);cursor:pointer} +.fv-body[data-cols="3"] .fv-sc-head .fv-iv-collapse:hover{background:rgb(var(--fv-tint) / .08)} +.fv-body[data-cols="3"] .fv-sc-head .fv-iv-collapse svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6} +.fv-body[data-cols="3"] .fv-sc-scroll{flex:1;min-height:0;overflow:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;padding:0 0 8px;--iv-dur:var(--fv-dur-2,200ms);--iv-ease:var(--fv-ease-out,cubic-bezier(.2,.8,.2,1))} +.fv-body[data-cols="3"] .fv-sc-foot{flex:none;padding:8px 16px 16px;border-top:1px solid var(--fv-line)} +/* the prompt's row of keys is the picture view's (fv-iv-prompt-bar, fv-iv-text-btn): the chips only lose their own face here */ +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-tools .fv-iv-text-btn{flex:none;width:auto;height:28px;min-height:0;padding:0 5px;border:0;border-radius:var(--fv-rad-ctl,12px);background:transparent;box-shadow:none;color:var(--fv-fg2);font-size:var(--fv-fs-1,12px);font-weight:500;gap:4px} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-tools .fv-iv-text-btn:hover{background:var(--fv-ctl-hover);color:var(--fv-fg)} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-tools .fv-iv-text-btn[aria-pressed=true]{background:var(--fv-accent-soft);color:var(--fv-accent-ink)} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-tools .fv-iv-text-btn svg{width:16px;height:16px;flex:none} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fv-iv-sec-tools .fv-prompt-tools{position:static;inset:auto;display:flex;align-items:center;gap:2px;margin:0} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fv-iv-sec-tools :is(button,a){position:static;flex:none;width:28px;height:28px;min-width:0;min-height:0;padding:0;display:grid;place-items:center;border:0;border-radius:var(--fv-rad-ctl,12px);background:transparent;box-shadow:none;color:var(--fv-fg3)} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fv-iv-sec-tools :is(button,a):hover{background:var(--fv-ctl-hover);color:var(--fv-fg)} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fv-iv-sec-tools .fv-prompt-draft-note{width:auto;max-width:96px;padding:0 6px;font-size:var(--fv-fs-1,12px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray{position:static;display:block;width:auto;max-height:none;margin:8px 0 0;padding:0;border:0;background:none;box-shadow:none;animation:none;backdrop-filter:none;-webkit-backdrop-filter:none} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray:not([open]){display:none} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray-head{display:none} +/* the advanced tray's own "Restore defaults" keeps its place as a row of the section (its popup rule floats it over the first row) */ +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fvs-tray.fv-at[data-fv-pop]>.fvs-tray-head{display:flex;position:static;justify-content:flex-end;margin:0 0 8px} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fvs-tray.fv-at[data-fv-pop]>.fvs-tray-head:not([data-hx-rst]){display:none} +/* settings column: the console's own rules no longer reach these controls, so the column carries its own */ +.fv-body[data-cols="3"] .fv-sc-scroll{padding-bottom:24px} +.fv-body[data-cols="3"] .fvs-console-prompt .fv-label{display:none} +.fv-body[data-cols="3"] .fvs-console-prompt{background:none;border:0;padding:0;margin:0} +.fv-body[data-cols="3"] .fvs-console-prompt .fv-section{margin:0;padding:0;border:0;background:none} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-tools{flex-wrap:wrap;height:auto;min-height:28px;row-gap:4px;gap:2px} +.fv-body[data-cols="3"] .fv-sc-section .fv-enhance-bar{flex:1 0 100%;min-height:36px;padding:0;border:0} +.fv-body[data-cols="3"] .fv-sc-section .fv-iv-sec-inner>:is(.fvp-chip,.fvs-stepper){width:100%;justify-content:flex-start;box-sizing:border-box} +/* quality: the four names as one segmented row, in place of the slider */ +.fv-body[data-cols="3"] .fv-effort-heading>span:first-child{display:none} +.fv-body[data-cols="3"] .fv-effort-heading{justify-content:flex-end;margin:0 0 6px} +/* the slider rail stays the keyboard target (arrows, Home, End), seen as a ring round the four names while it has focus */ +.fv-body[data-cols="3"] .fv-effort{position:relative} +.fv-body[data-cols="3"] .fv-effort-rail{position:absolute;left:0;top:0;width:1px;height:1px;overflow:hidden;opacity:0;pointer-events:none} +.fv-body[data-cols="3"] .fv-effort[data-hx-rail] .fv-effort-names{outline:2px solid var(--fv-accent,#1a8cff);outline-offset:2px} +.fv-body[data-cols="3"] .fv-effort-names{height:auto;margin:0;display:grid;grid-template-columns:repeat(4,1fr);gap:2px;padding:2px;border-radius:var(--fv-r-md,10px);background:var(--fv-ctl-bg,rgb(var(--fv-tint) / .06))} +/* With the Fast level listed (sampling_effort.js data-fast) the strip has five levels, one row of five. */ +.fv-body[data-cols="3"] .fv-effort-names[data-fast]{grid-template-columns:repeat(5,1fr)} +.fv-studio .fv-body[data-cols="3"] .fv-effort .fv-effort-name{position:static;transform:none;height:28px;min-width:0;padding:0 2px;border-radius:var(--fv-r-sm,8px);font-size:var(--fv-fs-1,12px);line-height:28px;text-align:center;overflow:hidden;text-overflow:ellipsis} +.fv-studio .fv-body[data-cols="3"] .fv-effort .fv-effort-name[data-active]{background:var(--fv-ctl-hover,rgb(var(--fv-tint) / .14));color:var(--fv-fg,inherit)} +/* second pass: three equal segments */ +.fv-body[data-cols="3"] .fv-pass-mode{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;width:100%;box-sizing:border-box} +.fv-body[data-cols="3"] .fv-pass-mode button{min-width:0;padding:0 2px;overflow:hidden;text-overflow:ellipsis} +/* the prompt history, templates and presets: a card over the stage's lower part beside the settings column (its host is the body here) */ +.fv-studio.fv-create .fv-body[data-cols="3"]>.fvs-library{position:absolute;left:calc(var(--ps-l,300px) + 2 * var(--ps-gut,12px));right:auto;bottom:calc(2 * var(--ps-gut,12px));width:min(520px,calc(100% - var(--ps-l,300px) - var(--ps-r,300px) - 6 * var(--ps-gut,12px)));max-height:min(60vh,520px);z-index:7} +/* the drawer is open (a window under 1280 px wide, or a portrait one): the card stands to the right of it, never over the settings or Generate */ +.fv-studio.fv-create .fv-body[data-cols="3"][data-drawer=left]>.fvs-library{left:calc(var(--fv-col-w,300px) + 3 * var(--ps-gut,12px));width:min(520px,calc(100% - var(--fv-col-w,300px) - 4 * var(--ps-gut,12px)))} +/* the status line is a row of the foot, above Generate (in the console it floated over the dock's edge, which the column's card would clip) */ +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-foot .fvs-console-status{position:static;inset:auto;transform:none;height:auto;min-height:0;display:flex;flex-direction:column;align-items:stretch;gap:0;padding:0;background:none;box-shadow:none} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-foot .fvs-console-status>:not([hidden]):not(:empty){margin-bottom:8px!important;white-space:normal;overflow:visible;text-overflow:clip} +/* foot: the main button 244 px and a 40 px dropdown, 2 px apart; no progress fill */ +.fv-body[data-cols="3"] .fv-sc-foot{background:none} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runbar{position:static;padding:0;background:none} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow{display:flex;gap:2px;align-items:stretch;position:relative} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow>.fv-primary{flex:1;min-width:0;height:var(--fv-h-lg,44px);min-height:var(--fv-h-lg,44px);padding:0 12px;border:0;border-radius:var(--fv-rad-ctl,12px) 6px 6px var(--fv-rad-ctl,12px);background:var(--fv-accent-fill);color:#fff;font-size:var(--fv-fs-3,16px);font-weight:600;background-image:none;box-shadow:inset 0 1px 0 rgb(255 255 255 / .25),inset 0 -1px 0 rgb(0 0 0 / .12),0 10px 24px -10px rgb(15 116 214 / .75);white-space:nowrap;overflow:hidden} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow>.fv-primary::before,.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow>.fv-primary::after{background:none!important;width:0!important} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow>.fv-primary:disabled{opacity:.5} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow>:is(.fv-key-more,.fv-run-options){flex:none;width:40px;height:var(--fv-h-lg,44px)} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow>.fv-key-more>summary{height:var(--fv-h-lg,44px);width:40px;display:grid;place-items:center;padding:0;border:0;border-radius:6px var(--fv-rad-ctl,12px) var(--fv-rad-ctl,12px) 6px;background:var(--fv-accent-fill);box-shadow:inset 0 1px 0 rgb(255 255 255 / .25),inset 0 -1px 0 rgb(0 0 0 / .12),0 10px 24px -10px rgb(15 116 214 / .75);color:#fff;list-style:none;cursor:pointer} +.fv-body[data-cols="3"] .fv-sc-foot .fv-runrow.fv-at-moved>.fv-run-options{display:none} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray[open]>:not(summary){display:block} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray>summary{display:none} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray::details-content{content-visibility:visible;display:block;height:auto} +/* under 720 px: one column, the preview on top and the settings below it; the works column folds away */ +@media(max-width:719px){ + .fv-studio.fv-create .fv-body[data-cols="3"]{display:flex;flex-direction:column;gap:12px;overflow:auto;overscroll-behavior:contain;--ps-gut:8px} + .fv-studio.fv-create .fv-body[data-cols="3"]>.fv-preview-column{order:1;flex:none;width:100%;height:min(480px,62vh);min-height:260px;scrollbar-gutter:auto} + .fv-studio.fv-create .fv-body[data-cols="3"]>.fv-controls{order:2;flex:none;width:100%;overflow:visible} + .fv-studio.fv-create .fv-body[data-cols="3"]>.fv-work-column{display:none} + /* the bar under the picture on a phone: Download on its own row, as wide as the picture, and the other keys (Favourite, Reuse, Continue, Share, More) on a second row, spread from edge to edge of the picture */ + .fv-studio.fv-create .fv-body[data-cols="3"] .fvs-stagebar .fv-actions{flex:1 0 100%;width:100%;margin-left:0;flex-wrap:wrap;justify-content:space-between;row-gap:var(--fv-sp-4,4px)} + .fv-studio.fv-create .fv-body[data-cols="3"] .fvs-stagebar .fv-actions>.fv-action-primary{flex:1 0 100%;justify-content:center} + .fv-studio.fv-create .fv-body[data-cols="3"]>.fvs-library{position:fixed;left:var(--ps-gut,8px);right:var(--ps-gut,8px);bottom:var(--ps-gut,8px);width:auto;max-height:60vh} + .fv-body[data-cols="3"] .fv-sc-head .fv-iv-collapse,.fv-body[data-cols="3"] .fv-controls>.fv-iv-rail{display:none!important} + .fv-body[data-cols="3"] .fv-sc-scroll{overflow:visible;flex:none} + .fv-body[data-cols="3"] .fv-sc-foot{border-top:0} +} +/* one place for prompt enhancement: the Enhance chip, lit while it is on */ +.fv-body[data-cols="3"] .fv-sc-section .fv-enhance-toggle{display:none} +.fv-body[data-cols="3"] .fv-sc-section .fv-enhance-bar:not([data-hx-enh]){display:none} +/* advanced options: one column, every row the width of the column, rows spaced alike */ +.fv-body[data-cols="3"] .fv-sc-section[data-section=advanced] :is(.fvs-size-fields,.fv-sampling-settings,.fv-advanced-grid,.fv-expand){display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0} +.fv-body[data-cols="3"] .fv-sc-section[data-section=advanced] *{min-width:0;max-width:100%;box-sizing:border-box} +.fv-body[data-cols="3"] .fv-sc-section[data-section=advanced] .fvs-tray{margin-top:12px} +.fv-studio.fv-create .fv-body[data-cols="3"] .fvs-chip.fv-reference-trigger.fv-sc-mention{width:auto;padding:0 var(--fv-sp-12,12px);gap:6px;font-size:var(--fv-fs-2,13px)} +/* compact layout: only the prompt (taller) and the main button */ +.fv-body[data-cols="3"] .fv-controls[data-compact=true] .fv-sc-section:not([data-section=prompt]),.fv-body[data-cols="3"] .fv-controls[data-compact=true] :is(.fv-sc-tools,.fv-sc-section[data-section=prompt] .fvs-tray){display:none} +.fv-body[data-cols="3"] .fv-controls[data-compact=true] .fvs-console-prompt textarea{min-height:min(52vh,420px)} +/* (position: the words only a screen reader reads are placed absolutely and stay inside the tray, in every look; as a window the tray is their place already) */ +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray.fv-at>.fv-at-body{position:relative;grid-template-columns:minmax(0,1fr);row-gap:12px;padding-top:0;--fv-at-w:132px} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray.fv-at{min-width:0;max-width:100%;box-sizing:border-box} +.fv-studio.fv-create .fv-body[data-cols="3"] .fv-sc-section .fvs-tray[data-fv-pop][open]{position:static!important;inset:auto!important;transform:none!important;animation:none!important;width:auto!important;max-width:100%!important;margin:8px 0 0!important;padding:0!important;border:0!important;background:none!important;box-shadow:none!important;overflow:visible!important} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray .fv-mt>.fv-mt-media{grid-template-columns:repeat(3,minmax(0,1fr))} +.fv-body[data-cols="3"] .fv-sc-section .fvs-tray .fv-mt-works-grid{grid-template-columns:repeat(3,minmax(0,1fr))} +/* a tall window (portrait, 720 px or wider): the works open BELOW the stage, as wide as the stage, and the stage keeps the rest */ +.fv-studio.fv-create .fv-body[data-cols="3"][data-tall=true][data-below=true]{grid-template-rows:minmax(0,1fr) min(340px,45%)} +.fv-studio.fv-create .fv-body[data-cols="3"][data-tall=true][data-below=true]>.fv-controls{grid-row:1/-1} +.fv-studio.fv-create .fv-body[data-cols="3"][data-tall=true][data-below=true]>.fv-work-column{grid-column:2;grid-row:2;min-width:0;width:auto;overflow:hidden} diff --git a/web/panel_shell.js b/web/panel_shell.js new file mode 100644 index 00000000..f4019f23 --- /dev/null +++ b/web/panel_shell.js @@ -0,0 +1,48 @@ +// The three-column shell shared by the picture view and the creation panel: a left panel (settings), the stage in the +// middle, a right panel (works). Both panels fold to a rail; under 1280 wide they rest as rails and open as drawers over +// the stage, one at a time; on a tall window (portrait, wider than a phone) the settings open as a drawer over the works +// and the works open below them. Wide, they dock and fold, and what is chosen is kept. +// +// createPanelShell({body, left, right, stage, panels, save, onPaint, onOpenLeft}) → {setPanel, paint, closeDrawer, drawer, below, tall, narrow, tallQuery} +// body, left, right, stage: the elements (the panels carry data-collapsed, body carries data-left/right/narrow/tall/drawer/below) +// panels: {left, right} wide-window choices (false = folded); save(): writes them; onPaint(): after every repaint; +// onOpenLeft(): after the settings were opened. +export function createPanelShell({body, left, right, stage, panels, save = () => {}, onPaint = () => {}, onOpenLeft = () => {}}) { + // Under 1280 wide both panels rest as rails and open as drawers over the stage, one at a time, so the picture + // keeps the room; the stage still measures from the two rails, so it stays centred. + const narrowQuery = matchMedia('(min-width: 720px) and (max-width: 1279px)'); + // A tall window: the settings open as a drawer over the works, and the works panel opens below them, taking the + // height they leave (at least 320 px), so it never narrows them from the side. + const tallQuery = matchMedia('(orientation: portrait) and (min-width: 720px)'); + let drawer = '', below = false; + function paint() { + if (tallQuery.matches) { + if (drawer === 'right') drawer = ''; + left.dataset.collapsed = String(drawer !== 'left'); right.dataset.collapsed = String(!below); + body.dataset.tall = 'true'; body.dataset.below = String(below); body.dataset.narrow = 'true'; body.dataset.drawer = drawer; + body.dataset.left = 'rail'; body.dataset.right = 'rail'; + onPaint(); + return; + } + delete body.dataset.tall; delete body.dataset.below; + const narrow = narrowQuery.matches; + const leftShown = narrow ? drawer === 'left' : panels.left !== false, rightShown = narrow ? drawer === 'right' : panels.right !== false; + left.dataset.collapsed = String(!leftShown); right.dataset.collapsed = String(!rightShown); + body.dataset.narrow = String(narrow); body.dataset.drawer = narrow ? drawer : ''; + body.dataset.left = leftShown && !narrow ? 'open' : 'rail'; body.dataset.right = rightShown && !narrow ? 'open' : 'rail'; + onPaint(); + } + function setPanel(side, open) { + if (tallQuery.matches && side === 'right') below = open; + else if (tallQuery.matches || narrowQuery.matches) drawer = open ? side : drawer === side ? '' : drawer; + else { panels[side] = open; save(); } + paint(); if (open && side === 'left') onOpenLeft(); + } + const closeDrawer = () => { if (drawer) { drawer = ''; paint(); } }; + narrowQuery.addEventListener('change', () => { drawer = ''; paint(); onOpenLeft(); }); + tallQuery.addEventListener('change', () => { drawer = ''; below = false; paint(); onOpenLeft(); }); + // A drawer closes when the stage is touched; on a tall window, when anything outside it is. + stage.addEventListener('pointerdown', closeDrawer); + body.addEventListener('pointerdown', event => { if (tallQuery.matches && drawer === 'left' && !left.contains(event.target)) closeDrawer(); }); + return {setPanel, paint, closeDrawer, drawer: () => drawer, below: () => below, tall: () => tallQuery.matches, narrow: () => narrowQuery.matches, tallQuery}; +} diff --git a/web/pass_mode.js b/web/pass_mode.js index 794d5328..11d78639 100644 --- a/web/pass_mode.js +++ b/web/pass_mode.js @@ -8,7 +8,7 @@ const plainListen = (target, type, handler) => { export function createPassMode({t, onChoose, listen = plainListen}) { const element = document.createElement('div'); element.className = 'fv-pass-mode'; element.dataset.tourId = 'pass-mode'; element.setAttribute('role', 'radiogroup'); - element.setAttribute('aria-label', t('Two-pass sampling', '二采加速')); + element.setAttribute('aria-label', t('Faster second pass', '二采加速')); const options = [['off', t('Off', '关闭')], ['on', t('On', '开启')], ['preview', t('Preview first', '先出预览')]].map(([mode, label]) => { const option = document.createElement('button'); option.type = 'button'; option.textContent = label; option.dataset.mode = mode; option.setAttribute('role', 'radio'); @@ -36,6 +36,8 @@ export function createPassMode({t, onChoose, listen = plainListen}) { option.disabled = Boolean(state.disabled?.[key]); option.hidden = Boolean(state.hidden?.[key]); option.title = key === 'preview' ? state.hint || '' : ''; + // Why the choice is closed, for its hover card (the Fast level is one pass). + if (state.why && option.disabled) option.dataset.fvTipWhy = state.why; else delete option.dataset.fvTipWhy; } } return {element, options, sync, dispose: stop}; diff --git a/web/phone_model.js b/web/phone_model.js index 05455ddb..9549501e 100644 --- a/web/phone_model.js +++ b/web/phone_model.js @@ -1,6 +1,9 @@ import {chainPosition} from './studio_chain.js'; // Data shaping only. Backend identifiers are never guessed from the current job. -export const phoneText = (language = '') => String(language).toLowerCase().startsWith('zh') ? (en, zh) => zh : en => en; +// The phone page's own t: English and Chinese, with {name} placeholders filled (web/i18n.js is not among the files the +// phone page is served). +const fillText = (text, values) => values ? String(text).replace(/\{(\w+)\}/g, (whole, name) => Object.prototype.hasOwnProperty.call(values, name) ? String(values[name]) : whole) : text; +export const phoneText = (language = '') => String(language).toLowerCase().startsWith('zh') ? (en, zh, values) => fillText(zh, values) : (en, zh, values) => fillText(en, values); export const activeJob = job => ['running', 'cancelling'].includes(job.status); export const queuedJob = job => ['waiting', 'queued'].includes(job.status); export function jobGroups(jobs) { @@ -25,8 +28,8 @@ export function mergePhoneJobs(previous, chat, activity, snapshots = []) { } export function retryWords(seconds, t) { const count = Math.ceil(Math.max(0, seconds)); - return count > 90 ? t(`Too many attempts. Try again in ${Math.ceil(count / 60)} min.`, `尝试次数过多,请 ${Math.ceil(count / 60)} 分钟后再试。`) - : t(`Too many attempts. Try again in ${count} s.`, `尝试次数过多,请 ${count} 秒后再试。`); + return count > 90 ? t('Too many attempts. Try again in {minutes} min.', '尝试次数过多,请 {minutes} 分钟后再试。', { minutes: Math.ceil(count / 60) }) + : t('Too many attempts. Try again in {count} s.', '尝试次数过多,请 {count} 秒后再试。', { count }); } export function queueWords(index, t) { const n = index + 1, mod = n % 100; @@ -35,7 +38,7 @@ export function queueWords(index, t) { } export function remainingWords(seconds, t) { if (!(seconds > 0)) return ''; - return seconds >= 60 ? t(`About ${Math.ceil(seconds / 60)} min left`, `还要约 ${Math.ceil(seconds / 60)} 分钟`) : t('Under 1 min', '不到 1 分钟'); + return seconds >= 60 ? t('About {minutes} min left', '还要约 {minutes} 分钟', { minutes: Math.ceil(seconds / 60) }) : t('Under 1 min', '不到 1 分钟'); } export function mediaPath(value, kind = 'video') { if (typeof value !== 'string' || !value.startsWith('/') || value.startsWith('//')) return ''; @@ -68,8 +71,8 @@ export function applyPhoneChain(job, chain) { export function phonePartWords(job, t) { const b = job.progress?.block; if (!(b?.total > 1)) return ''; - return job.progress.waiting ? t(`Waiting in queue · Part ${b.index} of ${b.total}`, `正在排队 · 第 ${b.index} 段,共 ${b.total} 段`) - : t(`Part ${b.index} of ${b.total}`, `第 ${b.index} 段,共 ${b.total} 段`); + return job.progress.waiting ? t('Waiting in queue · Part {index} of {total}', '正在排队 · 第 {index} 段,共 {total} 段', { index: b.index, total: b.total }) + : t('Part {index} of {total}', '第 {index} 段,共 {total} 段', { index: b.index, total: b.total }); } // Ignore heartbeat-only fields when deciding whether a card needs repainting. @@ -91,16 +94,17 @@ export function longGeneration(value) { // FreeVideo on it returned an error (its own sentence when it wrote one, otherwise the HTTP status). // `what` is the action as [English, Chinese], e.g. ['send', '发送']. const RAW_REPLY = /^(?:HTTP\s*)?\d{3}\b|^[a-z][a-z0-9]*(?:[_.:-][a-z0-9]+)+$|Error\b|Traceback|Unexpected token|JSON/; -export function phoneFailure(error, t, [en, zh]) { +export function phoneFailure(error, t, what) { + const action = t(...what); const status = Number(error?.status); if (!(Number.isInteger(status) && status >= 100 && status < 600)) { if (error?.name === 'TypeError' || error?.unreachable) - return t(`Could not ${en}: the phone cannot reach FreeVideo on the computer. Check that the computer is on and connected to the same Wi-Fi.`, - `没能${zh}:手机连不上电脑上的 FreeVideo。请确认电脑已开机,并与手机连接同一个 Wi-Fi。`); - return t(`Could not ${en}. Try again.`, `没能${zh},请重试。`); + return t('Could not {action}: the phone cannot reach FreeVideo on the computer. Check that the computer is on and connected to the same Wi-Fi.', + '没能{action}:手机连不上电脑上的 FreeVideo。请确认电脑已开机,并与手机连接同一个 Wi-Fi。', { action }); + return t('Could not {action}. Try again.', '没能{action},请重试。', { action }); } const said = error?.data?.error?.message ?? error?.data?.message ?? (typeof error?.data?.error === 'string' ? error.data.error : ''); if (typeof said === 'string' && said.trim() && !RAW_REPLY.test(said.trim())) return said.trim(); - return t(`Could not ${en}: FreeVideo on the computer returned an error (HTTP ${status}). Try again.`, - `没能${zh}:电脑上的 FreeVideo 返回了错误(HTTP ${status})。请重试。`); + return t('Could not {action}: FreeVideo on the computer returned an error (HTTP {status}). Try again.', + '没能{action}:电脑上的 FreeVideo 返回了错误(HTTP {status})。请重试。', { action, status }); } diff --git a/web/picture_url.js b/web/picture_url.js new file mode 100644 index 00000000..6760d472 --- /dev/null +++ b/web/picture_url.js @@ -0,0 +1,4 @@ +// The address of a picture in ComfyUI's input folder (the image view's works and the creation panel's queue use the same one). +import { api } from '../../scripts/api.js'; + +export const pictureURL = file => { const at = file.lastIndexOf('/'); return api.apiURL('/view?' + new URLSearchParams({filename: file.slice(at + 1), subfolder: at < 0 ? '' : file.slice(0, at), type: 'input'})); }; diff --git a/web/port_notice.js b/web/port_notice.js index 657319ea..ca83f35a 100644 --- a/web/port_notice.js +++ b/web/port_notice.js @@ -1,3 +1,4 @@ +import { translator } from './i18n.js'; let portFrom = null; export function takePortMarker() { @@ -19,11 +20,11 @@ export function createPortNotice(cn) { const element = document.createElement('aside'); element.className = 'fv-update-notice'; element.setAttribute('role', 'status'); const label = document.createElement('span'); - label.textContent = cn - ? `FreeVideo 现在使用端口 ${newPort},因为端口 ${oldPort} 已被其他程序占用。如果收藏了 127.0.0.1:${oldPort},请改为当前地址。` - : `FreeVideo now uses port ${newPort} because port ${oldPort} is in use by another program. If you bookmarked 127.0.0.1:${oldPort}, change the bookmark to this address.`; + const t = translator(cn); + label.textContent = t('FreeVideo now uses port {newPort} because port {oldPort} is in use by another program. If you bookmarked 127.0.0.1:{oldPort}, change the bookmark to this address.', + 'FreeVideo 现在使用端口 {newPort},因为端口 {oldPort} 已被其他程序占用。如果收藏了 127.0.0.1:{oldPort},请改为当前地址。', { newPort, oldPort }); const close = document.createElement('button'); close.type = 'button'; - close.textContent = cn ? '关闭' : 'Close'; + close.textContent = t('Close', '关闭'); close.onclick = () => { element.hidden = true; portFrom = null; }; element.append(label, close); return element; diff --git a/web/pose_tool.js b/web/pose_tool.js index ed7b1da8..bc1cf075 100644 --- a/web/pose_tool.js +++ b/web/pose_tool.js @@ -307,7 +307,7 @@ export function createPoseTool(editor) { } function cameraPanel() { return [group(t('Camera', '机位'), chips(Object.entries(CAMERA_PRESETS).map(([id, c]) => [id, words(c.label)]), id => act(() => stage.cameraPreset(id, sel?.fig))), - chips([['fit', t('Fit everyone in the picture', '全部人物入画')]], () => act(() => stage.frameAll())))]; + chips([['fit', t('Fit everyone in the image', '全部人物入画')]], () => act(() => stage.frameAll())))]; } function openPop(id, anchor, build) { closePop(); diff --git a/web/private_settings.js b/web/private_settings.js index b70afd86..501aca68 100644 --- a/web/private_settings.js +++ b/web/private_settings.js @@ -32,15 +32,15 @@ export function privacySettings(t, api) { const size = el('span', 'st-sz'); size.setAttribute('role', 'status'); const clean = button(t('Clean up', '清理'), {kind: 'fill'}); clean.disabled = true; tip(clean, t('Clean up', '清理'), t('Delete the listed files for good', '彻底删除清单上的文件')); - const unused = row({iconName: 'shield', title: t('Uploads and pictures no longer used', '不再使用的上传和图片'), - sub: t('Nothing that a work, character, conversation or open page uses', '作品、角色、对话和打开的页面都不再使用'), end: [size, clean]}); + const unused = row({iconName: 'shield', title: t('Uploads and images no longer used', '不再使用的上传和图片'), + sub: t('Nothing that a creation, character, conversation or open page uses', '作品、角色、对话和打开的页面都不再使用'), end: [size, clean]}); let tokens = []; const review = async () => { try { const value = await json('/freevideo/private/review'); group.hidden = false; tokens = (value.items || []).map(item => item.token); - size.textContent = tokens.length ? t(`${tokens.length} files, ${amount(value.bytes || 0)}`, `${tokens.length} 个文件,共 ${amount(value.bytes || 0)}`) + size.textContent = tokens.length ? t('{count} files, {size}', '{count} 个文件,共 {size}', { count: tokens.length, size: amount(value.bytes || 0) }) : t('Nothing to clean up', '没有可清理的文件'); } catch (error) { tokens = []; @@ -52,7 +52,7 @@ export function privacySettings(t, api) { confirming(clean, t('Clean up', '清理'), t('Confirm clean up', '确认清理'), async () => { try { const value = await json('/freevideo/private/clean', {tokens}); - size.textContent = t(`Removed ${value.removed} files, ${amount(value.freed_bytes || 0)}`, `已删除 ${value.removed} 个文件,共 ${amount(value.freed_bytes || 0)}`); + size.textContent = t('Removed {removed} files, {size}', '已删除 {removed} 个文件,共 {size}', { removed: value.removed, size: amount(value.freed_bytes || 0) }); } catch { size.textContent = t('The clean up did not finish. Try again.', '清理没有完成,请再试一次。'); } await new Promise(done => setTimeout(done, 1500)); await review(); }); @@ -63,7 +63,7 @@ export function privacySettings(t, api) { for (const gb of [1, 2, 5, 10, 20]) { const option = el('option', '', `${gb} GB`); option.value = String(gb * 1e9); limit.append(option); } limit.value = String(2e9); const clear = button(t('Clear cache', '清除缓存')); clear.disabled = true; - const cache = row({iconName: 'disk', title: t('Cache', '缓存'), sub: t('Kept so a repeated prompt or picture starts sooner', '让重复的提示词和图片更快开始'), end: [cacheSize, clear]}); + const cache = row({iconName: 'disk', title: t('Cache', '缓存'), sub: t('Kept so a repeated prompt or image starts sooner', '让重复的提示词和图片更快开始'), end: [cacheSize, clear]}); const cacheLimit = row({title: t('Cache limit', '缓存上限'), sub: t('The oldest goes first when it is full', '满了先删最久没用的'), end: [segmented(limit, {label: t('Cache limit', '缓存上限')})]}); const busyWhy = t('Available when nothing is being generated.', '没有正在生成的任务时可用。'); const usage = async () => { @@ -82,23 +82,23 @@ export function privacySettings(t, api) { confirming(clear, t('Clear cache', '清除缓存'), t('Confirm clear', '确认清除'), async () => { try { const value = await json('/freevideo/private/cache-clear', {}); - cacheSize.textContent = t(`Cleared ${amount(value.freed_bytes || 0)}`, `已清除 ${amount(value.freed_bytes || 0)}`); + cacheSize.textContent = t('Cleared {size}', '已清除 {size}', { size: amount(value.freed_bytes || 0) }); } catch (error) { cacheSize.textContent = error.message === 'busy' ? busyWhy : t('The cache could not be cleared.', '缓存未能清除。'); } await new Promise(done => setTimeout(done, 1500)); await usage(); }); // Old reference pictures in the input folder itself. Counted when the page opens: with none there is nothing to // open, the line says so and the fold stays shut; otherwise one sentence over the pictures, each deleted on its own. - const oldSub = t('Pictures in ComfyUI’s input folder, deleted one by one', 'ComfyUI 输入文件夹中的图片,逐张删除'); - const old = fold({iconName: 'img', title: t('Clean up old reference pictures', '清理旧参考图'), sub: oldSub, cls: 'st-private-old'}); + const oldSub = t('Images in ComfyUI’s input folder, deleted one by one', 'ComfyUI 输入文件夹中的图片,逐张删除'); + const old = fold({iconName: 'img', title: t('Clean up old reference images', '清理旧参考图'), sub: oldSub, cls: 'st-private-old'}); const grid = el('div', 'st-private-grid'), status = el('div', 'st-private-status'); status.setAttribute('role', 'status'); - const note = el('p', 'st-private-note'); note.append(icon('info', 'fv-i'), el('span', '', t('Earlier versions left reference pictures among your own files. Check each one before deleting it.', + const note = el('p', 'st-private-note'); note.append(icon('info', 'fv-i'), el('span', '', t('Earlier versions left reference images among your own files. Check each one before deleting it.', '旧版本的参考图与其他文件混在一起,请逐张确认后删除。'))); old.body.append(note, grid, status); const nothingOld = none => { old.element.toggleAttribute('data-empty', none); old.summary.setAttribute('aria-disabled', String(none)); old.summary.tabIndex = none ? -1 : 0; - old.sub.textContent = none ? t('No pictures to clean up', '没有需要清理的图片') : oldSub; + old.sub.textContent = none ? t('No images to clean up', '没有需要清理的图片') : oldSub; if (none) old.element.open = false; }; old.summary.addEventListener('click', event => { if (old.element.hasAttribute('data-empty')) event.preventDefault(); }); @@ -118,9 +118,9 @@ export function privacySettings(t, api) { try { const value = await json('/freevideo/private/legacy-delete', {name: item.name}); if (value.removed) cell.remove(); - else status.textContent = value.reason === 'in-use' ? t('This picture is still used by a work or workflow, so it was kept.', '这张图片仍被作品或工作流使用,已保留。') - : t('This picture could not be deleted.', '这张图片无法删除。'); - } catch { status.textContent = t('This picture could not be deleted.', '这张图片无法删除。'); } + else status.textContent = value.reason === 'in-use' ? t('This image is still used by a creation or workflow, so it was kept.', '这张图片仍被作品或工作流使用,已保留。') + : t('This image could not be deleted.', '这张图片无法删除。'); + } catch { status.textContent = t('This image could not be deleted.', '这张图片无法删除。'); } if (!grid.childElementCount) nothingOld(true); }); cell.append(image, caption, el('span', 'st-private-size', amount(item.bytes || 0)), remove); diff --git a/web/prompt_enhance.js b/web/prompt_enhance.js index 6ff4d27f..5a668393 100644 --- a/web/prompt_enhance.js +++ b/web/prompt_enhance.js @@ -98,8 +98,8 @@ export function createPromptEnhancer({node, input, editor, api, context, setText label.append(toggle, el('span', t('Prompt enhancement', '提示词增强'))); // Product words on screen: what it does, not what it is built on. label.dataset.fvTipName = t('Prompt enhancement', '提示词增强'); - label.dataset.fvTipUse = t('Rewrite the prompt in more detail first, on this computer', '生成前在本机把描述改写得更具体'); - label.title = t('Rewrites the prompt in more detail before generating, on this computer, using your reference pictures.', '生成前在本机结合参考图,把描述改写得更具体。'); + label.dataset.fvTipUse = t('Rewrite the prompt in more detail first, on this computer', '生成前在本机把提示词改写得更具体'); + label.title = t('Rewrites the prompt in more detail before generating, on this computer, using your reference images.', '生成前在本机结合参考图,把提示词改写得更具体。'); const enhancementHint = label.title; // The compact form for a tool row: one key, lit while enhancement is on. A view that places it hides the switch; // the rest of the bar (versions, rewrite, cancel) can go beside it (`bar`), and shows only while enhancement is on. @@ -114,15 +114,15 @@ export function createPromptEnhancer({node, input, editor, api, context, setText for (const [name, text] of [['original', t('Original', '原文')], ['rewritten', t('Enhanced', '改写')]]) { const b = el('button', text); b.type = 'button'; buttons[name] = b; tabs.append(b); b.dataset.fvTipName = text; - b.dataset.fvTipUse = name === 'original' ? t('Show the prompt as written', '显示原始描述') : t('Show the rewritten prompt', '显示改写后的描述'); + b.dataset.fvTipUse = name === 'original' ? t('Show the prompt as written', '显示原始提示词') : t('Show the rewritten prompt', '显示改写后的提示词'); b.onclick = () => { if (running) cancelJob().catch(() => {}); versions.select(name); apply(); }; } const redo = el('button', t('Rewrite', '改写'), 'fv-quiet'); redo.type = 'button'; redo.classList.add('fv-enhance-redo'); - redo.dataset.fvTipName = t('Rewrite', '改写'); redo.dataset.fvTipUse = t('Rewrite the prompt again', '重新改写一次描述'); + redo.dataset.fvTipName = t('Rewrite', '改写'); redo.dataset.fvTipUse = t('Rewrite the prompt again', '重新改写一次提示词'); redo.innerHTML = ''; const cancel = el('button', t('Cancel', '取消'), 'fv-quiet'); cancel.type = 'button'; - cancel.dataset.fvTipName = t('Cancel', '取消'); cancel.dataset.fvTipUse = t('Stop rewriting; keep the prompt as written', '停止改写,保留原来的描述'); + cancel.dataset.fvTipName = t('Cancel', '取消'); cancel.dataset.fvTipUse = t('Stop rewriting; keep the prompt as written', '停止改写,保留原来的提示词'); const status = el('div', null, 'fv-enhance-status'); status.setAttribute('role', 'status'); const statusText = el('span', null, 'fv-enhance-status-text'); const meter = el('div', null, 'fv-enhance-meter'), fill = el('i'); @@ -218,11 +218,7 @@ export function createPromptEnhancer({node, input, editor, api, context, setText const checkFacts = check => ({check: check.name, check_category: check.category, check_retried: check.retried}); const gib = value => String(Math.round(value / 2 ** 30)); // Mentions are counted as the character descriptions they expand to, so the count can exceed what the box shows. - const lengthOf = (error, english) => { - const number = error.characters.toLocaleString('en-US'); - return english ? `The prompt${error.expanded ? ' and character descriptions' : ''} ha${error.expanded ? 've' : 's'} ${number} characters` - : `提示词${error.expanded ? '连同角色描述' : ''}共 ${number} 字符`; - }; + const tooLong = error => ({ number: error.characters.toLocaleString('en-US') }); // Unknown codes keep the server's own reason, without paths, so the user can quote it. // Other programs holding graphics memory, as the server measured them; no-break spaces keep name, size and unit on one line. const holderNames = holders => (Array.isArray(holders) ? holders : []).slice(0, 3) @@ -240,31 +236,33 @@ export function createPromptEnhancer({node, input, editor, api, context, setText model_missing: t('Download the optional model to enable enhancement.', '下载可选模型后可启用。'), download_failed: t('Download paused. Retry to resume.', '下载已暂停,重试可继续。'), disk_space: t('Not enough disk space for the optional model.', '可选模型的磁盘空间不足,请清理后重试。'), - ram_space: t(`This model needs about ${gib(error?.ramBytes || ramBytes)} GiB of available RAM to load. You can keep using the original.`, `此模型加载需约 ${gib(error?.ramBytes || ramBytes)} GiB 可用内存,可先使用原文生成。`), + ram_space: t('This model needs about {size} GiB of available RAM to load. You can keep using the original.', '此模型加载需约 {size} GiB 可用内存,可先使用原文生成。', { size: gib(error?.ramBytes || ramBytes) }), unsupported_media: t('Enhancement can read only images and videos added in Media. You can keep using the original.', '增强只能读取素材中添加的图片和视频,可先使用原文生成。'), connected_media: t('Enhancement cannot read connected nodes. Add images or videos in Media, or use the original.', '增强读不到连接节点的素材,请在素材中添加图片或视频,或使用原文。'), audio_media: t('Enhancement cannot read audio. Add images or videos in Media, or use the original.', '增强读不到音频,请在素材中添加图片或视频,或使用原文。'), unreadable_video: t('Could not read a frame from this video. Replace it with another video or an image, or use the original.', '读不出这个视频的画面,请换一个视频或图片,或使用原文。'), too_many_images: t('Use up to 8 reference images for enhancement.', '增强暂支持最多 8 张参考图。'), - invalid_prompt: error?.characters - ? t(`${lengthOf(error, true)}; enhancement supports up to 12,000. Shorten it or use the original.`, `${lengthOf(error, false)},增强最多支持 12,000 字符,请精简或使用原文。`) + invalid_prompt: error?.characters ? (error.expanded + ? t('The prompt and character prompts have {number} characters; enhancement supports up to 12,000. Shorten it or use the original.', '提示词连同角色提示词共 {number} 字符,增强最多支持 12,000 字符,请精简或使用原文。', tooLong(error)) + : t('The prompt has {number} characters; enhancement supports up to 12,000. Shorten it or use the original.', '提示词共 {number} 字符,增强最多支持 12,000 字符,请精简或使用原文。', tooLong(error))) : t('Enter a prompt of up to 12,000 characters.', '请输入不超过 12,000 字符的提示词。'), invalid_output: error?.check - ? t(`The rewrite was incomplete: ${CHECK_LABELS[error.check.category][0]}. Retry or use the original.`, - `改写结果不完整:${CHECK_LABELS[error.check.category][1]}。请重试或使用原文。`) + ? t('The rewrite was incomplete: {reason}. Retry or use the original.', '改写结果不完整:{reason}。请重试或使用原文。', + { reason: t(...CHECK_LABELS[error.check.category]) }) : t('The rewrite was incomplete. Retry or use the original.', '改写结果不完整,请重试或使用原文。'), invalid_request: t('Rewriting does not support this model or aspect ratio. Change it or use the original.', '当前模型或画幅不支持改写,请更换或使用原文。'), context_length: t('The scene is too long for this model. Shorten it or use the original.', '内容超出改写模型容量,请精简或使用原文。'), out_of_memory: holderNames(error?.holders) - ? t(`Not enough graphics memory to rewrite. In use: ${holderNames(error.holders)}. Close the listed programs and rewrite again, or use the original.`, - `显存不足,无法改写。正在占用:${holderNames(error.holders)}。关闭上述程序后可重新改写,或使用原文。`) + ? t('Not enough graphics memory to rewrite. In use: {programs}. Close the listed programs and rewrite again, or use the original.', + '显存不足,无法改写。正在占用:{programs}。关闭上述程序后可重新改写,或使用原文。', { programs: holderNames(error.holders) }) : t('Not enough memory to rewrite. Close other GPU apps or use the original.', '改写时内存不足,请关闭其他显卡程序或使用原文。'), timeout: t('Rewriting took too long. Retry or use the original.', '改写超时,请重试或使用原文。'), stale: t('The prompt or references changed. Rewrite again to use the current scene.', '原文或素材已更改,可按当前内容重新改写。'), cancelled: t('Cancelled. Your original prompt is retained.', '已取消,原文已保留。'), worker_cleanup_failed: t('The rewrite process could not close. Restart FreeVideo before generating.', '改写进程未能退出,请重启 FreeVideo 后再生成。'), - }[error?.message] || t(`Could not enhance the prompt${reasonOf(error) ? `: ${reasonOf(error)}` : ''}. Retry or switch enhancement off to use the original.`, - `暂时无法改写${reasonOf(error) ? `。原因:${reasonOf(error)}。` : ','}请重试,或关闭增强使用原文。`)); + }[error?.message] || (reasonOf(error) + ? t('Could not enhance the prompt: {reason}. Retry or switch enhancement off to use the original.', '暂时无法改写。原因:{reason}。请重试,或关闭增强使用原文。', { reason: reasonOf(error) }) + : t('Could not enhance the prompt. Retry or switch enhancement off to use the original.', '暂时无法改写,请重试,或关闭增强使用原文。'))); // After falling back the original is already in use, so only the reason and the next useful step are shown. const fallbackText = error => isNetworkTypeError(error) ? networkText(error) : ({ busy: t('The prompt cannot be rewritten while the queue is running.', '队列未完成时不能改写。'), @@ -272,25 +270,25 @@ export function createPromptEnhancer({node, input, editor, api, context, setText model_missing: t('Rewriting needs the optional model. Download it to enable rewriting.', '改写需要可选模型,下载后可用。'), download_failed: t('The optional model download paused. Retry to resume.', '可选模型下载已暂停,重试可继续下载。'), disk_space: t('Not enough disk space for the optional model.', '磁盘空间不足,无法安装可选模型。'), - ram_space: t(`The rewrite model needs about ${gib(error?.ramBytes || ramBytes)} GiB of available RAM to load.`, `改写模型加载需约 ${gib(error?.ramBytes || ramBytes)} GiB 可用内存。`), - invalid_prompt: error?.characters - ? t(`${lengthOf(error, true)}; rewriting supports up to 12,000. Shorten it before rewriting again.`, `${lengthOf(error, false)},改写最多支持 12,000 字符,精简后可再改写。`) + ram_space: t('The rewrite model needs about {size} GiB of available RAM to load.', '改写模型加载需约 {size} GiB 可用内存。', { size: gib(error?.ramBytes || ramBytes) }), + invalid_prompt: error?.characters ? (error.expanded + ? t('The prompt and character prompts have {number} characters; rewriting supports up to 12,000. Shorten it before rewriting again.', '提示词连同角色提示词共 {number} 字符,改写最多支持 12,000 字符,精简后可再改写。', tooLong(error)) + : t('The prompt has {number} characters; rewriting supports up to 12,000. Shorten it before rewriting again.', '提示词共 {number} 字符,改写最多支持 12,000 字符,精简后可再改写。', tooLong(error))) : t('Rewriting supports prompts of up to 12,000 characters.', '改写只支持不超过 12,000 字符的提示词。'), invalid_output: error?.check - ? t(`The rewrite was incomplete: ${CHECK_LABELS[error.check.category][0]}.`, - `改写结果不完整:${CHECK_LABELS[error.check.category][1]}。`) + ? t('The rewrite was incomplete: {reason}.', '改写结果不完整:{reason}。', { reason: t(...CHECK_LABELS[error.check.category]) }) : t('The rewrite was incomplete.', '改写结果不完整。'), invalid_request: t('Rewriting does not support this model or aspect ratio.', '当前模型或画幅不支持改写。'), context_length: t('The scene is too long for the rewrite model.', '内容超出改写模型容量。'), out_of_memory: holderNames(error?.holders) - ? t(`Not enough graphics memory to rewrite. In use: ${holderNames(error.holders)}. Close the listed programs before rewriting again.`, - `显存不足,无法改写。正在占用:${holderNames(error.holders)}。关闭上述程序后可重新改写。`) + ? t('Not enough graphics memory to rewrite. In use: {programs}. Close the listed programs before rewriting again.', + '显存不足,无法改写。正在占用:{programs}。关闭上述程序后可重新改写。', { programs: holderNames(error.holders) }) : t('Not enough memory to rewrite. Close other GPU apps before rewriting again.', '改写时内存不足,关闭其他显卡程序后可再改写。'), timeout: t('Rewriting took too long.', '改写超时。'), unsupported_media: errorText(error), too_many_images: errorText(error), stale: errorText(error), connected_media: errorText(error), audio_media: errorText(error), unreadable_video: errorText(error), worker_cleanup_failed: errorText(error), - }[error?.message] || (reasonOf(error) ? t(`The rewrite failed: ${reasonOf(error)}.`, `改写失败,原因:${reasonOf(error)}。`) : t('The rewrite failed.', '改写失败。'))); + }[error?.message] || (reasonOf(error) ? t('The rewrite failed: {reason}.', '改写失败,原因:{reason}。', { reason: reasonOf(error) }) : t('The rewrite failed.', '改写失败。'))); function save(changed = true) { node.properties ||= {}; node.properties.freevideo_prompt_versions = {...versions.value}; @@ -404,8 +402,8 @@ export function createPromptEnhancer({node, input, editor, api, context, setText clock?.pause(); // The rewrite starts by itself once enough graphics memory is free. const short = Math.max(0.1, (row.gpu_short_bytes || 0) / 2 ** 30).toFixed(1), names = holderNames(row.gpu_holders); - show(names ? t(`Waiting for ${short}\u00a0GiB more graphics memory to rewrite. In use: ${names}.`, `显存不足,再空出 ${short}\u00a0GiB 后自动改写。正在占用:${names}。`) - : t(`Waiting for ${short}\u00a0GiB more graphics memory to rewrite.`, `显存不足,再空出 ${short}\u00a0GiB 后自动改写。`), 'progress'); + show(names ? t('Waiting for {short}\u00a0GiB more graphics memory to rewrite. In use: {names}.', '显存不足,再空出 {short}\u00a0GiB 后自动改写。正在占用:{names}。', { short, names }) + : t('Waiting for {short}\u00a0GiB more graphics memory to rewrite.', '显存不足,再空出 {short}\u00a0GiB 后自动改写。', { short }), 'progress'); } else if (action !== 'install') { clock?.set(row.phase === 'rewriting' ? 'rewriting' : 'preparing', row.phase); } @@ -419,14 +417,14 @@ export function createPromptEnhancer({node, input, editor, api, context, setText } function showDownload(done, total) { const size = value => (value / 2 ** 30).toFixed(1); - const text = t(`Downloading the model · ${size(done)} / ${size(total)} GiB`, `正在下载模型 · ${size(done)} / ${size(total)} GiB`); + const text = t('Downloading the model · {done} / {total} GiB', '正在下载模型 · {done} / {total} GiB', { done: size(done), total: size(total) }); publishModel({text}); show(text, 'progress', done / (total || 1)); } async function installModel(info) { if (info.ready) return true; const model = String(info.model || 'Qwen/Qwen3-VL-4B-Instruct').split('/').pop().replace(/-Instruct$/, ''); - detail.textContent = t(`Local model ${model} · ${(info.bytes / 2 ** 30).toFixed(1)} GiB download · needs ${gib(ramBytes)} GiB free RAM. Your prompt and images stay on this computer.`, - `本地模型 ${model} · 下载 ${(info.bytes / 2 ** 30).toFixed(1)} GiB · 需 ${gib(ramBytes)} GiB 可用内存。提示词和图片只在本机处理。`); + detail.textContent = t('Local model {model} · {size} GiB download · needs {ram} GiB free RAM. Your prompt and images stay on this computer.', + '本地模型 {model} · 下载 {size} GiB · 需 {ram} GiB 可用内存。提示词和图片只在本机处理。', { model, size: (info.bytes / 2 ** 30).toFixed(1), ram: gib(ramBytes) }); agree.textContent = downloadOnly ? t('Download', '下载') : t('Download and enable', '下载并启用'); // The open panels of the toolbars close for the question (glass/frame_picker.js ASKING), so none covers it; one // that held the keyboard (its Download prompt model) hands it to the question. @@ -524,12 +522,12 @@ export function createPromptEnhancer({node, input, editor, api, context, setText const reverseErrorText = error => isNetworkTypeError(error) ? networkText(error) : ({ busy: t('Finish the current queue before writing a prompt from media.', '请等待当前队列完成后再生成提示词。'), unreadable_video: t('Could not read frames from this video. Choose another file.', '无法读取这个视频的画面,请换一个文件。'), - unsupported_media: t('Only pictures and videos can be turned into a prompt.', '只能用图片或视频生成提示词。'), - invalid_media: t('Could not read this picture. Choose another file.', '无法读取这张图片,请换一个文件。'), + unsupported_media: t('Only images and videos can be turned into a prompt.', '只能用图片或视频生成提示词。'), + invalid_media: t('Could not read this image. Choose another file.', '无法读取这张图片,请换一个文件。'), out_of_memory: holderNames(error?.holders) - ? t(`Not enough graphics memory. In use: ${holderNames(error.holders)}. Close them and try again.`, `显存不足,无法生成提示词。正在占用:${holderNames(error.holders)}。关闭后再试。`) + ? t('Not enough graphics memory. In use: {programs}. Close them and try again.', '显存不足,无法生成提示词。正在占用:{programs}。关闭后再试。', { programs: holderNames(error.holders) }) : t('Not enough graphics memory. Close other GPU apps and try again.', '显存不足,请关闭其他显卡程序后再试。'), - ram_space: t(`Loading needs about ${gib(error?.ramBytes || ramBytes)} GiB of free RAM. Close other programs and try again.`, `加载需约 ${gib(error?.ramBytes || ramBytes)} GiB 可用内存,请关闭其他程序后再试。`), + ram_space: t('Loading needs about {size} GiB of free RAM. Close other programs and try again.', '加载需约 {size} GiB 可用内存,请关闭其他程序后再试。', { size: gib(error?.ramBytes || ramBytes) }), timeout: t('Took too long. Try again.', '生成提示词超时,请重试。'), invalid_output: t('The result was incomplete. Try again.', '结果不完整,请重试。'), context_length: t('The result was incomplete. Try again.', '结果不完整,请重试。'), @@ -538,7 +536,9 @@ export function createPromptEnhancer({node, input, editor, api, context, setText worker_cleanup_failed: t('The process could not close. Restart FreeVideo before generating.', '生成提示词的进程未能退出,请重启 FreeVideo 后再生成。'), cancelled: t('Stopped. Your prompt is unchanged.', '已停止,原文已保留。'), not_enabled: t('Not enabled. Your prompt is unchanged.', '未启用,原文已保留。'), - }[error?.message] || t(`Could not write the prompt${reasonOf(error) ? `: ${reasonOf(error)}` : ''}. Try again.`, `暂时无法生成提示词${reasonOf(error) ? `。原因:${reasonOf(error)}。` : ''}请重试。`)); + }[error?.message] || (reasonOf(error) + ? t('Could not write the prompt: {reason}. Try again.', '暂时无法生成提示词。原因:{reason}。请重试。', { reason: reasonOf(error) }) + : t('Could not write the prompt. Try again.', '暂时无法生成提示词,请重试。'))); const reverseListeners = new Set(); let reverseState = {state: 'idle', fraction: 0, text: ''}; const publishReverse = change => { @@ -576,8 +576,8 @@ export function createPromptEnhancer({node, input, editor, api, context, setText const video = source.kind === 'video'; const stages = video ? [{key: 'read', en: 'Reading the frames…', zh: '正在读取画面…', seconds: 2}, {key: 'describe', en: 'Describing the video…', zh: '正在描述视频…', seconds: 8}, - {key: 'camera', en: 'Looking at the camera movement…', zh: '正在看镜头运动…', seconds: 1}, ...(shapeVideo ? [{key: 'shape', en: 'Shaping it into a video prompt…', zh: '正在整理成视频描述…', seconds: 10}] : [])] - : [{key: 'describe', en: 'Describing the picture…', zh: '正在描述图片…', seconds: 8}]; + {key: 'camera', en: 'Looking at the camera movement…', zh: '正在看镜头运动…', seconds: 1}, ...(shapeVideo ? [{key: 'shape', en: 'Shaping it into a video prompt…', zh: '正在整理成视频提示词…', seconds: 10}] : [])] + : [{key: 'describe', en: 'Describing the image…', zh: '正在描述图片…', seconds: 8}]; // The job is under way: the box is read-only and dimmed, the key says Stop, Generate waits. const begin = () => { input.readOnly = true; input.dataset.reversing = 'true'; element.dataset.reversing = 'true'; bar.dataset.reversing = 'true'; @@ -625,7 +625,7 @@ export function createPromptEnhancer({node, input, editor, api, context, setText write(versions.text()); setText(input.value); save(); render(); if (before.trim()) { - show(t('Description filled in.', '已填入描述。'), 'note'); undoKey.hidden = false; undoState = {before, snapshot}; + show(t('Prompt filled in.', '已填入提示词。'), 'note'); undoKey.hidden = false; undoState = {before, snapshot}; undoKey.onclick = () => { versions.value = snapshot; write(before); setText(input.value); save(); render(); show(''); }; clearTimeout(undoTimer); undoTimer = setTimeout(() => { if (!undoKey.hidden) show(''); }, 10000); } else show(''); @@ -661,7 +661,7 @@ export function createPromptEnhancer({node, input, editor, api, context, setText const stale = error?.message === 'stale'; if (!stale) console.warn('FreeVideo prompt rewrite failed; using the original prompt.', error?.message); versions.value.selected = 'original'; apply(); - show(t(`Generated with the original prompt. ${stale ? errorText(error) : fallbackText(error)}`, `已用原文生成。${stale ? errorText(error) : fallbackText(error)}`), 'note'); + show(t('Generated with the original prompt. {reason}', '已用原文生成。{reason}', { reason: stale ? errorText(error) : fallbackText(error) }), 'note'); } return {element, chip, bar, reverse, stop: () => cancelJob().catch(() => {}), get reversing() { return reverseState.state === 'running'; }, onReverse(listener) { reverseListeners.add(listener); listener(reverseState); return () => reverseListeners.delete(listener); }, model: {read: readModel, download: downloadModel, subscribe(listener) { diff --git a/web/prompt_library.js b/web/prompt_library.js index 7fa45f25..c9c6849a 100644 --- a/web/prompt_library.js +++ b/web/prompt_library.js @@ -110,19 +110,21 @@ export function createPromptLibrary({t, host, fill, snapshot, apply, describe = const mod = globalThis.navigator?.platform?.startsWith('Mac') ? '⌘' : 'Ctrl'; button.setAttribute('aria-label', t('Prompt history, templates and presets', '提示词历史、模板和预设')); button.setAttribute('aria-haspopup', 'dialog'); button.setAttribute('aria-expanded', 'false'); - setTip(button, t('History and presets', '历史与预设'), t('Reuse a prompt, a template or saved settings', '复用描述、模板或保存的设置'), `${mod} ↑`); + setTip(button, t('History and presets', '历史与预设'), t('Reuse a prompt, a template or saved settings', '复用提示词、模板或保存的设置'), `${mod} ↑`); const panel = el('section', 'fvs-library'); panel.hidden = true; panel.setAttribute('role', 'dialog'); panel.setAttribute('aria-label', button.getAttribute('aria-label')); const tabs = el('div', 'fvs-library-tabs'); tabs.setAttribute('role', 'tablist'); const search = el('input', 'fvs-library-search'); search.type = 'search'; - search.placeholder = t('Search', '搜索'); search.setAttribute('aria-label', t('Search prompts', '搜索描述')); + search.placeholder = t('Search', '搜索'); search.setAttribute('aria-label', t('Search prompts', '搜索提示词')); const close = el('button', 'fvs-icon-button'); close.type = 'button'; close.innerHTML = svg(CLOSE); close.setAttribute('aria-label', t('Close', '关闭')); setTip(close, t('Close', '关闭'), t('Hide this panel', '收起这个面板'), 'Esc'); const head = el('div', 'fvs-library-head'); head.append(tabs, search, close); const list = el('div', 'fvs-library-list'); list.setAttribute('role', 'listbox'); const foot = el('div', 'fvs-library-foot'); panel.append(head, list, foot); - host.append(panel); + // The host may be a function: the panel stands where the console is now (the column layout has no console on the page). + const home = () => (typeof host === 'function' ? host() : host); + home().append(panel); let tab = 'history', query = ''; const TABS = [['history', t('History', '历史')], ['templates', t('Templates', '模板')], ['presets', t('Presets', '预设')]]; const tabButtons = TABS.map(([id, label]) => { @@ -130,7 +132,7 @@ export function createPromptLibrary({t, host, fill, snapshot, apply, describe = b.onclick = () => { tab = id; render(); }; tabs.append(b); return b; }); - setTip(tabButtons[0], t('History', '历史'), t('Prompts you generated, newest first', '生成过的描述,最新在前')); + setTip(tabButtons[0], t('History', '历史'), t('Prompts you generated, newest first', '生成过的提示词,最新在前')); setTip(tabButtons[1], t('Templates', '模板'), t('Starting points to edit', '可修改的起点描述')); setTip(tabButtons[2], t('Presets', '预设'), t('Settings saved under a name', '按名称保存的一组设置')); const matches = text => !query || text.toLowerCase().includes(query); @@ -151,7 +153,7 @@ export function createPromptLibrary({t, host, fill, snapshot, apply, describe = return item; } function empty(text) { list.append(el('p', 'fvs-library-empty', text)); } - function use(text) { const undo = fill(text); hide(); notify(t('Prompt filled in', '已填入描述'), undo); } + function use(text) { const undo = fill(text); hide(); notify(t('Prompt filled in', '已填入提示词'), undo); } function render() { for (const b of tabButtons) { b.setAttribute('aria-selected', String(b.dataset.tab === tab)); b.tabIndex = b.dataset.tab === tab ? 0 : -1; } search.hidden = tab === 'presets'; @@ -160,22 +162,22 @@ export function createPromptLibrary({t, host, fill, snapshot, apply, describe = const rows = promptHistory(storage).filter(item => matches(item.text)); for (const item of rows) list.append(row(item.text, [when(item.at, t), describe(item)].filter(Boolean).join(' · '), () => use(item.text), () => { forgetPrompt(item.text, storage); render(); }, t('Remove from history', '从历史移除'))); - if (!rows.length) empty(query ? t('No prompt matches.', '没有匹配的描述。') : t('Prompts you generate appear here.', '生成过的描述会出现在这里。')); + if (!rows.length) empty(query ? t('No prompt matches.', '没有匹配的提示词。') : t('Prompts you generate appear here.', '生成过的提示词会出现在这里。')); } else if (tab === 'templates') { const rows = TEMPLATES.filter(item => matches(t(...item.title)) || matches(t(...item.text))); for (const item of rows) list.append(row(t(...item.title), t(...item.text), () => use(t(...item.text)), null, '', {named: true})); if (!rows.length) empty(t('No template matches.', '没有匹配的模板。')); if (guide) { - const link = el('a', 'fvs-library-guide', t('How to write a prompt ↗', '描述写法 ↗')); + const link = el('a', 'fvs-library-guide', t('How to write a prompt ↗', '提示词写法 ↗')); link.href = guide; link.target = '_blank'; link.rel = 'noopener noreferrer'; - setTip(link, t('How to write a prompt', '描述写法'), t('Open the guide to writing a good prompt', '打开描述写法指南,写得更准')); + setTip(link, t('How to write a prompt', '提示词写法'), t('Open the guide to writing a good prompt', '打开提示词写法指南,写得更准')); foot.append(link); } } else { const rows = presets(storage); for (const item of rows) list.append(row(item.name, describe(item.settings), () => { hide(); - Promise.resolve(apply(item.settings)).then(problem => problem ? notify(problem, null, 'warn') : notify(t(`Preset applied: ${item.name}`, `已套用预设:${item.name}`)), + Promise.resolve(apply(item.settings)).then(problem => problem ? notify(problem, null, 'warn') : notify(t('Preset applied: {name}', '已套用预设:{name}', { name: item.name })), () => notify(t('Could not apply the preset.', '预设没能套用。'), null, 'fail')); }, () => { removePreset(item.id, storage); render(); }, t('Delete preset', '删除预设'), {named: true})); if (!rows.length) empty(t('Save the current settings to use them again in one step.', '把当前设置存成预设,下次一步套用。')); @@ -183,7 +185,7 @@ export function createPromptLibrary({t, host, fill, snapshot, apply, describe = const name = el('input', 'fvs-preset-name'); name.type = 'text'; name.maxLength = 40; name.required = true; name.placeholder = t('Preset name', '预设名称'); name.setAttribute('aria-label', name.placeholder); const withPrompt = el('label', 'fvs-preset-check'), promptBox = el('input'); promptBox.type = 'checkbox'; - withPrompt.append(promptBox, document.createTextNode(t('Include the prompt', '包含描述'))); + withPrompt.append(promptBox, document.createTextNode(t('Include the prompt', '包含提示词'))); const withSeed = el('label', 'fvs-preset-check'), seedBox = el('input'); seedBox.type = 'checkbox'; withSeed.append(seedBox, document.createTextNode(t('Include the seed', '包含种子值'))); const save = el('button', 'fvs-preset-save', t('Save', '保存')); save.type = 'submit'; @@ -205,6 +207,7 @@ export function createPromptLibrary({t, host, fill, snapshot, apply, describe = function show(which) { if (which) tab = which; query = ''; search.value = ''; + if (panel.parentNode !== home()) home().append(panel); panel.hidden = false; button.setAttribute('aria-expanded', 'true'); render(); document.addEventListener('pointerdown', outside, true); (tab === 'presets' ? panel.querySelector('.fvs-preset-name') : search)?.focus({preventScroll: true}); diff --git a/web/prompt_references.js b/web/prompt_references.js index 0b5d25c2..421557ad 100644 --- a/web/prompt_references.js +++ b/web/prompt_references.js @@ -2,6 +2,7 @@ import {caretRect} from './caret_rect.js'; import {listenDialogKey} from './dialog_keys.js'; import {effectiveRows} from './replace_state.js'; +import { translatorFor } from './i18n.js'; const titles = {image: 'Picture', video: 'Video', audio: 'Audio'}; const widget = (node, name) => node?.widgets?.find(w => w.name === name); const linkFor = (node, name) => node?.graph?.links?.[node.inputs?.find(i => i.name === name)?.link]; @@ -121,7 +122,7 @@ export function remapReferences(text, previous, current, removed = '[Removed ref } const bindings = new WeakMap(); -export function syncReferencePrompt(node, t = en => en, reset = false) { +export function syncReferencePrompt(node, t = translatorFor(null, false), reset = false) { const text = widget(node, 'text'); if (!text || linkFor(node, 'text') || linkFor(node, 'conditioning')) { bindings.delete(node); return; } let items; try { items = referenceItems(node); } catch { return; } @@ -157,7 +158,7 @@ export const handleNames = people => people.map(person => person.handle || perso let serial = 0; // `characters()` lists library characters for the same popup: [{id, name, thumb, blocked}], `blocked` being the reason // one cannot be used now; `onCharacter(character)` puts its pictures in the media list and may return false to refuse. -export function attachReferencePicker(input, {items, t = en => en, view, host, addMedia, characters = () => [], onCharacter = () => true} = {}) { +export function attachReferencePicker(input, {items, t = translatorFor(null, false), view, host, addMedia, characters = () => [], onCharacter = () => true} = {}) { if (!document.querySelector('link[data-freevideo-references]')) { const css = document.createElement('link'); css.rel = 'stylesheet'; css.dataset.freevideoReferences = ''; css.href = new URL('./prompt_references.css', import.meta.url).href; diff --git a/web/prompt_sections.js b/web/prompt_sections.js index 6fd04074..79a34aad 100644 --- a/web/prompt_sections.js +++ b/web/prompt_sections.js @@ -1,16 +1,35 @@ // A rewrite in H3's sections, as the prompt box shows it: the scene, then a "Sound:" paragraph (any music joins it). // The section names, the summary and the retention analysis stay out of sight; `modelText` puts them back when the // prompt is sent, so an untouched rewrite reaches the model exactly as the model wrote it. +import { CATALOG, translator, translatorFor } from './i18n.js'; + const ORDERS = [ ['subject_definitions', 'summary', 'retention_analysis', 'detailed_description', 'overall_soundscape', 'non_diegetic_music'], ['integrated_multimodal_description', 'overall_soundscape', 'non_diegetic_music'], ]; const SCENE = new Set(['detailed_description', 'integrated_multimodal_description']); -const LABELS = [['en', 'Sound: '], ['zh', '声音:']]; +// The box's own words, as the page writes them. Text written on a page of another language is read back too: English, +// Chinese in both scripts, and the language of this page. +const shotText = (t, number, time, text) => t('Shot {number} ({time}): {text}', '镜头 {number}({time}):{text}', { number, time, text }); +const soundText = (t, text) => t('Sound: {text}', '声音:{text}', { text }); +const TRADITIONAL = translatorFor({'Shot {number} ({time}): {text}': '鏡頭 {number}({time}):{text}', 'Sound: {text}': '聲音:{text}'}, true); +const WRITERS = [translatorFor(null, false), translatorFor(null, true), TRADITIONAL, ...(CATALOG ? [translator(true), translator(false)] : [])]; const NO_MUSIC = /^n\/?a\.?$/i; // "[Shot 2] At 00:03.000, ..." in the model's words; "Shot 2 (0:03): ..." or "镜头 2(0:03):..." in the box. const AT = /^At (\d{1,2}):(\d{2}(?:\.\d+)?),[ \t]*/; -const SHOT_HEAD = /^(?:Shot|镜头) (\d+)(?: ?[((](\d{1,2}):(\d{2}(?:\.\d+)?)[))])?[::][ \t]*/; +const SHOT_HEAD = /^(?:Shot|镜头|鏡頭) (?:\d+)(?: ?[((](?\d{1,2}):(?\d{2}(?:\.\d+)?)[))])?[::][ \t]*/; +// What this page's language file writes in front of {text}, as a pattern; null when the file has no such text or writes +// something after it. +function ownHead(written, start) { + if (!CATALOG || !written.endsWith('{text}')) return null; + const pattern = written.slice(0, -'{text}'.length).trimEnd().replace(/[.*+?^$()|[\]\\]/g, '\\$&').replace(/\s+/g, '\\s*') + .replace('{number}', '\\d+').replace('{time}', '(?\\d{1,2}):(?\\d{2}(?:\\.\\d+)?)'); + return pattern ? `${start}${pattern}[ \\t]*` : null; +} +const OWN_SHOT = ownHead(translator(false)('Shot {number} ({time}): {text}', '镜头 {number}({time}):{text}'), '^'); +const OWN_SOUND = ownHead(translator(false)('Sound: {text}', '声音:{text}'), ''); +const ownShot = OWN_SHOT && new RegExp(OWN_SHOT), shotHead = paragraph => SHOT_HEAD.exec(paragraph) || (ownShot ? ownShot.exec(paragraph) : null); +const SOUND_HEAD = new RegExp(`(?:^|\\n\\n+)(?:(?:Sound:|声音:|聲音:)[ \\t]*${OWN_SOUND ? `|${OWN_SOUND}` : ''})`, 'g'); // [[name, body]] when the text is exactly H3's sections in order (subject definitions may be absent), else null. function sections(text) { @@ -40,20 +59,17 @@ const clock = (minutes, seconds) => `${minutes}:${seconds.replace(/(\.\d*?)0+$/, // What the box shows for a rewrite, or null to show it as it is. A single shot shows without its marker; several shots // each start a paragraph with their number and start time. -export function shownRewrite(text, language = 'en') { +export function shownRewrite(text, language = 'en', t = translator(language === 'zh')) { const rows = sections(text); if (!rows) return null; const get = name => rows.find(([key]) => key === name)?.[1] ?? ''; const list = shots(rows.find(([key]) => SCENE.has(key))[1]); if (!list) return null; - const zh = language === 'zh'; - const scene = list.length === 1 ? list[0].text : list.map((shot, index) => { - const time = clock(shot.minutes, shot.seconds); - return (zh ? `镜头 ${index + 1}(${time}):` : `Shot ${index + 1} (${time}): `) + shot.text; - }).join('\n\n'); + const scene = list.length === 1 ? list[0].text + : list.map((shot, index) => shotText(t, index + 1, clock(shot.minutes, shot.seconds), shot.text)).join('\n\n'); const music = get('non_diegetic_music'); const sound = [get('overall_soundscape'), NO_MUSIC.test(music) ? '' : music].filter(Boolean).join(' '); - return scene + '\n\n' + (zh ? LABELS[1][1] : LABELS[0][1]) + sound; + return scene + '\n\n' + soundText(t, sound); } // The scene section for the scene part of an edited box. Paragraphs that open with a shot number become that shot, @@ -61,7 +77,7 @@ export function shownRewrite(text, language = 'en') { function sceneFromBox(box, original) { const shot = []; for (const paragraph of box.split(/\n\n+/)) { - const head = SHOT_HEAD.exec(paragraph); + const head = shotHead(paragraph); if (head || !shot.length) shot.push({head, text: paragraph.slice(head ? head[0].length : 0).trim()}); else shot[shot.length - 1].text += ' ' + paragraph.trim(); } @@ -69,10 +85,11 @@ function sceneFromBox(box, original) { return shot.map(({head, text}, index) => { const old = original?.[index]; let at = ''; - if (head?.[2] !== undefined) { - const time = clock(Number(head[2]), head[3]); + const { m, s } = head?.groups || {}; + if (m !== undefined) { + const time = clock(Number(m), s); at = old && clock(old.minutes, old.seconds) === time ? old.at - : time === '0:00' && index === 0 ? '' : `At ${head[2].padStart(2, '0')}:${head[3]},`; + : time === '0:00' && index === 0 ? '' : `At ${m.padStart(2, '0')}:${s},`; } else if (old?.at) at = old.at; return `[Shot ${index + 1}] ${at ? at + ' ' : ''}${text}`; }).join(' '); @@ -82,14 +99,14 @@ function sceneFromBox(box, original) { // definitions and retention analysis but drops the summary, which may no longer match the edited scene. export function modelText(shown, rewrite) { const rows = sections(rewrite); - if (!rows || LABELS.some(([code]) => shownRewrite(rewrite, code) === shown)) return rows ? rewrite : shown; + if (!rows || WRITERS.some(t => shownRewrite(rewrite, 'en', t) === shown)) return rows ? rewrite : shown; const get = name => rows.find(([key]) => key === name)?.[1] ?? ''; const [sceneName, sceneText] = rows.find(([key]) => SCENE.has(key)); const box = String(shown ?? '').trim(); - // The last paragraph that opens with "Sound:" or "声音:" (in either language) is the sound; the music goes on while + // The last paragraph that opens with "Sound:" or "声音:" (in any language above) is the sound; the music goes on while // its words still end it. Without one, the whole box is the scene and no sound is described, as the box shows. let scene = box, soundscape = 'N/A', music = get('non_diegetic_music'); - const heads = [...box.matchAll(/(?:^|\n\n+)(?:Sound:|声音:)[ \t]*/g)]; + const heads = [...box.matchAll(SOUND_HEAD)]; const head = heads[heads.length - 1]; let sound = head ? box.slice(head.index + head[0].length).trim() : ''; if (head) scene = box.slice(0, head.index).trim(); diff --git a/web/prompt_terms.js b/web/prompt_terms.js index 8ce5a0aa..00c03dea 100644 --- a/web/prompt_terms.js +++ b/web/prompt_terms.js @@ -2,6 +2,7 @@ // a word is written only when it is chosen, and the typed language decides which form is inserted. import {caretRect} from './caret_rect.js'; import {listenDialogKey} from './dialog_keys.js'; +import { translatorFor } from './i18n.js'; export const TERMS = [ ['dolly in', '推镜头'], ['dolly out', '拉镜头'], ['pan left', '左摇镜头'], ['pan right', '右摇镜头'], ['tilt up', '上摇镜头'], ['tilt down', '下摇镜头'], ['tracking shot', '跟拍镜头'], ['orbit shot', '环绕镜头'], @@ -42,7 +43,7 @@ export function termMatches(text, caret = text.length, terms = TERMS) { } let serial = 0; -export function attachTermSuggest(input, {t = en => en, host, suppressed = () => false} = {}) { +export function attachTermSuggest(input, {t = translatorFor(null, false), host, suppressed = () => false} = {}) { if (!document.querySelector('link[data-freevideo-references]')) { const css = document.createElement('link'); css.rel = 'stylesheet'; css.dataset.freevideoReferences = ''; css.href = new URL('./prompt_references.css', import.meta.url).href; diff --git a/web/replace_person.js b/web/replace_person.js index ad56191b..ed7a9bbd 100644 --- a/web/replace_person.js +++ b/web/replace_person.js @@ -131,9 +131,9 @@ export function createReplacePerson({t, api, media, mount, view, onChange = () = peopleBox.dataset.count = String(shown); peopleBox.replaceChildren(...Array.from({length: shown}, (_, index) => { const part = personSlot(index); - part.title.textContent = shown > 1 ? t(`Person image ${index + 1}`, `人物图 ${index + 1}`) : t('Person image', '人物图'); + part.title.textContent = shown > 1 ? t('Person image {number}', '人物图 {number}', { number: index + 1 }) : t('Person image', '人物图'); part.remove.hidden = !people[index]; part.remove.disabled = Boolean(busy); - part.remove.setAttribute('aria-label', t(`Remove person image ${index + 1}`, `移除人物图 ${index + 1}`)); + part.remove.setAttribute('aria-label', t('Remove person image {number}', '移除人物图 {number}', { number: index + 1 })); fill(part, people[index], t('Add image', '添加图片')); return part.box; })); diff --git a/web/report_issue.js b/web/report_issue.js index d813b6cb..c93e0b6c 100644 --- a/web/report_issue.js +++ b/web/report_issue.js @@ -234,11 +234,11 @@ export function showReportTip(bar, anchor, t, {mode = 'invite', submit, onHide = mark.replaceChildren(glyph('done')); title.textContent = t('Last step', '最后一步'); lead.replaceChildren(...words(savedName?.endsWith('.zip') - ? t(`The report is large, so it was saved as ${savedName}. Please drag it into "Diagnostic report", then select Submit new issue.`, - `报告较大,已保存为 ${savedName}。请将它拖入「诊断报告」,再点击 Submit new issue。`) + ? t('The report is large, so it was saved as {savedName}. Please drag it into "Diagnostic report", then select Submit new issue.', + '报告较大,已保存为 {savedName}。请将它拖入「诊断报告」,再点击 Submit new issue。', { savedName }) : savedName - ? t(`Please drag ${savedName} into "Diagnostic report", then select Submit new issue.`, - `请将 ${savedName} 拖入「诊断报告」,再点击 Submit new issue。`) + ? t('Please drag {savedName} into "Diagnostic report", then select Submit new issue.', + '请将 {savedName} 拖入「诊断报告」,再点击 Submit new issue。', { savedName }) : t('Please drag the downloaded report into "Diagnostic report", then select Submit new issue.', '请将下载的诊断报告拖入「诊断报告」,再点击 Submit new issue。'))); const link = el('a', null, t("Page didn't open? Open the feedback page", '页面没有打开?点此前往反馈页面')); diff --git a/web/request_assets.js b/web/request_assets.js index 09de4420..30c483ca 100644 --- a/web/request_assets.js +++ b/web/request_assets.js @@ -1,5 +1,5 @@ // One muted line above Generate: what this request will download first. -export const about = (seconds, t) => seconds >= 60 ? t(`About ${Math.ceil(seconds / 60)} min`, `约 ${Math.ceil(seconds / 60)} 分钟`) : t('Under 1 min', '不到 1 分钟'); +export const about = (seconds, t) => seconds >= 60 ? t('About {minutes} min', '约 {minutes} 分钟', { minutes: Math.ceil(seconds / 60) }) : t('Under 1 min', '不到 1 分钟'); // ", about 5 min" after a size, only when a real download speed is known. export function timeAfter(bytes, rate, t) { if (!(bytes > 0) || !(rate > 0)) return ''; @@ -44,7 +44,7 @@ export function createRequestAssets({t, api, request, onError = () => {}}) { function lines(items, rate) { const rows = []; // One line names what Generate will fetch first: the two-pass model, then the sampling data. - const names = {upscaler: t('two-pass model', '二采模型'), sampling: t('sampling data', '采样数据')}; + const names = {upscaler: t('second pass model', '二采模型'), sampling: t('sampling data', '采样数据')}; const bytes = {}; for (const item of items) { if (item.action !== 'auto') continue; @@ -54,15 +54,15 @@ export function createRequestAssets({t, api, request, onError = () => {}}) { const parts = [['upscaler', names.upscaler], ['sampling', names.sampling], ['other', t('other model files', '其他模型文件')]] .filter(([kind]) => bytes[kind]).map(([kind, name]) => `${name} ${size(bytes[kind])}`); const wait = timeAfter(Object.values(bytes).reduce((sum, n) => sum + n, 0), rate, t); - if (parts.length) rows.push(t(`Downloads before generating: ${parts.join(', ')}${wait}`, `生成前会先下载:${parts.join('、')}${wait}`)); + if (parts.length) rows.push(t('Downloads before generating: {items}{wait}', '生成前会先下载:{items}{wait}', { items: parts.join(t(', ', '、')), wait })); for (const item of items) { if (item.action === 'unavailable') continue; if (item.kind === 'prompt-vlm') { const wait = timeAfter(item.bytes, rate, t); - rows.push(t(`First prompt rewrite downloads ${size(item.bytes)}${wait}`, `首次改写提示词会先下载 ${size(item.bytes)}${wait}`)); + rows.push(t('First prompt rewrite downloads {size}{wait}', '首次改写提示词会先下载 {size}{wait}', { size: size(item.bytes), wait })); } else if (item.kind === 'lora') { const names = (item.names || []).map(short); - rows.push(t(`LoRA not found: ${names.join(', ')}`, `找不到 LoRA:${names.join('、')}`)); + rows.push(t('LoRA not found: {names}', '找不到 LoRA:{names}', { names: names.join(t(', ', '、')) })); } } return rows; diff --git a/web/result_actions.js b/web/result_actions.js index 2f18d8cb..d86c9ebb 100644 --- a/web/result_actions.js +++ b/web/result_actions.js @@ -25,6 +25,7 @@ const ICONS = { expand: '', copy: '', trash: '', + star: '', heart: '', reuse: '', upscale: '', @@ -41,7 +42,7 @@ export function icon(name) { export function previewBadge(record, t) { const badge = document.createElement('span'); badge.className = 'fv-preview-badge'; const g = record.preview_geometry; - badge.textContent = g?.width ? t(`First-pass preview · ${g.width} × ${g.height}`, `一采预览 · ${g.width} × ${g.height}`) + badge.textContent = g?.width ? t('First-pass preview · {width} × {height}', '一采预览 · {width} × {height}', { width: g.width, height: g.height }) : t('First-pass preview', '一采预览'); return badge; } @@ -202,7 +203,7 @@ async function reuseAction(record, t, reuse) { clearTimeout(timer); stop(); const button = action('button', '', 'reuse', 'fv-action-secondary fv-action-reuse'); button.dataset.tourId = 'library-reuse'; - button.dataset.fvTipName = label; button.dataset.fvTipUse = t('Bring back its prompt, size and length', '带回这条的描述、尺寸和时长'); + button.dataset.fvTipName = label; button.dataset.fvTipUse = t('Bring back its prompt, size and length', '带回这条的提示词、尺寸和时长'); button.lastElementChild.replaceWith(make(label)); button.hidden = !offered(); button.onclick = () => { @@ -264,12 +265,20 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null, const bar = document.createElement('div'); bar.className = 'fv-actions'; const stage = layout === 'stage'; if (stage) bar.dataset.layout = 'stage'; - let download = null, copy = null; + let download = null, copy = null, favoriteButton = null; if (secondPass) bar.append(secondPassAction(t, secondPass)); if (favorite) { - const button = action('button', '', 'heart', 'fv-action-secondary fv-action-favorite'); + const button = action('button', '', stage ? 'star' : 'heart', 'fv-action-secondary fv-action-favorite'); const sync = () => { button.setAttribute('aria-pressed', String(!!record.favorite)); + if (stage) { + // Under the picture the key names the state ("Favourite" / "Favourited"), after Download; its hover card says what a press does. + button.lastElementChild.textContent = record.favorite ? t('Favorited', '已收藏') : t('Favorite', '收藏'); + button.dataset.fvTipName = record.favorite ? t('Favorited', '已收藏') : t('Favorite', '收藏'); + button.dataset.fvTipUse = record.favorite ? t('Take this video out of favorites', '把这条视频移出收藏') : t('Keep it at the top of Creations', '在作品里置顶保留'); + button.setAttribute('aria-label', button.lastElementChild.textContent); + return; + } button.lastElementChild.textContent = button.title = record.favorite ? t('Remove from favorites', '取消收藏') : t('Add to favorites', '收藏'); button.setAttribute('aria-label', button.title); @@ -284,6 +293,7 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null, catch { /* Shown by the caller. */ } finally { sync(); button.disabled = false; button.removeAttribute('aria-busy'); } }; + favoriteButton = button; bar.append(button); } if (record.video) { @@ -294,6 +304,7 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null, download.dataset.fvTipName = t('Download video', '下载视频'); download.dataset.fvTipUse = t('Save the video to this computer', '把视频保存到本机'); bar.append(download); + if (stage && favoriteButton) download.after(favoriteButton); copy = action('button', t('Copy path', '复制路径'), 'copy', 'fv-action-secondary fv-action-copy'); copy.dataset.fvTipName = t('Copy path', '复制路径'); copy.dataset.fvTipUse = t('Copy where the file is saved', '复制视频文件所在位置'); @@ -308,7 +319,7 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null, }; bar.append(copy); // The creative panel puts Reuse right after the primary action; Copy path goes under More there. - if (reuse) reuseAction(record, t, reuse).then(button => { if (button && bar.isConnected) (stage ? download : copy).after(button); }); + if (reuse) reuseAction(record, t, reuse).then(button => { if (button && bar.isConnected) (stage ? favoriteButton || download : copy).after(button); }); } if (extend && canExtend(record)) { const button = action('button', extendText(t, 'action'), 'extend', 'fv-action-secondary fv-action-extend'); @@ -317,7 +328,7 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null, let problem; const fault = () => { problem?.remove(); - problem = issueButton(t, () => ({where: ['Continue video', '延长视频'], message: label.textContent})); + problem = issueButton(t, () => ({where: ['Extend video', '延长视频'], message: label.textContent})); button.after(problem); }; // Only a video the server says is gone keeps the issue button; a check that could not finish just retries. @@ -348,7 +359,7 @@ export function resultActions(record, t, {diagnostic = null, secondPass = null, share.className = 'fv-action fv-action-secondary fv-share-trigger'; const label = document.createElement('span'); label.textContent = share.textContent; share.replaceChildren(icon('share'), label); - share.dataset.fvTipName = label.textContent; share.dataset.fvTipUse = t('Export a video or picture to send', '导出可发送的视频或图片'); + share.dataset.fvTipName = label.textContent; share.dataset.fvTipUse = t('Export a video or image to send', '导出可发送的视频或图片'); bar.append(share); if (diagnostic) { const reportLabel = t('Download report', '下载报告'); diff --git a/web/sampling_effort.css b/web/sampling_effort.css index 5df36be1..b6cc7311 100644 --- a/web/sampling_effort.css +++ b/web/sampling_effort.css @@ -7,7 +7,13 @@ .fv-effort{--fv-position:0;--fv-snap:.18s;--fv-move:cubic-bezier(.25,1.15,.45,1);--fv-tone:var(--fv-accent,#6db8fa)} .fv-effort-heading{display:flex;align-items:baseline;gap:8px;margin:0 0 10px;color:var(--fv-muted,#969a9f);font:12px/1.5 var(--fv-font,system-ui)} .fv-effort-estimate{margin-left:auto;font-variant-numeric:tabular-nums;text-align:right;font-size:11px} -.fv-effort-warning{margin:-4px 0 10px;color:var(--fv-warning);font:11px/1.5 var(--fv-font,system-ui);text-align:left} +.fv-effort-warning{margin:-4px 0 10px;color:var(--fv-warning);font:11px/1.5 var(--fv-font,system-ui);text-align:left;text-wrap:pretty} +/* The Fast level's download line in the same window: no one-character last line (Lane 11-24). */ +.fv-fast-pack .fv-swap-download-text{text-wrap:pretty} +.fv-effort-ways{display:flex;flex-wrap:wrap;gap:8px;margin:-2px 0 12px} +.fv-effort-way{min-height:var(--fv-h-sm,28px);padding:0 12px;border:1px solid var(--fv-border);border-radius:var(--fv-rad-ctl,8px);background:var(--fv-raised);color:var(--fv-ink);font:var(--fv-semibold,600) var(--fv-micro,12px)/1 var(--fv-font,system-ui);cursor:pointer} +.fv-effort-way:hover{background:var(--fv-hover)} +.fv-effort-way:focus-visible{outline:2px solid var(--fv-accent);outline-offset:2px} .fv-effort-rail{position:relative;cursor:pointer;touch-action:pan-y;user-select:none;-webkit-user-select:none;outline:none;border-radius:var(--fv-r-lg)} /* A thick track in the interface's own accent; the knob travels inside it. */ .fv-effort-track{position:relative;display:block;height:36px;border-radius:var(--fv-r-lg);background:color-mix(in srgb,var(--fv-ink,#eee) 7%,transparent);box-shadow:inset 0 1px 2px #0005} diff --git a/web/sampling_effort.js b/web/sampling_effort.js index b82427b2..188bc4bf 100644 --- a/web/sampling_effort.js +++ b/web/sampling_effort.js @@ -3,12 +3,25 @@ // told apart by the learned upscale factor (Medium starts from a larger first pass); High and Max // sample 16 and 20 steps once, both with the guarded step cache. `upscale` is 2 for every single-pass level. const frozen = rows => Object.freeze(rows.map(row => Object.freeze({...row}))); +// Steps as words: "8 steps", "1 step", "8 + 3 steps" (the second pass's steps after the plus). One sentence each, so a +// language whose nouns change with the number writes plural forms for them. +export const stepsWords = (t, steps, twoPass = false, refine = 3) => twoPass + ? t('{steps} + {refine} steps', '{steps} + {refine} 步', {steps, refine}) + : steps === 1 ? t('1 step', '1 步') : t('{steps} steps', '{steps} 步', {steps}); export const SAMPLING_EFFORTS = frozen([ {name: 'Light', zh: '轻量', steps: 8, twoPass: true, stepCache: null, upscale: 2, color: '#3dd6b5'}, {name: 'Medium', zh: '标准', steps: 8, twoPass: true, stepCache: null, upscale: 1.5, color: '#4ea8ff'}, {name: 'High', zh: '精细', steps: 16, twoPass: false, stepCache: 'easycache-av', upscale: 2, color: '#9d7bff'}, {name: 'Max', zh: '极致', steps: 20, twoPass: false, stepCache: 'easycache-av', upscale: 2, color: '#ffa94d'}, ]); +// The Fast level, listed before Light where the planner admits it (grid.fast_mode). The engine takes its steps from the +// `fast_mode` input, so it is never matched from step counts. Its one line of description is here. +export const FAST_EFFORT = Object.freeze({name: 'Fast', zh: '极速', fast: true, steps: 2, twoPass: false, stepCache: null, upscale: 2, color: '#35d0e6'}); +export const FAST_OPTION_TEXT = Object.freeze(['Faster; fine detail may flicker', '更快,画面细节可能闪烁']); +// What a capability grid offers of it (capabilities.fast_mode, listed by the planner); never on a Mac, where the engine +// refuses it. +export const fastOfferOf = grid => grid?.machine?.system !== 'Darwin' && grid?.fast_mode?.listed === true ? grid.fast_mode : null; +export const withFastLevel = (levels, offer) => offer ? frozen([FAST_EFFORT, ...levels]) : levels; // Mac runs the same plans; retain platform identity for its legacy High alias. const macLevels = new WeakSet(); export const SAMPLING_EFFORTS_MAC = frozen(SAMPLING_EFFORTS); @@ -54,7 +67,7 @@ export function effortsFrom(grid) { // two-pass levels apart (a single pass has none). export function effortFor(steps, twoPass, refine, stepCache = null, levels = SAMPLING_EFFORTS, upscale = 2) { const cache = stepCacheOf(stepCache), factor = twoPass ? upscaleOf(upscale) : 2; - return levels.find(tier => tier.steps === steps && tier.twoPass === twoPass && (!twoPass || refine === 3) + return levels.find(tier => !tier.fast && tier.steps === steps && tier.twoPass === twoPass && (!twoPass || refine === 3) && tier.stepCache === cache && tier.upscale === factor) || legacyMaxEffort(steps, twoPass, cache, levels) || (macLevels.has(levels) ? legacyMacEffort(steps, twoPass, cache, levels) : undefined); @@ -101,46 +114,61 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels const label = el('span', '', t('Quality', '质量')); const estimate = el('span', 'fv-effort-estimate'); const warning = el('div', 'fv-effort-warning'); warning.hidden = true; + // Ways out of what the warning says (the Fast level where a length does not fit): buttons under it. + const ways = el('div', 'fv-effort-ways'); ways.hidden = true; // The names under the track show the level; the heading does not repeat it. header.append(label, custom, estimate); const rail = el('div', 'fv-effort-rail'); rail.tabIndex = 0; rail.setAttribute('role', 'slider'); rail.setAttribute('aria-label', label.textContent); - rail.setAttribute('aria-valuemin', '0'); rail.setAttribute('aria-valuemax', '3'); + rail.setAttribute('aria-valuemin', '0'); rail.setAttribute('aria-orientation', 'horizontal'); rail.dataset.fvTipName = t('Quality level', '质量档位'); rail.dataset.fvTipKey = '← →'; rail.dataset.fvTipUse = t('More steps look finer and take longer', '步数越多越细,用时越长'); // A thick track with the knob inside it; stops sit at the knob's centers. const track = el('span', 'fv-effort-track'); track.setAttribute('aria-hidden', 'true'); const fill = el('span', 'fv-effort-fill'); track.append(fill); - const stops = [0, 1, 2, 3].map(i => { const stop=el('span','fv-effort-stop'); stop.style.setProperty('--fv-stop', i / 3); track.append(stop); return stop; }); + let stops = [], nameButtons = [], fastUse = ''; + const last = () => efforts.length - 1; const knob = el('span', 'fv-effort-knob'); track.append(knob); rail.append(track); knob.addEventListener('animationend', () => knob.classList.remove('fv-effort-pop')); const names = el('div', 'fv-effort-names'); - const nameButtons = efforts.map((tier, i) => { - const b = el('button', 'fv-effort-name', effortName(t, tier)); b.type = 'button'; b.tabIndex = -1; - b.style.setProperty('--fv-stop', i / 3); - b.dataset.fvTipName = effortName(t, tier); - b.dataset.fvTipUse = tier.twoPass - ? (tier.upscale < 2 ? t(`${tier.steps} + 3 steps from a larger first pass: more detail`, `两遍 ${tier.steps} + 3 步,一采更大、细节更多`) - : t(`${tier.steps} + 3 steps in two passes: fastest`, `两遍 ${tier.steps} + 3 步,最快`)) - : t(`${tier.steps} steps in one pass: finer, slower`, `一遍 ${tier.steps} 步,更细也更慢`); - b.onclick = () => { if (!disabled && pointer === null) commit(i); }; - names.append(b); return b; - }); - element.append(header, warning, rail, names); - let selected = 0, disabled = false, pointer = null, draft = 0, previewed = -1, currentSteps = 8, currentRefine = 3, twoPass = true, stepCache = null, upscale = 2, reason = ''; + const nameUse = tier => tier.fast ? fastUse || t(...FAST_OPTION_TEXT) : tier.twoPass + ? (tier.upscale < 2 ? t('{steps} + 3 steps from a larger first pass: more detail', '两遍 {steps} + 3 步,一采更大、细节更多', { steps: tier.steps }) + : efforts.some(level => level.fast) ? t('{steps} + 3 steps in two passes: quick', '两遍 {steps} + 3 步,速度较快', { steps: tier.steps }) + : t('{steps} + 3 steps in two passes: fastest', '两遍 {steps} + 3 步,最快', { steps: tier.steps })) + : t('{steps} steps in one pass: finer, slower', '一遍 {steps} 步,更细也更慢', { steps: tier.steps }); + // One stop and one name per level; a machine's table can add the Fast level. + function buildScale() { + for (const stop of stops) stop.remove(); + stops = efforts.map((_, i) => { const stop = el('span', 'fv-effort-stop'); stop.style.setProperty('--fv-stop', i / last()); track.insertBefore(stop, knob); return stop; }); + names.replaceChildren(); + names.toggleAttribute('data-fast', efforts.some(tier => tier.fast)); + nameButtons = efforts.map((tier, i) => { + const b = el('button', 'fv-effort-name', effortName(t, tier)); b.type = 'button'; b.tabIndex = -1; + b.style.setProperty('--fv-stop', i / last()); + b.dataset.level = tier.name; // the tooltip's words are found by level, whichever position it has + b.dataset.fvTipName = effortName(t, tier); + b.dataset.fvTipUse = nameUse(tier); + b.onclick = () => { if (!disabled && pointer === null) commit(i); }; + names.append(b); return b; + }); + rail.setAttribute('aria-valuemax', String(last())); + } + element.append(header, warning, ways, rail, names); + let selected = 0, disabled = false, pointer = null, draft = 0, previewed = -1, currentSteps = 8, currentRefine = 3, twoPass = true, stepCache = null, upscale = 2, reason = '', fastNow = false; + buildScale(); function paint(position) { - element.style.setProperty('--fv-position', position / 3); + element.style.setProperty('--fv-position', position / last()); const index = Math.round(position), tier = efforts[index]; nameButtons.forEach((b, i) => b.toggleAttribute('data-active', i === index)); stops.forEach((stop, i) => stop.toggleAttribute('data-filled', i <= position + .01)); rail.setAttribute('aria-valuenow', String(index)); - rail.setAttribute('aria-valuetext', `${effortName(t, tier)}, ${tier.steps}${tier.twoPass ? ' + 3' : ''} ${t('steps', '步')}`); + rail.setAttribute('aria-valuetext', tier.fast ? effortName(t, tier) : `${effortName(t, tier)}, ${stepsWords(t, tier.steps, tier.twoPass, 3)}`); } function position(event) { const box = rail.getBoundingClientRect(); // The knob's center travels between 18 px from either end (4 px inset, 28 px knob). - return Math.max(0, Math.min(3, (event.clientX - box.left - 18) / (box.width - 36) * 3)); + return Math.max(0, Math.min(last(), (event.clientX - box.left - 18) / (box.width - 36) * last())); } // A drag tells the caller the level under the knob when it changes, not on every move. function preview(position) { @@ -155,7 +183,7 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels function cancel() { const id = pointer; pointer = null; delete rail.dataset.dragging; if (id !== null && rail.hasPointerCapture(id)) rail.releasePointerCapture(id); - update({baseSteps: currentSteps, refineSteps: currentRefine, twoPass, stepCache, upscale, disabled, reason}); + update({baseSteps: currentSteps, refineSteps: currentRefine, twoPass, stepCache, upscale, disabled, reason, fast: fastNow}); onPreview(null); } rail.onpointerdown = event => { @@ -181,26 +209,26 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels rail.dataset.keyboard = 'true'; if (event.key === 'Escape' && pointer !== null) { event.preventDefault(); event.stopPropagation(); cancel(); return; } if (disabled || pointer !== null) return; - const next = {ArrowRight: selected + 1, ArrowUp: selected + 1, ArrowLeft: selected - 1, ArrowDown: selected - 1, Home: 0, End: 3}[event.key]; + const next = {ArrowRight: selected + 1, ArrowUp: selected + 1, ArrowLeft: selected - 1, ArrowDown: selected - 1, Home: 0, End: last()}[event.key]; if (next === undefined) return; - event.preventDefault(); commit(Math.max(0, Math.min(3, next))); + event.preventDefault(); commit(Math.max(0, Math.min(last(), next))); }; function update(state) { currentSteps = Number(state.baseSteps); currentRefine = Number(state.refineSteps); - twoPass = state.twoPass; stepCache = stepCacheOf(state.stepCache); upscale = upscaleOf(state.upscale); disabled = state.disabled; reason = state.reason || ''; + twoPass = state.twoPass; stepCache = stepCacheOf(state.stepCache); upscale = upscaleOf(state.upscale); disabled = state.disabled; reason = state.reason || ''; fastNow = Boolean(state.fast); rail.tabIndex = disabled ? -1 : 0; rail.setAttribute('aria-disabled', String(disabled)); element.dataset.disabled = String(disabled); if (pointer !== null) return; - const level = effortFor(currentSteps, twoPass, currentRefine, stepCache, efforts, upscale); + const level = (fastNow && efforts.find(tier => tier.fast)) || effortFor(currentSteps, twoPass, currentRefine, stepCache, efforts, upscale); // Custom steps sit at the nearest level, preferring one with the same pass count. const distance = v => Math.abs(v.steps - currentSteps) * 2 + (v.twoPass !== twoPass); - selected = level ? efforts.indexOf(level) : efforts.reduce((best, v, i) => distance(v) < distance(efforts[best]) ? i : best, 0); + const plain = efforts.filter(tier => !tier.fast); + selected = efforts.indexOf(level || plain.reduce((best, v) => distance(v) < distance(best) ? v : best)); const isCustom = !level; element.dataset.custom = String(isCustom); custom.hidden = !isCustom; - const unit = currentSteps === 1 && !twoPass ? t('step', '步') : t('steps', '步'); paint(selected); if (isCustom) nameButtons.forEach(b => b.removeAttribute('data-active')); // No level is highlighted for custom steps. - if (isCustom) rail.setAttribute('aria-valuetext', `${t('Custom', '自定义')} · ${currentSteps}${twoPass ? ' + ' + currentRefine : ''} ${unit}`); + if (isCustom) rail.setAttribute('aria-valuetext', `${t('Custom', '自定义')} · ${stepsWords(t, currentSteps, twoPass, currentRefine)}`); rail.title = disabled ? reason || t('Controlled by connected nodes.', '由连接的节点控制。') : t('Same model. Higher effort uses more sampling steps; results vary by scene.', '使用同一模型,提高档位会增加采样步数;效果因场景而异。'); if (disabled) rail.dataset.fvTipWhy = reason || t('Set by connected nodes', '由连接的节点决定'); else delete rail.dataset.fvTipWhy; @@ -209,10 +237,18 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels // The machine's own table (effortsFrom); the names stay, the plans follow the machine. function setLevels(next) { const same = (a, b) => a.steps === b.steps && a.twoPass === b.twoPass && a.stepCache === b.stepCache && a.upscale === b.upscale; - if (!next || next.length !== efforts.length || (macLevels.has(next) === macLevels.has(efforts) + if (!next || (next.length === efforts.length && macLevels.has(next) === macLevels.has(efforts) && next.every((tier, i) => same(tier, efforts[i])))) return; + const rebuilt = next.length !== efforts.length; efforts = next; - update({baseSteps: currentSteps, refineSteps: currentRefine, twoPass, stepCache, upscale, disabled, reason}); + if (rebuilt) buildScale(); + update({baseSteps: currentSteps, refineSteps: currentRefine, twoPass, stepCache, upscale, disabled, reason, fast: fastNow}); } - return {element, update, setLevels, levels: () => efforts, setWarning(text) { warning.textContent = text; warning.hidden = !text; }, setEstimate(text, title = '') { estimate.textContent = text; if (title) estimate.title = title; else estimate.removeAttribute('title'); }, dispose: cancel}; + // What the Fast level's option says: its download while the files are missing. + function setFastUse(text) { fastUse = text || ''; efforts.forEach((tier, i) => { if (tier.fast) nameButtons[i].dataset.fvTipUse = nameUse(tier); }); } + return {element, update, setLevels, setFastUse, levels: () => efforts, setWarning(text) { warning.textContent = text; warning.hidden = !text; }, + setWays(list = []) { + ways.replaceChildren(...list.map(way => { const b = el('button', 'fv-effort-way', way.label); b.type = 'button'; b.dataset.way = way.id; b.onclick = way.run; return b; })); + ways.hidden = !list.length; + }, setEstimate(text, title = '', parts = 0) { estimate.textContent = text; if (parts > 1) estimate.dataset.parts = String(parts); else delete estimate.dataset.parts; if (title) estimate.title = title; else estimate.removeAttribute('title'); }, dispose: cancel}; } diff --git a/web/settings_room.js b/web/settings_room.js index 86ab3c65..b3aa7c6a 100644 --- a/web/settings_room.js +++ b/web/settings_room.js @@ -39,6 +39,8 @@ if (typeof document !== 'undefined') { import { nearestAllowed } from './field_note.js'; import { cn, t, INSTALLED_HINT, gib, bytesText, atLeast, WAIT_REFUSAL, reportable, reportText, failureText, setupError, SECTIONS, sectionOf } from './settings_words.js'; import { languageUrl } from './i18n.js'; +import { languagePicker, addressLanguage } from './language_picker.js'; +import { localized } from './i18n_tables.js'; export { failureText, sectionOf, SECTIONS, bytesText }; let current; @@ -241,11 +243,11 @@ export async function openSetup(options) { // Picture models: both always listed, each with its own state (installed, not installed, downloading, failed). const imageCard = card(); const imageRows = new Map(); - const imageHead = groupHead(t('Picture models', '图像模型'), el('span', '', '')); + const imageHead = groupHead(t('Image models', '图像模型'), el('span', '', '')); const IMAGE_WORDS = { - 'minimax-h3-image': t('Default for the image view; clear lettering in pictures', '图像视图默认模型,图中文字清晰'), + 'minimax-h3-image': t('Default for the image view; clear lettering in images', '图像视图默认模型,图中文字清晰'), 'qwen-image-2.1-turbo': t('Another look, up to about 4 MP', '另一种画风,最大约 4 MP'), - 'moss-image-sft': t('Pictures from a text prompt, up to about 4 MP', '根据文字提示出图,最大约 4 MP'), + 'moss-image-sft': t('Images from a text prompt, up to about 4 MP', '根据文字提示出图,最大约 4 MP'), }; for (const model of IMAGE_MODELS) { const r = row({iconName: 'img', title: model.short, sub: IMAGE_WORDS[model.id] || '', cls: 'st-mrow'}); @@ -342,7 +344,7 @@ export async function openSetup(options) { for (const [id, name] of SOURCES) { const option = el('option', '', name); option.value = id; source.append(option); } let measuredRates = {}, autoBest = ''; const sourceList = radioList(source, {label: t('Download source', '下载源'), describe: value => { - const sub = value === 'auto' && autoBest ? t(`Recommended · now the ${autoBest}`, `推荐 · 当前用${autoBest}`) : SOURCES.find(s => s[0] === value)?.[2] || ''; + const sub = value === 'auto' && autoBest ? t('Recommended · now the {autoBest}', '推荐 · 当前用{autoBest}', { autoBest }) : SOURCES.find(s => s[0] === value)?.[2] || ''; const rate = measuredRates[value]; if (rate == null) return {sub}; const speedText = rate < 0 ? t('Unavailable', '未连通') : rate < .005 ? '<0.01 MiB/s' : `${rate.toFixed(rate < 1 ? 2 : 1)} MiB/s`; @@ -424,10 +426,10 @@ export async function openSetup(options) { const list = (Array.isArray(names) ? names : []).filter(n => typeof n === 'string'); const usable = list.filter(n => n.toLowerCase().endsWith('.safetensors')), other = list.length - usable.length; loraVerdicts.clear(); loraCard.replaceChildren(); - loraHead.querySelector('.r').textContent = usable.length ? t(`${usable.length} files`, `${usable.length} 个文件`) : ''; + loraHead.querySelector('.r').textContent = usable.length ? t('{count} files', '{count} 个文件', { count: usable.length }) : ''; if (!usable.length) { loraCard.append(row({iconName: 'layers', title: t('No LoRA files yet', '还没有 LoRA 文件'), sub: t('Put .safetensors files in models/loras, then check again', '把 .safetensors 文件放进 models/loras 文件夹,再点“重新检查”')}).element); - loraStatus.textContent = other ? t(`${other} files of other formats are not read.`, `另有 ${other} 个其他格式的文件不会被读取。`) : ''; + loraStatus.textContent = other ? t('{other} files of other formats are not read.', '另有 {other} 个其他格式的文件不会被读取。', { other }) : ''; loraRescan.disabled = false; return; } const rows = usable.slice(0, 200).map(name => { const made = loraRow(name); loraCard.append(made.r.element, made.more); return [name, made.r]; }); @@ -437,9 +439,9 @@ export async function openSetup(options) { await Promise.all([worker(), worker(), worker()]); if (run !== loraRun) return; loraRescan.disabled = false; - loraStatus.textContent = [bad ? t(`${bad} cannot be used; open a row for the reason.`, `${bad} 个不能使用,点开该行查看原因。`) : t('Every file was checked.', '已检查全部文件。'), + loraStatus.textContent = [bad ? t('{bad} cannot be used; open a row for the reason.', '{bad} 个不能使用,点开该行查看原因。', { bad }) : t('Every file was checked.', '已检查全部文件。'), usable.length > 200 ? t('The first 200 files are listed.', '只列出前 200 个文件。') : '', - other ? t(`${other} files of other formats are not read.`, `另有 ${other} 个其他格式的文件不会被读取。`) : ''].filter(Boolean).join(' '); + other ? t('{other} files of other formats are not read.', '另有 {other} 个其他格式的文件不会被读取。', { other }) : ''].filter(Boolean).join(' '); navItems.get('lora').querySelector('.end').replaceChildren(...(bad ? [el('i', 'st-dot')] : [])); } loraRescan.onclick = () => loadLoras(); @@ -493,11 +495,11 @@ export async function openSetup(options) { tip(tenSwitch, t('High color depth copy', '高色深版本'), t('Adds a 10-bit video beside it, for color grading', '另存一份 10 位视频,适合调色')); // Every finished picture is also copied into the output folder; the user can switch that off. The 10-bit row stays hidden. const imageSwitch = switchify(el('input')); imageSwitch.type = 'checkbox'; imageSwitch.checked = true; - imageSwitch.setAttribute('aria-label', t('Also save pictures to the output folder', '同时将图片保存到 output 文件夹')); - const imageRow = row({iconName: 'img', title: t('Also save pictures to the output folder', '同时将图片保存到 output 文件夹'), end: [imageSwitch]}); - tip(imageSwitch, t('Also save pictures to the output folder', '同时将图片保存到 output 文件夹')); + imageSwitch.setAttribute('aria-label', t('Also save images to the output folder', '同时将图片保存到 output 文件夹')); + const imageRow = row({iconName: 'img', title: t('Also save images to the output folder', '同时将图片保存到 output 文件夹'), end: [imageSwitch]}); + tip(imageSwitch, t('Also save images to the output folder', '同时将图片保存到 output 文件夹')); tenRow.element.hidden = true; - const outputCard = card(imageRow.element, tenRow.element); const outputHead = groupHead(t('Finished videos and pictures', '成片与图片')); + const outputCard = card(imageRow.element, tenRow.element); const outputHead = groupHead(t('Finished videos and images', '成片与图片')); let tenSaved = false, imageSaved = true; tenSwitch.onchange = async () => { const wanted = tenSwitch.checked; tenSwitch.disabled = true; @@ -532,7 +534,7 @@ export async function openSetup(options) { try { localStorage.setItem('freevideo.theme', themeSelect.value); } catch { /* This page only. */ } }; const themeRow = row({iconName: 'moon', title: t('Theme', '主题'), sub: t('Applies at once to every view', '立即应用到所有视图'), - end: [segmented(themeSelect, {label: t('Theme', '主题'), tips: {dark: t('Dark panels, best for pictures', '深色界面,适合看画面'), light: t('Light panels', '浅色界面')}})]}); + end: [segmented(themeSelect, {label: t('Theme', '主题'), tips: {dark: t('Dark panels, best for viewing', '深色界面,适合看画面'), light: t('Light panels', '浅色界面')}})]}); const solidSwitch = switchify(el('input')); solidSwitch.type = 'checkbox'; solidSwitch.setAttribute('aria-label', t('Compatibility view', '兼容界面')); const solidNow = () => document.documentElement.dataset.glass === 'solid' || document.documentElement.classList.contains('lite'); @@ -543,6 +545,16 @@ export async function openSetup(options) { }; tip(solidSwitch, t('Compatibility view', '兼容界面'), t('For older computers', '适合较旧的电脑')); const solidRow = row({iconName: 'layers', title: t('Compatibility view', '兼容界面'), sub: t('Solid panels, fewer animations, no autoplay', '实体背景,减少动画,视频不自动播放'), end: [solidSwitch]}); + // Compact layout: the creation panel keeps only the prompt, the preview and Create. Read by the panel when it opens + // and told at once through an event when this switch moves. + const compactSwitch = switchify(el('input')); compactSwitch.type = 'checkbox'; + compactSwitch.setAttribute('aria-label', t('Compact layout', '简洁模式')); + try { compactSwitch.checked = localStorage.getItem('freevideo.studio.compact') === '1'; } catch { /* off */ } + compactSwitch.onchange = () => { + try { localStorage.setItem('freevideo.studio.compact', compactSwitch.checked ? '1' : '0'); } catch { /* this page only */ } + window.dispatchEvent(new CustomEvent('fv-studio-compact', {detail: compactSwitch.checked})); + }; + const compactRow = row({iconName: 'film', title: t('Compact layout', '简洁模式'), sub: t('Only the prompt, preview and Create in the creation panel', '创作面板只显示描述、预览和生成'), end: [compactSwitch]}); // The top bar's status capsule follows the same key (freevideo.monitor.shown): on only when set to "1"; never set // reads as off. Writing goes through setMonitorShown, whose event repaints the capsule in the same frame. const statusShown = () => { try { return localStorage.getItem('freevideo.monitor.shown') === '1'; } catch { return false; } }; @@ -560,9 +572,21 @@ export async function openSetup(options) { langSelect.onchange = () => { langReload.hidden = langSelect.value === (cn ? 'zh' : 'en'); }; langReload.onclick = () => { const url = languageUrl(location.href, langSelect.value); location.replace(url.href); }; tip(langReload, t('Reload now', '立即重新载入'), t('Reload the page in the chosen language', '以所选语言重新载入页面')); - const langRow = row({iconName: 'globe', title: t('Interface language', '界面语言'), end: [segmented(langSelect, {label: t('Language', '语言'), tips: {zh: t('Show the interface in Chinese', '界面显示为中文'), en: t('Show the interface in English', '界面显示为英文')}})]}); + const langSeg = segmented(langSelect, {label: t('Language', '语言'), tips: {zh: t('Show the interface in Chinese', '界面显示为中文'), en: t('Show the interface in English', '界面显示为英文')}}); + const langRow = row({iconName: 'globe', title: t('Interface language', '界面语言'), end: [langSeg]}); const langFoot = el('div', 'st-foot'); langFoot.append(langNote, langReload); - appearance.append(groupHead(t('Look', '外观')), card(themeRow.element, solidRow.element), + // Every language ready to offer, saved with the launcher's settings (language_picker.js); the two buttons stay when the + // list cannot be read. + api.fetchApi('/freevideo/language', {cache: 'no-store'}).then(response => response.ok ? response.json() : null).then(state => { + if (!Array.isArray(state?.languages) || !state.languages.length) return; + const note = langNote.textContent; + const picker = languagePicker({api, t, state, + onSaved: () => { langNote.textContent = note; langReload.hidden = !picker.differs(); }, + onError: text => { langNote.textContent = text; }}); + langSeg.replaceWith(picker.element); + langReload.onclick = () => location.replace(languageUrl(location.href, addressLanguage(picker.state.language)).href); + }).catch(() => {}); + appearance.append(groupHead(t('Look', '外观')), card(themeRow.element, solidRow.element, compactRow.element), groupHead(t('Top bar', '顶栏')), card(statusRow.element), groupHead(t('Language', '语言')), card(langRow.element, langFoot)); // ════════════ Assistant ════════════ @@ -602,10 +626,10 @@ export async function openSetup(options) { // ════════════ Page check ════════════ const health = pane('health', t('Page check', '页面检查')); - const healthRun = button(t('Check now', '立即检查'), {kind: 'fill'}); + const healthRun = button(t('Check for updates', '立即检查'), {kind: 'fill'}); const healthReload = button(t('Reload page', '刷新页面')); const healthRow = row({iconName: 'shield', title: t('Page files', '页面文件'), sub: t('Not checked yet', '尚未检查'), end: [healthReload, healthRun]}); - tip(healthRun, t('Check now', '立即检查'), t('Confirm every page file loads', '确认页面的每个文件都能载入')); + tip(healthRun, t('Check for updates', '立即检查'), t('Confirm every page file loads', '确认页面的每个文件都能载入')); tip(healthReload, t('Reload page', '刷新页面'), t('Load the page again; generations keep running', '重新载入页面,生成不受影响')); const healthList = el('div', 'st-sub st-hlist'); healthList.hidden = true; health.append(groupHead(t('This page', '本页面')), card(healthRow.element, healthList), @@ -621,11 +645,11 @@ export async function openSetup(options) { healthRun.disabled = false; if (!failed.length) { healthRow.sub.className = 'is-ok'; - healthRow.sub.textContent = t(`All ${MODULES.length} files load`, `全部 ${MODULES.length} 个文件都能载入`); + healthRow.sub.textContent = t('All {count} files load', '全部 {count} 个文件都能载入', { count: MODULES.length }); healthList.hidden = true; return; } healthRow.sub.className = 'is-warn'; - healthRow.sub.textContent = t(`${failed.length} files could not be loaded. Reload the page; if it stays, report it.`, `${failed.length} 个文件无法载入。请刷新页面;仍然出现时请提交问题。`); + healthRow.sub.textContent = t('{count} files could not be loaded. Reload the page; if it stays, report it.', '{count} 个文件无法载入。请刷新页面;仍然出现时请提交问题。', { count: failed.length }); const list = el('pre', 'st-pre fv-copyable', failed.join('\n')); const report = reportTip(issueButton(t, () => ({where: ['Page check', '页面检查'], message: failed.join('\n')}))); healthList.replaceChildren(list, report); healthList.hidden = false; @@ -677,7 +701,7 @@ export async function openSetup(options) { const calibrateRepeats = el('select'); for (const n of [1, 2, 3, 4]) { const o = el('option', '', String(n)); o.value = String(n); calibrateRepeats.append(o); } calibrateRepeats.value = '1'; - const repeatsSeg = segmented(calibrateRepeats, {label: t('Passes', '轮数'), tips: Object.fromEntries([1, 2, 3, 4].map(n => [String(n), t(`About ${n * 30} minutes`, `约 ${n * 30} 分钟`)]))}); + const repeatsSeg = segmented(calibrateRepeats, {label: t('Passes', '轮数'), tips: Object.fromEntries([1, 2, 3, 4].map(n => [String(n), t('About {minutes} minutes', '约 {minutes} 分钟', { minutes: n * 30 })]))}); const repeatsRow = row({iconName: 'clock', title: t('Passes', '轮数'), sub: t('About 30 minutes each; nothing can be generated meanwhile', '每轮约 30 分钟,期间不能生成'), end: [repeatsSeg]}); const calibrateButton = button(t('Start measuring', '开始测量'), {iconName: 'gauge', kind: 'fill'}); const calibrateStatus = slot(); @@ -989,7 +1013,7 @@ export async function openSetup(options) { const {freed_bytes: freed, left} = result; if (left > 0) storageSay(cn ? (freed > 0 ? `已释放 ${storageAmount(freed)},` : '') + `${left} 项未能删除` : (freed > 0 ? `Freed ${storageAmount(freed)}. ` : '') + `${left} ${left === 1 ? 'item' : 'items'} could not be deleted.`, true); - else if (freed > 0) storageSay(t(`Freed ${storageAmount(freed)}`, `已释放 ${storageAmount(freed)}`), false); + else if (freed > 0) storageSay(t('Freed {size}', '已释放 {size}', { size: storageAmount(freed) }), false); else storageSay(t('Nothing to clear up', '没有可清理的文件'), false); if (!(left > 0)) usageValue.textContent = storageAmount(0); } catch { storageSay(t('The output folder cannot be accessed.', '无法访问输出文件夹'), true); } @@ -1007,10 +1031,10 @@ export async function openSetup(options) { chip.hidden = act.hidden = meter.hidden = true; r.sub.className = ''; r.sub.textContent = IMAGE_WORDS[id] || ''; r.element.querySelector('.st-ic').classList.toggle('is-ok', s.state === 'ready'); - size.textContent = s.total && s.state !== 'ready' ? t(`About ${gb(s.total)} GiB`, `约 ${gb(s.total)} GiB`) : ''; + size.textContent = s.total && s.state !== 'ready' ? t('About {total} GiB', '约 {total} GiB', { total: gb(s.total) }) : ''; // Installed is the normal case and says nothing on the row; its size is on hover. const kept = s.row?.bytes_total || s.total || 0; - if (s.state === 'ready' && kept) tip(r.title, item.model.short, t(`Installed · ${gb(kept)} GiB`, `已安装 · ${gb(kept)} GiB`)); + if (s.state === 'ready' && kept) tip(r.title, item.model.short, t('Installed · {size} GiB', '已安装 · {size} GiB', { size: gb(kept) })); else { delete r.title.dataset.fvTipName; delete r.title.dataset.fvTipUse; } if (s.state === 'ready') { installedBytes += s.row?.bytes_total || s.total || 0; @@ -1031,15 +1055,18 @@ export async function openSetup(options) { tip(act, t('Stop', '停止'), t('Stop the download; the part downloaded is kept', '停止下载,已下载的部分会保留')); } } else if (s.state === 'failed') { - r.sub.className = 'is-warn'; r.sub.textContent = t(`${item.model.short} download failed${s.reason ? ': ' + s.reason.replace(/[.。]$/, '') : ''}. Retry to continue; if it keeps failing, report the problem.`, `${item.model.short} 下载失败${s.reason ? ':' + s.reason.replace(/[.。]$/, '') : ''}。请重试以继续下载;仍然失败时,请提交问题。`); + r.sub.className = 'is-warn'; r.sub.textContent = s.reason + ? t('{model} download failed: {reason}. Retry to continue; if it keeps failing, report the problem.', '{model} 下载失败:{reason}。请重试以继续下载;仍然失败时,请提交问题。', + { model: item.model.short, reason: s.reason.replace(/[.。]$/, '') }) + : t('{model} download failed. Retry to continue; if it keeps failing, report the problem.', '{model} 下载失败。请重试以继续下载;仍然失败时,请提交问题。', { model: item.model.short }); act.hidden = false; act.className = 'st-btn is-fill'; act.replaceChildren(icon('retry', 'fv-i s'), el('span', 'st-btn-t', t('Retry', '重试'))); act.onclick = () => imageAction(id, 'install'); tip(act, t('Retry', '重试'), t('Download again; the part downloaded is kept', '重新下载,已下载的部分会保留')); } else if (s.state === 'missing') { - if (s.resume) { r.sub.className = 'is-caution'; r.sub.textContent = t(`Stopped · ${gb(s.done)} of ${gb(s.total)} GiB kept`, `已停止 · 已下载 ${gb(s.done)} / ${gb(s.total)} GiB`); } + if (s.resume) { r.sub.className = 'is-caution'; r.sub.textContent = t('Stopped · {done} of {total} GiB kept', '已停止 · 已下载 {done} / {total} GiB', { done: gb(s.done), total: gb(s.total) }); } act.hidden = false; act.className = 'st-btn is-fill'; act.replaceChildren(icon('down', 'fv-i s'), el('span', 'st-btn-t', s.resume ? t('Resume', '继续') : t('Install', '安装'))); act.onclick = () => imageAction(id, 'install'); - tip(act, s.resume ? t('Resume', '继续') : t('Install', '安装'), t('Download this picture model', '下载这个图像模型')); + tip(act, s.resume ? t('Resume', '继续') : t('Install', '安装'), t('Download this image model', '下载这个图像模型')); } else if (s.state === 'unavailable') { r.sub.textContent = t('Not available on this computer', '这台电脑不支持'); r.element.setAttribute('aria-disabled', 'true'); } else r.sub.textContent = t('Checking…', '正在检查…'); @@ -1105,7 +1132,7 @@ export async function openSetup(options) { let token, planId, busy = false, probeBusy = false, pollTimer, lastPlanId, planErrors = false, planStale = false, ready = false, waitSince; let lastTask = {}, loaded = false, readFailed = false, wantSheet = false, busyLabel = ''; // A click names what is happening at once, before the server has answered. - const doing = (en, zh) => { waitSince ??= Date.now(); state.className = 'st-state'; state.textContent = t(en, zh); paintHero(); }; + const doing = (...pair) => { waitSince ??= Date.now(); state.className = 'st-state'; state.textContent = t(...pair); paintHero(); }; const fail = error => { waitSince = undefined; fault(state, error.message, error); state.className = "st-state is-fail"; if (shown !== 'models' && !busy) { /* The dot on Models says where to look. */ } paintHero(); }; const request = async (action, value) => { const response = await api.fetchApi("/freevideo/setup" + (action ? "/" + action : root.value ? '?root='+encodeURIComponent(root.value) : ""), action ? { @@ -1148,7 +1175,7 @@ export async function openSetup(options) { const extraCount = extra.value.split('\n').map(s => s.trim()).filter(Boolean).length; state.hidden = kind === 'busy' || (kind === 'ready' && !state.textContent); if (kind === 'none' && !state.textContent) state.textContent = t('Check first: models already on this computer are used as they are.', '先检查一遍,电脑上已有的模型会直接使用。'); - folders.sub.textContent = [root.value, extraCount ? t(`${extraCount} more folders`, `另 ${extraCount} 个模型文件夹`) : ''].filter(Boolean).join(' · '); + folders.sub.textContent = [root.value, extraCount ? t('{extraCount} more folders', '另 {extraCount} 个模型文件夹', { extraCount }) : ''].filter(Boolean).join(' · '); folders.sub.hidden = !folders.sub.textContent; navItems.get('models').querySelector('.end').replaceChildren(...(kind === 'failed' || kind === 'problem' || kind === 'readerr' ? [el('i', 'st-dot is-warn')] : busy ? [el('i', 'st-dot is-run')] : [])); } @@ -1205,8 +1232,8 @@ export async function openSetup(options) { if (moved) reserve.value = String(moved.value); reserveFailure.className = 'st-slot is-warn'; reserveStep.classList.add('is-bad'); reserveFailure.textContent = !moved ? t('Enter a number in range', '请输入范围内的数') - : moved.kind === 'max' ? t(`At most ${moved.value}`, `最多 ${moved.value}`) - : moved.kind === 'min' ? t(`At least ${moved.value}`, `最少 ${moved.value}`) : t(`Changed to ${moved.value}`, `已改为 ${moved.value}`); + : moved.kind === 'max' ? t('At most {value}', '最多 {value}', { value: moved.value }) + : moved.kind === 'min' ? t('At least {value}', '最少 {value}', { value: moved.value }) : t('Changed to {value}', '已改为 {value}', { value: moved.value }); reserve.focus(); return; } @@ -1300,7 +1327,7 @@ export async function openSetup(options) { cancel.hidden = !busy; install.disabled = busy || !planId || !accept.checked; accept.disabled = busy; const why = busy ? "" : planStale ? t("Settings changed. Click Check installation again.", "设置已更改,请重新点“检查安装”。") : planErrors ? t("Fix the problems listed above, then check again.", "请先处理上面列出的问题,再重新检查。") - : ready && !planId ? t(INSTALLED_HINT.en, INSTALLED_HINT.zh) + : ready && !planId ? t(...INSTALLED_HINT) : !planId ? "" : !accept.checked ? t("Tick the agreement to enable Install.", "勾选同意后,可点击“安装”。") : ""; blocked.textContent = why; @@ -1335,7 +1362,7 @@ export async function openSetup(options) { const facts = [ [t("To download", "需要下载"), bytesText(value.model_download_bytes)], [t("Already here", "已有模型"), bytesText(value.existing_model_bytes_size_matched || 0)], - [t("Reused from this computer", "复用本地模型"), bytesText(local.reused_bytes || 0), t(`Linked ${bytesText(local.linked_bytes || 0)} · copied ${bytesText(local.copy_bytes || 0)}`, `链接 ${bytesText(local.linked_bytes || 0)} · 复制 ${bytesText(local.copy_bytes || 0)}`)], + [t("Reused from this computer", "复用本地模型"), bytesText(local.reused_bytes || 0), t('Linked {linked} · copied {copied}', '链接 {linked} · 复制 {copied}', { linked: bytesText(local.linked_bytes || 0), copied: bytesText(local.copy_bytes || 0) })], [t("Extra disk space", "额外占用磁盘"), bytesText(disksNeeded)], [t("Graphics card", "显卡"), gpu.name || "—"], ]; @@ -1349,7 +1376,7 @@ export async function openSetup(options) { } plan.append(list); // The package name stays in Details and logs (and the report), not on the plan sheet. - for (const line of value.replace_models_text?.[cn ? 'zh' : 'en'] || []) { + for (const line of localized(value.replace_models_text, t) || []) { const replacement = el('div', 'st-notice'); replacement.append(icon('info', 'fv-i')); const words = el('div'); words.append(el('p', '', line.text), el('p', 'st-path fv-copyable', line.path)); replacement.append(words); plan.append(replacement); @@ -1358,7 +1385,7 @@ export async function openSetup(options) { const note = el('div', 'st-notice is-info'); note.append(icon('key', 'fv-i'), el('p', '', t("This model needs an account with access. Add an access token under Downloads.", "这个模型需要有访问权限的账号,请在“下载”里填写访问令牌。"))); plan.append(note); } - const licenses = el('details', 'st-tfold'); const ls = el('summary'); ls.append(icon('chev', 'fv-i'), el('span', '', t(`Model and toolkit licenses · ${value.licenses?.length || 0}`, `模型与工具包许可证 · ${value.licenses?.length || 0}`))); + const licenses = el('details', 'st-tfold'); const ls = el('summary'); ls.append(icon('chev', 'fv-i'), el('span', '', t('Model and toolkit licenses · {count}', '模型与工具包许可证 · {count}', { count: value.licenses?.length || 0 }))); licenses.append(ls, el("pre", 'st-pre fv-copyable', value.licenses?.join("\n") || "")); plan.append(licenses); if (value.errors?.length) { const e = el('div', 'st-notice is-warn is-fail'); e.append(icon('warn', 'fv-i')); @@ -1371,7 +1398,7 @@ export async function openSetup(options) { sheetIcon.replaceChildren(icon(problem ? 'warn' : 'down', 'fv-i')); sheetLine.textContent = problem ? t('Installation cannot start until these are fixed.', '处理完这些问题后才能开始安装。') : t('These files are downloaded or reused. Closing Settings does not stop the installation.', '将下载或复用以下文件。关闭设置不会中断安装。'); - setText(install, value.model_download_bytes > 0 ? t(`Install · ${bytesText(value.model_download_bytes)}`, `安装 · ${bytesText(value.model_download_bytes)}`) : t('Install', '安装')); + setText(install, value.model_download_bytes > 0 ? t('Install · {size}', '安装 · {size}', { size: bytesText(value.model_download_bytes) }) : t('Install', '安装')); } function render(task) { lastTask = task || {}; loaded = true; readFailed = false; @@ -1396,7 +1423,7 @@ export async function openSetup(options) { overall.hidden = !busy; overallBar.max = phases.total > 0 ? phases.total : 1; overallBar.value = phases.done || 0; overallText.replaceChildren(el('b', '', phases.total > 0 ? `${t("Overall", "整体进度")} · ${Math.floor(100 * phases.done / phases.total)}%` : t("Preparing installation…", "正在准备安装…")), - el('span', '', phases.total > 0 ? `${phases.done} / ${phases.total} ${t("stages complete", "阶段已完成")}` : '')); + el('span', '', phases.total > 0 ? t("{done} / {total} stages complete", "{done} / {total} 阶段已完成", {done: phases.done, total: phases.total}) : '')); fileBar.hidden = !busy; fileBar.max = valid ? p.total : 1; fileBar.value = valid ? p.done : 0; if (busy && !valid) fileBar.set(null); const amount = n => p.total >= 2 ** 30 ? gib(n) : `${(n / 2 ** 20).toFixed(1)} MiB`; @@ -1428,7 +1455,7 @@ export async function openSetup(options) { savedMissing = missing.length > 0; savedFolders = !missing.length ? t('Saved.', '已保存。') : missing.length === 1 ? t('Saved. This folder was not found:', '已保存。找不到这个文件夹:') - : t(`Saved. ${missing.length} folders were not found:`, `已保存。有 ${missing.length} 个文件夹找不到:`); + : t('Saved. {count} folders were not found:', '已保存。有 {count} 个文件夹找不到:', { count: missing.length }); folderStatus.className = savedMissing ? 'st-slot is-caution' : 'st-slot is-ok'; folderStatus.replaceChildren(savedFolders); if (savedMissing) { @@ -1482,12 +1509,12 @@ export async function openSetup(options) { showDownloads(info.discovery.downloads); showResources(info.discovery.resources); if (info.discovery.resources_damaged) reserveDamaged.hidden = false; - samplingSize.textContent = info.discovery.sampling_cache_bytes ? t(`About ${gib(info.discovery.sampling_cache_bytes)}`, `约 ${gib(info.discovery.sampling_cache_bytes)}`) : ''; + samplingSize.textContent = info.discovery.sampling_cache_bytes ? t('About {size}', '约 {size}', { size: gib(info.discovery.sampling_cache_bytes) }) : ''; // New installations prepare every quality level; a ready one adds them only when chosen. samplingCaches.checked = !info.discovery.ready; const libs = info.discovery.libraries || []; paths.textContent = libs.join("\n") || t("No model folders found; add one above.", "没有发现模型文件夹,可在上方添加。"); - libSummary.lastChild.textContent = t(`Folders found automatically · ${libs.length}`, `自动发现的文件夹 · ${libs.length}`); + libSummary.lastChild.textContent = t('Folders found automatically · {count}', '自动发现的文件夹 · {count}', { count: libs.length }); paths.dataset.count = String(libs.length); ready = Boolean(info.discovery.ready); render(info.task || {}); diff --git a/web/settings_words.js b/web/settings_words.js index fa1149ab..3a66422e 100644 --- a/web/settings_words.js +++ b/web/settings_words.js @@ -3,7 +3,7 @@ import { isChinese, translator } from './i18n.js'; export const cn = isChinese(); export const t = translator(cn); -export const INSTALLED_HINT = {en: 'Already installed. To reinstall, click Check installation first.', zh: '已装好。要重装,请先点“检查安装”。'}; +export const INSTALLED_HINT = ['Already installed. To reinstall, click Check installation first.', '已装好。要重装,请先点“检查安装”。']; export const gib = n => Number.isFinite(n) ? (n / 2 ** 30).toFixed(1) + " GiB" : "—"; // Plan sizes pick their unit, so a few-MB repair does not read as "0.0 GiB". // The cut-offs sit where rounding would print 1024.0 MiB or 1024 KiB, so those carry to the next unit. @@ -11,16 +11,16 @@ export const bytesText = n => !(n > 0 && n < 1023.95 * 2 ** 20) ? gib(n) : n >= 1023.5 * 2 ** 10 ? (n / 2 ** 20).toFixed(1) + " MiB" : Math.max(1, Math.round(n / 2 ** 10)) + " KiB"; const SPEED_TEST_FAILED = 'The speed test did not finish. Click "Test source speeds".'; const BUSY_LOCK = /using this installation\/GPU lock/; -const BUSY_TEXT = {en: 'FreeVideo is busy with another task. Try again when it finishes. If nothing else is running, close duplicate FreeVideo instances, then try again.', - zh: 'FreeVideo 正在处理另一个任务。请在它完成后重试。若没有其他任务在进行,请关闭重复运行的 FreeVideo 后重试。'}; +const BUSY_TEXT = ['FreeVideo is busy with another task. Try again when it finishes. If nothing else is running, close duplicate FreeVideo instances, then try again.', + 'FreeVideo 正在处理另一个任务。请在它完成后重试。若没有其他任务在进行,请关闭重复运行的 FreeVideo 后重试。']; // The speed-test row passes text that failureText already turned into the busy message. -export const isBusy = value => BUSY_LOCK.test(value) || value.startsWith(BUSY_TEXT.en) || value.startsWith(BUSY_TEXT.zh); +export const isBusy = value => BUSY_LOCK.test(value) || value.startsWith(BUSY_TEXT[0]) || value.startsWith(BUSY_TEXT[1]); // Setup refusals whose cause and next step are known. Repair goes where the server's sentence pointed: the launcher when it watches. const repairStep = text => text.includes('In the FreeVideo launcher, open Settings and click Repair.') ? t('In the FreeVideo launcher, open Settings and click Repair.', '请在 FreeVideo 启动器的设置里点“修复”。') : t('Click Check installation, then Install.', '请先点“检查安装”,再点“安装”。'); // The reserve's lower limit, said the same way whether the panel or the service stopped the value. -export const atLeast = least => t(`Enter at least ${least} GiB, or turn on Automatic optimization.`, `请输入不小于 ${least} GiB 的数值,或打开“自动优化”。`); +export const atLeast = least => t('Enter at least {least} GiB, or turn on Automatic optimization.', '请输入不小于 {least} GiB 的数值,或打开“自动优化”。', { least }); export const WAIT_REFUSAL = /^Wait for (the installation check|the installation|a placement test|a setup task) to finish; its progress is in this panel\.$/; // A runtime stop, not a setup refusal: the sentence replaces the traceback on screen, but the report button stays and // sends the original text, because the guard's numbers are what the cause is read from. @@ -28,7 +28,7 @@ const MEMORY_STOP = /MemoryError: RAM guard/; export const reportText = (shown, original) => MEMORY_STOP.test(String(original || '')) ? String(original) : shown; const SETUP_ERRORS = [ // Another task holds the installation lock; any "Lock file open:" lines name the holders. - [BUSY_LOCK, text => [t(BUSY_TEXT.en, BUSY_TEXT.zh), ...text.split(/\r?\n/).filter(line => line.startsWith('Lock file open:')).slice(0, 6)].join('\n')], + [BUSY_LOCK, text => [t(...BUSY_TEXT), ...text.split(/\r?\n/).filter(line => line.startsWith('Lock file open:')).slice(0, 6)].join('\n')], [/^Choose an engine installation folder$/, () => t('Choose a FreeVideo installation folder first.', '请先选择 FreeVideo 安装位置。')], [/^Use a dedicated FreeVideo folder, not the ComfyUI root or its parent$/, () => t('Choose a separate folder for FreeVideo, not the program folder or the folder that contains it.', @@ -43,8 +43,8 @@ const SETUP_ERRORS = [ [WAIT_REFUSAL, text => { const names = {'the installation check': ['the installation check', '安装检查'], 'the installation': ['the installation', '安装'], 'a placement test': ['the performance measurement', '性能测量']}; - const [en, zh] = names[text.match(/^Wait for (.+) to finish/)[1]] ?? ['the setup task', '安装任务']; - return t(`Wait for ${en} to finish; its progress is under Models.`, `请等待${zh}完成,进度见“模型”。`); + const task = names[text.match(/^Wait for (.+) to finish/)[1]] ?? ['the setup task', '安装任务']; + return t('Wait for {task} to finish; its progress is under Models.', '请等待{task}完成,进度见“模型”。', { task: t(...task) }); }], // The placement test's text encoder was stopped by the memory guard: the computer, not FreeVideo's own use, ran short. // The paging-file step is said only when Windows reports its commit headroom as exhausted. @@ -85,8 +85,8 @@ export const failureText = value => { if (text === SPEED_TEST_FAILED) return t('The speed test did not finish. Click "Test again".', '测速没有完成,请点“重新测速”。'); if (!matches.length) return text; const file = matches.at(-1)[1]; - return t(`${file} differs from the tested version and was left unchanged. Click Check installation, then Install. After you confirm, the original is renamed and kept, and the tested version is downloaded.`, - `${file} 和测试过的版本不同,这次没有改动。请先点“检查安装”,再点“安装”,确认后原文件改名保留,再下载测试过的版本。`); + return t('{file} differs from the tested version and was left unchanged. Click Check installation, then Install. After you confirm, the original is renamed and kept, and the tested version is downloaded.', + '{file} 和测试过的版本不同,这次没有改动。请先点“检查安装”,再点“安装”,确认后原文件改名保留,再下载测试过的版本。', { file }); }; // The pages, in their groups. `icon` names settings_kit's icons. diff --git a/web/share.js b/web/share.js index 39f332c4..126cb874 100644 --- a/web/share.js +++ b/web/share.js @@ -92,8 +92,8 @@ export function exportingText(progress,seconds,t){ if(!Number.isInteger(frame)||frame<1)return t('Exporting the share video…','正在导出分享视频…'); const time=`${Math.floor(seconds/60)}:${String(Math.floor(seconds%60)).padStart(2,'0')}`; return Number.isInteger(total)&&total>=frame - ?t(`Exporting the share video · Frame\u00a0${frame}\u00a0of\u00a0${total} · ${time}\u00a0elapsed`,`正在导出分享视频 · 第\u00a0${frame}\u00a0帧,共\u00a0${total}\u00a0帧 · 已用\u00a0${time}`) - :t(`Exporting the share video · Frame\u00a0${frame} · ${time}\u00a0elapsed`,`正在导出分享视频 · 第\u00a0${frame}\u00a0帧 · 已用\u00a0${time}`); + ?t('Exporting the share video · Frame\u00a0{frame}\u00a0of\u00a0{total} · {time}\u00a0elapsed','正在导出分享视频 · 第\u00a0{frame}\u00a0帧,共\u00a0{total}\u00a0帧 · 已用\u00a0{time}', { frame, total, time }) + :t('Exporting the share video · Frame\u00a0{frame} · {time}\u00a0elapsed','正在导出分享视频 · 第\u00a0{frame}\u00a0帧 · 已用\u00a0{time}', { frame, time }); } export function shareButton(record,t){ const b=button(t('Share','分享'),()=>openShare(record,t),'fv-quiet fv-share-trigger'); diff --git a/web/shortcuts.js b/web/shortcuts.js index 34fefd70..73d02532 100644 --- a/web/shortcuts.js +++ b/web/shortcuts.js @@ -16,7 +16,7 @@ export const VIEW_ORDER = Object.freeze(['global', 'studio', 'image', 'editor', const G = { layer: ['Command layer', '命令与搜索'], views: ['Views', '视图'], general: ['General', '通用'], prompt: ['Prompt', '提示词'], generate: ['Generate', '生成'], result: ['Result', '结果'], - history: ['History', '历史'], compare: ['Compare', '对比'], picture: ['Picture editing', '图像编辑'], + history: ['History', '历史'], compare: ['Compare', '对比'], picture: ['Image editing', '图像编辑'], playback: ['Playback', '播放'], timeline: ['Timeline', '时间线'], clips: ['Clips', '片段'], edit: ['Editing', '编辑'], chat: ['Conversation', '对话'], tasks: ['Running tasks', '进行中的任务'], library: ['Creations', '作品库'], }; @@ -39,15 +39,15 @@ export const BUILTIN_SHORTCUTS = Object.freeze({ ], studio: [ {keys: 'Mod+Enter', title: ['Generate video', '生成视频'], group: G.generate}, - {keys: '@', title: ['Mention a picture or character', '提及图片或角色'], group: G.prompt}, + {keys: '@', title: ['Mention an image or character', '提及图片或角色'], group: G.prompt}, {keys: 'Up / Down', title: ['Choose a suggestion', '选择候选项'], group: G.prompt}, {keys: 'Enter / Tab', title: ['Insert the chosen item', '插入选中的项'], group: G.prompt}, {keys: 'Esc', title: ['Close a panel, then Create', '先关浮层,再关创作面板'], group: G.general}, ], image: [ {keys: 'Mod+Enter', title: ['Generate image', '生成图片'], group: G.generate}, - {keys: 'Mod+V', title: ['Paste a picture as reference', '粘贴图片作为参考图'], group: G.prompt}, - {keys: 'Shift+Click / Mod+Click', title: ['Select several pictures', '多选图片'], group: G.history}, + {keys: 'Mod+V', title: ['Paste an image as reference', '粘贴图片作为参考图'], group: G.prompt}, + {keys: 'Shift+Click / Mod+Click', title: ['Select several images', '多选图片'], group: G.history}, {keys: 'Left / Right', title: ['Move the compare line', '移动对比分界线'], group: G.compare}, {keys: 'Esc', title: ['Close a menu, then the view', '先关菜单,再关视图'], group: G.general}, {keys: 'Mod+Z / Mod+Shift+Z', title: ['Undo / redo', '撤销 / 重做'], group: G.picture}, @@ -91,7 +91,7 @@ export const BUILTIN_SHORTCUTS = Object.freeze({ autopilot: [ {keys: 'Enter', title: ['Send', '发送'], group: G.chat}, {keys: 'Shift+Enter', title: ['New line', '换行'], group: G.chat}, - {keys: 'Mod+V', title: ['Attach pasted pictures', '粘贴图片作为附件'], group: G.chat}, + {keys: 'Mod+V', title: ['Attach pasted images', '粘贴图片作为附件'], group: G.chat}, {keys: 'Esc', title: ['Close a list or drawer, then Autopilot', '先关列表或抽屉,再关 AI 全自动'], group: G.general}, ], library: [ diff --git a/web/sound_bubble.js b/web/sound_bubble.js index 0c6973d1..6327ea5b 100644 --- a/web/sound_bubble.js +++ b/web/sound_bubble.js @@ -1,6 +1,7 @@ // A one-time bubble on the "Separate tracks" button, shown when a clip with sound is first selected. // It is seen once the button is used, the chapter is opened, the bubble is closed or any click lands; a bubble that only // fades out is shown one more time. +import { translator } from './i18n.js'; if (typeof document !== 'undefined' && !document.head.querySelector('link[href$="sound_bubble.css"]')) { const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = new URL('./sound_bubble.css', import.meta.url).href; document.head.append(link); @@ -15,7 +16,7 @@ const NO_BUBBLE = () => {}; /** Show the bubble under `button` when it is due. Returns a function that removes it. */ export const isBubbleRemover = remove => remove !== NO_BUBBLE; export function showSoundBubble(button, {cn = false} = {}) { - const t = pair => pair[cn ? 1 : 0], state = read(); + const say = translator(cn), t = pair => say(...pair), state = read(); if (state.seen || state.faded > 1 || document.querySelector('.fv-sound-bubble') || document.querySelector(OTHER_CARD) || button.hidden) return NO_BUBBLE; const bubble = document.createElement('div'); bubble.className = 'fv-sound-bubble'; bubble.setAttribute('role', 'status'); const line = document.createElement('p'); line.textContent = t(TEXT.line); diff --git a/web/studio.js b/web/studio.js index d266d917..5442181d 100644 --- a/web/studio.js +++ b/web/studio.js @@ -24,7 +24,6 @@ import { createPreviewScene } from './preview_scene.js?v=20261115-still'; import { animateDetails, closeDialog } from './motion.js'; import { openLibrary, setDefaultUpscale, setDefaultUpscaleWork, videoThumbnailURL, admittedFrames } from './library.js'; import { createUpscaleOffer, upscaleChoices, UPSCALE_USE, UPSCALE_QUEUED, UPSCALE_FAILED } from './upscale_offer.js'; -import { createRecentVideos } from './studio_recent.js'; import { createStudioQueue, randomSeed, turnNodeOn } from './studio_queue.js'; import { isNetworkTypeError, connectionLostText, wrappedFetchOnly } from './browser_extension.js'; import { newEngineExit, engineExitText, watchEngineExit, refreshLoopStalls } from './engine_exit.js'; @@ -37,20 +36,25 @@ import { openCastLibrary } from './cast_source.js'; import { mediaName, uploadMedia } from './media_upload.js'; import { reconcileLoraTriggers, promptLines } from './lora_triggers.js'; import { createVerdicts, describeVerdict, feedbackDraft } from './lora_check.js'; -import { continuationUpscale, createSamplingEffort, effortFor, effortsFrom, passSwitch, stepCacheOf, upscaleOf } from './sampling_effort.js'; +import { FAST_EFFORT, FAST_OPTION_TEXT, continuationUpscale, createSamplingEffort, effortFor, effortsFrom, fastOfferOf, passSwitch, stepCacheOf, upscaleOf, withFastLevel } from './sampling_effort.js'; +import { fastPackControl } from './fast_pack.js'; +import { createPanelShell } from './panel_shell.js'; +import { layoutColumns } from './studio_columns.js'; +import { mountStudioColumn } from './studio_right_column.js'; +import { button as railButton, icon as railIcon, readStore as readLocal, writeStore as writeLocal } from './image_view_ui.js'; import { resultActions, previewBadge, icon, actionsUnavailable, liftMenu } from './result_actions.js'; import { TIPS } from './tooltip_copy.js'; import { createFrameChip, createFrameIcon, createPopChip } from './glass/frame_picker.js'; import { createWarm } from './studio_warm.js'; import { attach as attachPlayer } from './glass/player_bar.js'; -import { framesOf, savedPrompt } from './result_reuse.js'; +import { framesOf, savedPrompt, savedSettings } from './result_reuse.js'; import { addVideoLabel, addVideoModel, missingVideoText, videoModelState } from './video_model.js'; import { createPromptEnhancer } from './prompt_enhance.js'; import { requestText, shownRewrite } from './prompt_sections.js'; import { createRequestAssets, enabledLoras, referenceFiles } from './request_assets.js'; import { promptDraftTrouble, rememberPromptDraft, restorePromptDraft, savePromptDraft, trackPromptDraft, watchPromptDraftTrouble } from './prompt_draft.js'; import { canvasDimensions, imageSizeSelection } from './studio_size.js'; -import { createCapabilityView, capabilityContext } from './capability_view.js'; +import { createCapabilityView, capabilityContext, setupNote } from './capability_view.js'; import { createOtherUsageNotice } from './other_usage.js'; import { openEditorView } from './editor_loader.js'; import { frameShapes, frameSize } from './frame_sizes.js'; @@ -105,7 +109,7 @@ function loraStrengthBox(initial, commit, said = null) { // said: {text, value, // An emptied box goes back to the strength in use, and the line says so. let kept = String(initial); input.oninput = () => { if (said) said.text = ''; sync(); }; input.onchange = () => { - if (input.value === '' && kept !== '') { input.value = kept; sync(); note.say(t(`Back to ${kept}`, `已恢复为 ${kept}`)); mark.hidden = true; return; } + if (input.value === '' && kept !== '') { input.value = kept; sync(); note.say(t('Back to {kept}', '已恢复为 {kept}', { kept })); mark.hidden = true; return; } const ok = note.settle(); sync(); if (said) { said.text = note.line && !note.line.hidden ? note.line.textContent : ''; said.value = Number(input.value); } if (note.line && !note.line.hidden) mark.hidden = true; // one line under the box: this one replaces the range note until the next input @@ -122,6 +126,7 @@ const glassCss = document.createElement('link'); glassCss.rel = 'stylesheet'; gl // The panel reports ready only once this layer applies, so its first frame is never laid out without it. const glassReady = new Promise(resolve => { glassCss.addEventListener('load', resolve, {once: true}); glassCss.addEventListener('error', resolve, {once: true}); setTimeout(resolve, 3000); }); document.head.append(glassCss); +const shellCss = document.createElement('link'); shellCss.rel = 'stylesheet'; shellCss.href = new URL('./panel_shell.css', import.meta.url).href; document.head.append(shellCss); const el = (tag, label, cls) => { const e = document.createElement(tag); if (label != null) e.textContent = label; if (cls) e.className = cls; return e; }; // One line per part of a long video, under the preview. A part that has not started opens in // place for editing and saves when it loses focus; the server's reply decides what stays. @@ -148,15 +153,15 @@ function createChainPartList(t, save, {onShow = () => {}, onHide = () => {}, red // In the joined video a continuing part plays its seam: two seconds either side. const seam = playSeam && part.seam != null; row.meta.disabled = !seam; row.meta.dataset.seam = String(seam); - if (seam) row.meta.setAttribute('aria-label', t(`Play the seam before part ${part.index + 1}`, `播放第 ${part.index + 1} 段的接缝`)); + if (seam) row.meta.setAttribute('aria-label', t('Play the seam before part {part}', '播放第 {part} 段的接缝', { part: part.index + 1 })); else row.meta.removeAttribute('aria-label'); // One way on per part: a stopped video continues from its first unfinished part; a finished part makes a new video. const action = part.action, number = part.index + 1; row.redo.hidden = !action; if (action) { row.redo.textContent = action === 'resume' ? t('Continue from here', '从这段继续') : t('Redo from here', '从这段重新生成'); - row.redo.setAttribute('aria-label', action === 'resume' ? t(`Continue from part ${number}`, `从第 ${number} 段继续`) - : t(`Redo from part ${number}`, `从第 ${number} 段重新生成`)); + row.redo.setAttribute('aria-label', action === 'resume' ? t('Continue from part {number}', '从第 {number} 段继续', { number }) + : t('Redo from part {number}', '从第 {number} 段重新生成', { number })); } if (timers.has(part.id) || row.tag.dataset.kind === 'error' || row.starting) return; const ended = {done: t('Done', '已完成'), failed: t('Failed', '失败'), cancelled: t('Stopped', '已停止'), interrupted: t('Stopped', '已停止')}[part.state]; @@ -176,7 +181,7 @@ function createChainPartList(t, save, {onShow = () => {}, onHide = () => {}, red // The line says the server's own sentence when it gave one; the card carries what failed and a report. // A redo refused for its changed settings is told on the card; its line stays the short one. const said = error.code === 'redo_request_changed' ? null : error.said || error.cause?.said; - if (rows.get(row.part.id) === row) flash(row, said ? t(said[0], said[1]) + if (rows.get(row.part.id) === row) flash(row, said ? t(...said) : t('Could not start. See the details on the picture.', '没能开始,原因见画面上的说明。'), 'error'); onError(error); } finally { row.starting = false; row.redo.disabled = false; } @@ -210,7 +215,7 @@ function createChainPartList(t, save, {onShow = () => {}, onHide = () => {}, red editing = row; clearTimeout(timers.get(row.part.id)); timers.delete(row.part.id); tag(row, ''); const editor = row.editor = el('textarea', null, 'fv-chain-part-editor'); editor.maxLength = 20000; editor.value = row.draft = row.part.text; - editor.setAttribute('aria-label', t(`Part ${row.part.index + 1} description`, `第 ${row.part.index + 1} 段描述`)); + editor.setAttribute('aria-label', t('Part {part} prompt', '第 {part} 段提示词', { part: row.part.index + 1 })); editor.addEventListener('input', () => { row.draft = editor.value; }); listenDialogKey(editor, 'keydown', event => { // Escape leaves the edit, never the studio. @@ -259,10 +264,10 @@ function createChainPartList(t, save, {onShow = () => {}, onHide = () => {}, red row.redo.onclick = event => { event.stopPropagation(); remake(row); }; row.element.onclick = () => open(row); const joins = part.continues === 'part' ? t('After the previous part', '接上一段') : part.continues === 'video' ? t('After the video', '接原视频') : ''; - row.meta = el('button', [joins, t(`${part.seconds} s`, `${part.seconds} 秒`)].filter(Boolean).join(' · '), 'fv-chain-part-meta'); + row.meta = el('button', [joins, t('{seconds} s', '{seconds} 秒', { seconds: part.seconds })].filter(Boolean).join(' · '), 'fv-chain-part-meta'); row.meta.type = 'button'; row.meta.onclick = event => { event.stopPropagation(); if (row.part.seam != null) playSeam?.(row.part.seam); }; - row.element.append(el('span', t(`Part ${index + 1}`, `第 ${index + 1} 段`), 'fv-chain-part-name'), row.meta, row.text, row.tag, row.redo); + row.element.append(el('span', t('Part {number}', '第 {number} 段', { number: index + 1 }), 'fv-chain-part-name'), row.meta, row.text, row.tag, row.redo); rows.set(part.id, row); element.append(row.element); } if (editing === row && !part.editable) { @@ -382,7 +387,8 @@ export function loraPanel(node, panel, {promptNode = null} = {}) { let names = [], disposed = false, rendering = false, renderAgain = false; const drafts = new Map(), errors = new Map(), saves = new Map(); let skipped = 0; - const idleNote = () => (skipped ? t(skipped === 1 ? ' 1 other LoRA file in the folder is not in .safetensors format and is not listed.' : ` ${skipped} other LoRA files in the folder are not in .safetensors format and are not listed.`, ` 文件夹中另有 ${skipped} 个 LoRA 文件不是 .safetensors 格式,未列出。`) : ''); + const idleNote = () => (!skipped ? '' : skipped === 1 ? t(' 1 other LoRA file in the folder is not in .safetensors format and is not listed.', ' 文件夹中另有 1 个 LoRA 文件不是 .safetensors 格式,未列出。') + : t(' {count} other LoRA files in the folder are not in .safetensors format and are not listed.', ' 文件夹中另有 {count} 个 LoRA 文件不是 .safetensors 格式,未列出。', { count: skipped })); const verdicts = createVerdicts((path, options) => api.fetchApi(path, options)); let rowChecks = []; const strengthSaid = new Map(); // row index -> {text}: the "At most 100" line of its strength box @@ -759,7 +765,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // The console (studio_console.js) is put together once every control exists; until then nothing reads it. let consoleUI = null, promptLibrary = null, reverseKey = null, reversePick = null; // Set while the editor borrows this panel's bar (current.borrow below). - let borrowed = null; + let borrowed = null, columns = null, placeReverse = () => {}; // (placeReverse: where the reverse-prompt key stands; set below, run again when the editor lends or takes back the bar) // Frame & size picker and the stage's outline of a new frame (set with the size tray). let framePicker = null; const header = el('header', null, 'fv-header'), brand = el('div', null, 'fv-brand'); @@ -785,6 +791,21 @@ export function openStudio(node, {extendFrom = null} = {}) { body.style.visibility = 'hidden'; glassReady.then(() => { body.style.visibility = ''; }); dialog.append(header, body); body.append(controls, output); + // The three-column layout (settings | stage | works) shares the picture view's shell; the right column stays hidden until the works page mounts in it. + { + const works = el('aside', null, 'fv-work-column'); works.hidden = true; body.append(works); + const settingsRail = el('div', null, 'fv-iv-rail'), worksRail = el('div', null, 'fv-iv-rail'); + const panels = readLocal('freevideo.studio.panels', {}), panelShell = {}; + const open = side => railButton('fv-iv-icon-btn', {iconName: side === 'left' ? 'panelL' : 'panelR', name: side === 'left' ? t('Show settings', '展开设置栏') : t('Show creations', '展开作品栏'), onClick: () => panelShell.api.setPanel(side, true)}); + const fold = side => railButton('fv-iv-icon-btn fv-iv-collapse', {iconName: side === 'left' ? 'panelL' : 'panelR', name: side === 'left' ? t('Hide settings', '收起设置栏') : t('Hide creations', '收起作品栏'), onClick: () => panelShell.api.setPanel(side, false)}); + settingsRail.append(open('left')); worksRail.append(open('right')); + const foldLeft = fold('left'); body.foldLeft = foldLeft; body.settingsRail = settingsRail; works.append(worksRail); + body.dataset.cols = '3'; + controls.classList.add('fv-glass', 'fv-g2'); works.classList.add('fv-glass', 'fv-g2'); + panelShell.api = createPanelShell({body, left: controls, right: works, stage: output, panels, save: () => writeLocal('freevideo.studio.panels', panels)}); + panelShell.api.paint(); + body.studioPanels = panelShell.api; + } const portNotice = createPortNotice(cn); if (portNotice) output.append(portNotice); const updateNotice = createUpdateNotice(cn); @@ -811,7 +832,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // The library's own upload of a picture goes to the same streaming upload the media panel uses. const castUpload = file => uploadMedia(api, file); const castBlocked = reason => ({people: t('Up to 3 characters', '最多 3 个角色'), props: t('Up to 2 props', '最多 2 个道具'), full: t('Up to 32 references', '参考素材最多 32 个'), - continued: t('No room left when continuing', '接续段位置已满')}[reason] || ''); + continued: t('No room left when extending', '接续段位置已满')}[reason] || ''); const castPending = new Map(); // The feature tour's "try it": one example into this panel's media list, prompt and settings. const canTryTour = entry => !busy && !queued && !capturing && (!entry.prompt || !linked(node, 'text')) @@ -836,7 +857,7 @@ export function openStudio(node, {extendFrom = null} = {}) { unknown_example: ['This example is not available yet.', '这个示例暂时不能用'], }[reason]; const detail = String(error?.message || error || '').split('\n')[0].slice(0, 160); - fault(say ? t(...say) : detail ? t(`The example was not filled in: ${detail}`, `示例没有填入:${detail}`) : t('The example was not filled in.', '示例没有填入')); + fault(say ? t(...say) : detail ? t('The example was not filled in: {detail}', '示例没有填入:{detail}', { detail }) : t('The example was not filled in.', '示例没有填入')); }; const tourBlock = example => busy || queued || capturing ? 'busy' : (example.prompt && linked(node, 'text')) || Object.keys(example.settings || {}).some(name => linked(node, name)) ? 'linked' : 'unavailable'; @@ -915,7 +936,7 @@ export function openStudio(node, {extendFrom = null} = {}) { target.field.value = JSON.stringify(withCharacter(rows, card, typed)); target.owner.graph?.change?.(); window.dispatchEvent(new CustomEvent('freevideo-media', {detail: target.owner.id})); - }).catch(() => { if (!disposed) fault(t('Could not add the character\'s pictures', '无法加入角色的图片')); }) + }).catch(() => { if (!disposed) fault(t('Could not add the character\'s images', '无法加入角色的图片')); }) .finally(() => castPending.delete(person.id)); return true; } @@ -944,9 +965,9 @@ export function openStudio(node, {extendFrom = null} = {}) { const showDraftTrouble = ({save, restore}) => { if (draftNote.disabled) return; draftNote.hidden = !save && !restore; - draftNote.textContent = save ? t('Prompt not saved. Click to retry', '描述没能保存,点此重试') : t('Last prompt not loaded. Click to retry', '上次的描述没能读取,点此重试'); + draftNote.textContent = save ? t('Prompt not saved. Click to retry', '提示词未能保存,点此重试') : t('Last prompt not loaded. Click to retry', '上次的提示词未能读取,点此重试'); // The note is a small plain dot; its hover card says what happened and what a click does. - draftNote.dataset.fvTipName = save ? t('Prompt not saved', '描述没能保存') : t('Last prompt not loaded', '上次的描述没能读取'); + draftNote.dataset.fvTipName = save ? t('Prompt not saved', '提示词未能保存') : t('Last prompt not loaded', '上次的提示词未能读取'); draftNote.dataset.fvTipUse = t('Click to retry', '点此重试'); draftNote.setAttribute('aria-label', draftNote.textContent); }; @@ -1011,11 +1032,11 @@ export function openStudio(node, {extendFrom = null} = {}) { promptHelp.href = 'https://github.com/MiniMax-AI/MiniMax-H3/blob/main/skills/h3-prompt-writing/SKILL.md'; promptHelp.target = '_blank'; promptHelp.rel = 'noopener noreferrer'; promptHelp.innerHTML = ''; - promptHelp.setAttribute('aria-label', t('How to write a prompt', '描述写法')); - tip(promptHelp, t('How to write a prompt', '描述写法'), t('Open the guide to writing a good prompt', '打开描述写法指南,写得更准')); + promptHelp.setAttribute('aria-label', t('How to write a prompt', '提示词写法')); + tip(promptHelp, t('How to write a prompt', '提示词写法'), t('Open the guide to writing a good prompt', '打开提示词写法指南,写得更准')); // Expand: a large box for long prompts; Generate works from there too. const promptExpand = createExpandButton({t, textarea: prompt, canGenerate: () => !generate.disabled, onGenerate: () => { generate.click(); return ''; }}); - tip(promptExpand.element, t('Expand', '放大'), t('Write a long prompt in a large box', '在大文本框里写长描述')); + tip(promptExpand.element, t('Expand', '展开'), t('Write a long prompt in a large box', '在大文本框里写长提示词')); cleanup.push(() => promptExpand.dispose?.()); promptTools.append(promptHelp, promptExpand.element); promptSection.append(enhancer.element); @@ -1091,7 +1112,7 @@ export function openStudio(node, {extendFrom = null} = {}) { for (const mark of sizeTicks.children) { mark.disabled = mp.disabled; setAttr(mark, 'aria-pressed', String(Math.abs(Number(mark.dataset.pixels) - Number(mp.value)) < .005)); } const w = extension.source?.geometry.width ?? value(node, 'width'), h = extension.source?.geometry.height ?? value(node, 'height'); sizeReadout.textContent = dimensionsLinked && !extension.source ? t('Size from connected nodes', '尺寸来自已连接节点') : `${Number(mp.value).toFixed(2)} MP · ${w} × ${h}`; - if (mp.disabled) sizeSlider.dataset.fvTipWhy = extension.source ? t('A continued video keeps its size', '接着生成时沿用原视频尺寸') : t('Set by connected nodes', '由连接的节点决定'); + if (mp.disabled) sizeSlider.dataset.fvTipWhy = extension.source ? t('An extended video keeps its size', '接着生成时沿用原视频尺寸') : t('Set by connected nodes', '由连接的节点决定'); else delete sizeSlider.dataset.fvTipWhy; }; resolutionControl.append(sizeSlider, sizeTicks, resolutionSelect); @@ -1128,9 +1149,10 @@ export function openStudio(node, {extendFrom = null} = {}) { const passControl = createPassMode({t, onChoose: mode => choosePassMode(mode), listen: listenDialogKey}); const passMode = passControl.element; cleanup.push(passControl.dispose); + const fastRowWords = () => fastParts() ? t('Each part runs a second pass', '每段使用二采') : t('Fast uses one pass', '极速档一次生成'); const previewPassHint = t('Stops at a lower-resolution preview. Choose "Run second pass" in the result when it looks right; the video matches a direct run.', '先出低分辨率预览,满意后在结果里点“继续二采”,成片与直接生成一致。'); - twoPassLabel.append(el('span', t('Two-pass', '二采')), twoPassStatus, passMode); + twoPassLabel.append(el('span', t('Second pass', '二采')), twoPassStatus, passMode); let effortEstimate = {}, effortEstimateKey = '', effortEstimateTimer = null, effortEstimateRequest = null, lengthControl = null, chainController = null; // A level's step cache; custom steps and workflows without the input sample every step. const stepCacheNow = () => stepCacheOf(value(node, 'step_cache')); @@ -1138,7 +1160,17 @@ export function openStudio(node, {extendFrom = null} = {}) { // The two-pass learned upscale factor; a single pass has none (2). const upscaleNow = () => upscaleOf(value(node, 'upscale_factor')); const setUpscale = factor => { if (widget(node, 'upscale_factor') && value(node, 'upscale_factor') !== String(factor)) set(node, 'upscale_factor', String(factor)); }; + // The Fast level is the `fast_mode` input; the engine takes its steps from it. The other sampling inputs hold the values + // it accepts beside it (8 + 3, one pass, no cache, factor 2). The two-pass choice made before it comes back when it is left. + let fastOffer = null, fastBack = null; + const fastOn = () => Boolean(widget(node, 'fast_mode')) && value(node, 'fast_mode') === 'fast2'; + const fastLeft = () => { if (fastOn()) set(node, 'fast_mode', 'none'); }; + // A video made in parts is sampled at Light in two passes, whatever is chosen (the request says so at submission). + const fastParts = () => fastOn() && lengthControl?.plan?.count > 1; const chooseEffort = tier => { + if (tier.fast) { chooseFast(); return; } + const back = fastOn() ? fastBack : null; + fastLeft(); fastBack = null; baseSteps.value = tier.steps; refineSteps.value = 3; twoPass.checked = tier.twoPass; @@ -1148,15 +1180,53 @@ export function openStudio(node, {extendFrom = null} = {}) { set(node, 'step_cache', tier.stepCache || 'none'); set(node, 'upscale_factor', String(tier.upscale)); syncSamplingSteps(); + if (back?.preview && tier.twoPass) choosePassMode('preview'); }; // (effortPointed: the quality panel's line on what the pointed-at level gives; set with that panel.) let effortPointed = () => {}; - const effort = createSamplingEffort(t, {onChange: chooseLevel, onPreview: tier => { if (tier) showEffortEstimate(tier.steps, tier.twoPass, tier.stepCache, tier.upscale); else showEffortEstimate(); effortPointed(tier); }}); + const effort = createSamplingEffort(t, {onChange: chooseLevel, onPreview: tier => { if (tier?.fast) { effort.setWarning(''); effort.setEstimate(''); } else if (tier) showEffortEstimate(tier.steps, tier.twoPass, tier.stepCache, tier.upscale); else showEffortEstimate(); effortPointed(tier); }}); + // The Advanced options find this strip by the mark (the editor's own bar has another one, with its own state). + effort.element.dataset.fvStudioEffort = ''; + let fastGrid = null, fastPublished = null; + const fastPack = fastPackControl({t, api, onResize: () => qualityChip.place(), onChange: () => { + effort.setFastUse(fastPack.needs()); + if ((!fastPack.present || fastPack.published === false) && fastOn()) chooseEffort(effort.levels().find(tier => tier.name === 'Light')); + // Files not yet on the download sources: the level is not listed (fast_pack.published). + if (fastPack.published !== fastPublished) { fastPublished = fastPack.published; effort.setLevels(fastLevels()); } + if (qualityChip.element.isConnected) paintQuality(); + }}); + cleanup.push(() => fastPack.dispose()); + // The Edit view sends the level only while this panel lists it with its files here (editor.js). + const fastOffered = () => Boolean(fastOffer) && fastPack.published === true && fastPack.present; + node.freevideoFastOffered = fastOffered; + cleanup.push(() => { if (node.freevideoFastOffered === fastOffered) delete node.freevideoFastOffered; }); + function chooseFast() { + if (!fastPack.present) { fastPack.ask(); syncSamplingSteps(); updateRunButton(); return; } + if (originalOn) { syncSamplingSteps(); effort.setWarning(t('With "Use as is", choose another level.', '选择“原样使用”时,请使用其他档位。')); qualityChip.place(); return; } + if (!fastOffer) return; + if (!fastOn()) fastBack = {preview: previewFirst.checked}; + baseSteps.value = '8'; refineSteps.value = '3'; twoPass.checked = false; autoSinglePass = false; + set(node, 'two_pass', false); set(node, 'refine_steps', 3); set(node, 'step_cache', 'none'); setUpscale(2); + if (previewFirst.checked) { previewFirst.checked = false; set(node, 'preview', false); } + set(node, 'fast_mode', 'fast2'); + syncSamplingSteps(); updateRunButton(); + } + // The planner's answer for this machine (capabilities.fast_mode): no answer lists no Fast level. + // Listed only once the files are known to be published; until then the four levels. + const fastLevels = () => withFastLevel(effortsFrom(fastGrid), fastOffer && fastPack.published === true ? fastOffer : null); + function applyFastOffer(grid) { + fastGrid = grid; + if (grid?.status === 'ready') fastOffer = widget(node, 'fast_mode') ? fastOfferOf(grid) : null; + effort.setLevels(fastLevels()); + if (fastOffer) fastPack.refresh(); + if (grid?.status !== 'ready' || !fastOn()) return; + if (!fastOffer) chooseEffort(effort.levels().find(tier => tier.name === 'Light')); + } // What the quality control shows now; the editor's generation bar shows the same control from this. const effortState = () => ({baseSteps: Number(baseSteps.value), refineSteps: Number(refineSteps.value), twoPass: twoPass.checked, stepCache: stepCacheNow(), upscale: upscaleNow(), disabled: baseSteps.disabled || linked(node, 'two_pass') || linked(node, 'refine_steps') || linked(node, 'step_cache') || linked(node, 'upscale_factor'), - reason: extension.source ? continuationReason() : ''}); + reason: extension.source ? continuationReason() : '', fast: fastOn()}); const effortListeners = new Set(); const sharedEffort = {state: effortState, choose: chooseLevel, levels: () => effort.levels(), subscribe(listener) { effortListeners.add(listener); return () => effortListeners.delete(listener); }}; @@ -1178,6 +1248,7 @@ export function openStudio(node, {extendFrom = null} = {}) { } // A level chosen on the control. function chooseLevel(tier) { + if (!tier.fast) fastPack.forget(); chooseEffort(tier); if (tier.twoPass) returnHeldPreview(); else holdPreview(false); } @@ -1191,6 +1262,7 @@ export function openStudio(node, {extendFrom = null} = {}) { function choosePassMode(mode) { if (extension.source) return; const wantsTwoPass = mode !== 'off', wantsPreview = mode === 'preview'; + if (fastOn()) return; // Chosen, so nothing waits; the workflow has to record that even when no other setting changes. if (!wantsPreview && node.properties?.freevideo_preview_held) { delete node.properties.freevideo_preview_held; node.graph?.change?.(); } if (twoPass.checked !== wantsTwoPass) { @@ -1206,6 +1278,8 @@ export function openStudio(node, {extendFrom = null} = {}) { syncSamplingSteps(); updateRunButton(); } function passState() { + if (fastOn()) return {mode: fastParts() ? 'on' : 'off', disabled: {off: true, on: true, preview: true}, hidden: {preview: !widget(node, 'preview')}, hint: '', + why: fastParts() ? fastRowWords() : t('Fast makes the full size in one pass. Choose another level to use it.', '极速档一次生成全分辨率。选其他档位后可用。')}; const passLinked = linked(node, 'two_pass'), previewLinked = linked(node, 'preview'); return {mode: !twoPass.checked ? 'off' : previewFirst.checked ? 'preview' : 'on', disabled: {off: Boolean(extension.source) || passLinked || !widget(node, 'two_pass'), on: twoPass.disabled, @@ -1432,26 +1506,29 @@ export function openStudio(node, {extendFrom = null} = {}) { if (extension.source) { const factor = continuationUpscale(baseSteps.value, twoPass.checked, refineSteps.value, stepCacheNow(), value(node, 'upscale_factor'), effort.levels()); baseSteps.value = '8'; refineSteps.value = '3'; twoPass.checked = true; set(node, 'two_pass', true); clearStepCache(); setUpscale(factor); autoSinglePass = false; + fastLeft(); } + samplingFields.hidden = fastOn(); // The Fast level's steps are the engine's. const baseLinked = linked(node, 'base_steps'); // Two-pass is offered at 8 first-pass steps, and from a single-pass level (it then gives Light). // A saved workflow that already uses it with other steps is shown as custom and left unchanged. const onePassLevel = !twoPass.checked && !baseLinked && Boolean(effortFor(Number(baseSteps.value), false, Number(refineSteps.value), stepCacheNow(), effort.levels())); const unavailable = Number(baseSteps.value) !== 8 && !twoPass.checked && !onePassLevel; - twoPass.disabled = Boolean(extension.source) || unavailable || linked(node, 'two_pass') || !widget(node, 'two_pass'); - twoPassStatus.textContent = Number(baseSteps.value) !== 8 && !onePassLevel ? t('Needs 8 first-pass steps', '一采需 8 步') : ''; + twoPass.disabled = Boolean(extension.source) || unavailable || fastOn() || linked(node, 'two_pass') || !widget(node, 'two_pass'); + twoPassStatus.textContent = fastOn() ? fastRowWords() : Number(baseSteps.value) !== 8 && !onePassLevel ? t('Needs 8 first-pass steps', '一采需 8 步') : ''; twoPassLabel.classList.toggle('fv-two-pass-unavailable', unavailable); // A preview stops after the first pass, so it needs two-pass sampling. // Steps half typed decide nothing; the two-pass rule above is applied to them once they are committed. const stepsWrong = !typing && previewStepsWrong(); - if ((!twoPass.checked || stepsWrong) && previewFirst.checked) { + if ((!twoPass.checked || stepsWrong || fastOn()) && previewFirst.checked) { // A linked value is another node's to change. if (stepsWrong && !linked(node, 'preview')) holdPreview(true); previewFirst.checked = false; set(node, 'preview', false); if (runButtonReady) updateRunButton(); } - previewFirst.disabled = !twoPass.checked || previewStepsWrong() || linked(node, 'preview') || !widget(node, 'preview'); + previewFirst.disabled = !twoPass.checked || fastOn() || previewStepsWrong() || linked(node, 'preview') || !widget(node, 'preview'); blockOriginal('preview', previewFirst.checked && !previewFirst.disabled, {release() { choosePassMode('on'); return ['Preview first was turned off for "Use as is".', '已为“原样使用”关闭“先出预览”。']; }}); + blockOriginal('fast', fastOn(), {release() { chooseEffort(effort.levels().find(tier => tier.name === 'Light')); return ['Switched to Light for "Use as is".', '已为“原样使用”改用轻量档。']; }}); syncPassMode(); baseSteps.disabled = baseLinked || !widget(node, 'base_steps') || Boolean(extension.source); refineSteps.disabled = !twoPass.checked || linked(node, 'refine_steps') || !widget(node, 'refine_steps') || Boolean(extension.source); @@ -1460,7 +1537,7 @@ export function openStudio(node, {extendFrom = null} = {}) { refineSteps.setCustomValidity(twoPass.checked && !baseLinked && !refineSteps.disabled && Number(refineSteps.value) !== 3 && Number(refineSteps.value) >= Number(baseSteps.value) ? t('Use 3 second-pass steps, or fewer than the first-pass steps.', '二采步数须为 3,或少于一采步数。') : ''); if (twoPass.checked) refineSteps.removeAttribute('title'); - else refineSteps.title = t('Turn on two-pass acceleration to use this setting.', '开启二采加速后生效。'); + else refineSteps.title = t('Turn on the faster second pass to use this setting.', '开启二采加速后生效。'); for (const [input, name] of [[baseSteps, 'base_steps'], [refineSteps, 'refine_steps']]) { if (!input.disabled && input.checkValidity() && Number(input.value) !== value(node, name)) { set(node, name, Number(input.value)); @@ -1480,16 +1557,79 @@ export function openStudio(node, {extendFrom = null} = {}) { // A continuation keeps a two-pass level (Light or Medium). function continuationReason() { const level = effortFor(8, true, 3, null, effort.levels(), upscaleNow()); - return level?.name === 'Medium' ? t('A continuation uses the Medium level.', '接着生成使用标准档。') : t('A continuation uses the Light level.', '接着生成使用轻量档。'); - } + return level?.name === 'Medium' ? t('An extended part uses the Medium level.', '接着生成使用标准档。') : t('An extended part uses the Light level.', '接着生成使用轻量档。'); + } + // The Fast level where the chosen size and length do not fit (capabilities.fast_mode): why, and the ways out. A video + // made in parts is sampled at Light, so this is about one run only. + // Declared, not assigned: a saved Fast setting asks for the estimate while the panel is still being built. + function fastCell() { return fastOn() && !(lengthControl?.plan?.count > 1) ? capabilityView?.fast?.() ?? null : null; } + function fastShortfall() { const cell = fastCell(); return cell && !cell.fits ? cell : null; } + // Where the page cannot tell yet: 'checking' (the planner's grid is not in) holds the key; 'linked' (the size comes from + // another node, so it never can) lets it go, and a refusal then comes back as the failure card (Lane 11-24). + function fastUnknown() { + // Not listed (no answer from the planner either): it is sent at Light, so nothing waits. + if (!fastOn() || !fastOffer || lengthControl?.plan?.count > 1 || fastCell()) return null; + return linked(node, 'width') || linked(node, 'height') ? 'linked' : 'checking'; + } + function fastUnknownWords(kind) { + return kind === 'linked' + ? t('The size comes from a connected node, so the Fast level is checked when you generate.', '宽高来自连接的节点,生成时再确认极\u2060速\u2060档能否生成。') + : t('Checking whether the Fast level can make this video…', '正在检查极\u2060速\u2060档能否生成这个视频…'); + } + function fastWays(cell) { + const ways = []; + if (cell.actions.includes('use_light') && cell.lightFits) + ways.push({id: 'use_light', label: t('Use Light', '改用轻量档'), run: () => { chooseLevel(effort.levels().find(tier => tier.name === 'Light')); refreshFast(); }}); + if (cell.actions.includes('shorten') && cell.shorten && !seconds.disabled) + ways.push({id: 'shorten', label: t('Shorten to {seconds} s', '缩短到 {seconds} 秒', { seconds: cell.shorten }), run: () => { + seconds.value = String(cell.shorten); + seconds.dispatchEvent(new Event('input', {bubbles: true})); seconds.dispatchEvent(new Event('change', {bubbles: true})); + refreshFast(); + }}); + // Neither level fits this size at any length: a smaller size is the one way out. + if (!ways.length) ways.push({id: 'size', label: t('Change size', '更改尺寸'), run: () => { qualityChip.close?.(); framePicker?.element.click(); }}); + return ways; + } + function fastShortfallWords(cell) { + const kind = ['gpu_memory', 'decode_gpu_memory'].includes(cell.limit) ? 'vram' : cell.limit === 'memory' ? 'ram' : 'either'; + // Whole sentences for each shortage, so a language whose words change with the noun can say each its own way. + if (fastWays(cell)[0].id === 'size') return { + vram: () => t('This computer does not have enough graphics memory for the Fast or Light level at this size. Use a smaller size, then generate again.', + '这台电脑的显存不足以用极\u2060速\u2060档或轻\u2060量\u2060档生成这个尺寸的视频。请缩小尺寸后重新生成。'), + ram: () => t('This computer does not have enough memory for the Fast or Light level at this size. Use a smaller size, then generate again.', + '这台电脑的内存不足以用极\u2060速\u2060档或轻\u2060量\u2060档生成这个尺寸的视频。请缩小尺寸后重新生成。'), + either: () => t('This computer does not have enough graphics memory or memory for the Fast or Light level at this size. Use a smaller size, then generate again.', + '这台电脑的显存或内存不足以用极\u2060速\u2060档或轻\u2060量\u2060档生成这个尺寸的视频。请缩小尺寸后重新生成。'), + }[kind](); + const s = Number(seconds.value); + return { + vram: () => t('This computer does not have enough graphics memory for the Fast level at {seconds} s.', '这台电脑的显存不足以用极\u2060速\u2060档生成 {seconds} 秒视频。', { seconds: s }), + ram: () => t('This computer does not have enough memory for the Fast level at {seconds} s.', '这台电脑的内存不足以用极\u2060速\u2060档生成 {seconds} 秒视频。', { seconds: s }), + either: () => t('This computer does not have enough graphics memory or memory for the Fast level at {seconds} s.', '这台电脑的显存或内存不足以用极\u2060速\u2060档生成 {seconds} 秒视频。', { seconds: s }), + }[kind](); + } + function refreshFast() { showEffortEstimate(); if (qualityChip.element.isConnected) qualityChip.place(); } function showEffortEstimate(steps = Number(baseSteps.value), twoPassPlan = twoPass.checked, cache = stepCacheNow(), factor = upscaleNow()) { - effort.setWarning(''); - const parts = lengthControl.plan?.count > 1 ? t(`${lengthControl.plan.count} parts`, `分 ${lengthControl.plan.count} 段`) : ''; + effort.setWarning(''); effort.setWays(); + if (!arguments.length && fastOn()) { + // Its time where the planner has one; a video made in parts is sampled at Light. + const cell = fastCell(); + effort.setEstimate(cell?.fits ? cell.estimate : ''); + if (lengthControl.plan?.count > 1) effort.setWarning(t('Each part of a video made in parts uses the Light level.', '分段生成时,每段使用轻量档。')); + else if (cell && !cell.fits) { effort.setWarning(fastShortfallWords(cell)); effort.setWays(fastWays(cell)); } + else if (!cell && fastUnknown()) effort.setWarning(fastUnknownWords(fastUnknown())); + if (runButtonReady) updateRunButton(); + // The length decides what the two-pass row and the line under the track say. + twoPassStatus.textContent = fastRowWords(); syncPassMode(); effortPointed(null); + if (runButtonReady) syncKeyMore(); + return; + } + const parts = lengthControl.plan?.count > 1 ? t('{count} parts', '分 {count} 段', { count: lengthControl.plan.count }) : ''; // A request that fits one run keeps its own estimate while the longest run is unknown. if ((lengthControl.capabilityState === 'pending' || lengthControl.capabilityState === 'unavailable') && (lengthControl.needsPlan || lengthControl.plan?.count > 1)) { const waiting = lengthControl.estimating ? t('Estimating time…', '正在估算用时…') : ''; - effort.setEstimate([parts, waiting].filter(Boolean).join(' · ')); + effort.setEstimate([parts, waiting].filter(Boolean).join(' · '), '', lengthControl.plan?.count > 1 ? lengthControl.plan.count : 0); return; } if (lengthControl.plan?.single && Number(seconds.value) > 60) { effort.setEstimate(''); return; } @@ -1498,8 +1638,8 @@ export function openStudio(node, {extendFrom = null} = {}) { const plan = lengthControl.plan; const seconds = steps === Number(baseSteps.value) && twoPassPlan === twoPass.checked && cache === stepCacheNow() && factor === upscaleNow() ? sumPartEstimates(plan, lengthControl.estimate) : null; - effort.setEstimate(seconds > 0 ? t(`${plan.count} parts · about ${Math.ceil(seconds / 60)} min`, `分 ${plan.count} 段 · 约 ${Math.ceil(seconds / 60)} 分钟`) - : t(`${plan.count} parts`, `分 ${plan.count} 段`)); + effort.setEstimate(seconds > 0 ? t('{count} parts · about {minutes} min', '分 {count} 段 · 约 {minutes} 分钟', { count: plan.count, minutes: Math.ceil(seconds / 60) }) + : t('{count} parts', '分 {count} 段', { count: plan.count }), '', plan.count); return; } const rangeEstimate = capabilityView?.estimate(steps, twoPassPlan, arguments.length ? 3 : Number(refineSteps.value), cache, factor); @@ -1547,13 +1687,16 @@ export function openStudio(node, {extendFrom = null} = {}) { if (loraNode && !widget(loraNode, 'adapters')) adapters = value(loraNode, 'lora') !== 'None'; const requestWidth = extension.source?.geometry.width ?? value(node, 'width'); const requestHeight = extension.source?.geometry.height ?? value(node, 'height'); + // With the Fast level the length is planned at Light: a video made in parts is sampled at Light, and whether one run + // fits the Fast level is its own cell (capabilityView.fast), which says so rather than splitting the video. lengthControl?.refresh({width: requestWidth, height: requestHeight, task, adapters, - settings: {tier: effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow())?.name.toLowerCase() || 'custom', + settings: fastOn() ? {tier: 'light', base_steps: 8, refine_steps: 3, two_pass: true, step_cache: null, upscale_factor: 2} + : {tier: effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow())?.name.toLowerCase() || 'custom', base_steps: Number(baseSteps.value), refine_steps: Number(refineSteps.value), two_pass: twoPass.checked, step_cache: stepCacheNow(), upscale_factor: upscaleNow()}}, force); requestAssetsQuery = () => { const query = new URLSearchParams({width: requestWidth, height: requestHeight, seconds: value(node, 'seconds'), task, - base_steps: baseSteps.value, refine_steps: refineSteps.value, two_pass: twoPass.checked ? '1' : '0', + base_steps: baseSteps.value, refine_steps: refineSteps.value, two_pass: twoPass.checked || fastOn() ? '1' : '0', enhance: node.properties?.freevideo_prompt_versions?.enabled ? '1' : '0'}); for (const name of enabledLoras(loraNode, {upstream, widget, value})) query.append('lora', name); for (const row of referenceFiles(requestRefs)) query.append('ref', row); @@ -1597,7 +1740,7 @@ export function openStudio(node, {extendFrom = null} = {}) { worksButton.innerHTML = ''; worksButton.append(el('span', t('Creations', '作品库'), 'fv-works-label')); worksButton.setAttribute('aria-label', t('Creations', '作品库')); - tip(worksButton, t('Creations', '作品库'), t('Open your works to sort and manage them', '打开作品库,筛选和管理')); + tip(worksButton, t('Creations', '作品库'), t('Open your creations to sort and manage them', '打开作品库,筛选和管理')); previewHead.append(previewTools); previewHead.hidden = true; output.append(previewHead); // The picture's space: its size comes from the column and the shape alone (fitPreview), never from what is below it. const previewSpace = el('div', null, 'fv-preview-space sgf-avoid'); previewSpace.dataset.fvMain = ''; output.append(previewSpace); @@ -1629,7 +1772,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // The floating task window grows out of this picture and returns to it. stage.dataset.fvTaskStage = 'studio'; // Before the first video: one quiet line under the empty frame's icon says where to start. - stage.style.setProperty('--fvs-empty-hint', JSON.stringify(t('Describe a scene below to start', '在下方写一句描述,开始生成'))); + stage.style.setProperty('--fvs-empty-hint', JSON.stringify(t('Describe a scene to start', '写一句描述,开始生成'))); const stageMedia = el('div', null, 'fv-stage-media'); // The next generation's empty frame: the stage itself, at the chosen (or pointed-at) shape, with its pixels. const nextSize = el('span', null, 'fvs-next-size'); @@ -1659,7 +1802,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // The queued count sits after the part number; a line too narrow for both puts the count on its own line. const setChainLine = text => { const main = el('span', text), more = chainController?.waiting, queued = el('span', null, 'fv-chain-queued'); - if (more) queued.append(el('span', ' · ', 'fv-chain-sep'), t(`${more} more queued`, `另有 ${more} 条排队`)); + if (more) queued.append(el('span', ' · ', 'fv-chain-sep'), t('{more} more queued', '另有 {more} 条排队', { more })); chainLine.replaceChildren(main, ...(more ? [queued] : [])); }; progress.updateReport({report_id: node.freevideoReportId}); @@ -1726,7 +1869,7 @@ export function openStudio(node, {extendFrom = null} = {}) { const g = r?.geometry || {}, parts = []; const length = g.seconds || (g.frames && g.frames / (g.fps || 24)); if (g.width && g.height) parts.push({key: 'size', text: `${g.width} × ${g.height}`}); - if (length) parts.push({key: 'length', text: t(`${Number(length).toFixed(1)} s`, `${Number(length).toFixed(1)} 秒`)}); + if (length) parts.push({key: 'length', text: t('{seconds} s', '{seconds} 秒', { seconds: Number(length).toFixed(1) })}); // The work's own size and length; the level is the console's (a first-pass preview is still named). if (r?.preview) parts.push({key: 'level', text: t('First-pass preview', '一采预览')}); return asParts ? parts : parts.map(part => part.text).join(' · '); @@ -1760,11 +1903,16 @@ export function openStudio(node, {extendFrom = null} = {}) { tall?.addEventListener?.('change', tallChange); cleanup.push(() => tall?.removeEventListener?.('change', tallChange)); function fitTall(gap) { const playerShown = getComputedStyle(playerRow).display !== 'none'; - const room = output.clientHeight - 2 * (TALL_EDGE / 2) - 40 - gap - (playerShown ? playerRoom() + gap : 0); + // Three columns: the works have a column (or a row under the stage) of their own, so there is no grid to make room for; + // the picture takes the column's width less its own padding, and the picture, bar and actions stand in the middle. + const columns = body.dataset.cols === '3', style = getComputedStyle(output); + const edges = columns ? parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) : 2 * (TALL_EDGE / 2); + const room = output.clientHeight - edges - 40 - gap - (playerShown ? playerRoom() + gap : 0); const gridWidth = output.clientWidth - 2 * TALL_EDGE, gridHeight = gridWidth / previewRatio; - const grid = recentCount() > 0 && gridHeight <= room && room - gridHeight >= GRID_MIN; + const grid = !columns && recentCount() > 0 && gridHeight <= room && room - gridHeight >= GRID_MIN; body.dataset.grid = String(grid); - return {room, width: grid ? gridWidth : output.clientWidth - TALL_EDGE - TALL_RAIL, grid, barRoom: 40 + gap + (playerShown ? playerRoom() + gap : 0)}; + const width = columns ? output.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) : grid ? gridWidth : output.clientWidth - TALL_EDGE - TALL_RAIL; + return {room, width, grid, barRoom: 40 + gap + (playerShown ? playerRoom() + gap : 0)}; } function fitPreview() { const isTall = !phone?.matches && !!tall?.matches; @@ -2010,11 +2158,11 @@ export function openStudio(node, {extendFrom = null} = {}) { source: row => ({src: view(row.video, 'output') + (row.version ? `&fv=${encodeURIComponent(row.version)}` : ''), poster: savedVideo(row.video) && !row.preview ? videoThumbnailURL(row) : ''}), // The two sides are A and B only: nothing about the works is written on them. describe: () => '', - onChange: active => { stage.dataset.comparing = String(active); compareButton.setAttribute('aria-pressed', String(active)); if (!active) recent?.clearPicks({quiet: true}); }}); + onChange: active => { stage.dataset.comparing = String(active); compareButton.setAttribute('aria-pressed', String(active)); if (!active) worksColumn?.clearPicks({quiet: true}); }}); cleanup.push(() => compare.dispose()); const compareButton = button('', () => { if (compare.active) { compare.close(); return; } - const rows = recent.rows(), index = recent.index(); + const rows = worksColumn.rows(), index = worksColumn.index(); const other = rows[index + 1] || rows[index - 1] || rows.find(row => row?.video !== result?.video); if (!result?.video || !other) return; stageMedia.querySelector('video')?.pause(); @@ -2023,31 +2171,33 @@ export function openStudio(node, {extendFrom = null} = {}) { compareButton.innerHTML = ``; compareButton.setAttribute('aria-label', t('Compare', '对比')); tip(compareButton, t('Compare', '对比'), t('Side by side or with a divider, with another video', '和另一条视频并排或滑动对比')); - // No Compare button on the bar: two videos picked together in the rail compare on the stage (F9 still opens it). - let shownCount = 0; - const recent = createRecentVideos(t, {body, rail: true, named: row => savedPrompt(api, row), - onSelect: row => { if (compare.active) compare.close(); showResult(row, {chosen: true}); }, + // No Compare button on the bar: two videos picked together in the works column compare on the stage (F9 still opens it). + let shownCount = 0, worksColumn = null; + // The right column of the three-column layout: the library's videos, the shown video's facts, the queue. The owner's + // Creations button stands beside its search. + worksColumn = mountStudioColumn({slot: body.querySelector('.fv-work-column'), shell: body.studioPanels, entry: worksButton, + onShow: row => { if (compare.active) compare.close(); showResult(row, {chosen: true}); }, named: row => savedPrompt(api, row), onPick: rows => { if (rows.length === 2) { if (compare.active) compare.close(); compare.open(rows[0], rows[1]); } else { if (compare.active) compare.close(); if (rows[0]) showResult(rows[0], {chosen: true}); } }, - onChange: () => { syncHistory(); const count = recent.rows().length; if (count !== shownCount) { shownCount = count; fitPreview(); } }}); - recentCount = () => recent.rows().length; - recent.element.classList.add('sgf-avoid'); - recent.element.prepend(worksButton); body.append(recent.element); + onChange: () => { syncHistory(); const count = worksColumn ? worksColumn.rows().length : 0; if (count !== shownCount) { shownCount = count; fitPreview(); } }, + // The info page's Reuse settings fills the panel as the result bar's does. + onReuse: async row => { const saved = await savedSettings(api, row); if (saved) reuse.apply(saved); }}); + recentCount = () => worksColumn.rows().length; + cleanup.push(() => worksColumn.dispose()); // Phones have no rail; Creations is the top bar's works entry, there at every width. function syncHistory() { stageBar.element.dataset.empty = String(!result?.video); - stageBar.setHistory(recent.index(), recent.rows().length); - compareButton.disabled = !result?.video || recent.rows().length < 2; + stageBar.setHistory(worksColumn.index(), worksColumn.rows().length); + compareButton.disabled = !result?.video || worksColumn.rows().length < 2; compareButton.dataset.fvTipWhy = compareButton.disabled ? t('Needs a second video in the history', '历史里还要有另一条视频') : ''; if (!compareButton.disabled) delete compareButton.dataset.fvTipWhy; } function stepHistory(delta) { - const rows = recent.rows(), index = recent.index(), row = rows[index + delta]; + const rows = worksColumn.rows(), index = worksColumn.index(), row = rows[index + delta]; if (row) showResult(row, {chosen: true}); } - cleanup.push(() => recent.dispose()); // A run this window watched. Its result can arrive before or after the // final progress message, and more than once; the tip stays with that video. // "Reuse settings" in the result bar: what the panel holds now, filling an earlier video's settings back, @@ -2100,7 +2250,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // chosen: a video picked from Recent videos. It only changes the picture; a run in progress keeps its progress. function showResult(r, {chosen = false} = {}) { if (!r?.video || disposed) return; result = r; leaveNext(); - recent.setSelected(r.video); syncPartList(); + worksColumn?.setShown(r); syncPartList(); refreshEffortEstimate(true); // The report belongs to the video that run made; a video picked from Recent videos // shows its own report, or none when this window never saw its run. @@ -2190,7 +2340,8 @@ export function openStudio(node, {extendFrom = null} = {}) { links.replaceChildren(resultActions(r, t, {diagnostic: reported ? downloadReport : null, extend: saved => openExtendEditor(saved, node, {studio: dialog, isCurrent: () => dialog.open && dialog.dataset.closing !== 'true' && topDialog() === dialog && result === r}), - secondPass: r.preview ? secondPass(r) : null, reuse: r.preview ? null : reuse, layout: 'stage', more: [...upscaleItems(r), guideItem()]})); + secondPass: r.preview ? secondPass(r) : null, reuse: r.preview ? null : reuse, layout: 'stage', + favorite: worksColumn && r.video ? value => worksColumn.setFavorite(r, value).catch(error => { notify(t('The favorite was not saved. Try again.', '收藏未能保存,请重试。'), null, 'fail'); throw error; }) : null, more: [...upscaleItems(r), guideItem()]})); refreshUpscaleItems(r); if (runButtonReady) updateExtendButton(); stageBar.sync(); syncHistory(); @@ -2238,8 +2389,8 @@ export function openStudio(node, {extendFrom = null} = {}) { const position = chainPosition(chain, message); const joining = readChainResult(chain).joining, waiting = chain.state === 'queued' && message.phase === 'prepare'; setChainLine(joining ? joiningText(chain.joining_part, t) - : waiting ? (chain.waiting ? waitingText(chain.waiting, t) : t(`Waiting in queue · Part ${position.index + 1} of ${position.count}`, `正在排队 · 第 ${position.index + 1} 段,共 ${position.count} 段`)) - : t(`Part ${position.index + 1} of ${position.count}`, `第 ${position.index + 1} 段,共 ${position.count} 段`)); + : waiting ? (chain.waiting ? waitingText(chain.waiting, t) : t('Waiting in queue · Part {part} of {count}', '正在排队 · 第 {part} 段,共 {count} 段', { part: position.index + 1, count: position.count })) + : t('Part {part} of {count}', '第 {part} 段,共 {count} 段', { part: position.index + 1, count: position.count })); progress.element.querySelector('.fv-generation-label').hidden = joining || waiting; progress.element.classList.toggle('fv-generation-waiting', waiting); progress.updateReport(message); showProgress(message); @@ -2257,7 +2408,7 @@ export function openStudio(node, {extendFrom = null} = {}) { busy = active || Boolean(queueState?.running || queueState?.pending.length); queued = chain?.state === 'queued'; chainLine.hidden = !active; setChainLine(outcome?.joining ? joiningText(chain?.joining_part, t) - : t(`Part ${position.index + 1} of ${position.count}`, `第 ${position.index + 1} 段,共 ${position.count} 段`)); + : t('Part {part} of {count}', '第 {part} 段,共 {count} 段', { part: position.index + 1, count: position.count })); if (active && node.properties.freevideo_chain?.width) previewSize(node.properties.freevideo_chain.width, node.properties.freevideo_chain.height); if (!active) { cancelling = false; hideProgress(); } if (!active) { progress.element.querySelector('.fv-generation-label').hidden = false; progress.element.classList.remove('fv-generation-waiting'); } @@ -2309,7 +2460,7 @@ export function openStudio(node, {extendFrom = null} = {}) { const perLine = el('input'); perLine.type = 'checkbox'; perLine.setAttribute('role', 'switch'); perLine.checked = node.properties?.freevideo_batch_lines === true; const perLineField = el('label', null, 'fv-batch-lines'); - perLineField.append(el('span', t('One prompt per line', '每行一条描述')), perLine); optionsPanel.append(perLineField); + perLineField.append(el('span', t('One prompt per line', '每行一条提示词')), perLine); optionsPanel.append(perLineField); const linesUsable = () => !linked(node, 'text') && !linked(node, 'conditioning'); const byLine = () => runMode === 'batch' && perLine.checked && linesUsable(); const lineTexts = () => promptLines(shown(value(node, 'text')), (node.properties?.[LORA_TRIGGERS] || []).map(row => row?.words)); @@ -2335,13 +2486,16 @@ export function openStudio(node, {extendFrom = null} = {}) { const keyLabel = el('span', null, 'fvs-key-label'), keyEta = el('span', null, 'fvs-key-eta'); let keyShowsEta = false, keySetup = false; // A one-time note (the first build) is not a standing line: it goes to the key's hover card instead. - const setupPart = part => /首次准备|first.time setup/i.test(part.replace(/\u2060/g, '').replace(/\u00a0/g, ' ')); + const plainWords = text => text.replace(/\u2060/g, '').replace(/\u00a0/g, ' ').replace(/^ · /, '').trim(), setupWords = plainWords(setupNote(t)); + const setupPart = part => plainWords(part) === setupWords; const paintEta = () => { const parts = (effort?.element?.querySelector('.fv-effort-estimate')?.textContent || '').trim().split(' · ').filter(Boolean); keySetup = parts.some(setupPart); // A preview has no estimate of its own (the figures are for the whole two-pass run), so the line stays empty rather than show the wrong time. const estimate = keyShowsEta && !(previewFirst.checked && !previewFirst.disabled) ? parts.filter(part => !setupPart(part)).join(' · ') : ''; if (keyEta.textContent !== estimate) keyEta.textContent = estimate; + const partCount = estimate ? effort?.element?.querySelector('.fv-effort-estimate')?.dataset.parts : undefined; + if (partCount) { if (keyEta.dataset.parts !== partCount) keyEta.dataset.parts = partCount; } else delete keyEta.dataset.parts; // Kept in place when empty (not hidden), so the label above it never moves. keyEta.dataset.empty = String(!estimate); }; @@ -2370,7 +2524,7 @@ export function openStudio(node, {extendFrom = null} = {}) { keyMore.hidden = runMode !== 'single' || videoMissing || Boolean(state.hidden.preview) || Boolean(extension.source); for (const b of keyChoices) setAttr(b, 'aria-pressed', String((b.dataset.choice === 'preview') === (state.mode === 'preview'))); keyChoices[1].disabled = state.disabled.preview && !(state.mode === 'preview'); - keyMenuWhy.hidden = !previewStepsWrong(); keyMenuWhy.textContent = keyMenuWhy.hidden ? '' : previewNeedsSteps(); + keyMenuWhy.hidden = !fastOn() && !previewStepsWrong(); keyMenuWhy.textContent = fastOn() ? fastRowWords() : previewStepsWrong() ? previewNeedsSteps() : ''; if (keyMore.hidden) keyMore.open = false; }; runrow.append(generate, runOptions, keyMore); @@ -2423,7 +2577,7 @@ export function openStudio(node, {extendFrom = null} = {}) { cleanup.push(() => otherUsage.dispose()); runbar.append(requestAssets.element, runrow, addVideoNote, queueActions); controls.append(runbar); // A chain action the server refused with its own sentence says that sentence, not the general "could not continue". - const queueError = error => (error?.action && error.said ? t(error.said[0], error.said[1]) : null) || ({ + const queueError = error => (error?.action && error.said ? t(...error.said) : null) || ({ queue_unavailable: t('Could not read the queue. The loop has stopped; videos already added stay queued.', '暂时读不到队列,循环已停止;已加入的视频还在队列中。'), cancel_failed: t('Could not cancel. Try again.', '没有取消成功,请重试。'), move_failed: t('Could not move it. Try again.', '没有移动成功,请重试。'), @@ -2434,7 +2588,7 @@ export function openStudio(node, {extendFrom = null} = {}) { missing_node: t('This node is disabled or no longer in the workflow.', '该节点已禁用或已从工作流移除。'), chain_cancel_failed: t('Could not cancel. Refresh the page and try again.', '没有取消成功,请刷新页面后再试。'), chain_resume_failed: t('Could not continue. Refresh the page and try again.', '没有继续生成,请刷新页面后再试。'), - }[error?.message] || (error?.said ? t(error.said[0], error.said[1]) : null) || userMessage(error, t)); + }[error?.message] || (error?.said ? t(...error.said) : null) || userMessage(error, t)); let lastQueueError = null, connectionNotice = false; watchEngineExit(api).catch(() => {}); refreshLoopStalls(api); @@ -2484,9 +2638,9 @@ export function openStudio(node, {extendFrom = null} = {}) { if (disposed) return; status.dataset.error = 'true'; // The server's plain sentence (a full disk, unreadable storage) when it has one; what failed stays in the card. - status.textContent = error.said ? (error.joining ? '' : t(`Part ${error.index + 1}: `, `第 ${error.index + 1} 段:`)) + t(error.said[0], error.said[1]) + status.textContent = error.said ? (error.joining ? '' : t('Part {part}: ', '第 {part} 段:', { part: error.index + 1 })) + t(...error.said) : error.joining ? t('Could not join the parts. See the details on the picture.', '未能接合各段,原因见画面上的说明。') - : t(`Part ${error.index + 1} could not be generated. See the details on the picture.`, `第 ${error.index + 1} 段未能生成,原因见画面上的说明。`); + : t('Part {part} could not be generated. See the details on the picture.', '第 {part} 段未能生成,原因见画面上的说明。', { part: error.index + 1 }); if (lastQueueError === error.message) return; lastQueueError = error.message; const report = failure.show(error.message, false, @@ -2495,7 +2649,7 @@ export function openStudio(node, {extendFrom = null} = {}) { } function lineLabel() { const n = lineTexts().length; - return n ? t(n === 1 ? 'Add 1 video' : `Add ${n} videos`, `添加 ${n} 个视频`) : t('Add videos', '添加视频'); + return !n ? t('Add videos', '添加视频') : n === 1 ? t('Add 1 video', '添加 1 个视频') : t('Add {n} videos', '添加 {n} 个视频', { n }); } function updateRunButton() { const submitting = capturing || queueState?.submitting; @@ -2512,16 +2666,17 @@ export function openStudio(node, {extendFrom = null} = {}) { const chainReason = !chainWait ? '' : readChainResult(chain)?.joining ? t('Joining the parts…', '正在接合各段…') : chain?.state === 'queued' ? (chain.waiting ? waitingText(chain.waiting, t) : t('Queued…', '排队中…')) - : t(`Generating part ${position.index + 1}…`, `正在生成第 ${position.index + 1} 段…`); - generate.disabled = submitting || chainWait || (lengthControl.blocked && !lengthControl.retryable) || (runMode === 'loop' && queueState?.looping) || enhancer.reversing; + : t('Generating part {part}…', '正在生成第 {part} 段…', { part: position.index + 1 }); + const fastShort = fastShortfall(), fastWait = fastUnknown(); + generate.disabled = submitting || chainWait || (lengthControl.blocked && !lengthControl.retryable) || Boolean(fastShort) || fastWait === 'checking' || (runMode === 'loop' && queueState?.looping) || enhancer.reversing; paintReverse?.(); // Planning the parts and adding a batch are different waits; a count is only shown when the queue really has one. - const adding = queueState?.batch ? t(`Adding ${Math.min(queueState.batch.done + 1, queueState.batch.total)}/${queueState.batch.total}…`, - `正在添加 ${Math.min(queueState.batch.done + 1, queueState.batch.total)}/${queueState.batch.total}…`) + const adding = queueState?.batch ? t('Adding {current}/{total}…', + '正在添加 {current}/{total}…', { current: Math.min(queueState.batch.done + 1, queueState.batch.total), total: queueState.batch.total }) : capturing ? t('Planning segments…', '正在规划分段…') : t('Adding…', '正在添加…'); const label = submitting ? adding : chainReason || (byLine() ? lineLabel() - : runMode === 'batch' ? t(`Add ${count.value || '…'} videos`, `添加 ${count.value || '…'} 个视频`) + : runMode === 'batch' ? t('Add {count} videos', '添加 {count} 个视频', { count: count.value || '…' }) : runMode === 'loop' ? (queueState?.looping ? t('Looping', '循环中') : t('Start loop', '开始循环')) : busy ? t('Add to queue', '加入队列') : !borrowed && previewFirst.checked && !previewFirst.disabled ? t('Generate preview', '生成预览') : t('Generate video', '生成视频')); @@ -2532,7 +2687,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // The hover card names what the button does now (its own label), and when it is greyed, why and how to free it. const lineUse = enhancer.element.dataset.enabled === 'true' ? t('Each line is one video, sent as written without enhancement', '每行生成一个视频,按原文发送,不做描述增强') - : t('Each line of the description is one video', '描述的每一行生成一个视频'); + : t('Each line of the prompt is one video', '提示词的每一行生成一个视频'); const use = videoMissing ? t('Download the video model before generating', '下载视频模型后才能生成视频') : generate.disabled ? '' : byLine() ? lineUse @@ -2547,8 +2702,11 @@ export function openStudio(node, {extendFrom = null} = {}) { : chainWait ? t('Parts are generating. Wait, or cancel them in the queue.', '分段视频生成中,完成或在队列里取消后可再生成') : enhancer.reversing ? t('Writing the prompt. One moment.', '正在生成提示词,请稍候') : lengthControl.blocked ? lengthControl.message || '' + : fastShort ? fastShortfallWords(fastShort) + : fastWait === 'checking' ? fastUnknownWords(fastWait) : t('A loop is running. Stop it to start again.', '正在循环生成,停止后可重新开始'); - const lengthSaid = lengthControl.blocked && !videoMissing ? lengthControl.visibleMessage : ''; + const lengthSaid = videoMissing ? '' : lengthControl.blocked ? lengthControl.visibleMessage : fastShort ? fastShortfallWords(fastShort) + : fastWait ? fastUnknownWords(fastWait) : ''; if (lengthWhy.textContent !== lengthSaid) lengthWhy.textContent = lengthSaid; if (lengthWhy.hidden !== !lengthSaid) lengthWhy.hidden = !lengthSaid; const words = {fvTipName: keyLabel.textContent.replace(/…$/, ''), fvTipUse: use && keySetup && keyShowsEta ? `${use} · ${t('Includes first-time setup', '含首次准备')}` : use, fvTipKey: TIPS['studio.generate'].key, fvTipWhy: why}; @@ -2570,7 +2728,7 @@ export function openStudio(node, {extendFrom = null} = {}) { if (count.value !== shownCount) { count.value = shownCount; count.fvAtPaint?.(); } } put(perLineField, 'hidden', !linesUsable()); put(perLine, 'disabled', runMode !== 'batch'); - const lineTip = {fvTipName: t('One prompt per line', '每行一条描述'), fvTipUse: lineUse, + const lineTip = {fvTipName: t('One prompt per line', '每行一条提示词'), fvTipUse: lineUse, fvTipWhy: perLine.disabled ? t('Choose Batch to use it', '选“批量”后可用') : ''}; for (const [key, text] of Object.entries(lineTip)) { if (text) { if (perLineField.dataset[key] !== text) perLineField.dataset[key] = text; } else delete perLineField.dataset[key]; @@ -2579,8 +2737,8 @@ export function openStudio(node, {extendFrom = null} = {}) { put(modeHelp, 'textContent', multiple ? t('Videos made in parts cannot use batch or loop.', '分段视频不能批量或循环生成。') : runMode === 'loop' ? t('Same settings, a new seed each time. Stops when this page closes.', '用当前设置,每次换一个种子;关闭网页后停止。') : byLine() ? (enhancer.element.dataset.enabled === 'true' - ? t('Each line of the description is one video, sent as written without enhancement.', '描述的每一行生成一个视频,按原文发送,不做描述增强。') - : t('Each line of the description is one video.', '描述的每一行生成一个视频。')) + ? t('Each line of the prompt is one video, sent as written without enhancement.', '提示词的每一行生成一个视频,按原文发送,不做提示词增强。') + : t('Each line of the prompt is one video.', '提示词的每一行生成一个视频。')) : t('Same settings, a new seed for each video.', '用当前设置,每个视频换一个种子。')); // With one video per GPU each running row carries its own Cancel; "current" would be ambiguous. put(cancelCurrent, 'hidden', !chainController?.active && (!queueState?.running || Boolean(queueState?.running_all))); @@ -2624,14 +2782,14 @@ export function openStudio(node, {extendFrom = null} = {}) { if (wasBusy && !busy) { requestAssets?.refresh(true); } const g = active?.inputs; runningSummary = Number.isFinite(g?.width) && Number.isFinite(g?.height) - ? [t('Generating', '正在生成'), `${g.width} × ${g.height}`, Number(g.seconds) > 0 ? t(`${g.seconds} s`, `${g.seconds} 秒`) : ''].filter(Boolean).join(' · ') : ''; + ? [t('Generating', '正在生成'), `${g.width} × ${g.height}`, Number(g.seconds) > 0 ? t('{seconds} s', '{seconds} 秒', { seconds: g.seconds }) : ''].filter(Boolean).join(' · ') : ''; // The right-hand frame belongs to the submitted video. Draft edits on // the left must never reshape a video currently being generated. if (Number.isFinite(g?.width) && Number.isFinite(g?.height)) previewSize(g.width, g.height); const queueRows = state.running_all ? [...state.running_all, ...state.pending] : state.pending; const running = state.running_all?.length || 0, waiting = state.pending.length; - queueToggle.textContent = !state.running_all ? t(`Queued · ${waiting}`, `排队 ${waiting} 个`) - : [running && t(`${running} generating`, `生成中 ${running} 个`), waiting && t(`${waiting} queued`, `排队 ${waiting} 个`)] + queueToggle.textContent = !state.running_all ? t('Queued · {waiting}', '排队 {waiting} 个', { waiting }) + : [running && t('{running} generating', '生成中 {running} 个', { running }), waiting && t('{waiting} queued', '排队 {waiting} 个', { waiting })] .filter(Boolean).join(' · '); queueDetails.hidden = queueRows.length === 0; const signature = JSON.stringify(queueRows.map(row => [row.id, row.inputs.width, row.inputs.height, @@ -2654,7 +2812,7 @@ export function openStudio(node, {extendFrom = null} = {}) { if (executing) { const bar = el('div', null, 'fv-queue-bar'), fill = el('div', null, 'fv-queue-fill'); bar.setAttribute('role', 'progressbar'); bar.setAttribute('aria-valuemin', '0'); bar.setAttribute('aria-valuemax', '100'); - bar.setAttribute('aria-label', t(`${size} · ${row.inputs.seconds} s`, `${size} · ${row.inputs.seconds} 秒`)); + bar.setAttribute('aria-label', t('{size} · {seconds} s', '{size} · {seconds} 秒', { size, seconds: row.inputs.seconds })); const fraction = row.progress?.overall?.fraction; if (Number.isFinite(fraction)) { const percent = Math.min(100, Math.max(0, fraction * 100)); @@ -2667,8 +2825,8 @@ export function openStudio(node, {extendFrom = null} = {}) { try { await queueController.cancel(row.id); } catch (error) { showQueueError(error); remove.disabled = false; } }, 'fv-quiet'); - remove.setAttribute('aria-label', executing ? t(`Cancel ${size} · ${row.inputs.seconds} s`, `取消 ${size} · ${row.inputs.seconds} 秒`) - : t(`Remove queued video ${index + 1}`, `移除排队的第 ${index + 1} 个`)); + remove.setAttribute('aria-label', executing ? t('Cancel {size} · {seconds} s', '取消 {size} · {seconds} 秒', { size, seconds: row.inputs.seconds }) + : t('Remove queued video {number}', '移除排队的第 {number} 个', { number: index + 1 })); item.append(description); // The buttons move together: on a narrow list they drop below the text, aligned right. const actions = el('div', null, 'fv-queue-buttons'); @@ -2679,7 +2837,7 @@ export function openStudio(node, {extendFrom = null} = {}) { try { await queueController.moveFirst(row.id); showMoved(); } catch (error) { movedId = null; showQueueError(error); first.disabled = remove.disabled = false; } }, 'fv-quiet'); - first.setAttribute('aria-label', t(`Move queued video ${index + 1} to front`, `把排队的第 ${index + 1} 个排到最前`)); + first.setAttribute('aria-label', t('Move queued video {number} to front', '把排队的第 {number} 个排到最前', { number: index + 1 })); actions.append(first); } actions.append(remove); item.append(actions); queueList.append(item); @@ -2742,7 +2900,14 @@ export function openStudio(node, {extendFrom = null} = {}) { const invalid = [...dialog.querySelectorAll('input:not(:disabled)')].find(e => !e.form && !e.classList.contains('fvp-dim') && !e.checkValidity()); if (invalid) { const details = invalid.closest('details'); if (details) details.open = true; - if (invalid.dataset.fvLength === 'block') { lengthControl.reportBlock(); invalid.focus(); invalid.scrollIntoView({block: 'center'}); return; } + // Three columns: a field in the folded Advanced options section opens it (the field must be on screen to say what is wrong). + const folded = invalid.closest('.fv-sc-section[data-open=false]'); if (folded) folded.querySelector('.fv-iv-sec-toggle')?.click(); + if (invalid.dataset.fvLength === 'block') { + lengthControl.reportBlock(); + // The Advanced options tray repaints its rows on events inside it; the tray was already open (three columns keep it so), so it hears of the reason from here. + invalid.closest('.fvs-tray')?.dispatchEvent(new Event('click')); + invalid.focus(); invalid.scrollIntoView({block: 'center'}); return; + } if (invalid.validity.valueMissing) { const message = new Map([[seconds, t('Fill in the duration.', '请填写时长。')], [width, t('Fill in the width.', '请填写宽度。')], [height, t('Fill in the height.', '请填写高度。')], @@ -2769,7 +2934,7 @@ export function openStudio(node, {extendFrom = null} = {}) { invalid.focus(); return; } // One prompt per line with no lines: say what to write (generating without a prompt is not offered here). - if (byLine() && !lineTexts().length) { status.dataset.error = 'true'; status.textContent = t('Write one prompt per line, then add them.', '每行写一条描述后再添加。'); prompt.focus(); return; } + if (byLine() && !lineTexts().length) { status.dataset.error = 'true'; status.textContent = t('Write one prompt per line, then add them.', '每行写一条提示词后再添加。'); prompt.focus(); return; } if (!emptyAllowed && !extension.source && !prompt.disabled && !prompt.value.trim() && !untouched() && !swapState(mediaNode)) { showEmptyPrompt({t, anchor: runrow, field: prompt, onContinue: () => submitDraft({allowEmpty: true})}); return; } @@ -2781,9 +2946,9 @@ export function openStudio(node, {extendFrom = null} = {}) { if (timedNote) { status.dataset.error = 'true'; status.textContent = timedNote; prompt.focus(); return; } const chosenMode = runMode, texts = byLine() ? lineTexts() : null; const batchCount = texts ? texts.length : chosenMode === 'batch' ? Number(count.value) : 1; - if (texts && !texts.length) { status.dataset.error = 'true'; status.textContent = t('Write one prompt per line, then add them.', '每行写一条描述后再添加。'); prompt.focus(); return; } - if (texts && texts.length > 100) { status.dataset.error = 'true'; status.textContent = t(`At most 100 lines at a time; there are ${texts.length}.`, `一次最多 100 行,现在有 ${texts.length} 行。`); prompt.focus(); return; } - if (texts && timedParse(texts.join('\n'))[1].length) { status.dataset.error = 'true'; status.textContent = t('Timed lines cannot be split into separate videos. Turn off One prompt per line.', '带时间的台词不能拆成多个视频,请关闭“每行一条描述”。'); return; } + if (texts && !texts.length) { status.dataset.error = 'true'; status.textContent = t('Write one prompt per line, then add them.', '每行写一条提示词后再添加。'); prompt.focus(); return; } + if (texts && texts.length > 100) { status.dataset.error = 'true'; status.textContent = t('At most 100 lines at a time; there are {count}.', '一次最多 100 行,现在有 {count} 行。', { count: texts.length }); prompt.focus(); return; } + if (texts && timedParse(texts.join('\n'))[1].length) { status.dataset.error = 'true'; status.textContent = t('Timed lines cannot be split into separate videos. Turn off One prompt per line.', '带时间的台词不能拆成多个视频,请关闭“每行一条提示词”。'); return; } const originalSeed = value(node, 'seed'), seedMode = mode.value; // A request that is not accepted leaves the node mode as the user had it; a retry turns it on again. // Once the server has taken a request it stays taken; only a request it never took is undone. @@ -2799,6 +2964,11 @@ export function openStudio(node, {extendFrom = null} = {}) { if (selected === 'input' && !dimensionsLinked) await inputRatio(true); const lengthPlan = await lengthControl.ready(); if (disposed || lengthControl.blocked) return; + // A saved or restored Fast setting on a machine the planner has not offered it to is sampled at Light. + if (fastOn() && !fastOffered()) chooseEffort(effort.levels().find(tier => tier.name === 'Light')); + const short = fastShortfall(); + if (short) { status.dataset.error = 'true'; status.textContent = fastShortfallWords(short); return; } + if (fastUnknown() === 'checking') { status.dataset.error = 'true'; status.textContent = fastUnknownWords('checking'); return; } if (lengthControl.absent && !durationNote.settle()) return; if (originalOn && lengthPlan?.count > 1 && !twoPass.checked) { status.dataset.error = 'true'; status.textContent = partsNeedTwoPassText(t); return; } if (lengthPlan?.count > 1 && chosenMode !== 'single') { status.textContent = t('Videos made in parts cannot use batch or loop.', '分段视频不能批量或循环生成。'); return; } @@ -2830,6 +3000,8 @@ export function openStudio(node, {extendFrom = null} = {}) { snapshot = singleRunSnapshot(extendSnapshot(graph, node.id, source, {multiple: lengthPlan?.count > 1}), node.id, lengthPlan); if (!snapshot) { fault(t('Could not prepare this run. Try again.', '没能准备这次生成,请重试。')); return; } + // The Fast level makes one whole video: the parts of a longer one are sampled at Light. + if (fastOn() && lengthPlan?.count > 1) Object.assign(snapshot.output[node.id].inputs, {fast_mode: 'none', two_pass: true, preview: false}); const seedIndex = node.widgets.findIndex(w => w.name === 'seed'); capturing = false; for (const section of controls.querySelectorAll('.fv-section')) section.inert = false; @@ -2857,7 +3029,7 @@ export function openStudio(node, {extendFrom = null} = {}) { if (accepted) held?.done(); else held?.restore(); // A prompt that was generated goes to the top of the history, with the size, length and level it used. if (accepted && prompt.value.trim()) rememberPrompt({text: prompt.value, w: Number(value(node, 'width')), h: Number(value(node, 'height')), - seconds: Number(seconds.value), level: effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow())?.name || null}); + seconds: Number(seconds.value), level: fastOn() ? FAST_EFFORT.name : effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow())?.name || null}); capturing = false; for (const section of controls.querySelectorAll('.fv-section')) section.inert = false; updateRunButton(); @@ -2874,7 +3046,7 @@ export function openStudio(node, {extendFrom = null} = {}) { const length = lengthControl.plan?.count > 1 ? lengthControl.plan.seconds : Number.isFinite(frames) ? frames / 24 : null; const whole = Math.round(length), minutes = Math.floor(whole / 60), rest = whole % 60; duration.textContent = length === null ? '—' : `${length <= 60 ? `${lengthControl.plan?.count > 1 ? length : length.toFixed(3)} s` - : rest ? t(`${minutes} min ${rest} s`, `${minutes} 分 ${rest} 秒`) : t(`${minutes} min`, `${minutes} 分钟`)} · 24 fps`; + : rest ? t('{minutes} min {seconds} s', '{minutes} 分 {seconds} 秒', { minutes, seconds: rest }) : t('{minutes} min', '{minutes} 分钟', { minutes })} · 24 fps`; } function updateCanvas() { syncResolutionLabel(); @@ -2892,7 +3064,7 @@ export function openStudio(node, {extendFrom = null} = {}) { // An empty frame takes the chosen shape; a work on the stage keeps its own (the outline shows the new one). if (!busy && (nextShown || !stageMedia.querySelector('video, img'))) { previewSize(Number(w), Number(h)); if (nextShown) nextSize.textContent = `${w} × ${h}`; } framePicker?.set({shape: selected, ratio: studioShapes(t).find(([id]) => id === selected)?.[2] || Number(w) / Number(h) || ratio, pixels: Number(mp.value), width: Number(w), height: Number(h), locked: shapeKept, empty: emptySide, - unavailable: {input: mediaPicture() ? '' : t('Add a picture in Media first', '先在素材里添加图片')}, + unavailable: {input: mediaPicture() ? '' : t('Add an image in Media first', '先在素材里添加图片')}, disabled: dimensionsLinked || Boolean(extension.source)}); refreshEffortEstimate(); consoleUI?.sync(); @@ -3028,7 +3200,7 @@ export function openStudio(node, {extendFrom = null} = {}) { if (lengthControl.commit()) updateCanvas(); } } - const mediaChanged = async e => { if (String(e.detail) !== String(mediaNode?.id)) return; syncOriginalAudio(); refreshEffortEstimate(true); framePicker?.set({unavailable: {input: mediaPicture() ? '' : t('Add a picture in Media first', '先在素材里添加图片')}}); if (selected !== 'input') return; try { await inputRatio(); } catch (error) { status.textContent = error.message; } }; + const mediaChanged = async e => { if (String(e.detail) !== String(mediaNode?.id)) return; syncOriginalAudio(); refreshEffortEstimate(true); framePicker?.set({unavailable: {input: mediaPicture() ? '' : t('Add an image in Media first', '先在素材里添加图片')}}); if (selected !== 'input') return; try { await inputRatio(); } catch (error) { status.textContent = error.message; } }; const lorasChanged = e => { if (String(e.detail) === String(loraNode?.id)) refreshEffortEstimate(true); }; window.addEventListener('freevideo-loras', lorasChanged); cleanup.push(() => window.removeEventListener('freevideo-loras', lorasChanged)); @@ -3100,15 +3272,21 @@ export function openStudio(node, {extendFrom = null} = {}) { cleanup.push(listenDialogKey(dialog, 'keydown', escape)); cleanup.push(isolateDialogKeys(dialog, event => routeDialogKey(event, dialog))); - // Escape first closes the recent videos panel of a narrower window, then the studio. + // Escape first closes a drawer of a narrower window (the settings or the works), then the studio. + const closeWorksDrawer = () => { + const panels = body.studioPanels; + if (panels.drawer()) { panels.closeDrawer(); return true; } + if (panels.below()) { panels.setPanel('right', false); return true; } + return false; + }; // An open result menu (More, delete) closes first, wherever the focus is, and gives it back to the menu's button. const closeMenu = () => { const open = [...dialog.querySelectorAll('details.fv-action-menu[open]')].pop(); if (!open) return false; open.open = false; open.querySelector(':scope>summary')?.focus({preventScroll: true}); return true; }; - dialog.addEventListener('cancel', e => { e.preventDefault(); if (!closeMenu() && !compare.close() && !promptLibrary?.hide() && !consoleUI?.dismiss() && !recent.dismiss()) closeDialog(dialog); }); - const dispose = () => { if (disposed) return; disposed = true; borrowed?.release({disposing: true}); blockOriginal('extend', false); blockOriginal('preview', false); for (const f of cleanup) f(); stage.querySelector('video')?.pause(); dialog.remove(); if (current?.dialog === dialog) { current = null; viewChanged('nodes', node); } }; + dialog.addEventListener('cancel', e => { e.preventDefault(); if (!closeMenu() && !compare.close() && !promptLibrary?.hide() && !consoleUI?.dismiss() && !closeWorksDrawer()) closeDialog(dialog); }); + const dispose = () => { if (disposed) return; disposed = true; borrowed?.release({disposing: true}); blockOriginal('extend', false); blockOriginal('preview', false); blockOriginal('fast', false); for (const f of cleanup) f(); stage.querySelector('video')?.pause(); dialog.remove(); if (current?.dialog === dialog) { current = null; viewChanged('nodes', node); } }; const onClose = () => { // The browser's own close event of a switch comes with the next frame; if the panel was opened again before it // (back from the node view at once), that late event is not a close and must not take the panel away. @@ -3125,6 +3303,7 @@ export function openStudio(node, {extendFrom = null} = {}) { let popHolder = null; current.borrow = ({mount, submit, label = null, previews = null, disabled = null, onSeconds = null, onFirstFrame = null, initial = {}, locked = []}) => { if (borrowed || disposed) return null; + columns?.restore(); // the editor shows the console bar, not the column const outer = mount.closest('dialog') || document.body; const home = {parent: controls.parentNode, next: controls.nextSibling}; // The pop-ups travel inside one display:contents holder, so a switch moves one node instead of every pop-up. @@ -3151,16 +3330,19 @@ export function openStudio(node, {extendFrom = null} = {}) { release({disposing = false} = {}) { if (!borrowed) return; borrowed = null; shadow = null; + placeReverse(); unlock(); updateFirstFrame(); shell.remove(); if (!disposing) { if (home.next?.parentNode === home.parent) home.parent.insertBefore(controls, home.next); else home.parent.append(controls); dialog.append(popHolder); + columns?.apply(); } updateRunButton(); }}; shadow = new Map(); borrowed = {submit, label: () => (state.labelFn ?? label)?.(), previews, disabled, onSeconds, onFirstFrame, firstFrame: null, applying: false, release: state.release}; + placeReverse(); const unlock = () => { for (const control of lockedNow.splice(0)) { control.disabled = false; delete control.dataset.fvLocked; } for (const element of [framePicker?.element, stepper?.element]) delete element?.dataset.fvLocked; @@ -3188,7 +3370,7 @@ export function openStudio(node, {extendFrom = null} = {}) { capabilityView = createCapabilityView({node, api, t, getState: () => ({ratio, custom: selected === 'custom', steps: Number(baseSteps.value), twoPass: twoPass.checked, refine: Number(refineSteps.value), stepCache: stepCacheNow(), upscale: upscaleNow(), disabled: Boolean(extension.source) || dimensionsLinked || seconds.disabled}), - onEstimate: () => showEffortEstimate(), onGrid: grid => effort.setLevels(effortsFrom(grid)), onPick: point => { + onEstimate: () => showEffortEstimate(), onGrid: applyFastOffer, onPick: point => { pixels = point.pixels; mp.value = String(pixels); set(node, 'width', point.width); set(node, 'height', point.height); node.properties.freevideo_pixels = pixels; @@ -3199,7 +3381,7 @@ export function openStudio(node, {extendFrom = null} = {}) { function syncExtension() { releaseExtendThumbnail(); extendMount.replaceChildren(); const source = extension.source; - extendMount.hidden = !source; mediaMount.classList.toggle('fv-extend-active', Boolean(source)); blockOriginal('extend', Boolean(source), {text: ['"Use as is" is not available while continuing a video. Remove "Continues this video" first.', '接在视频之后时不能“原样使用”,请先移除“接在这条视频后面”。']}); + extendMount.hidden = !source; mediaMount.classList.toggle('fv-extend-active', Boolean(source)); blockOriginal('extend', Boolean(source), {text: ['"Use as is" is not available while extending a video. Remove "Extends this video" first.', '接在视频之后时不能“原样使用”,请先移除“接在这条视频后面”。']}); if (source) runMode = 'single'; canvasLock.hidden = !source; mp.disabled = width.disabled = height.disabled = Boolean(source) || dimensionsLinked; @@ -3271,8 +3453,8 @@ export function openStudio(node, {extendFrom = null} = {}) { function guideItem() { const item = el('a', null, 'fv-action fv-action-secondary fvs-phone-only'); item.href = promptHelp.href; item.target = '_blank'; item.rel = 'noopener noreferrer'; - item.append(el('span', t('How to write a prompt', '描述写法'))); - item.dataset.fvTipName = t('How to write a prompt', '描述写法'); item.dataset.fvTipUse = t('Open the guide to writing a good prompt', '打开描述写法指南,写得更准'); + item.append(el('span', t('How to write a prompt', '提示词写法'))); + item.dataset.fvTipName = t('How to write a prompt', '提示词写法'); item.dataset.fvTipUse = t('Open the guide to writing a good prompt', '打开提示词写法指南,写得更准'); return item; } // A press or focus anywhere outside the open tray (the description, another control, the picture, empty space) puts @@ -3281,6 +3463,9 @@ export function openStudio(node, {extendFrom = null} = {}) { const keepsTray = target => { const open = consoleUI?.open(); if (!open || !target?.closest) return true; if (target.closest('.fvs-tray[open]') || target.closest('.fvs-chip[aria-controls]')) return true; + // Three columns: the Media tray stands inside the Prompt section (not floating over the console), so a press or focus elsewhere + // does not fold it; its chip, Generate and Esc do (a continuation keeps its source in it). + if (body.dataset.cols === '3' && dialog.querySelector('.fv-sc-section .fvs-tray[open]:not([data-pinned])')) return true; if (target.closest('[popover], [role=listbox], [role=menu], .fv-select-menu, .fv-tip, .fv-ed-expand-dialog')) return true; return target.closest('dialog') !== dialog; }; @@ -3305,13 +3490,13 @@ export function openStudio(node, {extendFrom = null} = {}) { seconds.addEventListener('change', () => { const n = Number(seconds.value), most = longest(), least = 2; if (seconds.value === '' || !Number.isFinite(n) || seconds.disabled) return; - if (most > 0 && n > most) { seconds.value = String(most); durationNote.say(t(`At most ${most} s`, `最长 ${most} 秒`)); } - else if (n < least) { seconds.value = String(least); durationNote.say(t(`At least ${least} s`, `最短 ${least} 秒`)); } + if (most > 0 && n > most) { seconds.value = String(most); durationNote.say(t('At most {most} s', '最长 {most} 秒', { most })); } + else if (n < least) { seconds.value = String(least); durationNote.say(t('At least {least} s', '最短 {least} 秒', { least })); } }, true); const stepValue = stepper.element.querySelector('.fvs-step-value'); const paintDuration = () => { const plan = lengthControl?.plan, parts = plan?.count > 1 ? plan.count : 0; - stepValue.dataset.fvTipUse = parts ? t(`Made in ${parts} parts and joined`, `分 ${parts} 段生成并拼接`) : t('Click to type an exact length', '点一下输入精确时长'); + stepValue.dataset.fvTipUse = parts ? t('Made in {parts} parts and joined', '分 {parts} 段生成并拼接', { parts }) : t('Click to type an exact length', '点一下输入精确时长'); stepper.sync(); }; seconds.addEventListener('input', paintDuration); seconds.addEventListener('change', paintDuration); @@ -3319,11 +3504,11 @@ export function openStudio(node, {extendFrom = null} = {}) { // track with the knob inside, as before), one line under it on what the level gives (no times), and the two-pass // choice. const qualityChip = createPopChip({host: dialog, kind: 'quality', onOpen: () => paintQuality(), name: t('Quality', '质量'), icon: 'M8 2l1.6 3.6L13.5 6l-2.9 2.7.8 3.9L8 10.7 4.6 12.6l.8-3.9L2.5 6l3.9-.4Z'}); - const LEVEL_WORDS = {Light: ['Fastest, for trying ideas', '最快,适合试效果'], Medium: ['For everyday use', '日常使用'], High: ['More detail, slower', '细节更多,较慢'], Max: ['The most detail, slowest', '细节最多,最慢']}; + const LEVEL_WORDS = {Fast: FAST_OPTION_TEXT, Light: ['Fastest, for trying ideas', '最快,适合试效果'], Medium: ['For everyday use', '日常使用'], High: ['More detail, slower', '细节更多,较慢'], Max: ['The most detail, slowest', '细节最多,最慢']}; const levelUse = el('p', '', 'fvp-level-use'); levelUse.setAttribute('aria-live', 'polite'); - effort.element.after(levelUse); qualityChip.body.append(samplingSettings); - const qualityLevel = () => effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow()); - const sayLevel = tier => { const said = tier ? t(...(LEVEL_WORDS[tier.name] || ['', ''])) : t('Custom steps', '自定义步数'); if (levelUse.textContent !== said) levelUse.textContent = said; }; + effort.element.after(levelUse, fastPack.element); qualityChip.body.append(samplingSettings); + const qualityLevel = () => fastOn() ? effort.levels().find(tier => tier.fast) || FAST_EFFORT : effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow()); + const sayLevel = tier => { const said = tier?.fast && fastParts() ? '' : tier?.fast && fastPack.needs() ? fastPack.needs() : tier?.name === 'Light' && effort.levels().some(level => level.fast) ? t('Quick, for trying ideas', '速度较快,适合试效果') : tier ? t(...(LEVEL_WORDS[tier.name] || ['', ''])) : t('Custom steps', '自定义步数'); if (levelUse.textContent !== said) levelUse.textContent = said; }; effortPointed = tier => sayLevel(tier || qualityLevel()); const paintQuality = () => { const level = qualityLevel(); @@ -3354,7 +3539,7 @@ export function openStudio(node, {extendFrom = null} = {}) { chips: [ {id: 'media', tray: 'media', icon: 'media', read: () => { const n = mediaCount(); - return {label: t('Media', '素材'), badge: n || null, tip: [t('Media', '素材'), t('Add reference pictures, video and sound', '加参考图、视频和声音')]}; + return {label: t('Media', '素材'), badge: n || null, tip: [t('Media', '素材'), t('Add reference images, video and sound', '加参考图、视频和声音')]}; }}, {element: mention}, {element: framePicker.element}, @@ -3373,6 +3558,15 @@ export function openStudio(node, {extendFrom = null} = {}) { // An open tray: the play bar and the bar under the picture step back (CSS); they show again when it closes. void open; }}); + // The console replaced the controls' children: the fold button and the rail (how a folded settings column opens again) go back in. + if (body.dataset.cols === '3') controls.prepend(body.foldLeft), controls.append(body.settingsRail); + if (body.dataset.cols === '3') { + const part = id => consoleUI.chip(id); + columns = layoutColumns({t, controls, consoleUI, fold: body.foldLeft, rail: body.settingsRail, parts: {media: part('media'), mention, enhance: enhancer.chip, size: framePicker.element, + duration: stepper.element, quality: effort.element, pass: passMode, runbar, + // The level's line and the Fast level's download row stand under the levels, as in the Quality window (the column has no such window). + qualityMore: [levelUse, fastPack.element]}}); + } // The two panels repaint whenever the console's row does. { const sync = consoleUI.sync; consoleUI.sync = () => { sync(); paintDuration(); paintQuality(); }; } paintDuration(); paintQuality(); @@ -3411,20 +3605,41 @@ export function openStudio(node, {extendFrom = null} = {}) { for (const tray of consoleUI.trays.querySelectorAll('.fvs-tray')) trayWatch?.observe(tray); cleanup.push(() => trayWatch?.disconnect()); // The one-line slot sits at the top of the dock, above an open tray and the console, in room kept for it. - controls.prepend(consoleUI.slot); + // (In three columns the settings column keeps it in its foot, under Generate, whether or not the editor has borrowed the bar.) + if (body.dataset.cols !== '3') controls.prepend(consoleUI.slot); // The run's status line: in that notes line on wider windows (one band between the picture's bar and the console), // on its own row under the bar on phones. const placeStatus = () => { - if (!phone?.matches) { if (status.parentElement !== consoleUI.slot) consoleUI.slot.append(status); } + // (Three columns: the settings column's foot at every width, so a reason says itself beside the field it is about, also on a phone.) + if (!phone?.matches || body.dataset.cols === '3') { if (status.parentElement !== consoleUI.slot) consoleUI.slot.append(status); } else if (status.parentElement !== output) reuseRow.before(status); fitPreview(); }; placeStatus(); phone?.addEventListener?.('change', placeStatus); cleanup.push(() => phone?.removeEventListener?.('change', placeStatus)); + // A tray or a small window opened over the band (their glass lets 6% through) would show its line as a faint second + // copy under the window: while one covers a shown note, the line goes clear (still read out: glass/studio.css). + let coverFrame = 0; + const coverBand = () => { + coverFrame = 0; + const notes = [...consoleUI.slot.children].filter(item => !item.hidden && item.textContent.trim()).map(item => item.getBoundingClientRect()).filter(r => r.width && r.height); + // Only what floats is a window: in three columns a tray is a part of the column, and one scrolled out of sight still has its place. + const windows = [...dialog.querySelectorAll('.fvs-tray[open], .fvp-pop:not([hidden])')].filter(item => /^(fixed|absolute)$/.test(getComputedStyle(item).position)) + .map(item => item.getBoundingClientRect()).filter(r => r.width && r.height); + const covered = notes.some(n => windows.some(w => w.left < n.right && w.right > n.left && w.top < n.bottom && w.bottom > n.top)); + if (controls.dataset.statusCovered !== String(covered)) controls.dataset.statusCovered = String(covered); + }; + const queueCover = () => { if (!coverFrame) coverFrame = requestAnimationFrame(() => { coverFrame = requestAnimationFrame(coverBand); }); }; + const coverWatch = new MutationObserver(queueCover); + coverWatch.observe(dialog, {subtree: true, attributes: true, attributeFilter: ['open', 'hidden', 'data-open', 'data-closing']}); + // A tray rises 8 px into place as it opens: look again once it has settled. + globalThis.addEventListener('resize', queueCover); dialog.addEventListener('animationend', queueCover); + cleanup.push(() => { coverWatch.disconnect(); globalThis.removeEventListener('resize', queueCover); cancelAnimationFrame(coverFrame); }); // The band above the console is kept only while its line has something to say (glass/studio.css), so an empty band // never sits between the picture and the console. const syncBand = () => { const said = [...consoleUI.slot.children].some(item => !item.hidden && item.textContent.trim() && getComputedStyle(item).display !== 'none'); if (controls.dataset.status !== String(said)) controls.dataset.status = String(said); + queueCover(); }; const bandWatch = new MutationObserver(syncBand); bandWatch.observe(consoleUI.slot, {childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['hidden', 'data-state']}); @@ -3434,6 +3649,7 @@ export function openStudio(node, {extendFrom = null} = {}) { const bandSize = typeof ResizeObserver === 'function' ? new ResizeObserver(() => { const height = `${Math.ceil(consoleUI.slot.getBoundingClientRect().height)}px`; if (controls.style.getPropertyValue('--fvs-band') !== height) controls.style.setProperty('--fvs-band', height); + queueCover(); }) : null; bandSize?.observe(consoleUI.slot); cleanup.push(() => bandSize?.disconnect()); // Receipts (filled in, preset applied or saved) go to the shared toast in the top bar's right column (a bottom strip @@ -3462,17 +3678,18 @@ export function openStudio(node, {extendFrom = null} = {}) { reuse.receipt = (text, undo) => toast.actions === true && notify(text, undo); cleanup.push(() => clearTimeout(noticeTimer)); // Prompt history, templates and presets (F4): history is written when a request is accepted, below in submitDraft. - const levelNow = () => effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow()); + const levelNow = () => fastOn() ? FAST_EFFORT : effortFor(Number(baseSteps.value), twoPass.checked, Number(refineSteps.value), stepCacheNow(), effort.levels(), upscaleNow()); const enhanceSwitch = () => enhancer.element.querySelector('.fv-enhance-toggle input'); const describeSettings = item => { const level = item.level && SAMPLING_LEVELS().find(tier => tier.name === item.level); const shape = item.aspect && studioShapes(t).find(([id]) => id === item.aspect)?.[1]; const size = item.w && item.h ? `${item.w} × ${item.h}` : item.pixels ? `${Number(item.pixels).toFixed(2)} MP` : ''; - return [shape, size, Number(item.seconds) > 0 ? t(`${item.seconds} s`, `${item.seconds} 秒`) : '', level ? effortName(t, level) : '', - typeof item.prompt === 'string' ? t('with prompt', '含描述') : ''].filter(Boolean).join(' · '); + return [shape, size, Number(item.seconds) > 0 ? t('{seconds} s', '{seconds} 秒', { seconds: item.seconds }) : '', level ? effortName(t, level) : '', + typeof item.prompt === 'string' ? t('with prompt', '含提示词') : ''].filter(Boolean).join(' · '); }; const SAMPLING_LEVELS = () => effort.levels(); - promptLibrary = createPromptLibrary({t, host: consoleUI.element, notify, describe: describeSettings, guide: promptHelp.href, + // The panel stands over the console; in three columns the console is not on the page, so it stands in the body (a card beside the settings column), and in the editor's borrowed bar in the bar's own console. + promptLibrary = createPromptLibrary({t, host: () => (borrowed || body.dataset.cols !== '3' ? consoleUI.element : body), notify, describe: describeSettings, guide: promptHelp.href, fill: text => { if (prompt.disabled) return null; const before = value(node, 'text'); @@ -3503,8 +3720,14 @@ export function openStudio(node, {extendFrom = null} = {}) { if (!baseSteps.disabled) { holdPreview(false); const tier = settings.level && effort.levels().find(level => level.name === settings.level); - if (tier) chooseEffort(tier); + // A Fast preset where this machine does not list it, or before its files are here, is sampled at Light; + // with the level listed, its download is offered. + if (settings.level === FAST_EFFORT.name && (!tier || !fastPack.present)) { + chooseEffort(effort.levels().find(level => level.name === 'Light')); + if (tier) fastPack.ask(); + } else if (tier) chooseEffort(tier); else if (settings.steps) { + fastLeft(); baseSteps.value = String(settings.steps.base); refineSteps.value = String(settings.steps.refine); twoPass.checked = Boolean(settings.steps.twoPass); set(node, 'two_pass', twoPass.checked); set(node, 'step_cache', settings.steps.stepCache || 'none'); setUpscale(settings.steps.upscale || 2); syncSamplingSteps(); @@ -3517,7 +3740,7 @@ export function openStudio(node, {extendFrom = null} = {}) { try { const reply = await api.fetchApi('/models/loras', {cache: 'no-store'}); names = reply.ok ? await reply.json() : []; } catch {} const rows = settings.loras.filter(row => names.includes(row.name)), missing = settings.loras.filter(row => !names.includes(row.name)).map(row => row.name); if (set(loraNode, 'adapters', JSON.stringify(rows))) window.dispatchEvent(new CustomEvent('freevideo-loras', {detail: loraNode.id})); - if (missing.length) problems.push(t(`LoRA not found: ${missing.join(', ')}`, `找不到 LoRA:${missing.join('、')}`)); + if (missing.length) problems.push(t('LoRA not found: {names}', '找不到 LoRA:{names}', { names: missing.join(t(', ', '、')) })); } const toggle = enhanceSwitch(); if (typeof settings.enhance === 'boolean' && toggle && !toggle.disabled && toggle.checked !== settings.enhance) toggle.click(); @@ -3541,9 +3764,9 @@ export function openStudio(node, {extendFrom = null} = {}) { const on = enhancer.reversing, why = reverseQueueWhy(); reverseKey.dataset.state = on ? 'running' : ''; reverseKey.setAttribute('aria-disabled', String(!on && !!why)); - reverseKey.setAttribute('aria-label', on ? t('Stop', '停止') : t('Prompt from a picture or video', '从图片或视频生成提示词')); - reverseKey.dataset.fvTipName = on ? t('Stop', '停止') : t('Prompt from a picture or video', '从图片或视频生成提示词'); - if (on) delete reverseKey.dataset.fvTipUse; else reverseKey.dataset.fvTipUse = t('Pick a picture or video; its description fills the box', '选一张图片或一段视频,生成的描述填入描述框'); + reverseKey.setAttribute('aria-label', on ? t('Stop', '停止') : t('Prompt from an image or video', '从图片或视频生成提示词')); + reverseKey.dataset.fvTipName = on ? t('Stop', '停止') : t('Prompt from an image or video', '从图片或视频生成提示词'); + if (on) delete reverseKey.dataset.fvTipUse; else reverseKey.dataset.fvTipUse = t('Pick an image or video; its prompt fills the box', '选一张图片或一段视频,生成的提示词填入提示词框'); if (!on && why) reverseKey.dataset.fvTipWhy = why; else delete reverseKey.dataset.fvTipWhy; reverseKey.title = [reverseKey.dataset.fvTipName, reverseKey.dataset.fvTipUse].filter(Boolean).join(' · '); const html = on ? stopIcon : reverseIcon; if (reverseKey.dataset.icon !== String(on)) { reverseKey.innerHTML = html; reverseKey.dataset.icon = String(on); } @@ -3589,8 +3812,10 @@ export function openStudio(node, {extendFrom = null} = {}) { // At phone width the prompt tools stand in a column beside the box, and a third key would make the console taller than it // is without reverse: there the key sits in the options row, right of Enhance, as an icon (same key, same words). const reversePhone = window.matchMedia?.('(max-width:760px)'); - const placeReverse = () => { - const inRow = Boolean(reversePhone?.matches); + placeReverse = () => { + // (The three-column panel has no tools column beside the box: the key stays in the Prompt section's head at every width. + // The editor's lent bar is the console again, with the tools column: at phone width the key is in the options row there too.) + const inRow = Boolean(reversePhone?.matches) && (body.dataset.cols !== '3' || Boolean(borrowed)); // In the row it is one of the round keys (like LoRA and Settings); in the tools column it is a library-style key. reverseKey.classList.toggle('fvs-chip', inRow); reverseKey.classList.toggle('fvs-library-button', !inRow); if (inRow) enhancer.chip.after(reverseKey); else promptTools.prepend(reverseKey); @@ -3600,7 +3825,7 @@ export function openStudio(node, {extendFrom = null} = {}) { consoleUI.trays.querySelector('[data-tray=size] .fvs-tray-title')?.append(canvasLock); consoleUI.element.classList.add('sgf-avoid'); mention.dataset.fvTipName = t('Mention', '引用'); - mention.dataset.fvTipUse = t('Bring a picture or character into the prompt', '在描述里引用素材或角色'); mention.dataset.fvTipKey = '@'; + mention.dataset.fvTipUse = t('Bring an image or character into the prompt', '在提示词里引用素材或角色'); mention.dataset.fvTipKey = '@'; // The Generate button's hover words follow its label (updateRunButton). updateRunButton(); // The chips repeat what the trays hold: read them again whenever a setting or its estimate changes. @@ -3640,7 +3865,7 @@ export function openStudio(node, {extendFrom = null} = {}) { cleanup.push(registerTourWorkspace(tourContext)); const tourTimer = setTimeout(async () => { const state = await firstStart.ready; if (!closed && !state?.firstRun && !tourContext.isBusy()) offerVersionTour(tourContext); }, 1400); cleanup.push(() => clearTimeout(tourTimer)); - const recentLoad = recent.refresh(); + const recentLoad = worksColumn.refresh(); if (node.freevideoProgress && !node.freevideoProgress.chain) { showProgress(node.freevideoProgress); markReady(); } else if (result) showResult(result); // Do not change any saved width/height simply by opening a workflow. diff --git a/web/studio_columns.js b/web/studio_columns.js new file mode 100644 index 00000000..b7ebed16 --- /dev/null +++ b/web/studio_columns.js @@ -0,0 +1,118 @@ +// The creation panel's settings column (three-column layout): the controls the bottom console kept behind chips and trays +// stand here as sections, top to bottom, in the order of the picture view's left column. Nothing is rebuilt: the same +// elements move, so every handler and the saved values stay where they were. +import { button as railButton, section as ivSection } from './image_view_ui.js'; +const el = (cls, tag = 'div') => { const e = document.createElement(tag); e.className = cls; return e; }; + +export function layoutColumns({t, controls, consoleUI, parts, fold, rail}) { + // Everything the column moves is remembered by its old parents' child lists, so restore() puts the console back as it was + // (the editor borrows the console bar as it is) and apply() lays the column out again. + const promptTools = consoleUI.element.querySelector('.fv-prompt-tools'); + const expand = promptTools?.querySelector('.fv-ed-expand'); // the prompt history key is added to promptTools after this runs, so the whole holder moves + const movers = [promptTools, expand, parts.media, parts.mention, parts.enhance, parts.size, parts.duration, parts.quality, ...(parts.qualityMore || []), parts.pass, parts.runbar, consoleUI.slot, consoleUI.element.querySelector('.fvs-console-prompt'), + ...consoleUI.trays.querySelectorAll('[data-tray]')].filter(Boolean); + const parents = [...new Set([controls, ...movers.map(node => node.parentNode).filter(Boolean)])]; + const before = parents.map(parent => [parent, [...parent.childNodes]]); + let built = null; + const apply = () => { rail.querySelectorAll('.fv-sc-rail-icon').forEach(node => node.remove()); built = build(); }; + // The Enhance chip's own bar (switch, versions) follows the chip wherever it stands; studio.js sets it next to the chip. + const barOf = () => { const next = parts.enhance?.nextElementSibling; return next?.classList.contains('fv-enhance-bar') ? next : null; }; + const dressed = []; + const dress = (node, ...names) => { if (!node) return; node.classList.add(...names); dressed.push([node, names]); }; + const restore = () => { + const bar = barOf(); + for (const [node, names] of dressed.splice(0)) node.classList.remove(...names); + controls.querySelector('.fv-sc-tools')?.watch?.disconnect(); + for (const tray of controls.querySelectorAll('[data-pinned]')) { delete tray.dataset.pinned; tray.open = false; } /* the console starts with its trays put away */ + // Nodes that joined a parent after the snapshot was taken (the prompt history key, the reverse-prompt key) are no part of + // what the column built, so they stay where they stand: put back after their old neighbour, or first when they led. + const remembered = new Set(before.flatMap(([, nodes]) => nodes)), mine = new Set([built?.head, built?.scroll, built?.foot, fold, rail]); + const late = before.map(([parent]) => [parent, [...parent.childNodes].filter(node => !remembered.has(node) && !mine.has(node) && node !== consoleUI.slot)]); + const neighbours = new Map(late.flatMap(([parent, nodes]) => nodes.map(node => [node, node.previousSibling]))); + for (const [parent, nodes] of before) parent.replaceChildren(...nodes); + for (const [parent, nodes] of late) for (const node of nodes) { + const after = neighbours.get(node); + if (after && after.parentNode === parent) after.after(node); else parent.prepend(node); + } + // The status line stands first in the dock, as it does before the column is built (studio.js). + controls.prepend(consoleUI.slot); + fold.remove(); rail.remove(); delete controls.dataset.columns; controls.classList.remove('fv-sc-col'); + parts.mention?.querySelector('.fv-sc-mention-name')?.remove(); parts.mention?.classList.remove('fv-sc-mention'); + if (bar) parts.enhance.after(bar); + }; + compactHook(controls); + apply(); + return {apply, restore, get parts() { return built; }}; + function build() { + const box = consoleUI.element, scroll = el('div fv-sc-scroll fv-sc-col'), foot = el('div fv-sc-foot'); + // The sections are the picture view's own (image_view_ui.js section): an icon and a small grey title, a rule between them; + // the advanced one folds, closed until opened, and the choice is kept under the studio's own key. + const section = (name, label, iconName, content, options = {}) => { + const made = ivSection(name, {title: label, iconName, store: 'freevideo.studio.sections', ...options}); + made.element.classList.add('fv-sc-section'); made.body.append(...content.filter(Boolean)); return made; + }; + const head = el('div fv-sc-head'), headTitle = el('strong fv-sc-head-title', 'strong'); headTitle.textContent = t('Create', '生成'); + head.append(headTitle, fold); + const prompt = box.querySelector('.fvs-console-prompt'); + const tools = el('div fv-sc-tools fv-iv-prompt-bar'); + if (parts.mention && !parts.mention.querySelector('.fv-sc-mention-name')) { // the @ stands with its name, so it reads as the character picker + const name = el('span fv-sc-mention-name', 'span'); name.textContent = t('Character', '角色'); + name.classList.add('fv-iv-btn-label'); parts.mention.append(name); parts.mention.classList.add('fv-sc-mention'); + } + // The keys of the row wear the picture view's text-key class, so one rule set draws both rows. + for (const key of [parts.media, parts.mention, parts.enhance]) dress(key, 'fv-iv-text-btn'); + dress(parts.media?.querySelector('.fvs-chip-label'), 'fv-iv-btn-label'); dress(parts.enhance?.querySelector(':scope>span'), 'fv-iv-btn-label'); + const bar = barOf(); + tools.append(...[parts.media, parts.mention, parts.enhance].filter(Boolean), el('fv-iv-grow', 'span')); + // Prompt history, the writing guide and the draft note stand at the head of the section, as the picture view puts its add key; Expand ends the row. + if (expand) tools.append(expand); + // The row stays on one line: when its words do not fit, its keys keep their icons only (their hover cards still name them). + // The enhance bar (versions, cancel) wraps under the keys; only the keys and Expand are measured. + const fitTools = () => { + if (!tools.isConnected) return; delete tools.dataset.compact; + const keys = [...tools.children].filter(node => !node.classList.contains('fv-enhance-bar') && !node.classList.contains('fv-iv-grow')); + if (keys.reduce((sum, node) => sum + node.getBoundingClientRect().width, 0) + (parseFloat(getComputedStyle(tools).columnGap) || 0) * (keys.length - 1) > tools.clientWidth + 1) tools.dataset.compact = 'true'; + }; + tools.watch = typeof ResizeObserver === 'function' ? new ResizeObserver(fitTools) : null; tools.watch?.observe(tools); document.fonts?.ready?.then(fitTools).catch?.(() => {}); + const mediaTray = consoleUI.trays.querySelector('[data-tray=media]'); + const trays = ['lora', 'advanced'].map(id => consoleUI.trays.querySelector(`[data-tray=${id}]`)); + trays.forEach(tray => { // these two stay open in the column; the console's click-away closing leaves them be + if (!tray) return; + tray.open = true; tray.dataset.pinned = 'true'; + }); + const advanced = section('advanced', t('Advanced options', '高级选项'), 'sliders', trays, {fixed: false, open: false}); + // Opened at the foot of the column, the new rows would stand below the fold: bring the section's head to the top once it has grown. + advanced.element.addEventListener('fv-iv-section', () => { if (advanced.isOpen()) setTimeout(() => advanced.element.scrollIntoView?.({block: 'start', behavior: 'smooth'}), 230); }); + scroll.append( + section('prompt', t('Prompt', '描述'), 'prompt', [prompt, tools, bar, mediaTray], {fixed: true, actions: [promptTools].filter(Boolean)}).element, + section('size', t('Frame & size', '画幅与尺寸'), 'size', [parts.size], {fixed: true}).element, + section('duration', t('Duration', '时长'), 'clock', [parts.duration], {fixed: true}).element, + section('quality', t('Quality', '质量'), 'gen', [parts.quality, ...(parts.qualityMore || [])], {fixed: true}).element, + section('pass', t('Second pass', '二采'), 'split', [parts.pass], {fixed: true}).element, + advanced.element); + // On the narrow rail every section has its own icon, in the column's order; it opens the drawer at that section. + const railIcons = [['prompt', 'prompt', t('Prompt', '描述')], ['size', 'size', t('Frame & size', '画幅与尺寸')], ['duration', 'clock', t('Duration', '时长')], + ['quality', 'gen', t('Quality', '质量')], ['pass', 'split', t('Second pass', '二采')], ['advanced', 'sliders', t('Advanced options', '高级选项')]]; + for (const [name, iconName, label] of railIcons) { + rail.append(railButton('fv-iv-icon-btn fv-sc-rail-icon', {iconName, name: label, onClick: () => { + const body = controls.closest('.fv-body'); body?.studioPanels?.setPanel('left', true); + const target = scroll.querySelector(`[data-section=${name}]`); + if (name === 'advanced') advanced.open(true); + requestAnimationFrame(() => target.scrollIntoView({block: 'start'})); + }})); + } + foot.append(consoleUI.slot, parts.runbar); // the status line (notes, what will download first) stands above Generate + controls.replaceChildren(head, scroll, foot, rail); + controls.dataset.columns = 'true'; + controls.classList.add('fv-sc-col'); // the narrow rail's keys are the picture view's icon keys: its rules reach the whole column, rail included + return {scroll, foot, head}; + } +} + +// Compact layout (Settings > Appearance): the column keeps the prompt and Create; the rest stays built, only not shown. +function compactHook(controls) { + const paint = on => { controls.dataset.compact = String(!!on); }; + try { paint(localStorage.getItem('freevideo.studio.compact') === '1'); } catch { paint(false); } + const onCompact = event => { if (controls.isConnected) paint(event.detail); else window.removeEventListener('fv-studio-compact', onCompact); }; + window.addEventListener('fv-studio-compact', onCompact); +} diff --git a/web/studio_console.js b/web/studio_console.js index 13242d68..839c6c34 100644 --- a/web/studio_console.js +++ b/web/studio_console.js @@ -34,6 +34,9 @@ const promptMax = () => globalThis.matchMedia?.('(max-width:760px)').matches ? 1 // trays: [{id, title, element}] where element is a
(its summary is hidden; open is the tray's state) // or any element, which is then wrapped in one. chips: what each chip shows, read again on sync(). +// The chips that fold to their icon and count first when the row is short of room (see fitRow). +const FOLDS = new Set(['media', 'lora']); + export function createConsole({t, body, controls, prompt, runbar, trays, chips, status = [], onTray = () => {}}) { const host = el('div', 'fvs-trays'); const box = el('div', 'fvs-console'); @@ -66,7 +69,8 @@ export function createConsole({t, body, controls, prompt, runbar, trays, chips, host.append(details); rows.set(tray.id, {details, chip: null}); details.addEventListener('toggle', () => { - if (details.open) for (const [id, other] of rows) if (id !== tray.id && other.details.open) other.details.open = false; + // (A tray the column keeps open on its own — data-pinned: LoRA, Advanced options — never puts another one away, or a Media tray a continuation opened would be closed by their first toggle.) + if (details.open && !details.dataset.pinned) for (const [id, other] of rows) if (id !== tray.id && other.details.open && !other.details.dataset.pinned) other.details.open = false; paint(); }); } @@ -95,7 +99,7 @@ export function createConsole({t, body, controls, prompt, runbar, trays, chips, const calm = () => globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches; function stopClosing() { if (!closing) return; clearTimeout(closing.timer); delete closing.details.dataset.closing; closing = null; } function putAway(item, animate) { - if (!item?.details.open) return; + if (!item?.details.open || item.details.dataset.pinned) return; // a pinned tray (the settings column's) stays open if (!animate || calm()) { stopClosing(); item.details.open = false; return; } if (closing?.details === item.details) return; stopClosing(); @@ -108,7 +112,7 @@ export function createConsole({t, body, controls, prompt, runbar, trays, chips, item.details.open = force ?? !item.details.open; if (item.details.open) item.details.scrollTop = 0; } - function openId() { for (const [id, item] of rows) if (item.details.open) return id; return ''; } + function openId() { for (const [id, item] of rows) if (item.details.open && !item.details.dataset.pinned) return id; return ''; } function paint() { const open = openId(); body.dataset.tray = open; @@ -134,13 +138,65 @@ export function createConsole({t, body, controls, prompt, runbar, trays, chips, const value = spec.read() || {}; if (spec.label && spec.label.textContent !== (value.label ?? '')) spec.label.textContent = value.label ?? ''; if (spec.extra) { if (spec.extra.textContent !== (value.extra ?? '')) spec.extra.textContent = value.extra ?? ''; if (spec.extra.hidden !== !value.extra) spec.extra.hidden = !value.extra; } + if (spec.chip && FOLDS.has(spec.id)) spec.chip.toggleAttribute('data-empty', !value.extra); if (spec.chip) { if (spec.chip.disabled !== Boolean(value.disabled)) spec.chip.disabled = Boolean(value.disabled); if (value.badge != null) { if (spec.chip.dataset.badge !== String(value.badge)) spec.chip.dataset.badge = String(value.badge); } else if ('badge' in spec.chip.dataset) delete spec.chip.dataset.badge; if (value.tip) tip(spec.chip, value.tip[0], value.tip[1], value.tip[2]); } } + fitRow(); + } + // A row that cannot hold every chip on one line folds them (Iris 11-24, review/i18n/shots-widest/collapse-spec-iris.md): + // first Media and LoRA show their icon and count, then Enhance its star, then (Lane 11-24) the duration shows its number + // and the size and quality keys drop their drawings, as on a phone; the row never wraps. Judged by the row's own + // width in every language, not by a set breakpoint; the words come back once the row is 16 px wider than where it + // folded (no back and forth while a window is dragged). The narrow layout (760 px and less) wraps by design and does + // not fold. Folded chips keep their words for screen readers, and Media and LoRA say their count ("Media, 12"). + let fold = 0; + // Where each step was taken: the row's width and what its chips showed. Without the 16 px margin a step is only undone + // when that content has changed (a shorter level, fewer media); a resize back and forth or a refresh with the same + // content keeps it (c1-boot review 11-24). + const foldedAt = [0, 0, 0, 0], shownAt = ['', '', '', '']; + const shown = () => [...row.querySelectorAll('.fvs-chip-label,.fvs-chip-extra,.fvs-step-number,.fvp-chip-label,.fv-enhance-chip>span')] + .map(node => node.hidden ? '' : node.textContent).join('\u241f'); + const narrow = () => Boolean(globalThis.matchMedia?.('(max-width:760px)').matches); + function wraps() { + const shown = [...row.children].filter(node => node.offsetParent !== null && !node.classList.contains('fvs-chip-spacer')); + if (shown.length < 2) return false; + const top = Math.min(...shown.map(node => node.offsetTop)); + return shown.some(node => node.offsetTop > top + 2) || row.scrollWidth > row.clientWidth + 1; + } + function nameFolded() { + for (const spec of built) { + if (!spec.chip || !FOLDS.has(spec.id)) continue; + const name = spec.label?.textContent || '', count = spec.extra?.hidden ? '' : spec.extra?.textContent || ''; + // Square only without a count: read from what the chip shows now, not from the last sync. + spec.chip.toggleAttribute('data-empty', !count); + if (fold && name) spec.chip.setAttribute('aria-label', count ? t('{name}, {count}', '{name},{count}', {name, count}) : name); + else spec.chip.removeAttribute('aria-label'); + } + } + function setFold(level) { + fold = level; + if (level) row.dataset.fold = String(level); else delete row.dataset.fold; + } + function fitRow() { + if (!row.isConnected || !row.clientWidth) return; + if (narrow()) setFold(0); + else { + const width = row.clientWidth, now = shown(); + while (fold > 0 && (width >= foldedAt[fold] + 16 || now !== shownAt[fold])) { + const was = fold; setFold(fold - 1); + // Still too long: this width and content become the step's reference, so the next look does not try again + // (and the try's change of layout cannot call this back in a loop). + if (wraps()) { setFold(was); foldedAt[was] = width; shownAt[was] = now; break; } + } + while (fold < 3 && wraps()) { foldedAt[fold + 1] = width; shownAt[fold + 1] = now; setFold(fold + 1); } + } + nameFolded(); } + if (globalThis.ResizeObserver) new ResizeObserver(() => fitRow()).observe(row); // Every tray starts closed: the picture keeps its full size until a setting is opened. for (const item of rows.values()) item.details.open = false; paint(); sync(); @@ -236,8 +292,8 @@ export function durationStepper(t, seconds, {onOpen, max = () => Infinity, locke // It sits inside the number (not a grid column of its own), so the button grows by the lock and 4 px only. if (locked === 'audio') { const mark = lockMark(); mark.hidden = false; mark.classList.add('fvs-step-lock'); number.classList.add('fvs-step-locked'); number.prepend(mark); } value.replaceChildren(number, unit); - value.setAttribute('aria-label', locked === 'audio' ? t(`${shown} s, set by the audio`, `${shown} 秒,由音频决定`) - : locked === 'linked' ? t(`${shown} s, set by connected nodes`, `${shown} 秒,由连接的节点决定`) : t(`${shown} s`, `${shown} 秒`)); + value.setAttribute('aria-label', locked === 'audio' ? t('{shown} s, set by the audio', '{shown} 秒,由音频决定', { shown }) + : locked === 'linked' ? t('{shown} s, set by connected nodes', '{shown} 秒,由连接的节点决定', { shown }) : t('{shown} s', '{shown} 秒', { shown })); } // The page writes its own hover words for the length (how many parts it is made in) as it changes; while the // length is locked those are kept for later and the reason stays. diff --git a/web/studio_extend.js b/web/studio_extend.js index 87868786..72df782f 100644 --- a/web/studio_extend.js +++ b/web/studio_extend.js @@ -3,9 +3,9 @@ import {fileState} from './output_download.js'; export const EXTEND_PROPERTY = 'freevideo_extend'; export const EXTEND_TEXT = Object.freeze({ action: ['Extend', '接着生成'], - source: ['Continues this video', '接在这条视频后面'], + source: ['Extends this video', '接在这条视频后面'], remove: ['Remove', '移除'], - prompt: ['Prompt', '描述'], + prompt: ['Prompt', '提示词'], unavailable: ['Video unavailable', '视频不可用'], unchecked: ['Could not check the video', '没能检查视频'], }); @@ -106,6 +106,7 @@ export function extendSnapshot(snapshot, node, source, {multiple = false} = {}) inputs.width = source.geometry.width; inputs.height = source.geometry.height; const factor = continuationUpscale(inputs.base_steps ?? 8, inputs.two_pass, inputs.refine_steps ?? 3, inputs.step_cache, inputs.upscale_factor); inputs.preview = false; inputs.refine_from = ''; inputs.two_pass = true; + if ('fast_mode' in inputs) inputs.fast_mode = 'none'; for (const [key, value] of [['base_steps', 8], ['refine_steps', 3], ['step_cache', 'none'], ['upscale_factor', factor]]) if (key in inputs) inputs[key] = value; // A continuation takes no first or last frame and no pre-encoded conditioning. for (const key of ['first', 'last', 'conditioning']) delete inputs[key]; diff --git a/web/studio_length.js b/web/studio_length.js index a775834f..7579e3ca 100644 --- a/web/studio_length.js +++ b/web/studio_length.js @@ -5,6 +5,9 @@ import {buildPlanRequest, readLengthPlan, classifyPlanError, singleLimitSeconds, export const LENGTH_PROPERTIES = Object.freeze({seconds: 'freevideo_seconds', single: 'freevideo_single', block: 'freevideo_block_seconds'}); const positive = value => typeof value === 'number' && Number.isFinite(value) && value > 0; +// A shortest length as said to a person: up to the next tenth of a second, so the length said is always long enough +// (1.625 is 1.7), with no trailing .0. +export const tenthUp = value => String(Math.ceil(Number((value * 10).toFixed(6))) / 10); export const savedSeconds = (node, fallback) => positive(node.properties?.[LENGTH_PROPERTIES.seconds]) ? node.properties[LENGTH_PROPERTIES.seconds] : fallback; // Use the editor's capability adapter, including its new 30s display ceiling. @@ -80,7 +83,7 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fie let limits = null, planLimits = null, contextKey = '', revision = 0, timer = null, request = null, capabilityRequest = null, capabilityRevision = 0; let capabilityState = 'idle', waiting = false, waitingTimer = null, timeoutTimer = null, submitted = false; - let plan = null, error = null, absent = false, disposed = false, pending = null, edited = false, blockEdited = false, plannedSeconds = null; + let plan = null, error = null, shortest = null, absent = false, disposed = false, pending = null, edited = false, blockEdited = false, plannedSeconds = null; const remember = (key, value) => { node.properties ||= {}; node.properties[key] = value; node.graph?.change(); node.setDirtyCanvas?.(true, true); }; const total = () => Number(seconds.value); let forced = false; @@ -99,7 +102,7 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fie function paintModel() { const multiple = !absent && !error && plan?.count >= 2; put(modelNotice, 'hidden', !multiple || modelState.info?.ready !== false); - put(modelText, 'textContent', modelState.text || t('The prompt model is not installed, so the description will be split across the parts by sentence.', '未安装提示词模型,描述将按句子顺序分到各段。')); + put(modelText, 'textContent', modelState.text || t('The prompt model is not installed, so the prompt will be split across the parts by sentence.', '未安装提示词模型,提示词将按句子顺序分到各段。')); put(download, 'hidden', Boolean(modelState.busy)); put(download, 'disabled', Boolean(modelState.busy)); // Pending plans do not reset the check on every keystroke. A known single part does. if (plan?.count === 1 || (!plan && !effectiveSingle() && total() <= singleLimitSeconds(planLimits?.maximum) @@ -117,10 +120,10 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fie put(single, 'disabled', Boolean(absent || seconds.disabled || cannot || forced)); put(single, 'checked', !absent && effectiveSingle()); if (absent) seconds.max = '60'; const reason = cannot ? positive(forcedMaximum) - ? t(`Up to ${Math.floor(forcedMaximum)}\u00a0s in one run at this size.`, `当前画面大小单次最长 ${Math.floor(forcedMaximum)}\u00a0秒。`) + ? t('Up to {seconds}\u00a0s in one run at this size.', '当前画面大小单次最长 {seconds}\u00a0秒。', { seconds: Math.floor(forcedMaximum) }) : t('The maximum length is unknown for these settings.', '当前设置下无法确定最长时长。') : seconds.disabled ? '' : clamped - ? t(`Up to ${Math.floor(maximum)}\u00a0s in one run at this size.`, `当前画面大小单次最长 ${Math.floor(maximum)}\u00a0秒。`) : ''; + ? t('Up to {seconds}\u00a0s in one run at this size.', '当前画面大小单次最长 {seconds}\u00a0秒。', { seconds: Math.floor(maximum) }) : ''; put(unavailable, 'hidden', Boolean(absent || !reason)); put(unavailable, 'textContent', reason); put(single, 'title', single.disabled ? reason : ''); put(toggle, 'title', single.title); if (single.disabled && reason) { if (toggle.dataset.fvTipWhy !== reason) toggle.dataset.fvTipWhy = reason; } else if ('fvTipWhy' in toggle.dataset) delete toggle.dataset.fvTipWhy; @@ -136,6 +139,7 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fie // The same sentence is the problem note once a length needs parts: say it once. put(hint, 'hidden', Boolean(absent || (noParts && Boolean(error)))); put(note, 'hidden', Boolean(absent || !error)); + if (note.dataset.fvLengthError !== (error || undefined)) { if (error) note.dataset.fvLengthError = error; else delete note.dataset.fvLengthError; } if (error === 'too_long') note.replaceChildren(TOO_LONG(), ...storyboard()); else put(note, 'textContent', error ? errorMessage(error) : ''); if (error === 'other') note.append(issueButton(t, () => ({where: ['Video length planning', '视频分段规划'], message: errorMessage('other')}))); @@ -148,6 +152,10 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fie : t('Choose a smaller picture size to make a longer video.', '如需生成更长的视频,请选择更小的画面大小。'), too_long: TOO_LONG() + storyboardText(), block_missing: t('Fill in the longest part length.', '请填写每段最长时长。'), + too_short: shortest + ? t('The video must be at least {seconds}\u00a0seconds long. Set a longer duration.', '视频时长至少为 {seconds}\u00a0秒,请加长时长。') + .replace('{seconds}', () => tenthUp(shortest)) + : t('The video is too short. Set a longer duration.', '视频时长过短,请加长时长。'), block_too_short: t('The part length is too short. Set a longer part length.', '每段时长过短,请加长。'), block_too_long: t('The part length is longer than one run allows at this size. Set a shorter part length.', '每段时长超过当前画面大小的单次上限,请缩短。'), other: t('Could not plan this video. Try again.', '暂时无法安排这条视频的分段,请重试。')}[kind]; @@ -169,6 +177,8 @@ export function createStudioLength({api, node, seconds, advanced, fields, t, fie if (response.status === 404) { absent = true; plan = null; error = null; } else if (response.status === 400) { error = classifyPlanError(reply); + // The shortest length is the planner's own, said in its reply; the length field's minimum stands in for it. + shortest = positive(reply?.min_seconds) ? reply.min_seconds : Number(seconds.min) || null; // A part length the user cannot edit is not the cause: the device limit is. if (block.disabled && (error === 'block_too_short' || error === 'block_too_long')) error = 'continuation_unavailable'; } diff --git a/web/studio_queue.js b/web/studio_queue.js index c68d7b1f..1594a1b7 100644 --- a/web/studio_queue.js +++ b/web/studio_queue.js @@ -90,6 +90,7 @@ export async function upscaleResult(api, nodeId, result, currentPrompt) { : clone(await currentPrompt()); if (!snapshot.output?.[nodeId]) throw new Error('missing_node'); Object.assign(snapshot.output[nodeId].inputs, {preview: false, refine_from: result.video, force_regenerate: false}); + if ('fast_mode' in snapshot.output[nodeId].inputs) snapshot.output[nodeId].inputs.fast_mode = 'none'; const reply = await api.queuePrompt(0, snapshot); if (!reply?.prompt_id) throw new Error('submit_failed'); api.dispatchCustomEvent?.('promptQueued', {number: 0, batchCount: 1}); @@ -105,6 +106,7 @@ export async function upscaleWork(api, nodeId, result, currentPrompt, {to = ''} if (to !== '' && to !== '4k') throw new Error('unknown_size'); const snapshot = clone(await currentPrompt()); if (!snapshot.output?.[nodeId]) throw new Error('missing_node'); + if ('fast_mode' in snapshot.output[nodeId].inputs) snapshot.output[nodeId].inputs.fast_mode = 'none'; Object.assign(snapshot.output[nodeId].inputs, {preview: false, refine_from: '', upscale_from: result.video, upscale_to: to, force_regenerate: true}); const reply = await api.queuePrompt(0, snapshot); if (!reply?.prompt_id) throw new Error('submit_failed'); diff --git a/web/studio_right_column.js b/web/studio_right_column.js new file mode 100644 index 00000000..7c5c402a --- /dev/null +++ b/web/studio_right_column.js @@ -0,0 +1,85 @@ +// The creation panel's right column in the three-column layout: the shared column of the image view (web/work_column.js) +// with the videos of the library as its works page, the shown video's facts as its info page, and the queue of every view. +import { api } from '../../scripts/api.js'; +import { libraryPage, videoThumbnailURL, videoDimensions, videoTimestamp } from './library.js'; +import { createWorkColumn } from './work_column.js'; +import { mediaQueue, mediaURL, watchCards } from './work_media.js'; +import { studioWorks } from './studio_works.js'; +import { queuePanel } from './image_view_queue.js'; +import { jobs } from './task_store.js'; +import { confirmStop } from './task_float.js'; +import { pictureURL } from './picture_url.js'; +import { el, t, button } from './image_view_ui.js'; + +// The column's parts are styled in image_view.css (for .fv-iv and .fv-work-column alike); the creation panel does not load +// the image view, so it asks for the sheet itself, once (not in work_column.js: the image view's own order of sheets stays as it was). +{ + const href = new URL('./image_view.css', import.meta.url).href; + if (![...document.querySelectorAll('link[rel=stylesheet]')].some(link => link.href === href)) { + const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = href; document.head.append(css); + } +} + +const RAIL_THUMBS = 6; + +async function saveFavorite(row, favorite) { + const id = row.id || row.video.replace(/^FreeVideo\//, '').replace(/\/video\.mp4$/, ''); + const response = await api.fetchApi('/freevideo/library/favorite', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({id, favorite})}); + if (!response.ok) return false; + return (await response.json()).favorite === favorite; +} + +/** + * @param {object} o + * @param {HTMLElement} o.slot the right column's element (aside.fv-work-column) + * @param {{setPanel: (side: string, open: boolean) => void}} o.shell + * @param {(row: object) => void} o.onShow a work was chosen: show it on the stage + * @param {(row: object) => Promise} o.named the words a video was made from + * @param {(rows: object[]) => void} [o.onPick] videos picked together to compare (at most two, in the order picked; [] when cleared) + * @param {(row: object) => Promise} [o.onReuse] fill the panel with this video's settings (the info page's button) + * @param {() => void} [o.onChange] the videos or the shown one changed (also after the column reloads itself) + * @param {HTMLElement} [o.entry] the owner's button to the full library, put beside the search + * @param {(row: object) => string} [o.errorOf] what went wrong with this video's run, when something did (the info page says it) + */ +export function mountStudioColumn({slot, shell, onShow, onPick, onChange, entry, named, onReuse, errorOf}) { + // The videos on and near the screen load in the background after their covers, so the one chosen next plays at once. + const watch = (root, rowOf) => watchCards(mediaQueue(), root, tile => { + const hit = rowOf(tile); + return hit ? {url: mediaURL(hit.row.video, 'output'), kind: 'video', bytes: hit.row.bytes} : null; + }); + const works = studioWorks({load: libraryPage, thumb: videoThumbnailURL, favorite: saveFavorite, onShow, onPick, onChange, entry, named, watch}); + const info = el('div', 'fv-iv-info'); + let shown = null; + async function paintInfo() { + if (!shown) { info.replaceChildren(); return; } + const row = shown, words = await Promise.resolve(named(row)).catch(() => ''); + if (row !== shown) return; + const line = (label, value) => value ? el('p', 'fv-iv-info-line', `${label}${t(': ', ':')}${value}`) : null; + const problem = errorOf?.(row) || ''; + const reuse = onReuse ? button('fv-iv-text-btn fv-iv-info-reuse', {label: t('Reuse settings', '复用设置'), name: t('Reuse settings', '复用设置'), use: t('Fill the panel with this video\'s prompt, size and length', '把这条视频的提示词、尺寸和时长填回面板'), + onClick: () => { void onReuse(row); }}) : null; + info.replaceChildren(...[el('p', 'fv-iv-info-prompt', words || ''), line(t('Size', '尺寸'), videoDimensions(row, t)), line(t('Made', '时间'), videoTimestamp(row, t)), + problem ? el('p', 'fv-iv-info-error', problem) : null, reuse].filter(Boolean)); + } + const queue = queuePanel({jobs, confirmStop, pictureURL, onOpen: row => { + const go = globalThis.FreeVideoShell?.go; + if (row.view && row.view !== 'studio' && go) { void go(row.view); return; } + const found = row.result?.video ? works.rows().find(r => r.video === row.result.video) : null; + if (found) onShow(found); + }}); + const column = createWorkColumn({works, info, queue, storeKey: 'freevideo.studio.rightTab', + onCollapse: () => shell.setPanel('right', false), onOpen: () => shell.setPanel('right', true), + onTab: name => { if (name === 'info') void paintInfo(); }}); + slot.replaceChildren(); column.mount(slot); slot.hidden = false; column.setTab(column.tab); + const thumbs = () => column.railThumbs.replaceChildren(...works.rows().slice(0, RAIL_THUMBS).map(row => { + const b = el('button', 'fv-iv-rail-thumb'); b.type = 'button'; const i = el('img'); i.alt = ''; i.draggable = false; i.src = videoThumbnailURL(row); b.append(i); + b.classList.toggle('fv-iv-current', row.video === shown?.video); b.addEventListener('click', () => onShow(row)); return b; + })); + const refresh = async () => { const rows = await works.refresh(); thumbs(); return rows; }; + return { + refresh, setFavorite: (row, value) => works.setFavorite(row.video, value), rows: () => works.rows(), index: () => works.index(), picked: () => works.picked(), clearPicks: opts => works.clearPicks(opts), + // The stage shows this video now. + setShown(row) { shown = row || null; works.setSelected(row?.video); thumbs(); if (column.tab === 'info') void paintInfo(); }, + dispose() { works.dispose(); queue.dispose?.(); }, + }; +} diff --git a/web/studio_works.js b/web/studio_works.js new file mode 100644 index 00000000..e282415e --- /dev/null +++ b/web/studio_works.js @@ -0,0 +1,255 @@ +// The creation panel's works page: the library's videos in the same column and tiles as the image view's works +// (same classes, so the shared column looks one way), read from the library the page already lists. It owns no data: +// a tile shows a video on the stage (onShow), search filters by the work's name, the star filter reads the library's favourites. +// The library's own calls come in as options (load: the page of videos, thumb: a video's cover, favorite: save a star, +// watch: loads the videos near the screen ahead), so the page needs no engine to be tried. +// +// What the earlier Recent videos strip did, this page does too: +// - runs of one task fold under their newest video, which opens them when pressed (task_groups.js); +// - two videos picked together (Ctrl/⌘ or Shift and a click, a 500 ms press, or the tile's check) are reported by +// onPick(rows) in the order picked, [] when the picks are cleared; picked() and clearPicks({quiet}) are the same; +// - a read that fails leaves a mark that reads again on a press (only the reason when the reply asks for a restart); +// - a tile's hover name is the opening words of its prompt (24 letters), from named(row); +// - onChange() is called when the rows or the shown video changed (also after the page's own reload); +// - entry: a button of the owner's (the full library) put in the foot, left, where the column shows it whenever it is open; +// - sort (newest, oldest, favourites first) and select (every tile's click picks, for two to compare) sit beside the search, as in the picture view; +// - rows() are the videos newest first, index() is the place of the shown one. +import { el, icon, t, tip, button } from './image_view_ui.js'; +import { glyph } from './context_menu.js'; +import { applyTasks, toggledTask } from './task_groups.js'; + +const idle = () => ({observe() {}, unobserve() {}, disconnect() {}}); + +export function studioWorks({load, thumb, favorite = async () => true, onShow, onPick = () => {}, onChange = () => {}, entry = null, named = () => Promise.resolve(''), watch = idle, limit = 48}) { + const root = el('div', 'fv-iv-works'); + const head = el('div', 'fv-iv-panel-head'), title = el('h2', 'fv-iv-panel-title', t('Creations', '作品')), count = el('span', 'fv-iv-count'); + head.append(title, count); + const searchRow = el('label', 'fv-iv-search'), query = el('input'); query.type = 'search'; query.placeholder = t('Search prompts', '搜索提示词'); + tip(query, t('Search', '搜索'), t('Find videos by their prompt', '按提示词查找视频')); searchRow.append(icon('search'), query); + const SORTS = {new: ['Newest first', '最新在前'], old: ['Oldest first', '最早在前'], fav: ['Favorites first', '收藏在前']}; + const sortBtn = button('fv-iv-icon-btn', {iconName: 'sort'}); + const selectBtn = button('fv-iv-icon-btn', {iconName: 'select', name: t('Select', '选择'), use: t('Pick two videos to compare them side by side', '选两条视频并排对比')}); + selectBtn.setAttribute('aria-pressed', 'false'); + const tools = el('div', 'fv-iv-works-tools'); tools.append(searchRow, sortBtn, selectBtn); + const sortMenu = el('div', 'fv-iv-menu'); sortMenu.hidden = true; sortMenu.setAttribute('role', 'menu'); + const chips = el('div', 'fv-iv-chips'); chips.setAttribute('role', 'tablist'); + const chipAll = button('fv-iv-chip', {}), chipFav = button('fv-iv-chip', {}); + chipAll.append(el('span', 'fv-iv-btn-label', t('All', '全部'))); chipFav.append(el('span', 'fv-iv-btn-label', t('Favorites', '收藏'))); + for (const b of [chipAll, chipFav]) b.setAttribute('role', 'tab'); + chips.append(chipAll, chipFav); + const body = el('div', 'fv-iv-works-body'), grid = el('div', 'fv-iv-grid'); + const empty = el('div', 'fv-iv-empty'); empty.hidden = true; + body.append(grid, empty); + // Foot, as the picture view's: a link on the left (the full library); the right stays empty (the picture view's Recently deleted has no + // counterpart here). The shown video's star is a key of the bar under the picture (setFavorite). + const foot = el('div', 'fv-iv-panel-foot'), links = el('div', 'fv-iv-links'); + if (entry) entry.classList.add('fv-iv-btn', 'fv-iv-link'); + links.append(...[entry, el('span', 'fv-iv-grow')].filter(Boolean)); foot.append(links); + root.append(head, tools, chips, sortMenu, body, foot); + + let rows = [], selected = '', filter = 'all', sort = 'new', selecting = false, words = '', request = 0, disposed = false, order = [], unfolded = null, picks = [], failMark = null; + const tiles = new Map(), prompts = new Map(), byVideo = new Map(), names = new Map(), unnamed = t('Video', '视频'); + const originals = watch(grid, tile => { const row = byVideo.get(tile.dataset.file); return row ? {row} : null; }); + const key = row => row.video; + sortMenu.append(...Object.keys(SORTS).map(name => { + const item = el('button', 'fv-iv-menu-item'); item.type = 'button'; item.setAttribute('role', 'menuitemradio'); item.dataset.sort = name; + item.append(el('span', '', t(...SORTS[name])), icon('check', 'fv-iv-menu-mark')); + item.addEventListener('click', () => { sortMenu.hidden = true; sort = name; paint(); sortBtn.focus(); }); + return item; + })); + const onPointer = event => { if (!sortMenu.hidden && !sortMenu.contains(event.target) && !sortBtn.contains(event.target)) sortMenu.hidden = true; }; + document.addEventListener('pointerdown', onPointer, true); + sortBtn.addEventListener('click', () => { sortMenu.hidden = !sortMenu.hidden; if (!sortMenu.hidden) sortMenu.querySelector('[aria-checked=true]')?.focus(); }); + sortMenu.addEventListener('keydown', event => { if (event.key === 'Escape') { event.stopPropagation(); sortMenu.hidden = true; sortBtn.focus(); } }); + function paintSort() { + for (const item of sortMenu.querySelectorAll('[data-sort]')) item.setAttribute('aria-checked', String(item.dataset.sort === sort)); + // (Whole sentences, one for each order: the catalogue collects plain strings, not a sentence put together.) + const now = {new: t('Now: Newest first', '当前:最新在前'), old: t('Now: Oldest first', '当前:最早在前'), fav: t('Now: Favorites first', '当前:收藏在前')}; + tip(sortBtn, t('Sort', '排序'), now[sort]); + } + // Select: a press on a tile picks it (two at most, to compare) until select is pressed again or Esc. + function setSelecting(on) { + selecting = on; root.dataset.selecting = String(on); selectBtn.setAttribute('aria-pressed', String(on)); + tip(selectBtn, on ? t('Done', '完成') : t('Select', '选择'), on ? t('Leave selection', '退出多选') : t('Pick two videos to compare them side by side', '选两条视频并排对比')); + if (!on) clearPicks(); + } + selectBtn.addEventListener('click', () => setSelecting(!selecting)); + root.addEventListener('keydown', event => { if (event.key === 'Escape' && selecting) { event.stopPropagation(); setSelecting(false); } }); + const nameOf = video => names.get(video) || unnamed; + + // ── picking two videos to compare ── + function paintPicks() { + for (const [video, tile] of tiles) { + const at = picks.indexOf(video); + if (at >= 0) tile.dataset.picked = String(at + 1); else delete tile.dataset.picked; + tile.querySelector('.fv-recent-check')?.setAttribute('aria-pressed', String(at >= 0)); + } + root.dataset.picking = String(picks.length > 0); + } + // Picks one more (or takes it back); a third pick replaces the first. + function pick(video) { + if (!byVideo.has(video)) return; + if (picks.length === 0 && selected && selected !== video && byVideo.has(selected)) picks = [selected]; + picks = picks.includes(video) ? picks.filter(v => v !== video) : [...picks, video].slice(-2); + paintPicks(); onPick(picks.map(v => byVideo.get(v))); + } + function clearPicks({quiet = false} = {}) { if (!picks.length) return; picks = []; paintPicks(); if (!quiet) onPick([]); } + + // ── tasks: the newest video of a run covers the others ── + function fold() { + applyTasks({cards: tiles, rows: byVideo, order, open: unfolded, selected, t, label: nameOf}); + for (const [video, tile] of tiles) { + const open = tile.querySelector('.fv-iv-tile-open'), cover = tile.classList.contains('fv-task-head'); + // applyTasks marks the tile; the press target is the button inside it. + for (const attribute of ['aria-label', 'aria-expanded', 'aria-pressed']) { + const value = tile.getAttribute(attribute); + if (value !== null) { open.setAttribute(attribute, value); tile.removeAttribute(attribute); } else if (attribute !== 'aria-label') open.removeAttribute(attribute); + } + if (!cover) open.setAttribute('aria-pressed', String(video === selected)); + const badge = tile.querySelector('.fv-iv-tile-n'); + if (cover) { + const group = order.filter(item => byVideo.get(item)?.task && byVideo.get(item).task === byVideo.get(video).task).length; + const n = badge || tile.appendChild(el('span', 'fv-iv-tile-n')); n.textContent = String(group); + tip(open, open.getAttribute('aria-label') || nameOf(video), t('Show or fold the results of this run', '展开或收起这次生成的结果')); + } else { + badge?.remove(); + tip(open, nameOf(video), t('Show this video on the stage', '在画面里显示这条视频')); + } + open.dataset.fvTipLabel = 'auto'; + } + } + // The work's name: its prompt's opening words, read once per video (it also feeds the search). + // The prompts are read a few at a time (a library of many videos would otherwise ask for every one at once). + const NAME_READS = 4; let reading = 0; const waiting = []; + function readNamed(run) { + return new Promise((resolve, reject) => { + const start = () => { reading++; Promise.resolve().then(run).then(resolve, reject).finally(() => { reading--; waiting.shift()?.(); }); }; // (a throw from run() releases the slot too) + if (reading < NAME_READS) start(); else waiting.push(start); + }); + } + function nameCard(video) { + const row = byVideo.get(video); + if (!row || prompts.has(video)) return; + prompts.set(video, ''); + readNamed(() => Promise.resolve(named(row))).then(text => { + const prompt = String(text || ''), letters = Array.from(prompt.replace(/\s+/g, ' ').trim()); + prompts.set(video, prompt); + names.set(video, letters.length ? letters.slice(0, 24).join('').trim() + (letters.length > 24 ? '…' : '') : ''); + if (disposed) return; + if (words) paint(); else if (tiles.has(video)) fold(); + }, () => { prompts.delete(video); }); + } + + function tileFor(row) { + let tile = tiles.get(key(row)); + if (tile) return tile; + const video = key(row); + tile = el('div', 'fv-iv-tile'); tile.dataset.file = video; tile.dataset.video = video; + const open = el('button', 'fv-iv-tile-open'); open.type = 'button'; + const image = el('img'); image.alt = ''; image.loading = 'lazy'; image.decoding = 'async'; image.draggable = false; + image.dataset.loaded = 'false'; image.addEventListener('load', () => { image.dataset.loaded = 'true'; }); image.addEventListener('error', () => { image.dataset.loaded = 'true'; image.dataset.missing = 'true'; }); + image.src = thumb(row); + open.append(image); tile.append(open); + const star = el('span', 'fv-iv-tile-star'); star.append(icon('star')); tile.append(star); + // Ctrl/⌘ or Shift and a click, a long press, or the tile's check: pick it with another to compare. + const check = el('span', 'fv-recent-check'); check.setAttribute('role', 'button'); check.setAttribute('aria-pressed', 'false'); + check.setAttribute('aria-label', t('Pick to compare', '选中以对比')); + check.dataset.fvTipName = t('Pick', '选中'); check.dataset.fvTipUse = t('Pick two videos to compare them side by side', '选两条视频并排对比'); + check.addEventListener('click', event => { event.stopPropagation(); pick(video); }); + tile.append(check); + let held = null, longPressed = false; + open.addEventListener('pointerdown', event => { + if (event.button !== 0) return; longPressed = false; + held = setTimeout(() => { longPressed = true; pick(video); }, 500); + }); + for (const type of ['pointerup', 'pointerleave', 'pointercancel']) open.addEventListener(type, () => clearTimeout(held)); + for (const type of ['pointerenter', 'focus']) open.addEventListener(type, () => nameCard(video)); + open.addEventListener('click', event => { + if (longPressed) { longPressed = false; return; } + if (event.ctrlKey || event.metaKey || event.shiftKey || selecting) { pick(video); return; } + if (picks.length) clearPicks({quiet: true}); + // A cover with others under it opens them in place; any other tile is the choice. + const next = toggledTask(byVideo, order, video, unfolded); + onShow?.(byVideo.get(video) || row); + if (next !== unfolded || tile.classList.contains('fv-task-head')) { unfolded = next; fold(); } + }); + tiles.set(video, tile); originals.observe(tile); return tile; + } + // The videos in the order the column shows them (the sort chosen; no filter): the stage's previous and next follow it. + const ordered = () => (sort === 'old' ? rows.slice().reverse() : sort === 'fav' ? rows.slice().sort((a, b) => Number(!!b.favorite) - Number(!!a.favorite)) : rows.slice()); + const shown = () => { + const list = rows.filter(row => (filter !== 'fav' || row.favorite) && (!words || (prompts.get(key(row)) || '').toLowerCase().includes(words))); + if (sort === 'old') list.reverse(); else if (sort === 'fav') list.sort((a, b) => Number(!!b.favorite) - Number(!!a.favorite)); + return list; + }; + function paint() { + const list = shown(); + for (const b of [chipAll, chipFav]) { const on = (b === chipFav) === (filter === 'fav'); b.setAttribute('aria-selected', String(on)); b.setAttribute('aria-pressed', String(on)); } + count.textContent = rows.length ? String(rows.length) : ''; + const keep = new Set(list.map(key)); + for (const [file, tile] of tiles) if (!keep.has(file)) { originals.unobserve(tile); tile.remove(); tiles.delete(file); } + grid.replaceChildren(...list.map(row => { const tile = tileFor(row); tile.classList.toggle('fv-iv-current', key(row) === selected); tile.classList.toggle('fv-iv-fav', !!row.favorite); return tile; })); + order = list.map(key); + fold(); paintPicks(); paintSort(); + // No work at all: the page stays empty; a search or the star that hides every work says so. + empty.hidden = list.length > 0 || !rows.length; + empty.replaceChildren(...(empty.hidden ? [] : [icon('search'), el('span', '', t('Nothing matches', '没有符合条件的视频'))])); + } + // The works page is too narrow for the sentence: a small mark beside the search names the failure on hover and reads again on a press (disabled + // while it reads; it stays if the read fails again and goes once it works). A reply that asks for a restart has nothing + // to retry, so its mark is not a control, only the reason on hover. + function failed(error) { + const restart = Boolean(error?.restart); + if (!failMark || failMark.dataset.restart !== String(restart)) { + failMark?.remove(); + failMark = el(restart ? 'span' : 'button', 'fv-recent-fail'); + failMark.dataset.restart = String(restart); + if (restart) failMark.setAttribute('role', 'img'); + else { failMark.type = 'button'; failMark.onclick = () => { failMark.disabled = true; void refresh(); }; } + failMark.innerHTML = glyph('alert'); + } + const name = restart ? error.message : t('Creations could not be loaded', '无法读取作品'); + const use = restart ? '' : t('Read the creations again', '重新读取作品'); + failMark.setAttribute('aria-label', use ? `${name}. ${use}` : name); + failMark.dataset.fvTipName = name; + if (use) failMark.dataset.fvTipUse = use; else delete failMark.dataset.fvTipUse; + if (!restart) failMark.disabled = false; + tools.prepend(failMark); + } + async function refresh() { + const mine = ++request; + try { + const data = await load(t, {limit}); + if (disposed || mine !== request) return rows; + rows = (data.items || []).filter(row => row?.video && row.kind !== 'image'); + byVideo.clear(); for (const row of rows) byVideo.set(key(row), row); + for (const video of [...tiles.keys()]) if (!byVideo.has(video)) { originals.unobserve(tiles.get(video)); tiles.get(video).remove(); tiles.delete(video); } + // The tiles already made show the new row (a star, a task). + if (!rows.some(row => row.task === unfolded)) unfolded = null; + picks = picks.filter(video => byVideo.has(video)); + failMark?.remove(); failMark = null; + for (const row of rows) nameCard(key(row)); + } catch (error) { if (!disposed && mine === request) failed(error); /* the list stays as it was */ } + paint(); if (!disposed && mine === request) onChange(); return rows; + } + // The star of the shown video (pressed from the bar under the picture): kept in the library, marked on its tile, undone if it is refused. + async function setFavorite(video, value) { + const row = byVideo.get(video), before = !!row?.favorite; + if (row) { row.favorite = value; paint(); } + try { if (await favorite(row || {video}, value) === false) throw new Error('refused'); } + catch (error) { if (row) { row.favorite = before; paint(); } throw error; } + } + query.addEventListener('input', () => { words = query.value.trim().toLowerCase(); paint(); }); + chipAll.addEventListener('click', () => { filter = 'all'; paint(); }); + chipFav.addEventListener('click', () => { filter = 'fav'; paint(); }); + const completed = event => { if (event.detail?.value?.video) void refresh(); }; + const changed = () => { void refresh(); }; + window.addEventListener('freevideo-result', completed); + window.addEventListener('freevideo-library-deleted', changed); window.addEventListener('freevideo-library-restored', changed); + return { + element: root, refresh, setFavorite, rows: () => ordered(), index: () => ordered().findIndex(row => key(row) === selected), focusSearch: () => query.focus(), + picked: () => picks.map(video => byVideo.get(video)).filter(Boolean), clearPicks, + setSelected(video) { selected = video || ''; for (const [file, tile] of tiles) tile.classList.toggle('fv-iv-current', file === selected); fold(); tiles.get(selected)?.scrollIntoView?.({block: 'nearest'}); onChange(); }, + dispose() { disposed = true; document.removeEventListener('pointerdown', onPointer, true); originals.disconnect(); window.removeEventListener('freevideo-result', completed); window.removeEventListener('freevideo-library-deleted', changed); window.removeEventListener('freevideo-library-restored', changed); }, + }; +} diff --git a/web/swap_lora.js b/web/swap_lora.js index 932e740c..2ff2faf8 100644 --- a/web/swap_lora.js +++ b/web/swap_lora.js @@ -35,7 +35,7 @@ export function swapLoraDownload({t, api, onReady = () => {}}) { meter.dataset.indeterminate = String(!total); fill.style.width = total ? `${Math.min(100, 100 * (install.done || 0) / total).toFixed(1)}%` : ''; text.textContent = running() - ? (total ? t(`Downloading the Replace person model · ${mb(install.done)} / ${mb(total)}`, `正在下载替换人物模型 · ${mb(install.done)} / ${mb(total)}`) + ? (total ? t('Downloading the Replace person model · {done} / {total}', '正在下载替换人物模型 · {done} / {total}', { done: mb(install.done), total: mb(total) }) : t('Downloading the Replace person model…', '正在下载替换人物模型…')) : failed ? swapLoraFailureText(install.reason, t) : t('The Replace person model is ready.', '替换人物模型已就绪。'); diff --git a/web/task_float.css b/web/task_float.css index 72bc9b2d..c977ccce 100644 --- a/web/task_float.css +++ b/web/task_float.css @@ -84,6 +84,8 @@ .sgf .sgf-x { width: 28px; height: 28px; border-radius: var(--fv-r-sm); display: grid; place-items: center; color: var(--f-fg2); opacity: 0; transition: opacity 160ms, background-color 160ms, color 160ms; } .sgf .sgf-x svg { width: 14px; height: 14px; } .sgf:is(:hover, :focus-within) .sgf-x, .sgf.sheet-on .sgf-x { opacity: 1; } +/* Waiting for FreeVideo to come back (#1121): Stop waiting stays in sight, not only on hover. */ +.sgf.waiting .sgf-x { opacity: 1; } @media (hover: none) { .sgf .sgf-x { opacity: 1; } } .sgf .sgf-x:hover { background: var(--f-ctl-h); color: var(--f-fg); } .sgf:is([data-st=run], [data-st=queue]) .sgf-x:hover { color: var(--f-warn); } diff --git a/web/task_float.js b/web/task_float.js index 5d737876..91fa9396 100644 --- a/web/task_float.js +++ b/web/task_float.js @@ -7,7 +7,8 @@ import { api } from '../../scripts/api.js'; import { app } from '../../scripts/app.js'; import { jobs, imageSource, progressSource, chainSource, queueSource, journalSource, ACTIVE, FINAL } from './task_store.js'; import { errorText, failureAdvice } from './error_panel.js'; -import { createImageGenClient, imageGenError, imageReportBar } from './image_generation.js'; +import { createImageGenClient, imageGenError, imageReportBar, lostEngineText, WAITING_TEXT } from './image_generation.js'; +import { exitCause, newEngineExit, watchEngineExit } from './engine_exit.js'; import { saveGeneratedImage } from './image_library.js'; import { isChinese, translator } from './i18n.js'; @@ -27,7 +28,9 @@ const outputURL = file => api.apiURL('/view?' + new URLSearchParams({filename: f export function startJobSources() { if (sourcesStarted) return; sourcesStarted = true; let storage = null; try { storage = globalThis.localStorage; } catch { /* Private windows keep jobs in memory only. */ } - imageSource(jobs, {client: createImageGenClient(), storage}); + // Why FreeVideo went away while a picture was being made, as the launcher saw it end (#1121). + void watchEngineExit(api); + imageSource(jobs, {client: createImageGenClient(), storage, connection: api, lastExit: async () => exitCause(await newEngineExit(api))}); // The request the engine runs on each node now, from its own events: a plain (one graphics card) run's progress // names no request, so this keeps every queued video a row of its own (task_store.js progressSource). const runningOn = new Map(); @@ -165,10 +168,10 @@ const VIEW_NAMES = {image: ['Images', '图像视图'], studio: ['Create', '创 const kindText = row => viewFor(row) === 'editor' ? t('Edit', '剪辑生成') : t(...(KIND[row.kind] || KIND.video)); const clock = seconds => { const s = Math.max(0, Math.floor(seconds)); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`; }; // Short enough for the card's one line next to the count and Stop. -const etaText = seconds => !Number.isFinite(seconds) ? '' : seconds >= 60 ? t(`About ${Math.ceil(seconds / 60)} min left`, `还需约 ${Math.ceil(seconds / 60)} 分钟`) : t('Under 1 min left', '不到 1 分钟'); +const etaText = seconds => !Number.isFinite(seconds) ? '' : seconds >= 60 ? t('About {minutes} min left', '还需约 {minutes} 分钟', { minutes: Math.ceil(seconds / 60) }) : t('Under 1 min left', '不到 1 分钟'); const elapsedText = row => `${t('Elapsed', '已用时')} ${clock((Date.now() - (row.started_at || row.created_at || Date.now())) / 1000)}`; const percentOf = row => Math.floor(100 * (Number.isFinite(row.percent) ? row.percent : 0)); -const part = row => row.meta?.parts > 1 && row.meta?.part ? t(` · part ${row.meta.part}/${row.meta.parts}`, ` · 第 ${row.meta.part}/${row.meta.parts} 段`) : ''; +const part = row => row.meta?.parts > 1 && row.meta?.part ? t(' · part {part}/{parts}', ' · 第 {part}/{parts} 段', { part: row.meta.part, parts: row.meta.parts }) : ''; function stateWord(row) { if (row.status === 'running') return null; return {submitting: t('Starting', '正在开始'), queued: t('Queued', '排队中'), cancelling: t('Stopping', '正在停止'), done: t('Done', '已完成'), @@ -176,15 +179,18 @@ function stateWord(row) { } function reasonShort(row) { const code = row.failure?.code; - if (code === 'engine_closed') return t('The engine was closed', '引擎已关闭'); - if (code === 'engine_restarted' || row.status === 'interrupted') return t('The engine restarted', '引擎已重启'); + if (code === 'engine_closed') return t('Connection lost', '连接中断'); + // Short enough for the card's line (Lane, copy_lane.float_short); the hover and the opened card say it whole. + if (code === 'engine_restarted' || row.status === 'interrupted') return t('Restarted', '已重新启动'); return t('Open for the reason', '点开查看原因'); } function reasonLong(row) { const code = row.failure?.code; - if (code === 'engine_closed') return t('FreeVideo stopped answering while this was being made. Start FreeVideo again, then generate again.', '生成过程中 FreeVideo 停止了响应。重新启动 FreeVideo 后再生成一次。'); - if (code === 'engine_restarted' || row.status === 'interrupted') return t('FreeVideo restarted while this was being made, so it did not finish. Finished parts are in your works.', 'FreeVideo 在生成过程中重新启动,这次没有完成。已经完成的部分在作品里。'); - if (row.kind === 'image') return imageGenError(code, row.failure, t) || t('The picture did not finish.', '这张图没有完成。'); + // A picture: why FreeVideo went away, as far as the launcher saw it end, and what next (#1121). + if (row.kind === 'image' && (code === 'engine_closed' || code === 'engine_restarted')) return lostEngineText(code, row.failure?.cause, t).join(t(' ', '')); + if (code === 'engine_closed') return lostEngineText(code, row.failure?.cause, t).join(t(' ', '')); + if (code === 'engine_restarted' || row.status === 'interrupted') return t('FreeVideo restarted while this was being made, so it did not finish. Finished parts are in your creations.', 'FreeVideo 在生成过程中重新启动,这次没有完成。已经完成的部分在作品里。'); + if (row.kind === 'image') return imageGenError(code, row.failure, t) || t('The image did not finish.', '这张图没有完成。'); // The engine's own text is raw; it goes through the same advice as the create panel, and an unknown cause says so. const told = row.failure?.message ? failureAdvice(String(row.failure.message), t) : null; if (told?.summary) return told.summary + t(' ', '') + told.action; @@ -197,10 +203,12 @@ function reasonLong(row) { 'FreeVideo 没有给出这段视频失败的原因。请重试,仍然失败请提交问题。'); } function line2(row) { + // Waiting for FreeVideo to come back (#1121): said, with the stop button turned into "Stop waiting". + if (row.meta?.reconnecting && ACTIVE.has(row.status)) return t(...WAITING_TEXT.short); if (row.status === 'running') return etaText(row.eta_seconds) || elapsedText(row); if (row.status === 'queued' || row.status === 'submitting') return t('Starts after the one before it', '等前一项完成后开始'); if (row.status === 'cancelling') return elapsedText(row); - if (row.status === 'done') return t('Saved to your works', '已存入作品'); + if (row.status === 'done') return t('Saved to your creations', '已存入作品'); return reasonShort(row); } @@ -249,10 +257,10 @@ export function confirmStop(anchor, {kind = 'video', queued = false, host = null if (agent) { title.textContent = queued ? t('Remove from the queue?', '取消排队?') : t('Stop this step?', '停止这一步?'); text.textContent = queued ? t('It has not started; it will not run.', '这一步还没有开始,取消后不会进行。') - : t('What this step has made so far is not kept. Finished works stay.', '这一步做到一半的不会保留,已经完成的作品不受影响。'); + : t('What this step has made so far is not kept. Finished creations stay.', '这一步做到一半的不会保留,已经完成的作品不受影响。'); } else text.textContent = queued ? t('It has not started; it will not be made.', '这项还没有开始,取消后不会生成。') : voice ? t('Lines already dubbed are kept; the rest can be dubbed again later.', '已配好的台词会保留,其余台词可以稍后重新配音。') - : kind === 'image' ? t('This picture will not be kept.', '这张图不会保留。') : t('What has been made so far is not kept. Queued jobs go on.', '已生成的部分不会保留,排队的任务照常进行。'); + : kind === 'image' ? t('This image will not be kept.', '这张图不会保留。') : t('What has been made so far is not kept. Queued jobs go on.', '已生成的部分不会保留,排队的任务照常进行。'); const ask = el('div', 'sgf-ask'), acts = el('div', 'sgf-acts'); const keep = el('button', 'pill line'), stop = el('button', 'pill danger'); keep.type = stop.type = 'button'; keep.textContent = agent ? t('Keep going', '继续') : voice ? t('Keep dubbing', '继续配音') : t('Keep going', '继续生成'); stop.textContent = queued ? t('Remove', '取消排队') : t('Stop', '停止'); @@ -565,22 +573,26 @@ export function installTaskFloat() { $('.sgf-l2').textContent = stopError && row.id === ask ? stopError : line2(row) + (row.status === 'running' ? part(row) : ''); more.hidden = list.length < 2; more.innerHTML = `${list.length}${open ? ICON.down : ICON.up}`; more.setAttribute('aria-expanded', String(open)); - more.setAttribute('aria-label', t(`${list.length} jobs`, `${list.length} 项任务`)); + more.setAttribute('aria-label', t('{count} jobs', '{count} 项任务', { count: list.length })); // While the list is open it speaks for itself (names and states): the count button gives no tip over it. if (open) for (const key of ['fvTipName', 'fvTipUse', 'fvTipKey']) delete more.dataset[key]; else tip(more, t('Jobs', '任务列表'), t('Show every job in progress', '展开全部进行中的任务')); const stoppable = ACTIVE.has(row.status) && row.cancellable !== false && row.status !== 'cancelling'; close.hidden = ACTIVE.has(row.status) && !stoppable; close.innerHTML = stoppable ? ICON.stop : ICON.x; - close.setAttribute('aria-label', stoppable ? t('Stop', '停止') : t('Dismiss', '收起')); - if (stoppable) tip(close, t('Stop', '停止'), t('Stop this generation (asks first)', '停止这次生成(会先确认)')); - else tip(close, t('Dismiss', '收起'), row.status === 'done' ? t('Hide this; the result stays in your works', '收起提示,成品仍在作品里') : t('Hide this message', '收起这条提示')); + const waiting = Boolean(row.meta?.reconnecting) && ACTIVE.has(row.status); + F.classList.toggle('waiting', waiting); + close.setAttribute('aria-label', waiting ? t(...WAITING_TEXT.stop) : stoppable ? t('Stop', '停止') : t('Dismiss', '收起')); + if (waiting) tip(close, t(...WAITING_TEXT.stop), t(...WAITING_TEXT.status)); + else if (stoppable) tip(close, t('Stop', '停止'), t('Stop this generation (asks first)', '停止这次生成(会先确认)')); + else tip(close, t('Dismiss', '收起'), row.status === 'done' ? t('Hide this; the result stays in your creations', '收起提示,成品仍在作品里') : t('Hide this message', '收起这条提示')); const action = state === 'done' ? [t('Open', '打开'), t('See what was made', '查看这次生成的成品')] : state === 'fail' ? [t('See why', '查看原因'), t('Reason, what to do, and the report', '原因、可做的事和诊断报告')] : [t('Back to it', '回到生成'), t('Return to the generation; nothing restarts', '展开回生成画面,进度不中断')]; // The hover tip says the whole state, whatever the card had to shorten, then what a click does. - const full = `${[label.textContent, l1.querySelector('.sgf-p')?.textContent].filter(Boolean).join(' ')} · ${$('.sgf-l2').textContent}`; - tip(card, full, `${action[0]}:${action[1]}`.replace(':', cn ? ':' : ': '), 'Enter'); + const whole = row.meta?.reconnecting && ACTIVE.has(row.status) ? t(...WAITING_TEXT.status) : state === 'fail' && row.kind === 'image' && lostEngineText(row.failure?.code, row.failure?.cause, t)?.[0]; + const full = `${[label.textContent, l1.querySelector('.sgf-p')?.textContent].filter(Boolean).join(' ')} · ${whole || $('.sgf-l2').textContent}`; + tip(card, full, t('{name}: {use}', '{name}:{use}', { name: action[0], use: action[1] }), 'Enter'); card.setAttribute('aria-label', `${full}. ${action[0]}`); drawSheet(list); if (!shown) show(); @@ -616,7 +628,7 @@ export function installTaskFloat() { const row = rows.find(r => r.id === failCard); const box = el('div', 'sgf-fail'); box.setAttribute('role', 'dialog'); box.setAttribute('aria-label', t('What happened', '发生了什么')); const title = el('b'), text = el('p', 'fv-selectable'), acts = el('div', 'sgf-acts'); - title.textContent = row.kind === 'image' ? t("The picture didn't finish", '这张图没有完成') : t("The video didn't finish", '这段视频没有完成'); + title.textContent = row.kind === 'image' ? t("The image didn't finish", '这张图没有完成') : t("The video didn't finish", '这段视频没有完成'); text.textContent = reasonLong(row); const report = row.failure?.report_id || row.meta?.report_id; if (report && row.kind === 'image') { @@ -635,14 +647,14 @@ export function installTaskFloat() { tip(dismiss, dismiss.textContent, t('Hide this message', '收起这条提示'), 'Esc'); acts.append(back, dismiss); box.append(title, text, acts); sheet.append(box); } else if (open && list.length > 1) { - const head = el('header'); const count = el('b'); count.textContent = t(`${list.length} jobs`, `${list.length} 项任务`); head.append(count); sheet.append(head); + const head = el('header'); const count = el('b'); count.textContent = t('{count} jobs', '{count} 项任务', { count: list.length }); head.append(count); sheet.append(head); for (const row of list) { const line = el('button', 'sgf-row'); line.type = 'button'; line.dataset.k = 'go'; line.dataset.id = row.id; line.dataset.st = row.status === 'running' ? 'run' : ACTIVE.has(row.status) ? 'queue' : row.status === 'done' ? 'done' : 'fail'; const th = el('span', 'sgf-rth'), pic = el('i', 'sgf-img'); th.append(pic, Object.assign(el('i', 'sgf-glyph', row.kind === 'image' ? ICON.image : ICON.video))); paintThumb(pic, row); const tx = el('span', 'sgf-rtx'), name = el('b'), sub = el('span'); // A row's title is its kind, never its prompt (a prompt belongs to the work only). - name.textContent = row.kind === 'image' ? t('Picture', '图片任务') : viewFor(row) === 'editor' ? t('Edit', '剪辑任务') : t('Video', '视频任务'); + name.textContent = row.kind === 'image' ? t('Image', '图片任务') : viewFor(row) === 'editor' ? t('Edit', '剪辑任务') : t('Video', '视频任务'); sub.textContent = `${t(...(VIEW_NAMES[viewFor(row)] || VIEW_NAMES.studio))} · ${row.status === 'running' ? `${percentOf(row)}%` : stateWord(row)}`; tx.append(name, sub); line.append(th, tx); if (row.status === 'running') { const bar = el('i', 'sgf-rbar'), fill = el('b'); fill.style.width = `${percentOf(row)}%`; bar.append(fill); line.append(bar); } @@ -852,6 +864,8 @@ export function installTaskFloat() { drawSheet(); draw(); return; } if (button === close) { + // Waiting for FreeVideo: nothing can reach it to stop the job, so the button stops waiting (#1121). + if (row.meta?.reconnecting && ACTIVE.has(row.status)) { jobs.stopWaiting(row.id); draw(); return; } if (ACTIVE.has(row.status)) { ask = row.id; stopError = ''; open = false; failCard = null; drawSheet(); setTimeout(() => sheet.querySelector('[data-k="keep"]')?.focus({preventScroll: true}), 0); } else { jobs.dismiss(row.id); } return; diff --git a/web/task_groups.js b/web/task_groups.js index 8f380ca2..0fa2d50c 100644 --- a/web/task_groups.js +++ b/web/task_groups.js @@ -25,7 +25,7 @@ export function applyTasks({cards, rows, order, open = null, selecting = false, card.hidden = !!folded && !head && !shown; if (head && !selecting) { card.setAttribute('aria-expanded', String(shown)); - card.setAttribute('aria-label', t(`${group.length} results`, `${group.length} 个结果`)); + card.setAttribute('aria-label', t('{count} results', '{count} 个结果', { count: group.length })); // A folded cover stands for every video under it. if (!shown) card.setAttribute('aria-pressed', String(group.includes(selected))); } else { diff --git a/web/task_store.js b/web/task_store.js index 4afbfede..8ca9c311 100644 --- a/web/task_store.js +++ b/web/task_store.js @@ -173,6 +173,8 @@ export function createJobStore({now = () => Date.now(), storage = null} = {}) { localOf: id => local[id] || null, async refresh() { await Promise.all([...new Set(sources.values())].map(source => source.refresh?.().catch?.(() => {}))); }, // For sources only. + // A job waiting for FreeVideo to come back (meta.reconnecting): its source stops waiting and ends it (#1121). + stopWaiting(id) { const row = rows.get(id), source = sourceOf(row); return Boolean(source?.stopWaiting?.(id)); }, upsert, addSource(name, source) { sources.set(name, source); return () => { if (sources.get(name) === source) sources.delete(name); }; }, now, }; @@ -189,34 +191,59 @@ export const IMAGE_BUSY = new Set(['busy', 'busy_video']); export function imageSource(store, {client, storage = null, poll = 500, now = store.now, sleep = ms => new Promise(done => setTimeout(done, ms)), progress = defaultImageProgress, objectURL = blob => URL.createObjectURL(blob), revokeURL = url => URL.revokeObjectURL(url), - outageLimit = 8, newId = () => 'img-' + now().toString(36) + '-' + Math.random().toString(36).slice(2, 8)} = {}) { + outageLimit = 2, reconnectFor = 120000, lastExit = async () => null, connection = null, + newId = () => 'img-' + now().toString(36) + '-' + Math.random().toString(36).slice(2, 8)} = {}) { // The resume list holds the worker's job key, the model and the view: no prompt (old entries lose theirs on load). - const keys = readJSON(storage, IMAGE_KEY), tracking = new Set(); + const keys = readJSON(storage, IMAGE_KEY), tracking = new Set(), missed = new Map(); // id → the last failed asks, for Stop waiting + // The page's socket to ComfyUI closing (its 'reconnecting' event) wakes every poll at once: two failed asks in a row + // and the page says it is waiting, within seconds of FreeVideo going away instead of after the backoff (#1121). + const wakers = new Set(); + const nap = ms => new Promise(done => { const wake = () => { wakers.delete(wake); done(); }; wakers.add(wake); void Promise.resolve(sleep(ms)).then(wake); }); + connection?.addEventListener?.('reconnecting', () => { for (const wake of [...wakers]) wake(); }); if (Object.values(keys).some(entry => entry && 'prompt' in entry)) { for (const entry of Object.values(keys)) if (entry) delete entry.prompt; writeJSON(storage, IMAGE_KEY, keys); } // A page may hand its own client for its jobs; jobs found after a reload use the default. Only a client that says // standIn: true (a stand-in engine) keeps its pictures out of the library. const clients = new Map(), clientOf = id => clients.get(id) || client; const save = () => writeJSON(storage, IMAGE_KEY, keys); const forget = id => { delete keys[id]; save(); }; + // Why FreeVideo went away, as the launcher saw it end (engine_exit.js exitCause): asked once the page can reach it. + const causeOf = async () => { try { return await lastExit(); } catch { return null; } }; async function track(id) { if (tracking.has(id)) return; tracking.add(id); - let serial = 0, outages = 0, preview = store.get(id)?.meta?.preview || ''; + // misses: the kind of the last failed asks (connection_lost, engine_error, http_502...); lostSince: when the page + // began to wait for FreeVideo to come back (#1121: an engine_closed that said nothing of why). + let serial = 0, outages = 0, preview = store.get(id)?.meta?.preview || '', misses = [], lostSince = null; try { for (;;) { const entry = keys[id], row = store.get(id); if (!entry || !row || FINAL.has(row.status)) return; - await sleep(poll); + if (!outages) await nap(poll); // during an outage the backoff below is the wait let status; try { status = await clientOf(id).status(entry.job, entry.model); outages = 0; } catch (error) { if (GONE.has(error?.code)) { - store.upsert({id, status: 'interrupted', failure: {code: 'engine_restarted'}}); forget(id); return; + // FreeVideo came back without this job: it was restarted. Why it stopped is the launcher's to say. + const cause = await causeOf(); + store.upsert({id, status: 'interrupted', failure: {code: 'engine_restarted', ...(cause ? {cause} : {}), + ...(misses.length ? {misses} : {})}, meta: {reconnecting: null}}); + forget(id); return; } - // The engine is unreachable: a few misses are a reset, a run of them is a closed engine. - if (++outages >= outageLimit) { store.upsert({id, status: 'failed', failure: {code: 'engine_closed'}}); forget(id); return; } - await sleep(Math.min(8000, poll * 2 ** outages)); continue; + misses = [...misses, missWord(error?.step && error.step !== 'start' ? error.step + : error?.code || (error instanceof TypeError ? 'connection_lost' : 'unknown'))].slice(-3); + missed.set(id, misses); + // A few misses are a reset. A run of them: the page says it is waiting for FreeVideo to come back, and + // waits a while longer (the user can stop waiting) before it calls the job lost. + if (++outages >= outageLimit && lostSince === null) { lostSince = now(); store.upsert({id, meta: {reconnecting: {since: lostSince}}}); } + if (lostSince !== null && now() - lostSince >= reconnectFor) { + store.upsert({id, status: 'failed', failure: {code: 'engine_closed', cause: 'unreachable', misses}, meta: {reconnecting: null}}); + forget(id); return; + } + // Asked again soon enough that FreeVideo coming back is seen within a few seconds. + await nap(Math.min(4000, poll * 2 ** Math.min(outages, 3))); continue; } + if (lostSince !== null) { lostSince = null; store.upsert({id, meta: {reconnecting: null}}); } + misses = []; missed.delete(id); const state = status.state === 'error' ? (status.error === 'cancelled' ? 'cancelled' : 'failed') : IMAGE_STATES[status.state] || 'running'; const percent = state === 'done' ? 1 : progress(status.stage, status.fraction, entry.withImages, status.overall); const patch = {id, status: status.phase === 'cancelling' ? 'cancelling' : state, phase: status.stage || (state === 'queued' ? 'waiting' : ''), @@ -272,6 +299,14 @@ export function imageSource(store, {client, storage = null, poll = 500, now = st void track(id); return {id}; }, + // The user stops waiting for FreeVideo to come back: the job ends now as lost, with what the page saw. + stopWaiting(id) { + const row = store.get(id); + if (!row?.meta?.reconnecting || FINAL.has(row.status)) return false; + const misses = missed.get(id) || []; missed.delete(id); + store.upsert({id, status: 'failed', failure: {code: 'engine_closed', cause: 'stopped_waiting', ...(misses.length ? {misses} : {})}, meta: {reconnecting: null}}); + forget(id); return true; + }, async cancel(row) { const entry = keys[row.id]; if (!entry) return; // Not sent yet: submit sends the cancel once it has the key. @@ -291,6 +326,9 @@ export function imageSource(store, {client, storage = null, poll = 500, now = st store.addSource('image', source); return source; } +// What a failed ask was, for the problem report (#1121): a fixed word (connection_lost, engine_error, http_502...), +// never the server's text, a prompt or a file name; anything else is 'other'. +export const missWord = value => typeof value === 'string' && /^[a-z][a-z0-9_]{0,31}$/.test(value) ? value : 'other'; const pick = value => value && typeof value === 'object' ? Object.fromEntries(['report_id', 'stage', 'step', 'fitted', 'memory', 'other_usage', 'message_zh'] .filter(key => value[key] !== undefined).map(key => [key, value[key]])) : {}; diff --git a/web/theme.css b/web/theme.css index 73b3eb4b..039de59e 100644 --- a/web/theme.css +++ b/web/theme.css @@ -33,6 +33,15 @@ font-family:var(--fv-font); color-scheme:dark; } +/* Traditional Chinese (web/i18n.js marks the page) reads in Taiwan fonts and Taiwan glyph forms. */ +:root[data-fv-language="zh-Hant"], +:root[data-fv-language="zh-Hant"] :where(.fv-phone,.fv-lan,.fv-studio,.fv-setup,.fv-panel,.fv-generation-progress,.fv-view-navigation,.fv-prompt-guide,.fv-failure-dialog,.fv-reference-picker,.fv-release-notes,.fv-whatsnew,.fv-image-editor,.fv-cast-dialog,.fv-tutorial-book,.fv-feature-tour){ + --fv-font:-apple-system,BlinkMacSystemFont,"Segoe UI Variable Text","Segoe UI","FreeVideo Quotes", + "PingFang TC","Microsoft JhengHei UI","Noto Sans CJK TC","Noto Sans TC",system-ui,sans-serif; +} +:root[data-fv-language="zh-Hant"] .sgf{font-family:"Inter","Segoe UI","PingFang TC","Microsoft JhengHei UI","Noto Sans CJK TC",system-ui,sans-serif} +/* Japanese breaks lines by its own rules: a small kana (ッ, ャ) or a prolonged sound mark never starts a line. */ +:root[data-fv-language="ja"],:lang(ja){line-break:strict} .fv-wordmark{display:block;width:210px;height:auto;max-width:100%;object-fit:contain} :where(.fv-studio,.fv-setup,.fv-panel,.fv-view-navigation){overflow-wrap:anywhere} :where(.fv-studio,.fv-setup,.fv-panel) :is(input,select,textarea,button){font-family:inherit} diff --git a/web/timed_prompt.js b/web/timed_prompt.js index 3df509f9..c3818a99 100644 --- a/web/timed_prompt.js +++ b/web/timed_prompt.js @@ -1,9 +1,11 @@ // Subtitle-style timed lines in a description, turned into MiniMax H3's timed prompt notation. // Same function as freevideo_engine/timed_prompt.py; both are checked against tests/fixtures/timed_prompt_cases.json. +// A new shot is written "Cut: ..." or "切:..." in any language; a language file may name its own word for it +// (_meta.keywords.cut in web/locales/.json), which is read in that language's page as well. +import { KEYWORDS, keywordList, keywordSource } from './i18n.js'; + const TIME = /^[ \t ]*(\d{1,3}):([0-5]\d)(?:\.(\d{1,3}))?(?![\d.:])[ \t ]*([^\r\n]*)$/; const LOOSE = /^[ \t ]*\d{1,3}:\d{1,2}(?![\d:])/; -const CUT = /^(?:cut|CUT|Cut|切)[ \t ]*[::][ \t ]*([^\r\n]*)$/; -const CUT_BARE = /^(?:cut|CUT|Cut|切)$/; const SPEECH = /^@?([^::\s ][^::]{0,11}?)[ \t ]*[::][ \t ]*(\S[^\r\n]*)$/; const NAME_BREAK = /[,.;!?,。;!?]/; const WRITTEN = /\[Shot \d+\]|\bAt \d{2,}:\d{2}\.\d{3}/; @@ -41,6 +43,17 @@ function ukrainian(words) { return ukrainianWords > russianWords; } +// The cut word of a line ("Cut:", "切:", and the language's own, see _meta.keywords.cut), compiled once for a list of words. +const cutPatterns = new Map(); +function cuts(words) { + const own = keywordList(words), key = own.join('\u0001'); + if (!cutPatterns.has(key)) { + const source = keywordSource('cut', own); + cutPatterns.set(key, {line: new RegExp(`^${source}[ \\t ]*[::][ \\t ]*([^\\r\\n]*)$`), bare: new RegExp(`^${source}$`)}); + } + return cutPatterns.get(key); +} + export function language(words) { if (/[぀-ヿ]/.test(words)) return 'Japanese'; if (/[가-힯]/.test(words)) return 'Korean'; @@ -58,8 +71,8 @@ function sentence(words) { return words + (CJK.test(words) ? '。' : '.'); } -export function parse(text) { - const head = [], lines = [], errors = []; +export function parse(text, cutWords = KEYWORDS.cut) { + const head = [], lines = [], errors = [], {line: CUT, bare: CUT_BARE} = cuts(cutWords); text.split(/\r\n|\r|\n/).forEach((raw, index) => { const n = index + 1, found = TIME.exec(raw); if (!found) { @@ -79,9 +92,9 @@ export function parse(text) { return [head, lines, errors]; } -export function convert(text, seconds, speakers = null, offset = 0) { +export function convert(text, seconds, speakers = null, offset = 0, cutWords = KEYWORDS.cut) { if (typeof text !== 'string' || WRITTEN.test(text)) return {text, errors: [], timed: false}; - const [head, lines, errors] = parse(text); + const [head, lines, errors] = parse(text, cutWords); if (!lines.length && !errors.length) return {text, errors: [], timed: false}; const limit = Math.round(seconds * 1000), kept = []; const shift = Math.round(offset * 1000); @@ -121,26 +134,26 @@ export function convert(text, seconds, speakers = null, offset = 0) { const shortClock = seconds => `${Math.floor(seconds / 60)}:${pad(Math.floor(seconds % 60), 2)}`; // The first line the user has to fix, in one sentence; '' when every timed line can be used. -export function problem(text, seconds, t, offset = null) { - const {errors} = convert(text, seconds, null, offset ?? 0); +export function problem(text, seconds, t, offset = null, cutWords = KEYWORDS.cut) { + const {errors} = convert(text, seconds, null, offset ?? 0, cutWords); if (!errors.length) return ''; const {line, code} = errors[0], raw = text.split(/\r\n|\r|\n/)[line - 1] || ''; const time = (/^[ \t ]*(\d{1,3}:\d{1,3}(?:\.\d{1,3})?)/.exec(raw) || [, ''])[1]; const length = shortClock(seconds); if (code === 'out_of_range' && offset !== null) { const range = `${shortClock(offset)}\u2060–\u2060${shortClock(offset + seconds)}`; - return t(`Line ${line} is at ${time}, outside this part (${range}). Change it to a time within this part.`, - `第 ${line} 行的时间 ${time} 超出这一段(${range}),请改为这段内的时间。`); + return t('Line {line} is at {time}, outside this part ({range}). Change it to a time within this part.', + '第 {line} 行的时间 {time} 超出这一段({range}),请改为这段内的时间。', { line, time, range }); } - if (code === 'out_of_range') return t(`Line ${line} is at ${time}, beyond the video length (${length}). Change it to a time within ${length}.`, - `第 ${line} 行的时间 ${time} 超出视频时长(${length}),请改为 ${length} 以内的时间。`); - if (code === 'empty_cut') return t(`Line ${line} has nothing after the cut. Describe the new shot.`, `第 ${line} 行的“切:”后面没有内容,请写出新镜头的画面。`); - return t(`The time "${time}" on line ${line} is not valid. Write it as minutes:seconds, for example 0:05.`, - `第 ${line} 行的时间“${time}”无法识别,请按“分:秒”书写,例如 0:05。`); + if (code === 'out_of_range') return t('Line {line} is at {time}, beyond the video length ({length}). Change it to a time within {length}.', + '第 {line} 行的时间 {time} 超出视频时长({length}),请改为 {length} 以内的时间。', { line, time, length }); + if (code === 'empty_cut') return t('Line {line} has nothing after the cut. Describe the new shot.', '第 {line} 行的“切:”后面没有内容,请写出新镜头的画面。', { line }); + return t('The time "{time}" on line {line} is not valid. Write it as minutes:seconds, for example 0:05.', + '第 {line} 行的时间“{time}”无法识别,请按“分:秒”书写,例如 0:05。', { time, line }); } // What the model and the generator read: the converted text, or the typed text while a line is unusable. -export function timedText(text, seconds, offset = 0) { - const done = convert(text, seconds, null, offset); +export function timedText(text, seconds, offset = 0, cutWords = KEYWORDS.cut) { + const done = convert(text, seconds, null, offset, cutWords); return done.errors.length ? text : done.text; } diff --git a/web/tokens.css b/web/tokens.css index 488afb0d..4cdc03f3 100644 --- a/web/tokens.css +++ b/web/tokens.css @@ -57,6 +57,7 @@ --fv-rad-dock:20px; /* ▲ changed 22→20 · dock panel, sheet, floating window card */ --fv-rad-console:24px; /* ▲ changed 26→24 · console, dialog (12 pad + 12 control) */ --fv-rad-pill:999px; /* tabs, status capsule, filter chips */ + --fv-col-w:300px; /* side column of the picture view and of the creation panel (one width, both views) */ /* ── 5 · Heights ───────────────────────────────────────────────────────────────────────── */ --fv-ctl-s:28px; /* compact control, toolbar icon button in dense panels */ diff --git a/web/tooltip.js b/web/tooltip.js index a290c091..280a6c7c 100644 --- a/web/tooltip.js +++ b/web/tooltip.js @@ -14,7 +14,8 @@ // the words a hover shows; the moment a view writes its own attributes, the copy steps aside. import { TIPS, MATCHES, LABELS } from './tooltip_copy.js'; import { installA11y } from './a11y.js'; -import { isChinese } from './i18n.js'; +import { isChinese, translator } from './i18n.js'; +import { englishOf } from './i18n_tables.js'; if (globalThis.document?.head && !globalThis.document.head.querySelector?.('link[data-fv-sheet=tooltip]')) { const sheet = document.createElement('link'); @@ -23,8 +24,8 @@ if (globalThis.document?.head && !globalThis.document.head.querySelector?.('link } const query = new URLSearchParams(globalThis.location?.search || ''); -const cn = isChinese(); -const pick = value => Array.isArray(value) ? value[cn ? 1 : 0] : value; +const t = translator(isChinese()); +const pick = value => Array.isArray(value) ? t(...value) : value; export const SHOW_DELAY = 500, HIDE_DELAY = 100, WARM_FOR = 700, GAP = 8, MARGIN = 8, LONG_PRESS = 500, MAX_WIDTH = 320; const timing = {show: SHOW_DELAY, hide: HIDE_DELAY, warm: WARM_FOR}; @@ -117,8 +118,9 @@ export function copyFor(element) { if (matched !== undefined) return matched; const label = labelOf(element); if (!label) return null; + const names = [label, ...englishOf(label)]; for (const [pattern, id, within] of LABELS) { - if (!pattern.test(label)) continue; + if (!names.some(name => pattern.test(name))) continue; if (within && !element.closest?.(within)) continue; return TIPS[id] ? {id, entry: TIPS[id]} : null; } @@ -490,7 +492,8 @@ function collect(root) { } const labelHit = element => { const label = labelOf(element); - const hit = label && LABELS.find(([pattern, , within]) => pattern.test(label) && (!within || element.closest(within))); + const names = label ? [label, ...englishOf(label)] : []; + const hit = label && LABELS.find(([pattern, , within]) => names.some(name => pattern.test(name)) && (!within || element.closest(within))); return hit && TIPS[hit[1]] ? {id: hit[1], entry: TIPS[hit[1]]} : null; }; diff --git a/web/tooltip_copy.js b/web/tooltip_copy.js index 1d0416b0..855594b9 100644 --- a/web/tooltip_copy.js +++ b/web/tooltip_copy.js @@ -35,8 +35,8 @@ export const TIPS = { 'lan.save': {name: ['Save', '保存'], use: ['Phones will need this password', '保存后手机要输入这个密码']}, // ── Create ─────────────────────────────────────────────────────────────────────────────────── - 'studio.generate': {name: ['Generate video', '生成视频'], use: ['Make a video from the description and settings', '按描述和设置生成视频'], key: `${mod}Enter`, - off: ['Write a description or add a picture first', '先写描述或添加图片']}, + 'studio.generate': {name: ['Generate video', '生成视频'], use: ['Make a video from the prompt and settings', '按提示词和设置生成视频'], key: `${mod}Enter`, + off: ['Write a prompt or add an image first', '先写提示词或添加图片']}, 'studio.mode': {name: ['Generation mode', '生成方式'], use: ['Once, a batch, or keep going until stopped', '单次、批量或一直生成']}, 'studio.mode.single': {name: ['Single', '单次'], use: ['One video per press', '每按一次生成一个']}, 'studio.mode.batch': {name: ['Batch', '批量'], use: ['Several videos in a row, each a new take', '连续生成多个不同版本']}, @@ -49,43 +49,43 @@ export const TIPS = { 'studio.recent': {name: ['Recent creations', '最近作品'], use: ['Show or hide the strip of recent videos', '显示或收起最近作品栏']}, 'studio.recentCard': {byLabel: true, name: ['Recent results', '最近作品'], use: ['Open these results where they were made', '打开这组结果,回到它的画面']}, 'studio.regenerate': {name: ['Regenerate', '重新生成'], use: ['Same settings, a new take', '同样的设置,再生成一版']}, - 'studio.mention': {name: ['Mention', '提及'], use: ['Refer to a picture or character in the text', '在描述里引用图片或人物'], key: '@'}, - 'studio.guide': {name: ['Writing guide', '描述写法'], use: ['How to describe a scene well', '怎样写出效果更好的描述']}, - 'studio.enhanceGuide': {name: ['About enhancement', '关于提示词增强'], use: ['How descriptions are rewritten', '了解描述是怎样被改写的']}, - 'studio.enhance': {name: ['Prompt enhancement', '提示词增强'], use: ['Rewrite the description in more detail', '把描述自动改写得更详细']}, - 'studio.enhance.original': {name: ['Original', '原文'], use: ['See the description as you wrote it', '查看你写的原始描述']}, - 'studio.enhance.rewritten': {name: ['Rewritten', '改写'], use: ['See the enhanced description', '查看增强后的描述']}, - 'studio.enhance.redo': {name: ['Rewrite again', '重新改写'], use: ['Get another rewrite of the description', '换一种写法再改写一次']}, + 'studio.mention': {name: ['Mention', '提及'], use: ['Refer to an image or character in the text', '在描述里引用图片或人物'], key: '@'}, + 'studio.guide': {name: ['Writing guide', '提示词写法'], use: ['How to describe a scene well', '怎样写出效果更好的描述']}, + 'studio.enhanceGuide': {name: ['About enhancement', '关于提示词增强'], use: ['How prompts are rewritten', '了解提示词是怎样被改写的']}, + 'studio.enhance': {name: ['Prompt enhancement', '提示词增强'], use: ['Rewrite the prompt in more detail', '把提示词自动改写得更详细']}, + 'studio.enhance.original': {name: ['Original', '原文'], use: ['See the prompt as you wrote it', '查看你写的原始提示词']}, + 'studio.enhance.rewritten': {name: ['Rewritten', '改写'], use: ['See the enhanced prompt', '查看增强后的提示词']}, + 'studio.enhance.redo': {name: ['Rewrite again', '重新改写'], use: ['Get another rewrite of the prompt', '换一种写法再改写一次']}, 'studio.enhance.cancel': {name: ['Cancel', '取消'], use: ['Stop this rewrite', '停止这次改写']}, 'studio.enhance.install': {name: ['Download and turn on', '下载并启用'], use: ['Download the rewriting model, then use it', '下载改写模型后自动启用']}, 'studio.enhance.skip': {name: ['Not now', '暂不启用'], use: ['Write without enhancement; turn on later', '先不下载,之后可再开启']}, 'studio.enhance.license': {name: ['License', '许可协议'], use: ['Read the terms of the rewriting model', '查看改写模型的使用条款']}, - 'studio.draft': {name: ['Restore draft', '恢复草稿'], use: ['Try to read your last description again', '再次读取上次的描述']}, + 'studio.draft': {name: ['Restore draft', '恢复草稿'], use: ['Try to read your last prompt again', '再次读取上次的提示词']}, 'studio.tray.size': {name: ['Frame & size', '画幅与尺寸'], use: ['Pick the frame and the size', '选画幅和尺寸']}, 'studio.tray.quality': {name: ['Quality', '质量'], use: ['Trade speed for detail', '在速度和画面细节之间取舍']}, - 'studio.tray.media': {name: ['Pictures and sound', '素材'], use: ['Reference pictures, first and last frame, sound', '参考图、首尾帧和参考音频']}, + 'studio.tray.media': {name: ['Images and sound', '素材'], use: ['Reference images, first and last frame, sound', '参考图、首尾帧和参考音频']}, 'studio.tray.lora': {name: ['Style add-ons', 'LoRA'], use: ['Add a style or character add-on', '加入风格或人物的附加模型']}, 'studio.tray.advanced': {name: ['Advanced', '高级选项'], use: ['Seed and length details', '种子、分段等细节设置']}, 'studio.shape.16:9': {name: ['Landscape 16:9', '横屏 16:9'], use: ['Wide frame for screens and video sites', '适合电脑和视频网站']}, 'studio.shape.9:16': {name: ['Portrait 9:16', '竖屏 9:16'], use: ['Tall frame for phones and short videos', '适合手机和短视频']}, 'studio.shape.1:1': {name: ['Square 1:1', '方形 1:1'], use: ['Square frame for feeds and avatars', '适合信息流和头像']}, - 'studio.shape.input': {name: ['Match the picture', '跟随图片'], use: ['Use the shape of the added picture', '用添加的图片的比例'], off: ['Add a picture first', '先添加一张图片']}, + 'studio.shape.input': {name: ['Match the image', '跟随图片'], use: ['Use the shape of the added image', '用添加的图片的比例'], off: ['Add an image first', '先添加一张图片']}, 'studio.clarity': {name: ['Clarity', '清晰度'], use: ['Higher is sharper and takes longer', '越高越清楚,生成越慢']}, - 'studio.firstFrame': {name: ['First-frame reference', '首帧参考'], use: ['The video starts from this picture', '视频从这张图开始']}, + 'studio.firstFrame': {name: ['First-frame reference', '首帧参考'], use: ['The video starts from this image', '视频从这张图开始']}, 'studio.lengthEditor': {name: ['Edit', '剪辑视图'], use: ['Build a longer video shot by shot', '在剪辑视图里分段做长视频']}, 'studio.lengthAutopilot': {name: ['Autopilot', 'AI 全自动'], use: ['Let the assistant make a longer video', '让助手分段生成更长的视频']}, 'studio.lengthModel': {name: ['Download prompt model', '下载提示词模型'], use: ['Plans each part of a long video', '下载后自动规划长视频各段']}, 'studio.range': {name: ['What fits', '可生成范围'], use: ['Sizes and lengths this computer can make', '这台电脑能生成的尺寸和时长']}, 'studio.effort.1': {name: ['Light', '轻量'], use: ['Fastest, with less detail', '最快,细节较少']}, 'studio.effort.2': {name: ['Standard', '标准'], use: ['Balanced speed and detail', '速度和细节均衡']}, - 'studio.effort.3': {name: ['Fine', '精细'], use: ['More detail, takes longer', '细节更多,用时更长']}, - 'studio.effort.4': {name: ['Ultimate', '极致'], use: ['Most detail, takes longest', '细节最多,用时最长']}, - 'studio.twoPass': {name: ['Two-pass acceleration', '二采加速'], use: ['Draft small, then refine: usually faster', '先小后精,通常更快']}, + 'studio.effort.3': {name: ['High', '精细'], use: ['More detail, takes longer', '细节更多,用时更长']}, + 'studio.effort.4': {name: ['Max', '极致'], use: ['Most detail, takes longest', '细节最多,用时最长']}, + 'studio.twoPass': {name: ['Faster second pass', '二采加速'], use: ['Draft small, then refine: usually faster', '先小后精,通常更快']}, 'studio.twoPass.off': {name: ['Off', '关闭'], use: ['Make the full size in one go', '一次生成全分辨率']}, 'studio.twoPass.on': {name: ['On', '开启'], use: ['Draft small, then refine: usually faster', '先小后精,通常更快']}, 'studio.twoPass.preview': {name: ['Generate preview', '生成预览'], use: ['Lower-resolution preview; finish it if you like it', '先出低分辨率预览,满意再继续']}, - 'studio.replacePerson': {name: ['Replace person', '替换人物'], use: ['Put the person from your picture in the video', '把视频里的人换成你图里的人']}, - 'studio.swapRemove': {name: ['Remove picture', '移除人物图'], use: ['Stop using this person picture', '不再使用这张人物图']}, + 'studio.replacePerson': {name: ['Replace person', '替换人物'], use: ['Put the person from your image in the video', '把视频里的人换成你图里的人']}, + 'studio.swapRemove': {name: ['Remove image', '移除人物图'], use: ['Stop using this person image', '不再使用这张人物图']}, 'studio.swapSound': {name: ['Keep source sound', '保留源视频声音'], use: ['The new video keeps the original sound', '新视频沿用原视频的声音']}, 'studio.swapRetry': {name: ['Retry', '重试'], use: ['Download the replacement model again', '重新下载替换人物用的模型']}, 'studio.loraAdd': {name: ['Add', '添加'], use: ['Pick a style add-on to use', '选一个附加模型加入生成']}, @@ -95,8 +95,8 @@ export const TIPS = { 'studio.download': {name: ['Download video', '下载视频'], use: ['Save the MP4 to this computer', '把 MP4 保存到这台电脑']}, 'studio.copyPath': {name: ['Copy path', '复制路径'], use: ['Copy where the video file is stored', '复制视频文件的位置']}, 'studio.reuse': {name: ['Reuse settings', '复用设置'], use: ['Fill the panel with this video’s settings', '把这条视频的设置填回面板']}, - 'studio.extend': {name: ['Continue this video', '接着生成'], use: ['Make the next shot from its last frame', '从最后一帧接着生成下一段']}, - 'studio.favorite': {name: ['Favourite', '收藏'], use: ['Keep it at the top of Creations', '在作品里置顶保留']}, + 'studio.extend': {name: ['Extend this video', '接着生成'], use: ['Make the next shot from its last frame', '从最后一帧接着生成下一段']}, + 'studio.favorite': {name: ['Favorite', '收藏'], use: ['Keep it at the top of Creations', '在作品里置顶保留']}, 'studio.share': {name: ['Share', '分享'], use: ['Make a card or link to send', '做成可发送的卡片或链接']}, 'studio.report': {name: ['Download report', '下载报告'], use: ['Save details that help us fix problems', '保存帮助我们排查问题的信息']}, 'studio.delete': {name: ['Delete', '删除'], use: ['Move this video to Recently deleted', '把视频移到最近删除']}, @@ -104,16 +104,16 @@ export const TIPS = { 'studio.hintSettings': {name: ['Settings', '设置'], use: ['Change this in Settings', '到设置里调整这一项']}, 'studio.hintClose': {name: ['Dismiss', '关闭'], use: ['Hide this hint', '收起这条提示']}, 'cast.add': {byLabel: true, name: ['New', '新建'], use: ['Make one to mention with @ later', '新建后可在描述里用 @ 引用']}, - 'cast.generate': {name: ['Generate picture', 'AI 生成'], use: ['Make a reference picture from words', '用一句话生成一张参考图']}, - 'cast.purpose': {name: ['Use new pictures as', '新图片用途'], use: ['Reference, first frame or last frame', '作参考图、首帧或尾帧']}, - 'cast.drop': {name: ['Pictures', '素材'], use: ['Drop pictures or videos here, or click Add', '把图片或视频拖到这里,或点“添加”']}, + 'cast.generate': {name: ['Generate image', 'AI 生成'], use: ['Make a reference image from words', '用一句话生成一张参考图']}, + 'cast.purpose': {name: ['Use new images as', '新图片用途'], use: ['Reference, first frame or last frame', '作参考图、首帧或尾帧']}, + 'cast.drop': {name: ['Images', '素材'], use: ['Drop images or videos here, or click Add', '把图片或视频拖到这里,或点“添加”']}, // ── Images ─────────────────────────────────────────────────────────────────────────────────── 'image.generate': {name: ['Generate image', '生成图片'], use: ['Make an image from the prompt', '按提示词生成图片'], key: `${mod}Enter`, - off: ['Write a prompt or add a picture first', '先写提示词或添加图片']}, - 'image.addReference': {name: ['Add reference', '添加参考图'], use: ['Guide the result with your own picture', '用你的图片引导生成结果']}, - 'image.useReference': {name: ['Reference', '参考图'], use: ['Show how this picture is used', '查看这张图的用法']}, - 'image.removeReference': {name: ['Remove reference', '移除参考图'], use: ['Generate without this picture', '不再参考这张图']}, + off: ['Write a prompt or add an image first', '先写提示词或添加图片']}, + 'image.addReference': {name: ['Add reference', '添加参考图'], use: ['Guide the result with your own image', '用你的图片引导生成结果']}, + 'image.useReference': {name: ['Reference', '参考图'], use: ['Show how this image is used', '查看这张图的用法']}, + 'image.removeReference': {name: ['Remove reference', '移除参考图'], use: ['Generate without this image', '不再参考这张图']}, 'image.ratio': {name: ['Shape', '比例'], use: ['Width to height of the image', '图片的宽高比例']}, 'image.tier': {name: ['Clarity', '清晰度'], use: ['Higher takes longer, shows more detail', '越高越清楚,用时越长']}, 'image.tier.standard': {name: ['Standard', '标准'], use: ['About 4 MP, quicker', '约 400 万像素,更快']}, @@ -132,14 +132,14 @@ export const TIPS = { 'image.select': {name: ['Select', '选择'], use: ['Pick several images to delete together', '多选图片一起删除']}, 'image.prev': {name: ['Previous', '上一张'], use: ['Show the image before this one', '查看前一张图片'], key: '←', off: ['This is the first image', '已经是第一张']}, 'image.next': {name: ['Next', '下一张'], use: ['Show the image after this one', '查看后一张图片'], key: '→', off: ['This is the last image', '已经是最后一张']}, - 'image.favorite': {name: ['Favourite', '收藏'], use: ['Keep this image easy to find', '收藏这张,方便以后找到']}, + 'image.favorite': {name: ['Favorite', '收藏'], use: ['Keep this image easy to find', '收藏这张,方便以后找到']}, 'image.sort.new': {name: ['Newest first', '最新在前'], use: ['Latest images at the top', '按时间从新到旧排列']}, 'image.sort.old': {name: ['Oldest first', '最早在前'], use: ['Earliest images at the top', '按时间从旧到新排列']}, - 'image.sort.fav': {name: ['Favourites first', '收藏在前'], use: ['Favourite images at the top', '收藏的图片排在前面']}, + 'image.sort.fav': {name: ['Favorites first', '收藏在前'], use: ['Favorite images at the top', '收藏的图片排在前面']}, // ── Edit ───────────────────────────────────────────────────────────────────────────────────── - 'editor.generate': {name: ['Generate', '生成'], use: ['Make the selected stretch from its description', '按描述生成选中的这一段'], key: `${mod}Enter`, - off: ['Select a stretch on the timeline first', '先在时间线上选出一段']}, + 'editor.generate': {name: ['Generate', '生成'], use: ['Make the selected part from its prompt', '按提示词生成选中的这一段'], key: `${mod}Enter`, + off: ['Select a part on the timeline first', '先在时间线上选出一段']}, 'editor.mute': {name: ['Mute', '静音'], use: ['Silence this track for now', '让这条轨暂时没有声音']}, 'editor.solo': {name: ['Solo', '独奏'], use: ['Hear only this track', '只听这一条轨的声音']}, 'editor.lock': {name: ['Lock', '锁定'], use: ['Keep the clips on this track from changing', '锁住这条轨上的片段不被改动']}, @@ -149,8 +149,8 @@ export const TIPS = { 'editor.resave': {name: ['Save again', '重新保存'], use: ['Save the latest changes once more', '再保存一次最近的改动']}, 'editor.scaleHandle': {name: ['Resize', '缩放'], use: ['Drag to scale the picture', '拖动来缩放画面']}, 'editor.cropHandle': {name: ['Crop edge', '裁剪'], use: ['Drag to set what stays in frame', '拖动来调整保留的范围']}, - 'editor.expand': {name: ['Expand', '放大'], use: ['Edit the description in a large box', '在大文本框里编辑描述']}, - 'editor.passOptions': {name: ['Sampling', '采样'], use: ['Quality and two-pass settings for this clip', '这一段的质量和二采']}, + 'editor.expand': {name: ['Expand', '展开'], use: ['Edit the prompt in a large box', '在大文本框里编辑提示词']}, + 'editor.passOptions': {name: ['Sampling', '采样'], use: ['Quality and second pass settings for this clip', '这一段的质量和二采']}, 'editor.music': {byLabel: true, name: ['Music style', '配乐风格'], use: ['Generate music in this style', '按这种风格生成配乐']}, 'editor.voice': {name: ['Voice', '音色'], use: ['Choose the voice for the narration', '选择旁白用的声音']}, 'editor.voice.original': {name: ['Original', '原声'], use: ['Hear the voice before replacing', '听替换前的原声']}, @@ -162,8 +162,8 @@ export const TIPS = { off: ['Select a clip with sound first', '先选中一段有声音的片段']}, 'editor.more': {name: ['More tools', '更多工具'], use: ['Tools that do not fit in the bar', '显示工具栏放不下的工具']}, 'editor.tracks': {name: ['Timeline', '剪辑轨道'], use: ['Clips in time order; drag to arrange', '按时间排列的片段,可拖动']}, - 'editor.notesAgain': {name: ['Regenerate', '重新生成'], use: ['Make this clip again from its description', '按这段描述重新生成这一段'], - off: ['Write a description, or wait for the run to end', '先写描述,或等当前生成结束']}, + 'editor.notesAgain': {name: ['Regenerate', '重新生成'], use: ['Make this clip again from its prompt', '按这段提示词重新生成这一段'], + off: ['Write a prompt, or wait for the run to end', '先写提示词,或等当前生成结束']}, 'editor.zoomPicture': {name: ['Zoom', '缩放'], use: ['Enlarge or shrink this clip’s picture', '放大或缩小这一段的画面'], off: ['Select a video clip first', '先选中一个视频片段']}, 'editor.rotateLeft': {name: ['Rotate left 90°', '左转 90°'], use: ['Turn the picture anticlockwise', '画面逆时针转 90°'], off: ['Select a video clip first', '先选中一个视频片段']}, 'editor.rotateRight': {name: ['Rotate right 90°', '右转 90°'], use: ['Turn the picture clockwise', '画面顺时针转 90°'], off: ['Select a video clip first', '先选中一个视频片段']}, @@ -195,14 +195,14 @@ export const TIPS = { off: ['Select a range first', '先选出一段范围']}, 'editor.saveFrame': {name: ['Save frame', '保存当前帧'], use: ['Save the picture at the playhead', '把播放头处的画面存成图片'], off: ['Put a clip on the timeline first', '先在时间线上放一个片段']}, 'editor.fullscreen': {name: ['Full screen', '全屏'], use: ['Watch the preview filling the screen', '全屏查看预览'], key: 'F'}, - 'editor.reference': {name: ['Reference picture', '参考图'], use: ['Guide this clip with a picture', '用一张图引导这一段']}, + 'editor.reference': {name: ['Reference image', '参考图'], use: ['Guide this clip with an image', '用一张图引导这一段']}, 'editor.subtitle': {name: ['Subtitle', '字幕'], use: ['Add a subtitle at the playhead', '在播放头处添加字幕']}, 'editor.shortcuts': {name: ['Shortcuts', '快捷键'], use: ['Every keyboard shortcut in this view', '查看这个视图的全部快捷键'], key: '?'}, 'editor.adjust': {name: ['Adjust', '调整'], use: ['Picture, sound and speed of the selection', '调整选中片段的画面、声音和速度']}, - 'editor.libraryTab': {byLabel: true, name: ['Media group', '素材分组'], use: ['Show these clips and pictures', '切换到这一组素材']}, - 'editor.import': {name: ['Import', '导入'], use: ['Bring your own videos, pictures or sound', '导入自己的视频、图片或声音']}, + 'editor.libraryTab': {byLabel: true, name: ['Media group', '素材分组'], use: ['Show these clips and images', '切换到这一组素材']}, + 'editor.import': {name: ['Import', '导入'], use: ['Bring your own videos, images or sound', '导入自己的视频、图片或声音']}, 'editor.source': {byLabel: true, name: ['Media', '素材'], use: ['Drag onto the timeline, or press + to add', '拖到时间线,或按加号加入']}, - 'editor.drawer': {name: ['Media', '素材'], use: ['Show the clips and pictures you can add', '显示可加入的素材']}, + 'editor.drawer': {name: ['Media', '素材'], use: ['Show the clips and images you can add', '显示可加入的素材']}, 'editor.playhead': {name: ['Playhead', '播放位置'], use: ['Drag to move through the edit', '拖动来移动播放位置'], key: '← →'}, 'editor.adjustTab': {byLabel: true, name: ['Adjustments', '调整分组'], use: ['Show these settings for the selection', '切换到这一组调整']}, @@ -269,8 +269,8 @@ export const MATCHES = [ ['.fv-resolution-select select', 'studio.clarity'], ['.fv-replace-person input', 'studio.replacePerson'], ['label.fv-first-frame input,.fv-ed-first-frame input', 'studio.firstFrame'], ['.fv-length-model button', 'studio.lengthModel'], ['.fv-range-entry,.fv-range-plot', 'studio.range'], - ['.fv-effort-names>.fv-effort-name:nth-child(1)', 'studio.effort.1'], ['.fv-effort-names>.fv-effort-name:nth-child(2)', 'studio.effort.2'], - ['.fv-effort-names>.fv-effort-name:nth-child(3)', 'studio.effort.3'], ['.fv-effort-names>.fv-effort-name:nth-child(4)', 'studio.effort.4'], + ['.fv-effort-names:not([data-fast])>.fv-effort-name[data-level=Light]', 'studio.effort.1'], ['.fv-effort-names>.fv-effort-name[data-level=Medium]', 'studio.effort.2'], + ['.fv-effort-names>.fv-effort-name[data-level=High]', 'studio.effort.3'], ['.fv-effort-names>.fv-effort-name[data-level=Max]', 'studio.effort.4'], ['.fv-pass-mode[role=radiogroup] [data-mode=off]', 'studio.twoPass.off'], ['.fv-pass-mode[role=radiogroup] [data-mode=on]', 'studio.twoPass.on'], ['.fv-pass-mode[role=radiogroup] [data-mode=preview]', 'studio.twoPass.preview'], ['.fv-two-pass', 'studio.twoPass'], ['.fv-swap-remove', 'studio.swapRemove'], ['.fv-swap-sound input', 'studio.swapSound'], ['.fv-swap-retry', 'studio.swapRetry'], diff --git a/web/topbar.css b/web/topbar.css index 42149a85..d2273044 100644 --- a/web/topbar.css +++ b/web/topbar.css @@ -11,7 +11,10 @@ html body .fv-topbar.fv-topbar.fv-topbar{ height:calc(var(--fv-header-h) + env(safe-area-inset-top,0px))!important;min-height:0!important;max-height:none; margin:0;padding:env(safe-area-inset-top,0px) var(--fv-tb-pad) 0!important;flex:none;overflow:visible; border:0!important;background:transparent!important;box-shadow:none!important; + --fv-font:"Segoe UI","FreeVideo Quotes","Microsoft YaHei UI","Noto Sans CJK SC","Noto Sans SC",system-ui,sans-serif; /* theme.css's, also in the settings room */ font:400 var(--fv-fs-2)/1.5 var(--fv-font);color:var(--fv-fg);-webkit-user-select:none;user-select:none} +/* Traditional Chinese: the page's own list (theme.css gives the page and every view the same one). */ +html[data-fv-language="zh-Hant"] body .fv-topbar.fv-topbar.fv-topbar{--fv-font:inherit} /* The editor scrolls under its bar: keep it pinned and opaque. */ html body .fv-editor .fv-header.fv-topbar.fv-topbar.fv-topbar{position:sticky;top:0;z-index:9;background:var(--fv-bg)!important} html body .fv-topbar.fv-topbar.fv-topbar:is([data-fv-fit="1"],[data-fv-fit="2"]){column-gap:var(--fv-sp-8)} @@ -52,7 +55,7 @@ html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch::before{content:"";posi border-radius:var(--fv-rad-pill);background:var(--fv-ctl-hover);box-shadow:inset 0 1px 0 var(--fv-edge-hi);pointer-events:none; clip-path:inset(0 calc(100% - var(--fv-tb-r,0px)) 0 var(--fv-tb-l,0px) round var(--fv-rad-pill))} html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch[data-fv-tb-ink]::before{transition:clip-path var(--fv-dur-2) var(--fv-ease-out)} -html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button{position:relative;z-index:1;display:grid;grid-template-columns:auto;align-items:center;justify-items:center; +html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button{position:relative;z-index:1;display:grid;grid-template-columns:auto;align-items:center;justify-items:center;justify-content:center; box-sizing:border-box;height:var(--fv-ctl);min-height:var(--fv-ctl);margin:0;padding:0 var(--fv-sp-16);border:0;border-radius:var(--fv-rad-pill); background:transparent!important;box-shadow:none!important;color:var(--fv-fg2);font-size:var(--fv-fs-2);font-weight:500;line-height:var(--fv-ctl);white-space:nowrap;cursor:pointer; transition:color var(--fv-dur-1) var(--fv-ease-out),scale 100ms var(--fv-ease-out)} @@ -62,6 +65,7 @@ html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button:active{scale:.97 html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button[aria-pressed=true]{color:var(--fv-fg);font-weight:600} /* The bold label's width is reserved (view_navigation.css), so the current tab never changes the pill's width. */ html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button>span,html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button::after{grid-area:1/1} +html body .fv-topbar.fv-topbar.fv-topbar>.fv-view-switch>button::after{font-weight:600} html body .fv-topbar.fv-topbar.fv-topbar:is([data-fv-fit="1"],[data-fv-fit="2"])>.fv-view-switch>button{padding:0 var(--fv-sp-12)} html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="2"]>.fv-view-switch>button{padding:0 var(--fv-sp-10, 10px)} /* Phone: only the current tab shows, as a picker with a chevron; pressing it lists the views. */ @@ -70,7 +74,7 @@ html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]{grid-template-columns: html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]>.fv-view-switch{height:var(--fv-touch);padding:0;justify-self:center;min-width:0;max-width:100%} html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]>.fv-view-switch::before{display:none} html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]>.fv-view-switch>button:not([aria-pressed=true]){display:none} -html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]>.fv-view-switch>button[aria-pressed=true]{height:var(--fv-touch);min-height:var(--fv-touch);grid-template-columns:auto 16px;column-gap:var(--fv-sp-4); +html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]>.fv-view-switch>button[aria-pressed=true]{min-width:0;height:var(--fv-touch);min-height:var(--fv-touch);grid-template-columns:auto 16px;column-gap:var(--fv-sp-4); padding:0 var(--fv-sp-12) 0 var(--fv-sp-16);line-height:var(--fv-touch)} html body .fv-topbar.fv-topbar.fv-topbar[data-fv-fit="3"]>.fv-view-switch>button[aria-pressed=true]::before{content:"";grid-area:1/2;width:16px;height:16px;background:currentColor;opacity:.7; -webkit-mask:var(--fv-tb-chevron) center/16px 16px no-repeat;mask:var(--fv-tb-chevron) center/16px 16px no-repeat} diff --git a/web/topbar.js b/web/topbar.js index dfec82fe..69b0ec1a 100644 --- a/web/topbar.js +++ b/web/topbar.js @@ -263,18 +263,18 @@ function statusCapsule(t) { // tasks) is here, with the queue's stop and resume. Nothing is read in the background: the computer's numbers are // read while the panel is open (every 2 s), the assistant's state once per opening. let activity = null; -const SECONDS = (t, value) => { const s = Math.max(1, Math.round(value)); return s < 120 ? t(`about ${s} s`, `约 ${s} 秒`) : t(`about ${Math.round(s / 60)} min`, `约 ${Math.round(s / 60)} 分钟`); }; +const SECONDS = (t, value) => { const s = Math.max(1, Math.round(value)); return s < 120 ? t('about {s} s', '约 {s} 秒', { s }) : t('about {minutes} min', '约 {minutes} 分钟', { minutes: Math.round(s / 60) }); }; function jobTitle(row, t) { if (row.source === 'agent') return agentTitle(row.job, t); const text = String(row.meta?.text ?? row.prompt ?? '').replace(/\s+/g, ' ').trim(); - return text || ({image: t('Picture', '图片'), video: t('Video', '视频'), chain: t('Long video', '长视频')}[row.kind] || t('Task', '任务')); + return text || ({image: t('Image', '图片'), video: t('Video', '视频'), chain: t('Long video', '长视频')}[row.kind] || t('Task', '任务')); } function jobLine(row, t) { - if (row.status === 'queued' || row.status === 'submitting') return row.position > 0 ? t(`Waiting, ${row.position} ahead`, `排队中,前面 ${row.position} 个`) : t('Waiting', '排队中'); + if (row.status === 'queued' || row.status === 'submitting') return row.position > 0 ? t('Waiting, {position} ahead', '排队中,前面 {position} 个', { position: row.position }) : t('Waiting', '排队中'); if (row.status === 'cancelling') return t('Stopping', '正在停止'); if (row.status === 'running') { const percent = Math.round(100 * (Number(row.percent) || 0)); - return [t(`Generating ${percent}%`, `生成中 ${percent}%`), Number.isFinite(row.eta_seconds) && row.eta_seconds > 0 ? SECONDS(t, row.eta_seconds) : ''].filter(Boolean).join(' · '); + return [t('Generating {percent}%', '生成中 {percent}%', { percent }), Number.isFinite(row.eta_seconds) && row.eta_seconds > 0 ? SECONDS(t, row.eta_seconds) : ''].filter(Boolean).join(' · '); } if (row.status === 'done') return t('Finished', '已完成'); if (row.status === 'cancelled') return t('Stopped', '已停止'); @@ -287,7 +287,7 @@ function jobFigures(row, t) { const percent = Math.round(100 * (Number(row.percent) || 0)); return [`${percent}%`, Number.isFinite(row.eta_seconds) && row.eta_seconds > 0 ? SECONDS(t, row.eta_seconds) : ''].filter(Boolean).join(' · '); } - if (row.status === 'queued' || row.status === 'submitting') return row.position > 0 ? t(`${row.position} ahead`, `前面 ${row.position} 个`) : t('Waiting', '排队中'); + if (row.status === 'queued' || row.status === 'submitting') return row.position > 0 ? t('{position} ahead', '前面 {position} 个', { position: row.position }) : t('Waiting', '排队中'); if (row.status === 'cancelling') return t('Stopping', '正在停止'); if (row.status === 'done') return t('Finished', '已完成'); if (row.status === 'cancelled') return t('Stopped', '已停止'); @@ -321,7 +321,7 @@ function buildActivity(t) { if (row.status === 'done' || isFailure(row)) jobs.markSeen?.(row.id); }; const heading = (node, name, extra = null) => { const line = el('div', 'fv-tb-act-title'); line.append(el('span', '', name)); if (extra) line.append(extra); node.replaceChildren(line); }; - const VIEW = {studio: t('Studio', '创作面板'), image: t('Image', '图像视图'), editor: t('Edit', '剪辑视图'), autopilot: t('Autopilot', 'AI 全自动'), nodes: t('Nodes', '节点视图')}; + const VIEW = {studio: t('Create', '创作面板'), image: t('Image', '图像视图'), editor: t('Edit', '剪辑视图'), autopilot: t('Autopilot', 'AI 全自动'), nodes: t('Nodes', '节点视图')}; // 2 · Tasks: one row each; a press goes back to its picture; Stop (or Remove from queue) is confirmed first. const stopLost = new Map(), LOST_MS = 8000; const taskRow = row => { @@ -377,7 +377,7 @@ function buildActivity(t) { if (list.length) tasks.append(...list.map(taskRow)); else tasks.append(el('p', 'fv-tb-act-empty', t('Nothing is running.', '没有进行中的任务。'))); // Assistant tasks the engine could not read are counted, not hidden. const unreadable = agentTasks.unreadable(); - if (unreadable) tasks.append(el('p', 'fv-tb-act-empty fv-tb-act-unreadable', t(`${unreadable} ${unreadable === 1 ? 'job' : 'jobs'} could not be read`, `另有 ${unreadable} 个任务无法读取`))); + if (unreadable) tasks.append(el('p', 'fv-tb-act-empty fv-tb-act-unreadable', (unreadable === 1 ? t('1 job could not be read', '另有 1 个任务无法读取') : t('{count} jobs could not be read', '另有 {count} 个任务无法读取', { count: unreadable })))); drawFoot(); }; // 3 · This computer: video memory in large figures, then temperature, load and free disk, right-aligned. @@ -433,7 +433,7 @@ function buildActivity(t) { foot.hidden = !busy && !waiting; if (foot.hidden) return; if (confirming) { - const ask = el('p', 'fv-tb-act-ask', waiting ? t(`Stop the current video? What is being made is not kept; the ${waiting} waiting will pause.`, `停止当前视频?正在生成的不会保留,排队的 ${waiting} 个会暂停。`) + const ask = el('p', 'fv-tb-act-ask', waiting ? t('Stop the current video? What is being made is not kept; the {waiting} waiting will pause.', '停止当前视频?正在生成的不会保留,排队的 {waiting} 个会暂停。', { waiting }) : t('Stop the current video? What is being made is not kept.', '停止当前视频?正在生成的不会保留。')); const keep = el('button', 'fv-tb-act-btn', t('Keep running', '继续运行')), stop = el('button', 'fv-tb-act-btn is-armed', t('Stop', '停止')); keep.type = stop.type = 'button'; @@ -451,7 +451,7 @@ function buildActivity(t) { foot.classList.remove('is-asking'); const said = running ? jobLine(running, t) : t('Working', '运行中'); foot.append(el('span', 'fv-tb-act-note', said)); - if (waiting) foot.append(el('span', 'fv-tb-act-note is-quiet', t(`${waiting} waiting`, `排队 ${waiting}`))); + if (waiting) foot.append(el('span', 'fv-tb-act-note is-quiet', t('{waiting} waiting', '排队 {waiting}', { waiting }))); foot.append(el('span', 'fv-tb-grow')); const stop = el('button', 'fv-tb-act-stop', t('Stop', '停止')); stop.type = 'button'; tip(stop, t('Stop', '停止'), t('Stop what runs and pause the queue; asks first', '停止正在生成的并暂停队列,会先确认')); @@ -517,7 +517,7 @@ export function topbarActions(t = t0) { const right = el('div', 'fv-tb-right'); const capsule = statusCapsule(t); const search = paletteButton(t, 'fv-tb-btn fv-tb-search'); withIcon(search, 'search'); search.replaceChildren(); tip(search, ...w.search); - search.dataset.fvField = t('Search works, prompts and actions', '搜索作品、提示词和操作'); + search.dataset.fvField = t('Search creations, prompts and actions', '搜索作品、提示词和操作'); const sep = el('span', 'fv-tb-sep'); sep.setAttribute('aria-hidden', 'true'); // The works library is one click away in every view and at every width: never folded into the menu (CEO 11-17). // It is a link like the five beside it (same box, icon, hover), kept out of the phone menu so it stays on the bar. diff --git a/web/topbar_state.js b/web/topbar_state.js index 65972d51..60189e36 100644 --- a/web/topbar_state.js +++ b/web/topbar_state.js @@ -11,8 +11,8 @@ export function words(t = t0, mac = MAC) { const mod = mac ? '⌘' : 'Ctrl', alt = mac ? '⌥' : 'Alt'; return { status: [t('Run status', '运行状态'), t('See running tasks and notices', '看进行中的任务和通知')], - search: [t('Search and commands', '搜索与命令'), t('Search works and run any action', '搜索作品、提示词并执行操作'), `${mod} K`], - works: [t('Creations', '作品库'), t('Open your works to sort and manage them', '打开作品库,筛选和管理')], + search: [t('Search and commands', '搜索与命令'), t('Search creations and run any action', '搜索作品、提示词并执行操作'), `${mod} K`], + works: [t('Creations', '作品库'), t('Open your creations to sort and manage them', '打开作品库,筛选和管理')], phone: [t('Phone', '手机'), t('Open on a phone on this network', '在同一网络的手机上打开')], version: [t('Version', '版本'), t('See updates and what is new', '查看更新和新功能')], tutorial: [t('Tutorials', '教程'), t('Learn each feature step by step', '一步步学会每个功能')], @@ -22,8 +22,8 @@ export function words(t = t0, mac = MAC) { logo: [t('FreeVideo', 'FreeVideo'), t("Back to this view's start", '回到当前视图的首屏')], picker: [t('Switch view', '切换视图'), t('Choose one of the five views', '在五个视图之间切换')], views: { - studio: [t('Studio', '创作面板'), t('Make a video from one sentence', '写一句话,生成一段视频'), `${alt} 1`], - image: [t('Image', '图像视图'), t('Make and edit pictures', '生成和修改图片'), `${alt} 2`], + studio: [t('Create', '创作面板'), t('Make a video from one sentence', '写一句话,生成一段视频'), `${alt} 1`], + image: [t('Image', '图像视图'), t('Make and edit images', '生成和修改图片'), `${alt} 2`], nodes: [t('Nodes', '节点视图'), t('Combine generation steps freely with nodes', '用节点自由组合生成步骤'), `${alt} 3`], editor: [t('Edit', '剪辑视图'), t('Cut clips, add sound and captions', '剪片段,配声音和字幕'), `${alt} 4`], autopilot: [t('Autopilot', 'AI 全自动'), t('Describe it; the assistant films it', '说想法,助手分镜并拍完'), `${alt} 5`], @@ -68,7 +68,7 @@ export function capsuleWords(t, state) { export function machineLine(state, t = t0) { if (!state) return ''; const gb = bytes => (bytes / 2 ** 30).toFixed(1), parts = []; - if (state.memory_total) parts.push(t(`Video memory ${gb(state.memory_used)} / ${gb(state.memory_total)} GB`, `显存 ${gb(state.memory_used)} / ${gb(state.memory_total)} GB`)); + if (state.memory_total) parts.push(t('Video memory {used} / {total} GB', '显存 {used} / {total} GB', { used: gb(state.memory_used), total: gb(state.memory_total) })); if (state.temperature != null) parts.push(`${state.temperature} °C`); return parts.join(' · '); } diff --git a/web/translate_guard.js b/web/translate_guard.js index 7db62f0e..e9f8cbb4 100644 --- a/web/translate_guard.js +++ b/web/translate_guard.js @@ -1,6 +1,6 @@ // Browser auto-translate reads ComfyUI's lang="en" page and rewrites FreeVideo's own text: "MP" // became 兆帕. FreeVideo writes both languages itself, so its surfaces opt out of translation and -// a Chinese interface says so on the document. +// an interface in another language than English says which on the document (its lang attribute). const OWN_CLASS = /(^|\s)fv-/; export function markOwn(node) { @@ -8,8 +8,9 @@ export function markOwn(node) { if (OWN_CLASS.test(node.getAttribute('class') || '') || node.id?.startsWith('fv-')) node.setAttribute('translate', 'no'); } -export function installTranslateGuard({chinese, doc = document} = {}) { - if (chinese) doc.documentElement.lang = 'zh-CN'; +export function installTranslateGuard({lang, chinese, doc = document} = {}) { + const tag = lang ?? (chinese ? 'zh-CN' : null); + if (tag && tag !== 'en') doc.documentElement.lang = tag; for (const node of doc.body.children) markOwn(node); new MutationObserver(records => { for (const record of records) for (const node of record.addedNodes) markOwn(node); diff --git a/web/tutorial_book.js b/web/tutorial_book.js index 49a8cd7d..832ed56d 100644 --- a/web/tutorial_book.js +++ b/web/tutorial_book.js @@ -7,14 +7,16 @@ import {FEATURE_TOUR, readyCards} from './feature_tour_content.js'; import {SHOWCASE_TEXT, SHOWCASE_ASSET} from './entry_showcase.js'; import {isolateDialogKeys, listenDialogKey, routeDialogKey} from './dialog_keys.js'; import {reducedMotion} from './context_menu.js'; -import { isChinese } from './i18n.js'; +import { isChinese, translator, translatorFor, fill } from './i18n.js'; +import { localized, pageLang, promptText } from './i18n_tables.js'; +// i18n-table const COPY = { zh: {book: '教程', chapters: '章节', examples: '示例', contents: '目录', close: '关闭', search: '搜索教程', steps: '步骤', limits: '注意', follow: '跟着做', tryIt: '试一试', walk: '演示', goto: '带我去', prev: '上一篇', next: '下一篇', read: '已看过', none: '没有找到', noneHint: '换个词,或看“出错了怎么办”。', start: '新手指引', startLine: '三步认识界面', again: '再看一遍', featured: '精选', getStarted: '开始使用', - back: '示例', feature: '功能示例', fills: '描述、素材和参数会一起填好', prompt: '描述', newBadge: '新', play: '播放示例', playSound: '播放声音', - stepOf: (a, b) => `第 ${a} / ${b} 步`, done: '全部完成', doneNext: '做完了。下一篇:', stepDone: '这步做好了', stepBack: '上一步', expand: '展开教程', + back: '示例', feature: '功能示例', fills: '提示词、素材和参数会一起填好', prompt: '提示词', newBadge: '新', play: '播放示例', playSound: '播放声音', + stepOf: '第 {step} / {total} 步', done: '全部完成', doneNext: '做完了。下一篇:', stepDone: '这步做好了', stepBack: '上一步', expand: '展开教程', noView: '无法打开剪辑视图,请点顶部的“剪辑视图”。', noTarget: '当前界面中找不到这一项,请按上面的步骤操作。', noHidden: '时间线上还没有带声音的片段,请先导入或生成一段。', showcaseLine: '用白模定动作和镜头,生成写实视频。', tips: {close: '收起教程,回到刚才的界面', chapters: '按步骤学每个功能', examples: '看成品,一键填入示例', toc: '看全部章节', chapter: '打开这一章', @@ -27,7 +29,7 @@ const COPY = { noneHint: 'Try another word, or see "When something goes wrong".', start: 'Getting started', startLine: 'Three steps around the screen', again: 'Show again', featured: 'Featured', getStarted: 'Get started', back: 'Examples', feature: 'Feature example', fills: 'Fills the prompt, media and settings together', prompt: 'Prompt', newBadge: 'New', play: 'Play example', playSound: 'Play with sound', - stepOf: (a, b) => `Step ${a} of ${b}`, done: 'All done', doneNext: 'Done. Next: ', stepDone: 'Done this step', stepBack: 'Back', expand: 'Open the tutorial', + stepOf: 'Step {step} of {total}', done: 'All done', doneNext: 'Done. Next: ', stepDone: 'Done this step', stepBack: 'Back', expand: 'Open the tutorial', noView: 'Could not open the Edit view. Choose "Edit" at the top.', noTarget: 'This item is not available here. Follow the steps above.', noHidden: 'The timeline has no clip with sound yet. Import or generate one first.', showcaseLine: 'A whitebox sets the motion and camera; the video comes out real.', tips: {close: 'Close and go back to where you were', chapters: 'Learn each feature step by step', examples: 'See results; fill one in', toc: 'See every chapter', chapter: 'Open this chapter', @@ -38,8 +40,8 @@ const COPY = { }; const GROUPS = [ [['Start', '入门'], ['quick-start', 'text-to-video', 'timed-lines', 'quality-tiers', 'refine', 'run-modes']], - [['Pictures and people', '用图片和人物'], ['first-last-frame', 'middle-frames', 'reference-video', 'cast-sheet', 'scenes-props', 'replace-person', 'replace-two-people', 'lora']], - [['Pictures', '图像'], ['image-gen', 'image-references', 'edit-image', 'local-image-edit', 'new-image-shape']], + [['Images and people', '用图片和人物'], ['first-last-frame', 'middle-frames', 'reference-video', 'cast-sheet', 'scenes-props', 'replace-person', 'replace-two-people', 'lora']], + [['Images', '图像'], ['image-gen', 'image-references', 'edit-image', 'local-image-edit', 'new-image-shape']], [['Longer videos', '更长的视频'], ['long-video', 'extend-video', 'continue-or-new-shot']], [['Edit and sound', '剪辑与声音'], ['editor', 'save-frame', 'editor-extend-refs', 'segment-prompt', 'separate-tracks', 'replace-music', 'beat-snap', 'voice-recording', 'narration', 'sound-to-picture', 'text-subtitles']], [['Autopilot', 'AI 全自动'], ['autopilot', 'drama-outline', 'film-project']], @@ -62,7 +64,7 @@ const STEP_GO = {'quick-start': {0: 'prompt-box', 2: 'generate-btn'}, 'text-to-v 'separate-tracks': {0: 'audio-a1-track', 1: 'audio-track-button'}, 'reference-video': {0: 'prompt-box'}, 'library-reuse': {0: 'works-entry'}, 'cast-sheet': {0: 'cast-add'}}; const HOWTOS = new Set(['reference-video', 'long-video', 'editor-extend-refs', 'separate-tracks', 'replace-music', 'replace-voice']); const EX_GROUPS = [[['Video', '视频'], ['first-video', 'text-to-video', 'quality-tiers', 'reference-image', 'two-pass', 'first-last-frame', 'product-showcase', 'replace-person', 'character']], - [['Edit and sound', '剪辑与声音'], ['edit-view', 'extend', 'segment-prompt', 'separate-sound', 'add-sound', 'narration', 'sound-to-picture']], [['Pictures and library', '图片与作品'], ['edit-image', 'library-reuse', 'autopilot']]]; + [['Edit and sound', '剪辑与声音'], ['edit-view', 'extend', 'segment-prompt', 'separate-sound', 'add-sound', 'narration', 'sound-to-picture']], [['Images and library', '图片与作品'], ['edit-image', 'library-reuse', 'autopilot']]]; const CARD_CHAPTER = {'first-video': 'quick-start', 'text-to-video': 'text-to-video', 'first-last-frame': 'first-last-frame', 'quality-tiers': 'quality-tiers', 'reference-image': 'reference-video', 'replace-person': 'replace-person', character: 'cast-sheet', 'edit-view': 'editor', 'separate-sound': 'separate-tracks', extend: 'extend-video', 'two-pass': 'refine', autopilot: 'autopilot', 'sound-to-picture': 'sound-to-picture', narration: 'narration', 'add-sound': 'replace-music', 'segment-prompt': 'segment-prompt', 'library-reuse': 'library-reuse', 'edit-image': 'edit-image'}; @@ -103,10 +105,10 @@ export function bookGroups(chapters = TUTORIAL_CHAPTERS) { } export const bookOrder = (chapters = TUTORIAL_CHAPTERS) => bookGroups(chapters).flatMap(([, list]) => list); // Search: every word must appear in the title, summary, steps or another name for the chapter (either language's own text). -export function searchChapters(query, lang, chapters = TUTORIAL_CHAPTERS, aliases = TUTORIAL_ALIASES) { +export function searchChapters(query, lang, chapters = TUTORIAL_CHAPTERS, aliases = TUTORIAL_ALIASES, t = translatorFor(null, lang === 'zh')) { const words = String(query || '').toLowerCase().split(/\s+/).filter(Boolean); if (!words.length) return null; - return chapters.filter(c => { const hay = [c.title[lang], c.summary[lang], ...(c.steps[lang] || []), ...(aliases[c.id]?.[lang] || [])].join(' ').toLowerCase(); return words.every(word => hay.includes(word)); }).map(c => c.id); + return chapters.filter(c => { const hay = [localized(c.title, t), localized(c.summary, t), ...(localized(c.steps, t) || []), ...(aliases[c.id]?.[lang] || [])].join(' ').toLowerCase(); return words.every(word => hay.includes(word)); }).map(c => c.id); } function styles() { @@ -119,7 +121,7 @@ function styles() { } // A figure: the poster first; a play button swaps in the example's video (with sound when it has a waveform). -function figure(spec, lang, text) { +function figure(spec, t, text) { if (!spec) return null; const fig = el('figure', 'fv-book-fig'); const still = reducedMotion(); @@ -133,14 +135,14 @@ function figure(spec, lang, text) { } if (wave) { const strip = el('div', 'fv-book-wave'), w = el('img'); w.alt = ''; w.src = poster(wave); strip.append(w); box.append(strip); } if (playable && VIDEOS.has(name)) { - const play = button('fv-book-play', wave ? text.playSound : text.play, [wave ? text.playSound : text.play, text.tips.play, lang === 'zh' ? '空格' : 'Space'], icon('play')); + const play = button('fv-book-play', wave ? text.playSound : text.play, [wave ? text.playSound : text.play, text.tips.play, t('Space', '空格')], icon('play')); let video = null; play.onclick = () => { if (video && !video.paused && !video.muted) { video.muted = true; play.replaceChildren(icon('play'), document.createTextNode(wave ? text.playSound : text.play)); return; } video ||= box.querySelector('video'); if (!video) { video = el('video'); video.src = asset(`${name}.mp4`); video.loop = true; video.playsInline = true; video.setAttribute('aria-label', name); box.insertBefore(video, img.nextSibling); } video.muted = !wave; if (wave) video.currentTime = 0; - video.play().catch(() => {}); play.replaceChildren(icon('pause'), document.createTextNode(lang === 'zh' ? '暂停' : 'Pause')); + video.play().catch(() => {}); play.replaceChildren(icon('pause'), document.createTextNode(t('Pause', '暂停'))); }; box.append(play); } @@ -150,18 +152,19 @@ function figure(spec, lang, text) { else if (spec.k === 'pair') { const pair = el('div', 'fv-book-pair'); const to = el('span', 'fv-book-to'); to.append(icon('arrow')); pair.append(media(spec.a, null, false), to, media(spec.b)); fig.append(pair); } else if (spec.k === 'quad') { const quad = el('div', 'fv-book-quad'), card = FEATURE_TOUR.find(c => c.id === 'quality-tiers'); - for (const q of card.quality) { const cell = el('figure'); const img = el('img'); img.alt = ''; img.src = asset(q.poster); cell.append(img, el('figcaption', null, q.label[lang])); quad.append(cell); } + for (const q of card.quality) { const cell = el('figure'); const img = el('img'); img.alt = ''; img.src = asset(q.poster); cell.append(img, el('figcaption', null, localized(q.label, t))); quad.append(cell); } fig.append(quad); } else if (spec.k === 'tiles') { const tiles = el('div', 'fv-book-tiles'); for (const p of spec.ps) { const cell = el('figure'); const img = el('img'); img.alt = ''; img.src = poster(p); cell.append(img); tiles.append(cell); } fig.append(tiles); } return fig; } // A step's words with each control it names in quotes (“生成视频”, "Generate video") drawn as a small sample of that -// control, in the product's own control style, so the reader recognises it on screen. +// control, in the product's own control style, so the reader recognises it on screen. Other languages' quotes count too +// («Создать», 「建立」, „Erstellen“). export function stepParts(step) { - const parts = [], re = /[“"]([^”"]{1,24})[”"]/g; + const parts = [], re = /[“"]([^”"]{1,24})[”"]|«\s?([^»]{1,48}?)\s?»|„([^“”]{1,48})[“”]|[「『]([^」』]{1,48})[」』]/g; let at = 0, m; - while ((m = re.exec(step))) { if (m.index > at) parts.push({text: step.slice(at, m.index)}); parts.push({control: m[1]}); at = m.index + m[0].length; } + while ((m = re.exec(step))) { if (m.index > at) parts.push({text: step.slice(at, m.index)}); parts.push({control: m[1] ?? m[2] ?? m[3] ?? m[4]}); at = m.index + m[0].length; } if (at < step.length) parts.push({text: step.slice(at)}); return parts; } @@ -178,10 +181,10 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap if (chapter === 'separate-tracks') import('./sound_bubble.js').then(({markSoundBubbleSeen}) => markSoundBubbleSeen(), () => {}); if (current?.dialog.isConnected) { current.go({tab, chapter, example}); return current.dialog; } styles(); - const lang = language(), text = COPY[lang], L = pair => Array.isArray(pair) ? pair[lang === 'zh' ? 1 : 0] : pair?.[lang] ?? ''; + const lang = language(), t = translator(lang === 'zh'), text = localized(COPY, t), L = value => Array.isArray(value) ? t(...value) : localized(value, t); const restore = document.activeElement; const state = {tab, chapter: chapterOf(chapter) ? chapter : TUTORIAL_CHAPTERS[0].id, example, query: '', tocOnly: false, note}; - const dialog = el('dialog', 'fv-book'); dialog.lang = lang === 'zh' ? 'zh-CN' : 'en'; + const dialog = el('dialog', 'fv-book'); dialog.lang = pageLang(); dialog.setAttribute('aria-labelledby', 'fv-book-title'); dialog.dataset.fvTipScope = ''; // Head: name, the two pages (Chapters, Examples), contents (phones) and close. const head = el('header', 'fv-book-h'), name = el('h2'); name.id = 'fv-book-title'; name.append(icon('book'), el('span', 'fv-book-name', text.book)); @@ -207,7 +210,7 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap const page = el('div', 'fv-book-page'); page.tabIndex = -1; body.append(nav, page); dialog.append(head, body); function drawToc() { - const hits = searchChapters(state.query, lang), read = readSet(); + const hits = searchChapters(state.query, lang, undefined, undefined, t), read = readSet(); count.textContent = hits ? String(hits.length) : ''; toc.replaceChildren(); if (hits && !hits.length) { const none = el('div', 'fv-book-none'); none.append(el('b', null, text.none), document.createTextNode(text.noneHint)); toc.append(none); return; } @@ -217,12 +220,12 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap const group = el('div', 'fv-book-g'); group.append(el('span', null, L(title)), el('span', 'fv-book-n', `${list.filter(id => read.has(id)).length} / ${list.length}`)); toc.append(group); for (const id of list) { - const c = chapterOf(id), item = button('fv-book-ti', null, [c.title[lang], c.summary[lang] || text.tips.chapter]); + const c = chapterOf(id), item = button('fv-book-ti', null, [L(c.title), L(c.summary) || text.tips.chapter]); item.dataset.chapter = id; const t = el('span', 'fv-book-t'); const words = String(state.query || '').trim(); - if (words) { const at = c.title[lang].toLowerCase().indexOf(words.toLowerCase()); if (at >= 0) { t.append(c.title[lang].slice(0, at), el('mark', null, c.title[lang].slice(at, at + words.length)), c.title[lang].slice(at + words.length)); } else t.textContent = c.title[lang]; } - else t.textContent = c.title[lang]; + if (words) { const name = L(c.title), at = name.toLowerCase().indexOf(words.toLowerCase()); if (at >= 0) { t.append(name.slice(0, at), el('mark', null, name.slice(at, at + words.length)), name.slice(at + words.length)); } else t.textContent = name; } + else t.textContent = L(c.title); item.append(t, read.has(id) ? icon('check', 'fv-book-ok') : el('span')); if (state.tab === 'chapters' && id === state.chapter) item.setAttribute('aria-current', 'page'); item.onclick = () => go({tab: 'chapters', chapter: id, tocOnly: false, example: null}); @@ -236,9 +239,9 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap const inner = el('article', 'fv-book-in'); const eyebrow = el('div', 'fv-book-eyebrow'); eyebrow.append(el('span', null, group ? L(group[0]) : ''), el('span', null, '·'), el('span', 'fv-book-num', `${at + 1} / ${order.length}`)); if (read.has(id)) { const ok = el('span', 'fv-book-read'); ok.append(icon('check'), document.createTextNode(text.read)); eyebrow.append(ok); } - const h1 = el('h1', null, c.title[lang]); - inner.append(eyebrow, h1, el('p', 'fv-book-sum', c.summary[lang])); - const fig = figure(FIG[id], lang, text); if (fig) inner.append(fig); + const h1 = el('h1', null, L(c.title)); + inner.append(eyebrow, h1, el('p', 'fv-book-sum', L(c.summary))); + const fig = figure(FIG[id], t, text); if (fig) inner.append(fig); const acts = el('div', 'fv-book-acts'); const followButton = button('fv-book-btn', text.follow, [text.follow, text.tips.follow], icon('steps')); followButton.dataset.kind = 'primary'; followButton.onclick = () => { dialog.close(); openFollow(id); }; @@ -260,7 +263,7 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap const steps = el('section', 'fv-book-sec'); steps.id = 'fv-book-steps'; steps.append(el('h2', null, text.steps)); const ol = el('ol', 'fv-book-steps'); const marks = STEP_GO[id] || (c.goto?.length ? {0: c.goto[0]} : {}); - (c.steps[lang] || []).forEach((step, i) => { + (L(c.steps) || []).forEach((step, i) => { const li = el('li'); li.append(stepLine(step)); if (marks[i]) { const go = button('fv-book-go', text.goto, [text.goto, text.tips.goto], icon('target')); @@ -270,17 +273,17 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap ol.append(li); }); steps.append(ol); inner.append(steps); - if (c.limits?.[lang]?.length) { + if (c.limits?.en?.length) { const lims = el('section', 'fv-book-sec'); lims.append(el('h2', null, text.limits)); - const ul = el('ul', 'fv-book-lims'); for (const line of c.limits[lang]) ul.append(el('li', null, line)); + const ul = el('ul', 'fv-book-lims'); for (const line of L(c.limits)) ul.append(el('li', null, line)); lims.append(ul); inner.append(lims); } - const pn = el('nav', 'fv-book-pn'); pn.setAttribute('aria-label', lang === 'zh' ? '翻页' : 'Pages'); + const pn = el('nav', 'fv-book-pn'); pn.setAttribute('aria-label', t('Pages', '翻页')); const prevId = order[at - 1], nextId = order[at + 1]; const side = (target, label, cls, arrowFirst) => { - const node = button(`fv-book-pnb ${cls}${target ? '' : ' is-none'}`, null, [label, target ? chapterOf(target).title[lang] : '']); + const node = button(`fv-book-pnb ${cls}${target ? '' : ' is-none'}`, null, [label, target ? L(chapterOf(target).title) : '']); const small = el('small'); if (arrowFirst) small.append(icon('left'), document.createTextNode(label)); else small.append(document.createTextNode(label), icon('right')); - node.append(small, el('b', null, target ? chapterOf(target).title[lang] : '')); + node.append(small, el('b', null, target ? L(chapterOf(target).title) : '')); if (target) node.onclick = () => go({chapter: target}); else node.tabIndex = -1; return node; }; @@ -326,7 +329,7 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap dialog.close(); await globalThis.FreeVideoShell?.go?.('autopilot'); const box = document.querySelector('dialog.fv-autopilot[open] textarea'); - if (box && !box.value.trim()) { box.value = L(SHOWCASE_TEXT.example); box.dispatchEvent(new Event('input', {bubbles: true})); focusWhenOn(box); } + if (box && !box.value.trim()) { box.value = promptText(SHOWCASE_TEXT.example, lang === 'zh'); box.dispatchEvent(new Event('input', {bubbles: true})); focusWhenOn(box); } }; words.append(begin); hero.append(art, words); box.append(hero); const grid = el('div', 'fv-book-grid'), ready = new Set(readyCards().map(c => c.id)); @@ -335,10 +338,10 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap if (!list.length) continue; grid.append(el('h4', null, L(title))); for (const card of list) { - const tile = button('fv-book-tile', null, [card.title[lang], card.line[lang]]); + const tile = button('fv-book-tile', null, [L(card.title), L(card.line)]); const pic = el('span', 'fv-book-pic'), image = el('img'); image.alt = ''; image.src = asset(card.clip.poster); image.loading = 'lazy'; const play = el('span', 'fv-book-tplay'); play.append(icon('play')); pic.append(image, play); - tile.append(pic, el('span', 'fv-book-tt', card.title[lang]), el('span', 'fv-book-ts', card.line[lang])); + tile.append(pic, el('span', 'fv-book-tt', L(card.title)), el('span', 'fv-book-ts', L(card.line))); tile.onclick = () => go({example: card.id}); grid.append(tile); } @@ -352,16 +355,16 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap const box = el('div', 'fv-book-card'); const back = button('fv-book-back', text.back, [text.back, text.tips.back], icon('left')); back.onclick = () => go({example: null}); const eyebrow = el('div', 'fv-book-eyebrow'); eyebrow.append(el('span', null, text.feature)); - const h1 = el('h1', null, card.title[lang]); + const h1 = el('h1', null, L(card.title)); const pairBig = el('div', 'fv-book-pairbig'), inputs = el('div', 'fv-book-inputs'); for (const item of card.input) { - if (item.text) { const quote = el('div', 'fv-book-in-card'); quote.append(el('small', null, text.prompt), document.createTextNode(item.text[lang])); inputs.append(quote); } + if (item.text) { const quote = el('div', 'fv-book-in-card'); quote.append(el('small', null, text.prompt), document.createTextNode(promptText(item.text, lang === 'zh'))); inputs.append(quote); } else if (item.src) { const m = el('div', 'fv-book-media'), img = el('img'); img.alt = ''; img.src = asset(item.src); m.append(img); inputs.append(m); } else if (item.mp4) { const m = el('div', 'fv-book-media'), img = el('img'); img.alt = ''; img.src = asset(item.poster); m.append(img); inputs.append(m); } } const to = el('span', 'fv-book-to'); to.append(icon('arrow')); const out = el('div', 'fv-book-media'), video = el('video'); video.src = asset(card.clip.mp4); video.poster = asset(card.clip.poster); video.muted = true; video.loop = true; video.playsInline = true; - video.setAttribute('aria-label', card.title[lang]); + video.setAttribute('aria-label', L(card.title)); if (!reducedMotion()) video.autoplay = true; out.append(video); pairBig.append(inputs, to, out); @@ -374,9 +377,9 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap acts.append(g); } const chapter = CARD_CHAPTER[card.id]; - if (chapter && chapterOf(chapter)) { const r = button('fv-book-btn', lang === 'zh' ? '看教程' : 'Read the tutorial', [lang === 'zh' ? '看教程' : 'Read the tutorial', text.tips.read]); r.onclick = () => go({tab: 'chapters', chapter, example: null}); acts.append(r); } + if (chapter && chapterOf(chapter)) { const r = button('fv-book-btn', t('Read the tutorial', '看教程'), [t('Read the tutorial', '看教程'), text.tips.read]); r.onclick = () => go({tab: 'chapters', chapter, example: null}); acts.append(r); } strip.append(acts, el('span', 'fv-book-hint', text.fills)); - box.append(back, eyebrow, h1, el('p', 'fv-book-sum', card.line[lang]), pairBig, strip); + box.append(back, eyebrow, h1, el('p', 'fv-book-sum', L(card.line)), pairBig, strip); page.replaceChildren(box); } function go(next = {}) { @@ -423,11 +426,11 @@ export function openTutorialBook({chapter = TUTORIAL_CHAPTERS[0].id, tab = 'chap export function openFollow(id, at = 0) { follow?.close(); styles(); - const lang = language(), text = COPY[lang], c = chapterOf(id); + const lang = language(), say = translator(lang === 'zh'), text = localized(COPY, say), c = chapterOf(id), title = localized(c?.title, say); if (!c) return null; - const steps = c.steps[lang] || [], marks = STEP_GO[id] || (c.goto?.length ? {0: c.goto[0]} : {}); - const card = el('aside', 'fv-follow fv-glass fv-g2 sgf-avoid'); card.setAttribute('role', 'region'); card.setAttribute('aria-label', `${text.follow} · ${c.title[lang]}`); - card.dataset.fvTipScope = ''; card.lang = lang === 'zh' ? 'zh-CN' : 'en'; + const steps = localized(c.steps, say) || [], marks = STEP_GO[id] || (c.goto?.length ? {0: c.goto[0]} : {}); + const card = el('aside', 'fv-follow fv-glass fv-g2 sgf-avoid'); card.setAttribute('role', 'region'); card.setAttribute('aria-label', `${text.follow} · ${title}`); + card.dataset.fvTipScope = ''; card.lang = pageLang(); if ('popover' in HTMLElement.prototype) card.popover = 'manual'; let step = at, corner = 'tr', closed = false; let wasPhone = null; @@ -451,7 +454,7 @@ export function openFollow(id, at = 0) { const done = step >= steps.length, p = Math.min(1, step / Math.max(1, steps.length)), R = 9, C = 2 * Math.PI * R; const ring = document.createElementNS(SVG_NS, 'svg'); ring.setAttribute('viewBox', '0 0 24 24'); ring.setAttribute('class', 'fv-follow-ring'); ring.setAttribute('aria-hidden', 'true'); ring.innerHTML = ``; - const t = el('span', 'fv-follow-t'); t.append(el('b', null, c.title[lang]), el('small', null, done ? text.done : text.stepOf(step + 1, steps.length))); + const t = el('span', 'fv-follow-t'); t.append(el('b', null, title), el('small', null, done ? text.done : fill(text.stepOf, { step: step + 1, total: steps.length }))); card.append(ring, t); if (!done && marks[step]) { const g = button('fv-follow-icon', null, [text.goto, text.tips.goto], icon('target')); g.setAttribute('aria-label', text.goto); g.onclick = async () => { const {goToScene} = await import('./tour_goto.js'); await goToScene({view: c.view, ids: [marks[step]], select: c.select}); }; card.append(g); } if (!done) { const ok = button('fv-follow-icon', null, [text.stepDone, text.tips.stepDone], icon('check')); ok.setAttribute('aria-label', text.stepDone); ok.onclick = () => { step++; draw(); }; card.append(ok); } @@ -463,9 +466,9 @@ export function openFollow(id, at = 0) { const done = step >= steps.length; card.classList.toggle('is-done', done); card.replaceChildren(); if (innerWidth < 720) { drawCapsule(); return; } - const head = el('div', 'fv-follow-h'); tip(head, lang === 'zh' ? '拖动' : 'Drag', text.tips.drag); + const head = el('div', 'fv-follow-h'); tip(head, say('Drag', '拖动'), text.tips.drag); const ic = el('span', 'fv-follow-ic'); ic.append(icon(done ? 'check' : 'steps')); - const t = el('span', 'fv-follow-t'); t.append(el('b', null, c.title[lang]), el('small', null, done ? text.done : text.stepOf(step + 1, steps.length))); + const t = el('span', 'fv-follow-t'); t.append(el('b', null, title), el('small', null, done ? text.done : fill(text.stepOf, { step: step + 1, total: steps.length }))); const expand = button('fv-follow-icon', null, [text.expand, text.tips.expand], icon('expand')); expand.setAttribute('aria-label', text.expand); expand.onclick = () => { close(); openTutorialBook({chapter: id}); }; const x = button('fv-follow-icon', null, [text.close, text.tips.followClose, 'Esc'], icon('x')); x.setAttribute('aria-label', text.close); x.onclick = close; @@ -484,7 +487,7 @@ export function openFollow(id, at = 0) { const foot = el('div', 'fv-follow-f'); if (done) { const order = bookOrder(), nextId = order[order.indexOf(id) + 1]; - foot.append(el('span', 'fv-follow-next', nextId ? text.doneNext + chapterOf(nextId).title[lang] : text.done), el('span', 'fv-follow-grow')); + foot.append(el('span', 'fv-follow-next', nextId ? text.doneNext + localized(chapterOf(nextId).title, say) : text.done), el('span', 'fv-follow-grow')); if (nextId) { const n = button('fv-book-btn', text.next, [text.next, text.tips.next]); n.dataset.kind = 'primary'; n.onclick = () => { close(); openTutorialBook({chapter: nextId}); }; foot.append(n); } } else { const back = button('fv-book-btn', text.stepBack, [text.stepBack, text.tips.stepBack]); back.disabled = step === 0; back.onclick = () => { step = Math.max(0, step - 1); draw(); }; @@ -532,9 +535,9 @@ export function openFollow(id, at = 0) { * Callers that own another modal may close it in beforeOpen. */ export function mountBookEntry({container, chapter, beforeOpen} = {}) { - const lang = language(); - const entry = el('button', 'fv-book-entry', COPY[lang].book); entry.type = 'button'; - tip(entry, COPY[lang].book, COPY[lang].tips.read); + const text = localized(COPY, translator(language() === 'zh')); + const entry = el('button', 'fv-book-entry', text.book); entry.type = 'button'; + tip(entry, text.book, text.tips.read); entry.onclick = () => { beforeOpen?.(); openTutorialBook({chapter}); }; container?.append(entry); return entry; diff --git a/web/tutorial_book_content.js b/web/tutorial_book_content.js index b0346ef7..d0a37449 100644 --- a/web/tutorial_book_content.js +++ b/web/tutorial_book_content.js @@ -1,5 +1,7 @@ // Bundled tutorial copy, a short form of docs/zh-CN/使用说明.md; keep them consistent. // Only finished chapters are listed. Add a chapter here when it is written, with its picture row in scripts/tutorial_pictures.json. +// Shown: title, summary, steps, limits (the media captions and the example's prompt are not). +// i18n-table title summary steps limits export const TUTORIAL_CHAPTERS = [ { id: 'quick-start', @@ -9,7 +11,7 @@ export const TUTORIAL_CHAPTERS = [ media: { type: 'image', src: {zh: 'quick-start-1.webp', en: 'quick-start-2.webp'}, - alt: {zh: '创作面板:描述框和“生⁠成⁠视⁠频”按钮已用红框标出。', en: 'The creation panel, with the prompt box and the "Generate video" button outlined in red.'}, + alt: {zh: '创作面板:提示词框和“生⁠成⁠视⁠频”按钮已用红框标出。', en: 'The creation panel, with the prompt box and the "Generate video" button outlined in red.'}, }, steps: { zh: ['打开“创作面板”,在“描述画面”中写一句话,说明谁在什么地方做什么。', '画幅选“横屏”或“竖屏”,其余保持默认。', '点“生⁠成⁠视⁠频”。', '完成后在预览区播放,点“下载视频”保存。'], @@ -36,7 +38,7 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:描述、画幅与尺寸区域已用红框标出。', en: 'The creation panel, with the prompt and the Frame & size fields outlined in red.'}, }, steps: { - zh: ['在“描述画面”中写明主体、动作、场景和镜头,例如“镜头缓缓推近”。', '在“画幅与尺寸”中选择横屏、竖屏或方形,再在“尺寸”一行选择大小。', '点底栏的秒数,直接修改时长;“可⁠生⁠成⁠范⁠围”中可查看各尺寸的最长时长和预计用时。', '点“生⁠成⁠视⁠频”。描述为空时会先提示,点“继⁠续⁠生⁠成”仍可生成。'], + zh: ['在“描述画面”中写明主体、动作、场景和镜头,例如“镜头缓缓推近”。', '在“画幅与尺寸”中选择横屏、竖屏或方形,再在“尺寸”一行选择大小。', '点底栏的秒数,直接修改时长;“可⁠生⁠成⁠范⁠围”中可查看各尺寸的最长时长和预计用时。', '点“生⁠成⁠视⁠频”。提示词为空时会先提示,点“继⁠续⁠生⁠成”仍可生成。'], en: ['Write the subject, action, place and camera in the prompt, for example "the camera slowly moves closer".', 'Under "Frame & size", choose landscape, portrait or square, then choose a size in the "Size" row.', 'Click the seconds in the bottom bar to change the length. "Available sizes and lengths" shows the longest length and the estimated time for each size.', 'Choose "Generate video". With an empty prompt, a note appears first; choose "Generate anyway" to go ahead.'], }, example: { @@ -45,21 +47,21 @@ export const TUTORIAL_CHAPTERS = [ settings: {quality: 'High', width: 960, height: 544, seconds: 5}, }, limits: { - zh: ['尺寸越大、时长越长,用时和显存占用越多。', '描述中的文字内容不一定能准确显示在画面里。', '开启“提示词增强”后,描述会在本机被改写得更详细。'], + zh: ['尺寸越大、时长越长,用时和显存占用越多。', '提示词中的文字内容不一定能准确显示在画面里。', '开启“提示词增强”后,提示词会在本机被改写得更详细。'], en: ['A larger size and a longer length take more time and memory.', 'Text named in the prompt may not appear exactly in the picture.', 'With "Prompt enhancement" on, the prompt is rewritten in more detail on this computer.'], }, }, { id: 'timed-lines', title: {zh: '按时间写台词和镜头', en: 'Write lines and cuts by time'}, - summary: {zh: '在描述中按时间写台词和切镜,镜头会在写定的时间切换。', en: 'Write lines and cuts with times in the prompt, and the shot changes at the times you set.'}, + summary: {zh: '在提示词中按时间写台词和切镜,镜头会在写定的时间切换。', en: 'Write lines and cuts with times in the prompt, and the shot changes at the times you set.'}, media: { type: 'image', src: {zh: 'timed-lines-1.webp', en: 'timed-lines-2.webp'}, alt: {zh: '创作面板:按时间书写台词和切镜的描述已用红框标出。', en: 'The creation panel, with a prompt of timed lines and a cut outlined in red.'}, }, steps: { - zh: ['在描述中另起一行,以“分:秒”开头,例如“0:02”。', '时间后写“名字:台词”,表示这个人按顺序说这句话;直接写一句话,表示这时发生的事。', '时间后写“切:”再写新镜头的画面,镜头会在这个时间切换。'], + zh: ['在提示词中另起一行,以“分:秒”开头,例如“0:02”。', '时间后写“名字:台词”,表示这个人按顺序说这句话;直接写一句话,表示这时发生的事。', '时间后写“切:”再写新镜头的画面,镜头会在这个时间切换。'], en: ['Start a new line in the prompt with minutes:seconds, for example "0:02".', 'After the time, write "Name: line" for a line the person says in turn, or a plain sentence for something that happens.', 'After the time, write "Cut:" and the new shot, and the shot changes at that time.'], }, example: { @@ -74,38 +76,38 @@ export const TUTORIAL_CHAPTERS = [ }, { id: 'image-gen', - title: {zh: '生成图片', en: 'Make a picture'}, - summary: {zh: '在图像视图中用一段描述生成图片,也可以在 AI 全自动中请助手出图。', en: 'Make a picture from a description in the Images view, or ask the assistant for one in Autopilot.'}, + title: {zh: '生成图片', en: 'Make an image'}, + summary: {zh: '在图像视图中用一段提示词生成图片,也可以在 AI 全自动中请助手出图。', en: 'Make an image from a prompt in the Images view, or ask the assistant for one in Autopilot.'}, media: { type: 'image', src: {zh: 'image-gen-1.webp', en: 'image-gen-2.webp'}, - alt: {zh: '图像视图:描述框、比例与清晰度、“生成”和图片下方的“⋯”已用红框标出。', en: 'The Images view, with the prompt, the shape and clarity, "Generate" and the "⋯" below the picture outlined in red.'}, + alt: {zh: '图像视图:提示词框、比例与清晰度、“生成”和图片下方的“⋯”已用红框标出。', en: 'The Images view, with the prompt, the shape and clarity, "Generate" and the "⋯" below the picture outlined in red.'}, }, steps: { zh: ['点顶部的“图像视图”。', '在“描述画面”中写下主体、场景和风格;图中要出现的文字,用引号写出原文。', '在“画幅与尺寸”中选择比例,再在“尺寸”中选择“4M”(约 400 万像素)或“16M”(约 1600 万像素)。显存为 8 GB 的显卡,选“4M”。', '点“生成”。图片显示在中间,并加入右侧的作品列表;图片下方一行写明生成它的模型、尺寸和比例。用图片下方一行的图标下载、打开文件夹或复制提示词。图片也会另存一份到 output 文件夹,在“设置”中可以关闭。', '在“AI 全自动”中,连接助手 后说“画一张……”,助手只生成图片,不生成视频;完成后点“打开”查看,点“下载”保存。'], - en: ['Choose "Images" at the top.', 'In "Describe the picture", write the subject, the place and the style. Put any words that should appear in the picture in quotation marks, exactly as written.', 'Under "Frame & size", choose the shape, then choose "4M" (about 4 megapixels) or "16M" (about 16 megapixels) under "Size". On a graphics card with 8 GB of memory, choose "4M".', 'Choose "Generate". The picture appears in the middle and is added to the works on the right. The line below it names the model that made it, with its size and shape. Use the icons in the line below it to download it, open its folder or copy the prompt. A copy of the picture is also saved to the output folder; this can be switched off in Settings.', 'In Autopilot, connect an assistant and say "Draw a picture of …". The assistant makes only the picture, not a video. When it finishes, choose "Open" to view it and "Download" to save it.'], + en: ['Choose "Images" at the top.', 'In "Describe the picture", write the subject, the place and the style. Put any words that should appear in the picture in quotation marks, exactly as written.', 'Under "Frame & size", choose the shape, then choose "4M" (about 4 megapixels) or "16M" (about 16 megapixels) under "Size". On a graphics card with 8 GB of memory, choose "4M".', 'Choose "Generate". The image appears in the middle and is added to the creations on the right. The line below it names the model that made it, with its size and shape. Use the icons in the line below it to download it, open its folder or copy the prompt. A copy of the image is also saved to the output folder; this can be switched off in Settings.', 'In Autopilot, connect an assistant and say "Draw an image of …". The assistant makes only the image, not a video. When it finishes, choose "Open" to view it and "Download" to save it.'], }, limits: { - zh: ['未安装图像模型时,“生成”显示为“下载模型”,点它下载;和视频共用的文件不重复下载。', '加参考图见“用参考图生成图片”。选 MOSS 时,点描述框下方的“布局”,在画框上拖出框,每个框写一句放什么。框管位置和大致大小,不会把东西拉伸到填满框。', '“高清”用时更长;显存不足时,出错卡片上可点“改用标准并重试”。'], - en: ['Without a picture model installed, "Generate" reads "Download model"; choose it to download. Files shared with video are not downloaded again.', 'For reference pictures, see "Make a picture from reference pictures". When MOSS is selected, choose "Layout" below the description, drag boxes on the frame and write what goes in each one. A box sets where a thing goes and roughly how big it is; it does not stretch the thing to fill the box.', '"High" takes longer. If memory runs short, choose "Retry at Standard" on the error card.'], + zh: ['未安装图像模型时,“生成”显示为“下载模型”,点它下载;和视频共用的文件不重复下载。', '加参考图见“用参考图生成图片”。选 MOSS 时,点提示词框下方的“布局”,在画框上拖出框,每个框写一句放什么。框管位置和大致大小,不会把东西拉伸到填满框。', '“高清”用时更长;显存不足时,出错卡片上可点“改用标准并重试”。'], + en: ['Without an image model installed, "Generate" reads "Download model"; choose it to download. Files shared with video are not downloaded again.', 'For reference images, see "Make an image from reference images". When MOSS is selected, choose "Layout" below the prompt box, drag boxes on the frame and write what goes in each one. A box sets where a thing goes and roughly how big it is; it does not stretch the thing to fill the box.', '"High" takes longer. If memory runs short, choose "Retry at Standard" on the error card.'], }, }, { id: 'image-references', - title: {zh: '用参考图生成图片', en: 'Make a picture from reference pictures'}, - summary: {zh: '在图像视图中加入参考图,在描述里用“图 1”“图 2”写明每张图的用途。', en: 'Add reference pictures in the Images view and say what each one is for as "Image 1", "Image 2" in the description.'}, + title: {zh: '用参考图生成图片', en: 'Make an image from reference images'}, + summary: {zh: '在图像视图中加入参考图,在提示词里用“图 1”“图 2”写明每张图的用途。', en: 'Add reference images in the Images view and say what each one is for as "Image 1", "Image 2" in the prompt.'}, media: { type: 'image', src: {zh: 'image-references-1.webp', en: 'image-references-2.webp'}, - alt: {zh: '图像视图:描述框和其下方的参考图(图 1、图 2 和“+”)已用红框标出。', en: 'The Images view, with the description and the reference pictures below it (Image 1, Image 2 and "+") outlined in red.'}, + alt: {zh: '图像视图:提示词框和其下方的参考图(图 1、图 2 和“+”)已用红框标出。', en: 'The Images view, with the prompt box and the reference images below it (Image 1, Image 2 and "+") outlined in red.'}, }, steps: { - zh: ['点顶部的“图像视图”,点描述框下方的“参考图”,选“从电脑选择…”或作品中的一张图片;也可以把图片拖到左侧,或粘贴到描述框中。', '参考图按加入的顺序编号为“图 1”“图 2”……在描述中写明每张图的用途,例如“图 1 的人物手里托着图 2 的怀表”。点参考图的缩略图,可以裁剪或修图。', '比例默认为“跟随图片”,也可以改选其他比例;然后点“生成”。', '在结果下方点“编辑”,它会成为图 1,接着描述要改的地方;点“用作参考图”,它会加到参考图的最后。', '把鼠标移到缩略图上,点右上角的“×”,可移除这张参考图。'], - en: ['Choose "Images" at the top, then "References" below the description, and pick "From this computer…" or a picture from your works. You can also drag pictures onto the left side or paste them into the description.', 'Reference pictures are numbered in the order they were added: "Image 1", "Image 2" and so on. Say in the description what each one is for, for example "the person in Image 1 holds the pocket watch from Image 2". Choose a thumbnail to crop or retouch it.', 'The shape is "Match image" unless you choose another. Then choose "Generate".', 'Below the result, choose "Edit" to make it Image 1 and describe what to change, or "Use as reference" to add it after the other reference pictures.', 'To remove a reference picture, point to its thumbnail and choose "×" at its top right.'], + zh: ['点顶部的“图像视图”,点提示词框下方的“参考图”,选“从电脑选择…”或作品中的一张图片;也可以把图片拖到左侧,或粘贴到提示词框中。', '参考图按加入的顺序编号为“图 1”“图 2”……在提示词中写明每张图的用途,例如“图 1 的人物手里托着图 2 的怀表”。点参考图的缩略图,可以裁剪或修图。', '比例默认为“跟随图片”,也可以改选其他比例;然后点“生成”。', '在结果下方点“编辑”,它会成为图 1,接着描述要改的地方;点“用作参考图”,它会加到参考图的最后。', '把鼠标移到缩略图上,点右上角的“×”,可移除这张参考图。'], + en: ['Choose "Images" at the top, then "References" below the prompt box, and pick "From this computer…" or an image from your creations. You can also drag images onto the left side or paste them into the prompt box.', 'Reference images are numbered in the order they were added: "Image 1", "Image 2" and so on. Say in the prompt what each one is for, for example "the person in Image 1 holds the pocket watch from Image 2". Choose a thumbnail to crop or retouch it.', 'The shape is "Match image" unless you choose another. Then choose "Generate".', 'Below the result, choose "Edit" to make it Image 1 and describe what to change, or "Use as reference" to add it after the other reference images.', 'To remove a reference image, point to its thumbnail and choose "×" at its top right.'], }, limits: { - zh: ['描述中没有写编号时,所有参考图按顺序一起使用。', 'H3 Image 最多使用 16 张参考图;换用其他图像模型后超出其上限时,会提示需要移除几张。'], - en: ['When the description names no picture, all reference pictures are used in order.', 'H3 Image uses up to 16 reference pictures. After switching to another picture model, a note says how many to remove if there are more than it takes.'], + zh: ['提示词中没有写编号时,所有参考图按顺序一起使用。', 'H3 Image 最多使用 16 张参考图;换用其他图像模型后超出其上限时,会提示需要移除几张。'], + en: ['When the prompt names no image, all reference images are used in order.', 'H3 Image uses up to 16 reference images. After switching to another image model, a note says how many to remove if there are more than it takes.'], }, }, { @@ -142,11 +144,11 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['在“素材”中添加首帧和尾帧两张图片,做法见“首帧和尾帧”一章。', '再点“添⁠加”选一张图片,将它的用途下拉框选为“中间帧”。', '在“时间”中填写这张图出现在第几秒;默认值位于前后两帧的正中,可直接修改。', '需要更多中间画面时重复上两步,最多 3 张,各张时间不能相同。', '在描述中写明画面如何变化,点“生⁠成⁠视⁠频”。'], - en: ['Under "Media", add a first frame and a last frame, as in the chapter "First and last frames".', 'Choose "Add" again, pick an image and set its role dropdown to "Middle frame".', 'Under "At", enter the second at which this picture appears. The default lies halfway between its neighbors and can be changed.', 'Repeat the last two steps for more pictures, up to 3, each at a different time.', 'Describe how the picture changes, then choose "Generate video".'], + en: ['Under "Media", add a first frame and a last frame, as in the chapter "First and last frames".', 'Choose "Add" again, pick an image and set its role dropdown to "Middle frame".', 'Under "At", enter the second at which this image appears. The default lies halfway between its neighbors and can be changed.', 'Repeat the last two steps for more pictures, up to 3, each at a different time.', 'Describe how the picture changes, then choose "Generate video".'], }, limits: { zh: ['中间帧需要同时有首帧和尾帧,时间需在视频时长以内。', '30 秒及以上的视频分段生成,中间帧只用于第一段。', '接续视频时不使用中间帧,首尾帧会用作参考图。'], - en: ['Middle frames need both a first and a last frame, and each time must fall within the video.', 'A video of 30 seconds or longer is made in parts, and middle frames apply to the first part only.', 'When continuing a video, middle frames are not used, and the first and last frames are used as references.'], + en: ['Middle frames need both a first and a last frame, and each time must fall within the video.', 'A video of 30 seconds or longer is made in parts, and middle frames apply to the first part only.', 'When extending a video, middle frames are not used, and the first and last frames are used as references.'], }, }, { @@ -159,7 +161,7 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:素材区域和参考图已用红框标出。', en: 'The creation panel, with the Media section and a reference image outlined in red.'}, }, steps: { - zh: ['在创作面板的“素材”中添加图片,每张可设为参考、首帧或尾帧。', '在描述中输入 @ 选择图片,并写明它在画面中的作用,例如“ 里的女孩在海边奔跑”。', '视频和音频也可作为参考:同样点“添\u2060加”,在描述中输入 @ 引用;视频卡片上勾选“仅参考构图”时,只沿用它的构图,不沿用动作和颜色。', '音频卡片上选“原样使用”时,成片直接使用这段声音,时长随音频而定;一次只能有一段音频原样使用。', '点“生⁠成⁠视⁠频”。'], + zh: ['在创作面板的“素材”中添加图片,每张可设为参考、首帧或尾帧。', '在提示词中输入 @ 选择图片,并写明它在画面中的作用,例如“ 里的女孩在海边奔跑”。', '视频和音频也可作为参考:同样点“添\u2060加”,在提示词中输入 @ 引用;视频卡片上勾选“仅参考构图”时,只沿用它的构图,不沿用动作和颜色。', '音频卡片上选“原样使用”时,成片直接使用这段声音,时长随音频而定;一次只能有一段音频原样使用。', '点“生⁠成⁠视⁠频”。'], en: ['Add images under "Media" in the creation panel and set each one as a reference, first frame, or last frame.', 'Type @ in the prompt and choose an image, then say what it does in the scene, for example "The girl in runs along the beach".', 'Videos and audio can be references too: add them the same way with "Add" and mention them in the prompt with @. On a video card, check "Composition only" to follow its layout but not its motion or colors.', 'On an audio card, choose "Use as is" to put that audio into the result unchanged. The duration follows the audio, and only one audio file can be used as is.', 'Choose "Generate video".'], }, example: { @@ -176,15 +178,15 @@ export const TUTORIAL_CHAPTERS = [ id: 'cast-sheet', goto: ['cast-add'], title: {zh: '角色库和角色设定图', en: 'Characters and character sheets'}, - summary: {zh: '把人物保存为角色,之后在描述中用 @ 引用。', en: 'Save a person as a character, then mention it with @ in later prompts.'}, + summary: {zh: '把人物保存为角色,之后在提示词中用 @ 引用。', en: 'Save a person as a character, then mention it with @ in later prompts.'}, media: { type: 'image', src: {zh: 'cast-sheet-1.webp', en: 'cast-sheet-2.webp'}, alt: {zh: '角色窗口:名字和正面、侧面、背面三格已用红框标出。', en: 'The character window, with the name and the front, side and back slots outlined in red.'}, }, steps: { - zh: ['展开创作面板的“素材”,在“角色”一行点“+”新建角色。', '填写“名字”,设置图片:可“上⁠传⁠图⁠片”,也可“AI 生成”或“从照片生成”,会生成脸部特写、正面、侧面和背面四张。', '在脸部特写、正面、侧面、背面四格中添加或替换图片,四张齐了再点“保⁠存”。', '之后在描述中输入 @ 选择该角色,并写明其动作。'], - en: ['Expand "Media" in the creation panel and, on the "Characters" row, choose + to create a character.', 'Enter a "Name" and add pictures: choose "Upload images", or "Generate with AI" or "From a photo", which make a face close-up, front, side and back view.', 'Add or replace images in the face close-up, front, side and back slots; when all four are filled, choose "Save".', 'In later prompts, type @ to pick the character and describe what the character does.'], + zh: ['展开创作面板的“素材”,在“角色”一行点“+”新建角色。', '填写“名字”,设置图片:可“上⁠传⁠图⁠片”,也可“AI 生成”或“从照片生成”,会生成脸部特写、正面、侧面和背面四张。', '在脸部特写、正面、侧面、背面四格中添加或替换图片,四张齐了再点“保⁠存”。', '之后在提示词中输入 @ 选择该角色,并写明其动作。'], + en: ['Expand "Media" in the creation panel and, on the "Characters" row, choose + to create a character.', 'Enter a "Name" and add images: choose "Upload images", or "Generate with AI" or "From a photo", which make a face close-up, front, side and back view.', 'Add or replace images in the face close-up, front, side and back slots; when all four are filled, choose "Save".', 'In later prompts, type @ to pick the character and describe what the character does.'], }, example: { assets: [{file: 'fox-sheet.webp', role: 'reference'}], @@ -199,15 +201,15 @@ export const TUTORIAL_CHAPTERS = [ { id: 'scenes-props', title: {zh: '场景和道具', en: 'Scenes and props'}, - summary: {zh: '把常用的地点和物品存进素材库,在描述中用 @ 引用。', en: 'Save a place or an object once, then mention it with @ in later prompts.'}, + summary: {zh: '把常用的地点和物品存进素材库,在提示词中用 @ 引用。', en: 'Save a place or an object once, then mention it with @ in later prompts.'}, media: { type: 'image', src: {zh: 'scenes-props-1.webp', en: 'scenes-props-2.webp'}, alt: {zh: '道具窗口:名称和图片已用红框标出。', en: 'The prop window, with the name and the image outlined in red.'}, }, steps: { - zh: ['展开创作面板的“素材”,在“场景”或“道具”一行点“+”新建。', '填写“名称”,添加图片:可“上传图片”,也可“AI 生成”。场景最多 3 张图片,道具 1 张。', '点“保存”。', '之后在描述中输入 @ 选择它,并写明它在画面中的位置或用法。'], - en: ['Expand "Media" in the creation panel and choose + on the "Scenes" or "Props" row.', 'Enter a "Name" and add pictures: choose "Upload images" or "Generate with AI". A scene takes up to 3 pictures, a prop 1.', 'Choose "Save".', 'Later, type @ in the description to pick it, and say where it is in the shot or how it is used.'], + zh: ['展开创作面板的“素材”,在“场景”或“道具”一行点“+”新建。', '填写“名称”,添加图片:可“上传图片”,也可“AI 生成”。场景最多 3 张图片,道具 1 张。', '点“保存”。', '之后在提示词中输入 @ 选择它,并写明它在画面中的位置或用法。'], + en: ['Expand "Media" in the creation panel and choose + on the "Scenes" or "Props" row.', 'Enter a "Name" and add images: choose "Upload images" or "Generate with AI". A scene takes up to 3 images, a prop 1.', 'Choose "Save".', 'Later, type @ in the prompt to pick it, and say where it is in the shot or how it is used.'], }, limits: { zh: ['一次请求最多使用 1 个场景和 2 个道具,不占角色的 3 个名额。', 'Mac 上场景、道具与首帧、尾帧请选其一使用。', '物品的细节可能每次略有不同。'], @@ -224,7 +226,7 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:素材中的“替换人物”、源视频和人物图两格、“保⁠留⁠源⁠视⁠频⁠声⁠音”已用红框标出。', en: 'The creation panel, with "Replace person", the source video and person image slots, and "Keep source video sound" outlined in red.'}, }, steps: { - zh: ['展开创作面板的“素材”,打开“替换人物”。', '在“源视频”中点“添加视频”,在“人物图”中点“添加图片”。', '需要源视频的声音时,勾选“保⁠留⁠源⁠视⁠频⁠声⁠音”。', '描述可以留空,也可以补充画面要求;然后点“生⁠成⁠视⁠频”。'], + zh: ['展开创作面板的“素材”,打开“替换人物”。', '在“源视频”中点“添加视频”,在“人物图”中点“添加图片”。', '需要源视频的声音时,勾选“保⁠留⁠源⁠视⁠频⁠声⁠音”。', '提示词可以留空,也可以补充画面要求;然后点“生⁠成⁠视⁠频”。'], en: ['Expand "Media" in the creation panel and turn on "Replace person".', 'Under "Source video" choose "Add video", and under "Person image" choose "Add image".', 'To keep the sound of the source video, check "Keep source video sound".', 'The prompt can stay empty or describe more of the picture. Then choose "Generate video".'], }, limits: { @@ -236,7 +238,7 @@ export const TUTORIAL_CHAPTERS = [ id: 'replace-two-people', goto: ['replace-person'], title: {zh: '替换两个人物', en: 'Replace two people'}, - summary: {zh: '源视频里有两个人时,用两张人物图分别替换。', en: 'When the source video has two people, replace each with its own picture.'}, + summary: {zh: '源视频里有两个人时,用两张人物图分别替换。', en: 'When the source video has two people, replace each with its own image.'}, media: { type: 'image', src: {zh: 'replace-two-people-1.webp', en: 'replace-two-people-2.webp'}, @@ -244,7 +246,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['展开创作面板的“素材”,打开“替换人物”,在“源视频”中添加视频。', '在“人物图 1”中添加第一张人物图;右边会出现“人物图 2”,再添加第二张。', '人物图按画面中人物从左到右的顺序对应:人物图 1 替换左边的人,人物图 2 替换右边的人。', '点人物图右上角的 × 可以移除一张。', '点“生⁠成⁠视⁠频”。'], - en: ['Expand "Media" in the creation panel, turn on "Replace person" and add the video under "Source video".', 'Add the first picture under "Person image 1". "Person image 2" appears next to it; add the second picture there.', 'The pictures are matched to the people in the video from left to right: image 1 replaces the person on the left, image 2 the person on the right.', 'Choose × at the top right of a picture to remove it.', 'Choose "Generate video".'], + en: ['Expand "Media" in the creation panel, turn on "Replace person" and add the video under "Source video".', 'Add the first image under "Person image 1". "Person image 2" appears next to it; add the second image there.', 'The pictures are matched to the people in the video from left to right: image 1 replaces the person on the left, image 2 the person on the right.', 'Choose × at the top right of an image to remove it.', 'Choose "Generate video".'], }, limits: { zh: ['一次最多替换 2 个人物。', '替换人物与首帧、尾帧请选其一使用。'], @@ -253,7 +255,7 @@ export const TUTORIAL_CHAPTERS = [ }, { id: 'edit-image', - title: {zh: '编辑图片', en: 'Edit a picture'}, + title: {zh: '编辑图片', en: 'Edit an image'}, summary: {zh: '在生成前裁剪、修图或加文字,原图始终保留。', en: 'Crop, retouch or add text before generating. The original is always kept.'}, media: { type: 'image', @@ -262,16 +264,16 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['展开创作面板的“素材”,上传图片后点图片,或点图片上方的“编辑”。', '在左侧工具栏选择工具:“裁剪与画布”调整构图,“画笔”“污点修复”“仿制图章”修图,“文字”添加文字。', '改错了可点“撤销”,或按 Ctrl+Z。', '点“保存”。修改后的图片用于生成,原图仍保留;要改回,在图片的下拉菜单中选“改回原图”。'], - en: ['Expand "Media" in the creation panel, upload a picture, then choose the picture, or "Edit" at its top.', 'Choose a tool on the left: "Crop and canvas" to recompose, "Brush", "Spot healing" or "Clone stamp" to retouch, "Text" to add words.', 'To undo a change, choose "Undo" or press Ctrl+Z.', 'Choose "Save". The edited picture is used for generation and the original is kept. To switch back, choose "Use the original image again" in the picture\'s drop-down.'], + en: ['Expand "Media" in the creation panel, upload an image, then choose the image, or "Edit" at its top.', 'Choose a tool on the left: "Crop and canvas" to recompose, "Brush", "Spot healing" or "Clone stamp" to retouch, "Text" to add words.', 'To undo a change, choose "Undo" or press Ctrl+Z.', 'Choose "Save". The edited image is used for generation and the original is kept. To switch back, choose "Use the original image again" in the image\'s drop-down.'], }, limits: { zh: ['视频的裁剪另在“调整裁剪”中设置。', '“AI 生成”和“点选”需要图片生成功能可用时才显示。'], - en: ['Crop for a video is set separately, with "Adjust crop".', '"Generate with AI" and "Click select" appear only when picture generation is available.'], + en: ['Crop for a video is set separately, with "Adjust crop".', '"Generate with AI" and "Click select" appear only when image generation is available.'], }, }, { id: 'local-image-edit', - title: {zh: '局部改图', en: 'Change part of a picture'}, + title: {zh: '局部改图', en: 'Change part of an image'}, summary: {zh: '在编辑图片中框出一块区域,只让 AI 修改这一块,其余部分保持不变。', en: 'Select an area in the image editor and let the AI change only that area, leaving the rest as it is.'}, media: { type: 'image', @@ -279,30 +281,30 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '编辑图片:图片上框出了一块选区,“选框”工具、描述栏和“生成”按钮已用红框标出。', en: 'The image editor, with an area selected on the picture and the Marquee tool, the description field and the "Generate" button outlined in red.'}, }, steps: { - zh: ['展开创作面板的“素材”,点图片(或图片上方的“编辑”),打开“编辑图片”。', '点左上角的“AI 生成”,选择“改这张”。', '用“选框”“套索”或“魔棒”在图片上选出要修改的区域;按住 Shift 拖动可以添加区域,按住 Alt 拖动可以减去一块。', '在描述栏中写下选区要改成什么样。', '点“生⁠成”。结果出现后选区仍然保留,可以直接再改;满意后点“保存”。'], - en: ['Expand "Media" in the creation panel, click the picture (or "Edit" at its top) to open "Edit image".', 'Click "Generate with AI" at the top left and choose "Edit this".', 'Select the area to change on the picture with "Marquee", "Lasso" or "Magic wand". Hold Shift while dragging to add an area, or Alt to take one away.', 'In the description field, describe how the selection should change.', 'Click "Generate". The selection stays after the result appears, so it can be changed again; click "Save" when satisfied.'], + zh: ['展开创作面板的“素材”,点图片(或图片上方的“编辑”),打开“编辑图片”。', '点左上角的“AI 生成”,选择“改这张”。', '用“选框”“套索”或“魔棒”在图片上选出要修改的区域;按住 Shift 拖动可以添加区域,按住 Alt 拖动可以减去一块。', '在提示词栏中写下选区要改成什么样。', '点“生⁠成”。结果出现后选区仍然保留,可以直接再改;满意后点“保存”。'], + en: ['Expand "Media" in the creation panel, click the image (or "Edit" at its top) to open "Edit image".', 'Click "Generate with AI" at the top left and choose "Edit this".', 'Select the area to change on the image with "Marquee", "Lasso" or "Magic wand". Hold Shift while dragging to add an area, or Alt to take one away.', 'In the prompt field, describe how the selection should change.', 'Click "Generate". The selection stays after the result appears, so it can be changed again; click "Save" when satisfied.'], }, limits: { - zh: ['没有选区时,“改这张”会按描述修改整张图片。', '“点选”需要先下载一次选区模型,面板会显示进度。', '图片生成需要所用的图片模型已经下载完成。'], - en: ['Without a selection, "Edit this" changes the whole picture according to the description.', '"Click select" needs a selection model downloaded once; the panel shows the progress.', 'Generating pictures needs the picture model to be downloaded first.'], + zh: ['没有选区时,“改这张”会按提示词修改整张图片。', '“点选”需要先下载一次选区模型,面板会显示进度。', '图片生成需要所用的图片模型已经下载完成。'], + en: ['Without a selection, "Edit this" changes the whole image according to the prompt.', '"Click select" needs a selection model downloaded once; the panel shows the progress.', 'Generating images needs the image model to be downloaded first.'], }, }, { id: 'new-image-shape', - title: {zh: '在已有图片的画板上生成新图', en: 'A new picture on a canvas that has pictures'}, - summary: {zh: '画板上已有图片时,“生成一张”可以沿用当前画板,也可以换一种比例另起一块画板。', en: 'When the canvas already has pictures, "New image" can use the current canvas or start a canvas of another shape.'}, + title: {zh: '在已有图片的画板上生成新图', en: 'A new image on a canvas that has images'}, + summary: {zh: '画板上已有图片时,“生成一张”可以沿用当前画板,也可以换一种比例另起一块画板。', en: 'When the canvas already has images, "New image" can use the current canvas or start a canvas of another shape.'}, media: { type: 'image', src: {zh: 'new-image-shape-1.webp', en: 'new-image-shape-2.webp'}, alt: {zh: '编辑图片:“生成一张”和比例列表已用红框标出,比例选为 16:9。', en: 'The image editor, with "New image" and the shape list outlined in red and 16:9 chosen.'}, }, steps: { - zh: ['打开“编辑图片”,点左上角的“AI 生成”,选择“生⁠成⁠一⁠张”。', '旁边的比例列表默认是当前画板的比例;画板不是常用比例时,第一项显示它的尺寸。', '保持当前比例时,新图作为一个新图层加入当前画板。', '选择其他比例时,新图放在该比例的一块新空白画板上。', '写好描述后点“生⁠成”。要回到原来的画板,点一次“撤⁠销”。'], - en: ['Open "Edit image", click "Generate with AI" at the top left and choose "New image".', 'The shape list beside it starts at the current canvas shape. When the canvas is not one of the usual shapes, its size is listed first.', 'With the current shape kept, the new picture is added to the canvas as a new layer.', 'With another shape chosen, the new picture is placed on a new blank canvas of that shape.', 'Write the description and click "Generate". To return to the previous canvas, click "Undo" once.'], + zh: ['打开“编辑图片”,点左上角的“AI 生成”,选择“生⁠成⁠一⁠张”。', '旁边的比例列表默认是当前画板的比例;画板不是常用比例时,第一项显示它的尺寸。', '保持当前比例时,新图作为一个新图层加入当前画板。', '选择其他比例时,新图放在该比例的一块新空白画板上。', '写好提示词后点“生⁠成”。要回到原来的画板,点一次“撤⁠销”。'], + en: ['Open "Edit image", click "Generate with AI" at the top left and choose "New image".', 'The shape list beside it starts at the current canvas shape. When the canvas is not one of the usual shapes, its size is listed first.', 'With the current shape kept, the new image is added to the canvas as a new layer.', 'With another shape chosen, the new image is placed on a new blank canvas of that shape.', 'Write the prompt and click "Generate". To return to the previous canvas, click "Undo" once.'], }, limits: { zh: ['“改这张”修改当前图片,不显示比例列表。', '画板为空时,比例列表用来设定空白画板的比例。'], - en: ['"Edit this" changes the current picture and does not show the shape list.', 'On an empty canvas, the shape list sets the shape of the blank canvas.'], + en: ['"Edit this" changes the current image and does not show the shape list.', 'On an empty canvas, the shape list sets the shape of the blank canvas.'], }, }, { @@ -316,7 +318,7 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:“LoRA”中的“添加”按钮、模型下拉列表、强度和左侧把手已用红框标出。', en: 'The creation panel, with the "Add" button under "LoRA", the model list, the strength and the handle on the left outlined in red.'}, }, steps: { - zh: ['把 LoRA 文件(.safetensors)放进 models/loras 文件夹。', '点创作面板的“LoRA”,再点“添加 LoRA”,在下拉列表中选择文件。', '需要时修改右边的强度,默认是 1;取消行首的勾选可暂时停用;有多个 LoRA 时,拖动左侧的把手调整顺序。', '模型要求触发词时,填在“触发词”一栏,它会自动加进描述;移除这个 LoRA 时一并去掉。', '点“生⁠成⁠视⁠频”。'], + zh: ['把 LoRA 文件(.safetensors)放进 models/loras 文件夹。', '点创作面板的“LoRA”,再点“添加 LoRA”,在下拉列表中选择文件。', '需要时修改右边的强度,默认是 1;取消行首的勾选可暂时停用;有多个 LoRA 时,拖动左侧的把手调整顺序。', '模型要求触发词时,填在“触发词”一栏,它会自动加进提示词;移除这个 LoRA 时一并去掉。', '点“生⁠成⁠视⁠频”。'], en: ['Put the LoRA file (.safetensors) in the models/loras folder.', 'Choose "LoRA" in the creation panel, then "Add LoRA", and pick the file from the list.', 'Change the strength on the right if needed; the default is 1. Clear the checkbox at the start of the row to switch the LoRA off for now. With more than one LoRA, drag the handle on the left to change the order.', 'If the LoRA asks for trigger words, enter them in "Trigger words". They are added to the prompt, and removed again with the LoRA.', 'Choose "Generate video".'], }, limits: { @@ -357,7 +359,7 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '创作面板:“生⁠成⁠视⁠频”右侧的箭头已用红框标出,展开的菜单中有“生⁠成⁠视⁠频”和“生⁠成⁠预⁠览”。', en: 'The creation panel, with the arrow beside "Generate video" outlined in red and its menu open on "Generate video" and "Generate preview".'}, }, steps: { - zh: ['点“生⁠成⁠视⁠频”右侧的箭头,选“生⁠成⁠预⁠览”。', '点“生⁠成⁠预⁠览”,等待预览完成。', '画面满意时,点结果中的“继续二采”;也可以在作品库中右键这条预览,选“继续二采”。', '不满意时,修改描述或种子,再生成新的预览。'], + zh: ['点“生⁠成⁠视⁠频”右侧的箭头,选“生⁠成⁠预⁠览”。', '点“生⁠成⁠预⁠览”,等待预览完成。', '画面满意时,点结果中的“继续二采”;也可以在作品库中右键这条预览,选“继续二采”。', '不满意时,修改提示词或种子,再生成新的预览。'], en: ['Choose the arrow beside "Generate video" and pick "Generate preview".', 'Choose "Generate preview" and wait for it to finish.', 'When the picture is right, choose "Run second pass" in the result, or right-click the preview in Creations and choose "Run second pass".', 'Otherwise change the prompt or the seed and generate a new preview.'], }, example: { @@ -372,7 +374,7 @@ export const TUTORIAL_CHAPTERS = [ }, { id: 'run-modes', - title: {zh: '一次生成多条:批量、每行一条描述和循环', en: 'Several at once: batch, one prompt per line, loop'}, + title: {zh: '一次生成多条:批量、每行一条提示词和循环', en: 'Several at once: batch, one prompt per line, loop'}, summary: {zh: '用同一组设置连续生成多个版本,或一次试几种写法。', en: 'Make several takes with the same settings in a row, or try several prompts at once.'}, media: { type: 'image', @@ -380,8 +382,8 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '“高级选项”窗口:“生成方式”中的“批量”、“生成数量”和“每行一条描述”已用红框标出。', en: 'The Advanced window, with "Batch", "Number of videos" and "One prompt per line" under "Generation mode" outlined in red.'}, }, steps: { - zh: ['点创作面板底部的“高级选项”(滑杆图标)。', '在“生成方式”中选“批量”,填写“生成数量”,再点生成:用当前设置连续生成这么多个视频,每个换一个种子。', '要一次试几种写法,打开“每行一条描述”,在描述框中每行写一条,每行生成一个视频。', '选“循环”后点“开始循环”,会一直生成新版本;点“完成当前后停止”结束。'], - en: ['Choose "Advanced" (the sliders icon) at the bottom of the creation panel.', 'Under "Generation mode", choose "Batch", set "Number of videos", then generate: that many videos are made in a row with the current settings, each with a new seed.', 'To try several prompts at once, turn on "One prompt per line" and write one prompt per line in the description. Each line becomes one video.', 'Choose "Loop" and then "Start loop" to keep making new takes; choose "Stop after this video" to end it.'], + zh: ['点创作面板底部的“高级选项”(滑杆图标)。', '在“生成方式”中选“批量”,填写“生成数量”,再点生成:用当前设置连续生成这么多个视频,每个换一个种子。', '要一次试几种写法,打开“每行一条提示词”,在提示词框中每行写一条,每行生成一个视频。', '选“循环”后点“开始循环”,会一直生成新版本;点“完成当前后停止”结束。'], + en: ['Choose "Advanced" (the sliders icon) at the bottom of the creation panel.', 'Under "Generation mode", choose "Batch", set "Number of videos", then generate: that many videos are made in a row with the current settings, each with a new seed.', 'To try several prompts at once, turn on "One prompt per line" and write one prompt per line in the prompt box. Each line becomes one video.', 'Choose "Loop" and then "Start loop" to keep making new takes; choose "Stop after this video" to end it.'], }, limits: { zh: ['分段视频每次生成一条,“批量”和“循环”用于单段视频。', '打开“增强”时,每行一条描述按原文发送,不做增强。', '循环在关闭网页后停止。'], @@ -391,7 +393,7 @@ export const TUTORIAL_CHAPTERS = [ { id: 'long-video', title: {zh: '连续的长视频', en: 'Make a longer video'}, - summary: {zh: '填写更长的时长自动分段生成,也可逐段接续。', en: 'Enter a longer duration to generate in parts, or continue one part at a time.'}, + summary: {zh: '填写更长的时长自动分段生成,也可逐段接续。', en: 'Enter a longer duration to generate in parts, or extend one part at a time.'}, media: { type: 'image', src: {zh: 'long-video-1.webp', en: 'long-video-2.webp'}, @@ -399,7 +401,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['填写更长的时长,会自动分段生成;点画幅按钮(如“16:9 · 1M”),在“可⁠生⁠成⁠范⁠围”中可查看各尺寸的最长时长和预计用时。', '点“生⁠成⁠视⁠频”。', '在生成好的视频下方点“接着生成”,继续下一段。', '更长的多镜头视频,可在“剪辑视图”中另起新的镜头,或使用“AI 全自动”。'], - en: ['Enter a longer duration. It is made in parts automatically. Choose the frame button (such as "16:9 · 1M"); "Available sizes and lengths" there shows how long each size can be and about how long it takes.', 'Choose "Generate video".', 'Choose "Extend" below a finished video to continue it.', 'For a longer video with several shots, start new shots in "Edit", or use "Autopilot".'], + en: ['Enter a longer duration. It is made in parts automatically. Choose the frame button (such as "16:9 · 1M"); "Available sizes and lengths" there shows how long each size can be and about how long it takes.', 'Choose "Generate video".', 'Choose "Extend" below a finished video to add the next part.', 'For a longer video with several shots, start new shots in "Edit", or use "Autopilot".'], }, example: { assets: [], @@ -408,21 +410,21 @@ export const TUTORIAL_CHAPTERS = [ }, limits: { zh: ['接着生成的每一段至少 5 秒,最后一段可短至 2 秒。一个连续镜头最多 8 段,有短于 10 秒的段时最多 4 段;创作面板中时长最长 60 秒;分镜剧本可在剪辑视图中逐个镜头添加,或用 AI 全自动。', '分段生成和接着生成需要 NVIDIA 显卡或 Mac。', '段数越多,衔接处越容易出现变化;适合切换镜头处,可直接开始新的一段。'], - en: ['Each continued part is at least 5 seconds, and the last one can be as short as 2 seconds. One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds, and the creation panel accepts up to 60 seconds. For a storyboard, add shots one by one in Edit, or use Autopilot.', 'Generating in parts and Extend need an NVIDIA graphics card or a Mac.', 'The more parts are joined, the more the joins may change. Where a cut fits, cut to a new shot and start a fresh part.'], + en: ['Each added part is at least 5 seconds, and the last one can be as short as 2 seconds. One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds, and the creation panel accepts up to 60 seconds. For a storyboard, add shots one by one in Edit, or use Autopilot.', 'Generating in parts and Extend need an NVIDIA graphics card or a Mac.', 'The more parts are joined, the more the joins may change. Where a cut fits, cut to a new shot and start a fresh part.'], }, }, { id: 'extend-video', title: {zh: '延长已有视频', en: 'Extend an existing video'}, - summary: {zh: '从一条已有视频的结尾继续往下生成。', en: 'Continue from the end of a video you already have.'}, + summary: {zh: '从一条已有视频的结尾继续往下生成。', en: 'Extend a video you already have from its end.'}, media: { type: 'image', src: {zh: 'extend-video-1.webp', en: 'extend-video-2.webp'}, - alt: {zh: '剪辑视图:接着生成的草稿段和描述框已用红框标出。', en: 'The Edit view, with the draft part that continues the video and the prompt box outlined in red.'}, + alt: {zh: '剪辑视图:接着生成的草稿段和提示词框已用红框标出。', en: 'The Edit view, with the draft part that continues the video and the prompt box outlined in red.'}, }, steps: { - zh: ['在生成好的视频下方点“接着生成”,打开剪辑视图。', '选中后面自动加上的那一段,在底部描述框写明接下来发生什么。这一段默认 10 秒,在 Mac 和一次生成不了 10 秒的设备上为 5 秒。', '需要更长时,拖长这一段,每段至少 5 秒,然后点“生⁠成”。', '新的一段会接在原视频之后,并自动拼成一条。'], - en: ['Choose "Extend" below a finished video. The Edit view opens.', 'Select the part added after it and write what happens next in the box at the bottom. The part is 10 seconds by default, or 5 seconds on a Mac and on devices that cannot make 10 seconds at once.', 'To make it longer, drag the part out; each part is at least 5 seconds. Then choose "Generate".', 'The new part follows the original and is joined into one video.'], + zh: ['在生成好的视频下方点“接着生成”,打开剪辑视图。', '选中后面自动加上的那一段,在底部提示词框写明接下来发生什么。这一段默认 10 秒,在 Mac 和一次生成不了 10 秒的设备上为 5 秒。', '需要更长时,拖长这一段,每段至少 5 秒,然后点“生⁠成”。', '新的一段会接在原视频之后,并自动拼成一条。'], + en: ['Choose "Extend" below a finished video. The Edit view opens.', 'Select the part added after it and write what happens next in the prompt box at the bottom. The part is 10 seconds by default, or 5 seconds on a Mac and on devices that cannot make 10 seconds at once.', 'To make it longer, drag the part out; each part is at least 5 seconds. Then choose "Generate".', 'The new part follows the original and is joined into one video.'], }, example: { assets: [], @@ -436,7 +438,7 @@ export const TUTORIAL_CHAPTERS = [ }, { id: 'continue-or-new-shot', - title: {zh: '接着生成,还是另起镜头', en: 'Continue a shot or start a new one'}, + title: {zh: '接着生成,还是另起镜头', en: 'Extend a shot or start a new one'}, summary: {zh: '接着生成是同一个镜头的下一段;在时间线空白处另起的是新镜头。', en: 'Extend makes the next part of the same shot. A part dragged out in an empty place on the timeline is a new shot.'}, media: { type: 'image', @@ -445,7 +447,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['要让画面接着上一段往下发展,在生成好的视频下方点“接着生成”:新的一段紧接在后面,带有连接标记,与前面拼成同一个镜头。', '要换场景或切到另一个画面,在时间线的空白处拖出一段,写下描述再点“生⁠成”:它是独立镜头,不接前面的画面。', '看时间线:接续的一段紧贴前一段,带连接标记;独立镜头与前面的视频分开显示。'], - en: ['To carry the picture on from the previous part, choose "Extend" below a finished video. The new part follows right after it, carries a link mark, and joins the earlier part as one shot.', 'To change scene or cut to another picture, drag out a part in an empty place on the timeline, describe it and choose "Generate". It is a separate shot and does not continue the earlier picture.', 'Check the timeline: a continuing part sits right against the part before it and carries a link mark. A separate shot is drawn apart from the video before it.'], + en: ['To carry the picture on from the previous part, choose "Extend" below a finished video. The new part follows right after it, carries a link mark, and joins the earlier part as one shot.', 'To change scene or cut to another picture, drag out a part in an empty place on the timeline, describe it and choose "Generate". It is a separate shot and does not continue the earlier picture.', 'Check the timeline: an extended part sits right against the part before it and carries a link mark. A separate shot is drawn apart from the video before it.'], }, example: { assets: [], @@ -461,16 +463,16 @@ export const TUTORIAL_CHAPTERS = [ id: 'editor', view: 'editor', goto: ['editor-timeline'], - title: {zh: '剪辑视图:裁剪、描述、接续', en: 'The Edit view: crop, describe, continue'}, - summary: {zh: '在时间线上选中一段,描述它,并接着生成。', en: 'Select a part on the timeline, describe it and continue.'}, + title: {zh: '剪辑视图:裁剪、描述、接续', en: 'The Edit view: crop, describe, extend'}, + summary: {zh: '在时间线上选中一段,描述它,并接着生成。', en: 'Select a part on the timeline, describe it and extend the video.'}, media: { type: 'image', src: {zh: 'editor-1.webp', en: 'editor-2.webp'}, - alt: {zh: '剪辑视图:选中的一段和描述框已用红框标出。', en: 'The Edit view, with the selected part and the prompt box outlined in red.'}, + alt: {zh: '剪辑视图:选中的一段和提示词框已用红框标出。', en: 'The Edit view, with the selected part and the prompt box outlined in red.'}, }, steps: { - zh: ['点顶部的“剪辑视图”。', '在时间线上选中要处理的一段。', '在下方描述框中填写这一段的内容,点“生⁠成”接续下一段。', '在右侧“画面”中可调整缩放、位置和旋转,或点“裁⁠剪”;窗口窄于 1280 时,先点“调⁠整”打开该面板。', '完成后点右上角的“导⁠出”保存。'], - en: ['Choose "Edit" at the top.', 'Select a part on the timeline.', 'Write what happens in this part in the box below and choose "Generate" to continue.', 'Under "Video" on the right, adjust scale, position and rotation, or choose "Crop". On a window narrower than 1280 pixels, choose "Adjust" first to open the panel.', 'When done, choose "Export" at the top right.'], + zh: ['点顶部的“剪辑视图”。', '在时间线上选中要处理的一段。', '在下方提示词框中填写这一段的内容,点“生⁠成”接续下一段。', '在右侧“画面”中可调整缩放、位置和旋转,或点“裁⁠剪”;窗口窄于 1280 时,先点“调⁠整”打开该面板。', '完成后点右上角的“导⁠出”保存。'], + en: ['Choose "Edit" at the top.', 'Select a part on the timeline.', 'Write what happens in this part in the prompt box below and choose "Generate" to extend the video.', 'Under "Video" on the right, adjust scale, position and rotation, or choose "Crop". On a window narrower than 1280 pixels, choose "Adjust" first to open the panel.', 'When done, choose "Export" at the top right.'], }, example: { assets: [], @@ -479,7 +481,7 @@ export const TUTORIAL_CHAPTERS = [ }, limits: { zh: ['同一个连续镜头最多 8 段,有短于 10 秒的段时最多 4 段;在时间线后面另起的新镜头不计入。', '接续需要 NVIDIA 显卡或 Mac。'], - en: ['One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds; a new shot started later on the timeline does not count.', 'Continuing needs an NVIDIA graphics card or a Mac.'], + en: ['One continuous shot has at most 8 parts, or 4 when a part is shorter than 10 seconds; a new shot started later on the timeline does not count.', 'Extending needs an NVIDIA graphics card or a Mac.'], }, }, { @@ -494,7 +496,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['点顶部的“剪辑视图”。', '把播放头拖到想要的画面上,也可按空格播放、暂停后停在该处。', '点预览右下方的“保存当前帧”按钮(相机图标)。', '保存后,在“编辑图片 > AI 生成 > 作品库”中找到这张图片。'], - en: ['Choose "Edit" at the top.', 'Drag the playhead to the picture you want, or press Space to play and pause there.', 'Choose the "Save current frame" button (camera icon) at the lower right of the preview.', 'Find the saved picture under "Edit image > Generate with AI > Works".'], + en: ['Choose "Edit" at the top.', 'Drag the playhead to the picture you want, or press Space to play and pause there.', 'Choose the "Save current frame" button (camera icon) at the lower right of the preview.', 'Find the saved image under "Edit image > Generate with AI > Creations".'], }, limits: { zh: ['保存的图片与导出视频中这一刻的画面相同。', '播放头下方须有片段;正在生成的一段完成后才能保存。', '时间线为空时按钮不可用。'], @@ -513,7 +515,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['选中要接续的一段。', '点“素材”,上传或生成图片,最多 3 张。', '填写描述,然后点“生⁠成”。'], - en: ['Select the part to continue.', 'Choose "Media" to upload or generate images, up to 3.', 'Describe it, then choose "Generate".'], + en: ['Select the part to extend.', 'Choose "Media" to upload or generate images, up to 3.', 'Describe it, then choose "Generate".'], }, example: { assets: [], @@ -522,7 +524,7 @@ export const TUTORIAL_CHAPTERS = [ }, limits: { zh: ['接续生成最多使用 3 张参考图,不使用首帧和尾帧。', '剪辑视图只能添加图片;参考视频和音频在创作面板的“素材”中添加。', '段数限制相同;需要 NVIDIA 显卡或 Mac。'], - en: ['A part that continues the previous one uses up to 3 reference images and no first or last frames.', 'Edit takes images only. Add reference videos and audio under "Media" in the creation panel.', 'The same part limits apply. An NVIDIA graphics card or a Mac is required.'], + en: ['An extended part uses up to 3 reference images and no first or last frames.', 'Edit takes images only. Add reference videos and audio under "Media" in the creation panel.', 'The same part limits apply. An NVIDIA graphics card or a Mac is required.'], }, }, { @@ -530,15 +532,15 @@ export const TUTORIAL_CHAPTERS = [ view: 'editor', goto: ['segment-prompt'], title: {zh: '逐段描述', en: 'Describe each part'}, - summary: {zh: '为剪辑视图中的每一段单独写描述。', en: 'Write a separate description for each part in the Edit view.'}, + summary: {zh: '为剪辑视图中的每一段单独写提示词。', en: 'Write a separate prompt for each part in the Edit view.'}, media: { type: 'image', src: {zh: 'segment-prompt-1.webp', en: 'segment-prompt-2.webp'}, - alt: {zh: '剪辑视图:选中的一段和描述框已用红框标出。', en: 'The Edit view, with the selected part and the prompt box outlined in red.'}, + alt: {zh: '剪辑视图:选中的一段和提示词框已用红框标出。', en: 'The Edit view, with the selected part and the prompt box outlined in red.'}, }, steps: { - zh: ['在“画面”轨上拖出一段较长的范围,它会分成带序号的多段。', '点选其中一段,在描述框中写下这一段的内容。', '再点选另一段,写下它的内容;每段的描述保存在这一段上。', '点“生⁠成”,各段按顺序生成并连成一个视频。'], - en: ['On the picture track, drag a long range. It is divided into numbered parts.', 'Select one part and write what happens in it in the prompt box.', 'Select another part and write its own description. Each part keeps its own.', 'Choose "Generate". The parts are made in order and joined into one video.'], + zh: ['在“画面”轨上拖出一段较长的范围,它会分成带序号的多段。', '点选其中一段,在提示词框中写下这一段的内容。', '再点选另一段,写下它的内容;每段的提示词保存在这一段上。', '点“生⁠成”,各段按顺序生成并连成一个视频。'], + en: ['On the picture track, drag a long range. It is divided into numbered parts.', 'Select one part and write what happens in it in the prompt box.', 'Select another part and write its own prompt. Each part keeps its own.', 'Choose "Generate". The parts are made in order and joined into one video.'], }, limits: { zh: ['一个连续镜头的段数有上限,见“连续的长视频”。'], @@ -558,8 +560,8 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '剪辑视图:选中的声音片段和“分⁠离⁠音⁠轨”按钮已用红框标出。', en: 'The Edit view, with a selected sound clip and the "Separate tracks" button outlined in red.'}, }, steps: { - zh: ['在剪辑视图中选中带声音的片段。', '点“分⁠离⁠音⁠轨”,人声、音乐和环境声会分成三条轨道。', '选中“音乐”轨上的片段,在描述框中写下想要的音乐,点“替⁠换⁠配⁠乐”。', '选中“人声”轨上的片段,在“台词”中修改某一句的文字。', '点“重⁠新⁠配⁠音”,只重配改过的句子。'], - en: ['Select a clip with sound in the Edit view.', 'Choose "Separate tracks". Dialogue, music and ambience become three tracks.', 'Select a clip on the music track, describe the music you want and choose "Replace music".', 'Select a clip on the dialogue track and change the words of one line under "Lines".', 'Choose "Redub". The changed lines are spoken again.'], + zh: ['在剪辑视图中选中带声音的片段。', '点“分⁠离⁠音⁠轨”,人声、音乐和环境声会分成三条轨道。', '选中“音乐”轨上的片段,在提示词框中写下想要的音乐,点“替⁠换⁠配⁠乐”。', '选中“人声”轨上的片段,在“台词”中修改某一句的文字。', '点“重⁠新⁠配⁠音”,只重配改过的句子。'], + en: ['Select a clip with sound in the Edit view.', 'Choose "Separate tracks". Dialogue, music and ambience become three tracks.', 'Select a clip on the music track, write the music you want in the prompt box and choose "Replace music".', 'Select a clip on the dialogue track and change the words of one line under "Lines".', 'Choose "Redub". The changed lines are spoken again.'], }, limits: { zh: ['部分电脑暂不支持分离音轨,此时按钮不会出现。'], @@ -578,8 +580,8 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '剪辑视图:第二条声音轨上选中的一段和风格选项已用红框标出。', en: 'The Edit view, with a range on the second sound track and the style options outlined in red.'}, }, steps: { - zh: ['点“+ 声音轨”,添加第二条声音轨“声音 2”。', '在“声音 2”轨的空白处拖出一段。', '在“风格”和“情绪”中各选一项,或在“描述配乐”中写下想要的音乐。写了描述时,只按描述生成。', '点“生⁠成”。'], - en: ['Choose "+ Audio track" to add a second audio track, "Audio 2".', 'Drag a range on an empty part of the "Audio 2" track.', 'Choose one option under "Style" and one under "Mood", or describe the music under "Describe the music". When there is a description, the music follows it alone.', 'Choose "Generate".'], + zh: ['点“+ 声音轨”,添加第二条声音轨“声音 2”。', '在“声音 2”轨的空白处拖出一段。', '在“风格”和“情绪”中各选一项,或在“描述配乐”中写下想要的音乐。写了提示词时,只按提示词生成。', '点“生⁠成”。'], + en: ['Choose "+ Audio track" to add a second audio track, "Audio 2".', 'Drag a range on an empty part of the "Audio 2" track.', 'Choose one option under "Style" and one under "Mood", or describe the music under "Describe the music". When there is a prompt, the music follows it alone.', 'Choose "Generate".'], }, limits: { zh: ['首次生成需要下载配乐模型。', '要换掉分离后的音乐,请选中“音乐”轨上的片段,按钮会变为“替⁠换⁠配⁠乐”。'], @@ -629,7 +631,7 @@ export const TUTORIAL_CHAPTERS = [ id: 'narration', view: 'editor', goto: ['editor-timeline'], - title: {zh: '为一句话配音', en: 'Add a spoken line'}, + title: {zh: '为一句话添加旁白', en: 'Add a spoken line'}, summary: {zh: '写下一句话,用片中的声音或一段录音说出来。', en: 'Write a line and have it spoken in a voice from the project or a recording.'}, media: { type: 'image', @@ -649,12 +651,12 @@ export const TUTORIAL_CHAPTERS = [ id: 'sound-to-picture', view: 'editor', goto: ['editor-timeline'], - title: {zh: '按声音生成画面', en: 'Generate a picture from sound'}, + title: {zh: '按声音生成画面', en: 'Generate video from sound'}, summary: {zh: '为只有声音的部分生成匹配的画面。', en: 'Generate a picture that matches a part that only has sound.'}, media: { type: 'image', src: {zh: 'sound-to-picture-1.webp', en: 'sound-to-picture-2.webp'}, - alt: {zh: '剪辑视图:画面轨上选中的一段和描述框已用红框标出。', en: 'The Edit view, with a range on the picture track and the prompt box outlined in red.'}, + alt: {zh: '剪辑视图:画面轨上选中的一段和提示词框已用红框标出。', en: 'The Edit view, with a range on the picture track and the prompt box outlined in red.'}, }, steps: { zh: ['在剪辑视图中放入一段只有声音的素材。', '在“画面”轨上,对着声音拖出一段。', '在“描述这一段”中写下想看到的画面。', '点“生⁠成”。'], @@ -744,18 +746,18 @@ export const TUTORIAL_CHAPTERS = [ id: 'library-reuse', goto: ['library-reuse', 'works-entry'], title: {zh: '复用设置', en: 'Reuse settings'}, - summary: {zh: '把以前一条视频的描述、尺寸、时长和种子填回创作面板。', en: 'Fill the prompt, size, duration and seed of an earlier video back into the creation panel.'}, + summary: {zh: '把以前一条视频的提示词、尺寸、时长和种子填回创作面板。', en: 'Fill the prompt, size, duration and seed of an earlier video back into the creation panel.'}, media: { type: 'image', src: {zh: 'library-reuse-1.webp', en: 'library-reuse-2.webp'}, alt: {zh: '预览区下方的按钮:“复用设置”已用红框标出。', en: 'The buttons below the preview, with "Reuse settings" outlined in red.'}, }, steps: { - zh: ['在预览下方的最近作品中点一条以前的视频,或点开头的“作品库”从中选择。', '点“复⁠用⁠设⁠置”,描述、尺寸、时长和种子会填回创作面板。', '改动需要变化的内容,再点“生⁠成⁠视⁠频”。', '填入有误时,10 秒内点“撤⁠销”,恢复原来的内容。'], + zh: ['在预览下方的最近作品中点一条以前的视频,或点开头的“作品库”从中选择。', '点“复⁠用⁠设⁠置”,提示词、尺寸、时长和种子会填回创作面板。', '改动需要变化的内容,再点“生⁠成⁠视⁠频”。', '填入有误时,10 秒内点“撤⁠销”,恢复原来的内容。'], en: ['Pick an earlier video in the recent videos below the preview, or choose "Creations" at its start and pick one there.', 'Choose "Reuse settings". Its prompt, size, duration and seed are filled into the creation panel.', 'Change what should be different, then choose "Generate video".', 'If the fill was a mistake, choose "Undo" within 10 seconds to bring back what was there.'], }, limits: { - zh: ['没有保存描述的视频不提供“复用设置”。'], + zh: ['没有保存提示词的视频不提供“复用设置”。'], en: ['A video that kept no prompt does not offer "Reuse settings".'], }, }, @@ -770,7 +772,7 @@ export const TUTORIAL_CHAPTERS = [ alt: {zh: '作品库中一条视频的右键菜单:两项“放大到 宽 × 高”已用红框标出。', en: 'The right-click menu of a video in Creations, with the two "Upscale to W × H" rows outlined in red.'}, }, steps: { - zh: ['在作品库中右键一条生成好的视频;大图查看和创作页结果下方的“⋯”菜单中也有同样的选项。', '选“放大到 宽 × 高”:尺寸较小的一项放大 1.5 倍,按原来的描述和种子重新生成细节;尺寸较大的一项放大到 4K 级别,逐帧放大。', '放大任务加入队列,完成后作为新作品出现在作品库中。'], + zh: ['在作品库中右键一条生成好的视频;大图查看和创作页结果下方的“⋯”菜单中也有同样的选项。', '选“放大到 宽 × 高”:尺寸较小的一项放大 1.5 倍,按原来的提示词和种子重新生成细节;尺寸较大的一项放大到 4K 级别,逐帧放大。', '放大任务加入队列,完成后作为新作品出现在作品库中。'], en: ['In Creations, right-click a finished video. The "⋯" menu in the large view and below a result in the creation panel has the same choices.', 'Choose "Upscale to W × H". The smaller size is 1.5 times larger and redraws detail from the original prompt and seed; the larger size is about 4K, upscaled frame by frame.', 'The upscale is queued and appears in Creations as a new creation when done.'], }, limits: { @@ -790,7 +792,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['点预览下方最近作品开头的“作品库”。', '选择一条视频,可播放,或点“接着生成”在剪辑视图中继续;要一次下载多个作品,点作品右上角的勾选框选中它,再点其他作品一起选中,然后点“下⁠载”,存成一个压缩包。', '在作品详情中点爱心图标收藏;在左侧选“收⁠藏”只看收藏的作品,选“全⁠部”看所有作品。', '需要成片时,在“剪辑视图”点“导⁠出”。', '在导出窗口选择范围、画质和内容;要更流畅的画面时,在“帧率”中选 48 或 60,中间的画面由显卡补出;要保留无损的声音,在“声音”中选“无损”。再点“导⁠出”。'], - en: ['Choose "Creations" at the start of the recent videos below the preview.', 'Pick a video to play it, or choose "Continue" to continue it in the Edit view. To download several at once, choose the check box at the top right of a creation, choose the others to add them, then choose "Download" to save them as one zip file.', 'In a creation\'s details, choose the heart to add it to favorites. On the left, choose "Favorites" to see only those, or "All" to see every creation.', 'For a finished file, choose "Export" in the Edit view.', 'In the export window choose the range, quality and content. For smoother motion, choose 48 or 60 under "Frame rate"; the graphics card makes the frames in between. To keep the sound lossless, choose "Lossless" under "Sound". Then choose "Export".'], + en: ['Choose "Creations" at the start of the recent videos below the preview.', 'Pick a video to play it, or choose "Extend" to add the next part in the Edit view. To download several at once, choose the check box at the top right of a creation, choose the others to add them, then choose "Download" to save them as one zip file.', 'In a creation\'s details, choose the heart to add it to favorites. On the left, choose "Favorites" to see only those, or "All" to see every creation.', 'For a finished file, choose "Export" in the Edit view.', 'In the export window choose the range, quality and content. For smoother motion, choose 48 or 60 under "Frame rate"; the graphics card makes the frames in between. To keep the sound lossless, choose "Lossless" under "Sound". Then choose "Export".'], }, limits: { zh: ['删除作品前会确认;被剪辑使用的作品不能删除。', '导出窗口每次打开时,“内容”默认选“画面和声音”,“画质”默认选“高”;窗口里没有“帧率”时,这台电脑不支持 48 和 60 帧导出。', '导出过程中取消不会留下不完整的文件。'], @@ -809,7 +811,7 @@ export const TUTORIAL_CHAPTERS = [ }, steps: { zh: ['在作品库左侧点“新建标签”,输入名称后按 Enter。', '点作品右上角的勾选框选中它,再点其他作品一起选中;在右侧上方点标签图标,选一个标签。之后在左侧点这个标签,只看带有它的作品。', '点上方的“筛⁠选”,按时间、图片来源等条件缩小范围;也可以在搜索框中按提示词或名称查找。', '正好选中两个作品时,画面中间对比显示它们,可切换“并⁠排”或“滑⁠块”。'], - en: ['On the left of Creations, choose "New tag", type a name and press Enter.', 'Choose the check box at the top right of a creation and choose others to add them. At the top right, choose the tag icon and pick a tag. Later, choose that tag on the left to see only the creations that have it.', 'Choose "Filter" at the top to narrow the list by time, picture source and more, or search by prompt or name in the search box.', 'With exactly two creations selected, they are compared in the middle; switch between "Side by side" and "Slider".'], + en: ['On the left of Creations, choose "New tag", type a name and press Enter.', 'Choose the check box at the top right of a creation and choose others to add them. At the top right, choose the tag icon and pick a tag. Later, choose that tag on the left to see only the creations that have it.', 'Choose "Filter" at the top to narrow the list by time, image source and more, or search by prompt or name in the search box.', 'With exactly two creations selected, they are compared in the middle; switch between "Side by side" and "Slider".'], }, limits: { zh: ['标签保存在当前浏览器中,只在这个浏览器里显示。', '删除的作品在 10 秒内可在左侧“最近删除”中恢复。'], diff --git a/web/updates.js b/web/updates.js index f111f73a..adc0246e 100644 --- a/web/updates.js +++ b/web/updates.js @@ -5,7 +5,8 @@ import { userMessage } from './user_message.js'; import './glass/library.js'; import { hasWhatsNew } from './whatsnew_pages.js'; import { releaseMedia, mediaKind, mediaPath, splitChange } from './release_media.js'; -import { LANGUAGE_PARAM, askedLanguage } from './i18n.js'; +import { LANGUAGE, LANGUAGE_PARAM, askedLanguage, translator } from './i18n.js'; +import { localized } from './i18n_tables.js'; // Every platform downloads from one release: the latest vX.Y.Z. const releasePage = 'https://github.com/FlashML-org/FreeVideo/releases/latest'; @@ -52,7 +53,7 @@ const SOUND_ON = '