Files
effectcraft/crates/ui-egui/src/i18n/ui.rs
T
bflatasticandClaude Opus 5.5 67b9b20a07 Timeline: every property has a pick whip in the Parent & Link column (#363)
What: each property row that can take an expression (it has a stopwatch) now
has a property pick whip in the Parent & Link column, as in After Effects
CC 2018 and later (automation id `timeline.prop.<uid>.propertyPickWhip`).
Dragged onto another property's name or one of its values, it runs
`prop.pickWhip`: the reference is added as the property's expression, or
replaces the one it has, and the expression is enabled. A drop on one value
picks that dimension (`position[1]`).

The parent, expression and property pick whips share one widget and one
drop path (rubber band, autoscroll, dimension pick); only the expression
pick whip inserts at the cursor of an expression being edited.

Pick whips (expression and property) now also drop on properties in
Effect Controls: its property rows register as targets while a pick whip
is dragged, with their per-dimension value fields.

Why: the last part of #363. Adobe's docs say the Property Link pick whip
adds the expression without enabling expressions first, and a pick whip
outside an edit replaces the whole expression text. No modifier keys for
the property pick whip are documented, so none are implemented.

Tests: `the_property_pick_whip_links_a_property_to_another` (ui_inline_edit)
drops it on a property's name, on one of Position's values, on a property
with a disabled expression (replaced and enabled), on an Effect Controls
slider and one value of a point, and on itself (no change). It fails
before the change; with Effect Controls' targets removed it fails at the
slider. Looked at the result with the headless snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:28:22 +07:00

1078 lines
53 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! Translations for the interface *below* the menu bar: panel labels, buttons, field names,
//! tooltips and the sentences the panels draw themselves.
//!
//! The menu bar has its own catalog in [`super`], keyed by `(command, English label)`. Text with no
//! menu command is keyed here by its English source string, so a panel can wrap a literal without
//! inventing an id, and a missing row falls back to English instead of to an empty label.
//!
//! The language in force is set once per frame, from the same resolved language the fonts are
//! installed for ([`super::language`], [`set_current`]), so a panel does not have to thread it
//! through every function. It is thread-local: the render threads never draw interface text.
//!
//! A row that carries values keeps one `{}` per value and is read with [`tr_args`]; the tests below
//! refuse a row whose placeholder count differs from its English source, so a translation can never
//! drop a value, and `tr_args` itself cannot panic.
use std::cell::Cell;
use std::collections::HashMap;
use std::fmt::Display;
use std::sync::OnceLock;
thread_local! {
/// The resolved interface language ("en", "ja", "zh-hans", "zh-hant"); "en" until the first
/// frame sets it.
static CURRENT: Cell<&'static str> = const { Cell::new("en") };
}
/// Remember the language the panels should draw in: called from the frame loop with the language
/// the fonts were installed for.
pub(crate) fn set_current(language: &'static str) {
CURRENT.with(|c| c.set(language));
}
/// The language [`tr`] and [`tr_args`] are using.
pub(crate) fn current() -> &'static str {
CURRENT.with(Cell::get)
}
type Index = HashMap<&'static str, &'static str>;
/// The catalog for `language`, indexed by English source (built on first use: panels translate
/// hundreds of strings a frame); `None` for English and any language that has no rows yet.
fn catalog(language: &str) -> Option<&'static Index> {
static HANS: OnceLock<Index> = OnceLock::new();
static HANT: OnceLock<Index> = OnceLock::new();
let (index, rows) = match language {
"zh-hans" => (&HANS, SIMPLIFIED_CHINESE),
"zh-hant" => (&HANT, TRADITIONAL_CHINESE),
_ => return None,
};
Some(index.get_or_init(|| rows.iter().copied().collect()))
}
/// Translate one interface string: the current language's row for `text`, or `text` itself.
pub(crate) fn tr(text: &str) -> &str {
catalog(current()).and_then(|c| c.get(text)).copied().unwrap_or(text)
}
/// Translate an interface string that carries values: each `{}` takes the next argument. A missing
/// argument leaves its placeholder out and extra ones are ignored, so this cannot panic; the tests
/// keep the placeholder count equal to the English source's.
pub(crate) fn tr_args(text: &str, args: &[&dyn Display]) -> String {
let template = tr(text);
let mut out = String::with_capacity(template.len() + 16);
let mut rest = template;
let mut n = 0;
while let Some(at) = rest.find("{}") {
out.push_str(&rest[..at]);
if let Some(arg) = args.get(n) {
out.push_str(&arg.to_string());
}
n += 1;
rest = &rest[at + 2..];
}
out.push_str(rest);
out
}
const SIMPLIFIED_CHINESE: &[(&str, &str)] = &[
(" OK ", " 确定 "),
(" Delete ", " 删除 "),
(" Open Auto-Save ", " 打开自动保存 "),
("(missing)", "(缺失)"),
("360 View Orientation", "360 视图方向"),
("3:2 Pulldown: {}", "3:2 折叠:{}"),
(
"A clean-room, open-source compositor for motion graphics and visual effects: native on macOS, Windows and Linux, and in the browser. Part of the ArtCraft family of creative apps.",
"一款从零编写、开源的动态图形与视觉效果合成软件:原生支持 macOS、Windows 和 Linux,也可在浏览器中运行。属于 ArtCraft 创意应用家族。",
),
("About EffectCraft", "关于 EffectCraft"),
("About...", "关于..."),
("Active Camera", "活动摄像机"),
("Adapt Feature On Every Frame", "每帧都适应特征"),
("Adaptive Sample Limit:", "自适应采样限制:"),
("Add Animator", "添加动画制作器"),
("Add Comment", "添加注释"),
("Add Formatting", "添加格式"),
("Add Group", "添加组"),
("Add Mirror", "添加镜像"),
("Add Selected As", "将所选项目添加为"),
("Add a comment", "添加注释"),
("Add a shape, fill, stroke or path operation", "添加形状、填充、描边或路径操作"),
("Add to Composition", "添加到合成"),
("Add to Favorites", "添加到收藏夹"),
("Add:", "添加:"),
("Adjust Exposure (stops)", "调整曝光(光圈级数)"),
("Adjust composition duration to the time span of the selected layers", "将合成时长调整为所选图层的时间范围"),
("Advanced 3D", "高级 3D"),
("Align Layers to:", "将图层对齐到:"),
("All six face cameras turn together; the scene is not changed.", "六个面摄像机一起旋转;场景不会改变。"),
("Anchor:", "定位点:"),
("Aperture", "光圈"),
("Apply Dimensions:", "应用尺寸:"),
("Apply Motion To:", "将运动应用于:"),
("Arrange", "排列"),
("Assign", "指定"),
("Auto", "自动"),
("Auto-saves", "自动保存"),
("Back", "背面"),
("Background Color:", "背景颜色:"),
("Blend Mode:", "混合模式:"),
("Blending Mode", "混合模式"),
("Blur", "模糊"),
("Blur Level", "模糊级别"),
("Browser Storage", "浏览器存储"),
("Browse…", "浏览…"),
("Brush Dynamics", "画笔动态"),
("Caching frames…", "正在缓存帧…"),
("Cancel", "取消"),
("Casts Shadows", "投射阴影"),
("Change Renderer…", "更改渲染器…"),
("Changing a shortcut creates a custom preset; the default stays as it is.", "修改快捷键会创建自定义预设;默认预设保持不变。"),
("Channel", "色版"),
("Channel:", "通道:"),
("Chapter:", "章节:"),
("Choose...", "选择..."),
("Classic 3D", "经典 3D"),
("Clear", "清除"),
("Clear list", "清空列表"),
("Click a key to see its commands.", "单击某个按键以查看其命令。"),
("Click adds a point (½ height = no change)", "单击可添加点(上下滑动高度的一半 = 无变化)"),
("Click adds a point; drag one off to remove", "单击可添加点;拖出一个即可删除"),
("Click to make this viewer active", "单击可激活此视图"),
("Click to reveal the expression in the timeline", "单击可在时间轴中显示表达式"),
("Click to show the active composition here", "单击可在此显示当前合成"),
("Click, then click in the Composition panel", "单击后,在合成面板中单击"),
("Clone Options", "克隆选项"),
("Clone Source Overlay:", "克隆源叠加:"),
("Close", "关闭"),
("Close Panel", "关闭面板"),
("Close tutorial", "关闭教程"),
("Color", "颜色"),
("Color Depth: {}", "颜色深度:{}"),
("Color:", "颜色:"),
("Colour map", "颜色图"),
("Columns", "列"),
("Comment:", "注释:"),
("Community", "社区"),
("Composition", "合成"),
("Composition Mini-Flowchart", "合成微型流程图"),
("Composition Name:", "合成名称:"),
("Composition Settings ▸ 3D Renderer", "合成设置 ▸ 3D 渲染器"),
("Composition Settings…", "合成设置…"),
("Composition marker bin: drag a marker to the time ruler", "合成标记箱:将标记拖到时间标尺上"),
("Cone Angle", "圆锥角"),
("Cone Feather", "圆锥羽化"),
("Constrain Proportions", "约束比例"),
("Continuous (Lock Outgoing to Incoming)", "连续(将出点锁定到入点)"),
("Cue Point", "提示点"),
("Current Render", "当前渲染"),
("Darker", "更深"),
("Default Output:", "默认输出:"),
("Default: {}", "默认:{}"),
("Defaults", "默认值"),
("Delete", "删除"),
("Delete Selected Points", "删除所选的顶点"),
("Delete selected project items", "删除所选的项目项"),
("Delete this template", "删除此模板"),
("Depth of Field", "景深"),
("Discord", "Discord"),
("Distribute Layers:", "分布图层:"),
("Don't Recover", "不恢复"),
("Don't Save", "不保存"),
("Double-click a layer to open it in the Layer panel", "双击图层可在图层面板中打开"),
("Double-click footage in the Project panel to open it here", "双击项目面板中的素材可在此处打开"),
("Double-click to edit the comment", "双击可编辑注释"),
("Download", "下载"),
(
"Drag properties here from the timeline,\nor use Animation > Add Property to Essential Graphics.",
"请从时间轴将属性拖到此处,\n或使用 动画 > 将属性添加到基本图形。",
),
("Drag to change", "拖动可更改"),
("Drag to create a guide", "拖动可创建参考线"),
("Drag to slip the source", "拖动可滑移源"),
("Drop Frame", "丢帧"),
("Duplicate", "重复"),
("Duration:", "持续时间:"),
("Edit Gradient…", "编辑渐变…"),
("Edit Target: {}", "编辑目标:{}"),
("Edit in the Timeline", "在时间轴中编辑"),
("EffectCraft didn't quit normally last time.", "EffectCraft 上次未正常退出。"),
("Effects & Presets options", "效果和预设选项"),
("Effects: {}", "效果:{}"),
("Empty folder", "空文件夹"),
("Enable Depth of Field", "启用景深"),
("Enable Expression", "启用表达式"),
("Enhance", "增强"),
("Essential Properties — {}", "基本属性 — {}"),
("Event", "事件"),
("Export Template…", "导出模板…"),
("Export...", "导出..."),
("Expression Language Menu", "表达式语言菜单"),
("Expression pick whip: drag onto a property", "表达式拾取器:拖到属性上"),
("Expression:", "表达式:"),
("Eyedropper: click, then click in the Composition panel", "吸管:单击后,在合成面板中单击"),
("Falloff", "衰减"),
("Falloff Distance", "衰减距离"),
("Favorites", "收藏"),
("Field Render: {}", "场渲染:{}"),
("Figures", "数字"),
("Fill Target", "填充目标"),
("Finished", "已完成"),
("Flowchart: {}", "流程图:{}"),
("Focus Distance", "焦距"),
("Follow Feature Rotation and Scale", "跟随特征的旋转和缩放"),
("Footage: {}", "素材:{}"),
("Format: {}", "格式:{}"),
("Frame Aspect Ratio: {}", "帧长宽比:{}"),
("Frame Blending: {}", "帧混合:{}"),
("Frame Rate:", "帧速率:"),
("Frame Render Time {}ms", "帧渲染时间 {} 毫秒"),
("Frame Target:", "帧目标:"),
("Grab bag", "列表"),
("Grid", "网格"),
("Guide Layers: {}", "参考图层:{}"),
("Guides", "参考线"),
("Height:", "高度:"),
("Hide This", "隐藏此项"),
("Histogram", "直方图"),
("Hold In Place", "保持在原位"),
("Home", "主页"),
("If Confidence is Below", "如果置信度低于"),
("Import", "导入"),
("Import and Add to Composition", "导入并添加到合成"),
("Import...", "导入..."),
("Imported media", "已导入的媒体"),
("Influence:", "影响:"),
("Install from File…", "从文件安装…"),
("Intensity", "强度"),
("Inverted", "反转"),
("Join the ArtCraft community on Discord", "加入 ArtCraft 的 Discord 社区"),
("Key: {}", "按键:{}"),
("LEARN", "学习"),
("Label", "标签"),
("Label Colors and Names:", "标签颜色和名称:"),
("Label:", "标签:"),
("Latest auto-save: {}", "最新的自动保存:{}"),
("Layer", "图层"),
("Layer controls", "图层控制"),
("Layer {}", "图层 {}"),
("Layer:", "图层:"),
("Layer: {}", "图层:{}"),
("Learn", "学习"),
("Leave all attributes in \"{}\"", "将所有属性保留在“{}”中"),
("Licence: {}", "许可:{}"),
("Ligatures", "连字"),
("Light Type", "灯光类型"),
("Lighter", "更浅"),
("Link Selected Property", "链接所选属性"),
("Lock Aspect Ratio to {}", "锁定长宽比为 {}"),
("Lock to Zoom", "锁定缩放"),
("Locked: {} — {}", "已锁定:{} — {}"),
("Log:", "日志:"),
("Loop (Trace Path)", "循环(跟踪路径)"),
("MIT OR Apache-2.0 • Fonts: Inter, JetBrains Mono (OFL)", "MIT 或 Apache-2.0 • 字体:Inter、JetBrains Mono(OFL)"),
("Magnification ratio popup", "放大倍率弹出菜单"),
("Make Comp Size", "设为合成长宽"),
("Masks", "蒙版"),
("Maximize Panel", "最大化面板"),
("Media Replacement", "媒体替换"),
("Mesh:", "网格:"),
("Method Used: {} Average Error: {} pixels", "使用方法:{} 平均误差:{} 像素"),
("Models folder: {}", "模型文件夹:{}"),
("Modifiers:", "修饰键:"),
("More", "更多"),
("More ArtCraft apps", "更多 ArtCraft 应用"),
("More tutorials", "更多教程"),
("Motion Blur", "运动模糊"),
("Motion Blur: {}", "动态模糊:{}"),
("Motion Sketch: drag to record", "动态草图:拖动以记录"),
("Move Down", "下移"),
("Move Up", "上移"),
("Move to Project Root", "移到项目根目录"),
("Name", "名称"),
("Name:", "名称:"),
("Navigation", "导航"),
("New", "新建"),
("New Comp from Selection", "由所选项目新建合成"),
("New Duration:", "新持续时间:"),
("New composition name:", "新合成名称:"),
("New from Render Queue item:", "由渲染队列项新建:"),
("New from Template", "从模板新建"),
("Next", "下一个"),
("Nice work. Pick another tutorial on the Home screen's Learn tab.", "干得漂亮。请在主页面的“学习”选项卡中选择另一个教程。"),
("No VR environments yet. Create one with Composition ▸ VR ▸ Create VR Environment…", "还没有 VR 环境。请用 合成 ▸ VR ▸ 创建 VR 环境… 新建一个。"),
("No audio layer selected", "未选择音频图层"),
("No background jobs running", "没有正在运行的后台任务"),
("No composition markers", "没有合成标记"),
("No contributor data was built into this copy.", "此副本未内置贡献者数据。"),
("No device list from this host; the system default output is used.", "此主机无法获取设备列表;将使用系统默认输出。"),
("No layer selected", "未选择图层"),
("No matching effects or presets", "没有匹配的效果或预设"),
("No model credits were built into this copy.", "此副本未内置模型致谢。"),
("No nested compositions", "没有嵌套合成"),
("No shortcut", "无快捷键"),
("No unlocked layer selected", "未选择已解锁的图层"),
("No video", "无视频"),
("None", "无"),
("Not applied: tick it in the list to add it.", "未应用:在列表中勾选即可添加。"),
("Not assigned", "未分配"),
("Note: Shadows are only cast from layers with Cast Shadows enabled.", "注意:只有启用了“投射阴影”的图层才会投射阴影。"),
("Notify", "通知"),
("OK", "确定"),
("Offset:", "偏移:"),
("On ({}) stop:", "在({})时停止:"),
("One-Node Camera", "单节点摄像机"),
("Opacity:", "不透明度:"),
("Open Composition", "打开合成"),
("Open Last Saved Project", "打开上次保存的项目"),
("Open New Composition", "打开新建合成"),
("Open Output", "打开输出"),
("Open a composition to build Essential Graphics", "打开一个合成以构建基本图形"),
("Open a composition to see its scopes", "打开一个合成以查看其示波器"),
("Open a composition to track motion.", "打开一个合成以跟踪运动。"),
("Opus Tuning: {}", "Opus 调优:{}"),
("Original Duration:", "原始持续时间:"),
("Output Cycle: {}", "输出循环:{}"),
("Output To:", "输出到:"),
("Parameter Name:", "参数名称:"),
("Parent pick whip: drag onto a layer", "父级拾取器:拖到图层上"),
("Pixel Aspect Ratio:", "像素长宽比:"),
("Playing on Video Preview", "在视频预览中播放"),
("Post-Render Action: {}", "渲染后动作:{}"),
("Preserve frame rate when nested or in render queue", "嵌套或在渲染队列中时保留帧速率"),
("Preserve resolution when nested", "嵌套时保留分辨率"),
("Preset", "预设"),
("Preset:", "预设:"),
("Presets", "预设"),
("Previous", "上一个"),
("Primary:", "主要:"),
("Process Before Match", "匹配前处理"),
("Profile: {}", "配置文件:{}"),
(
"Project color depth: click to cycle 8/16/32 bpc, Alt-click for Project Settings",
"项目颜色深度:单击可在 8/16/32 bpc 之间循环,按住 Alt 单击可打开项目设置",
),
("Project: {}", "项目:{}"),
("Projects", "项目"),
("Property pick whip: drag onto a property", "属性拾取器:拖到属性上"),
("Protected Region", "受保护区域"),
("Proxy Use: {}", "代理使用:{}"),
("Push All to Comp", "全部推送到合成"),
("Radius", "半径"),
("Rate Control: {}", "比特率控制:{}"),
("Recent", "最近使用"),
("Recording", "录制中"),
("Remove", "移除"),
("Rename", "重命名"),
("Render: {} ms • UI {} fps{}", "渲染:{} 毫秒 • 界面 {} fps{}"),
("Renderer:", "渲染器:"),
("Request Persistent Storage", "请求持久化存储"),
("Reset", "重置"),
("Reset Labels", "重置标签"),
("Reset Preset", "重置预设"),
("Reset to Default", "重置为默认"),
("Reset to Saved Layout", "重置为已保存的布局"),
("Resolution/Down Sample Factor Popup", "分辨率/向下采样系数弹出菜单"),
("Restore Panel Size", "恢复面板大小"),
("Reverse the order", "反转顺序"),
("Revert All", "全部还原"),
("Roman Hanging Punctuation", "西文悬挂标点"),
("Roving:", "游动:"),
("Ruler zero point (drag to move, double-click to reset)", "标尺零点(拖动可移动,双击可重置)"),
("Rulers", "标尺"),
("Run", "运行"),
("Sample Format: {}", "采样格式:{}"),
("Samples Per Frame:", "每帧采样数:"),
("Save from #{}", "从 #{} 保存"),
("Saved {}", "已保存 {}"),
("Script… (⌘/Ctrl+Enter runs)", "脚本…(⌘/Ctrl+Enter 运行)"),
("Search commands or shortcuts", "搜索命令或快捷键"),
("Select", "选择"),
("Select a command to change its shortcut.", "选择一条命令以更改其快捷键。"),
("Select a layer to see its effects", "选择图层以查看其效果"),
("Select a layer to see its properties", "选择图层以查看其属性"),
(
"Select a layer with a mask or shape path (or the path property), or Puppet pins.",
"请选择带蒙版或形状路径(或路径属性)的图层,或带有人偶定位点的图层。",
),
("Select a text layer", "选择文字图层"),
("Select an item in the Project panel", "在项目面板中选择一个项"),
("Select animated properties to show them in the Graph Editor", "选择已制作动画的属性以在图表编辑器中显示"),
(
"Select the leader pin, then Shift-click the pins that should trail it (hair, cloth, tails)",
"先选择引导定位点,再按住 Shift 单击应跟随它的定位点(头发、布料、尾巴)",
),
("Set Ground Plane and Origin", "设置地平面和原点"),
("Set Paint Colors to Black and White (D)", "将绘画颜色设为黑白(D)"),
("Settings", "设置"),
("Settings Name:", "设置名称:"),
("Shadow Darkness", "阴影暗度"),
("Shadow Diffusion", "阴影扩散"),
("Shadows", "阴影"),
("Shape…", "形状…"),
("Show", "显示"),
("Show Layer Name", "显示图层名称"),
("Show Source Name", "显示源名称"),
("Show me", "演示一下"),
("Show:", "显示:"),
("Shutter Angle:", "快门角度:"),
("Shutter Phase:", "快门相位:"),
("Size", "大小"),
("Skip", "跳过"),
("Snapping", "对齐"),
("Snapping options", "对齐选项"),
("Snapshot", "快照"),
("Solo Supported Properties", "支持独奏的属性"),
("Solo Switches: {}", "独奏开关:{}"),
("Sort", "排序"),
("Spacing:", "间距:"),
("Spatial Interpolation:", "空间插值:"),
("Speed:", "速度:"),
("Start Timecode:", "开始时间码:"),
("Start: {} Duration: {}", "开始:{} 持续时间:{}"),
("Step {} of {}: {}", "第 {} 步,共 {} 步:{}"),
("Stop {} at {}°", "停止点 {} 位于 {}°"),
("Stored in: {}", "存储位置:{}"),
("Stretch", "伸展"),
("Stretch Factor:", "伸展系数:"),
("Stylistic Sets", "样式集"),
("Subpixel Positioning", "次像素定位"),
("Swap Paint Colors (X)", "交换绘画颜色(X)"),
("System Default", "系统默认"),
("Table", "表格"),
("Template name", "模板名称"),
("Template: {}\n{}", "模板:{}\n{}"),
("Temporal Interpolation:", "时间插值:"),
("The Media Browser is not available here (use File ▸ Import)", "此处不支持媒体浏览器(请使用 文件 ▸ 导入)"),
("The OpenEXR layer shown in red, green, blue and alpha", "以红、绿、蓝和 Alpha 显示的 OpenEXR 图层"),
("The render queue is empty.", "渲染队列为空。"),
("This ScriptUI panel has closed", "此 ScriptUI 面板已关闭"),
("This change will create a new solid for this layer.", "此更改将为该图层创建新的纯色。"),
("Time", "时间"),
("Time Stretch…", "时间伸缩…"),
("Time:", "时间:"),
("Time: {}", "时间:{}"),
("Title/action safe", "字幕/动作安全框"),
("Toggle Switches / Modes", "切换开关/模式"),
("Track Name:", "跟踪名称:"),
("Trained models are available in the desktop app; the browser uses the classic engine.", "训练好的模型仅在桌面应用中可用;浏览器版使用经典引擎。"),
("Transform", "变换"),
("Transparency grid", "透明网格"),
("Tutorial complete", "教程完成"),
("Two-Node Camera", "双节点摄像机"),
("Type", "文字"),
("Type a command or effect…", "输入命令或效果…"),
("URL:", "URL:"),
("Undock Panel", "取消停靠面板"),
("Unlink {}", "取消链接 {}"),
(
"Use this option to place the currently selected layers together into a new intermediate composition.",
"使用此选项可将当前所选图层一起放入一个新的中间合成。",
),
("VR Environments", "VR 环境"),
("Value:", "值:"),
("Variable Font Axes", "可变字体轴"),
("Video Codec: {}", "视频编解码器:{}"),
("View:", "视图:"),
("Welcome to EffectCraft", "欢迎使用 EffectCraft"),
("Width:", "宽度:"),
("You can undo this.", "您可以撤销此操作。"),
("Your changes will be lost if you don't save them.", "如果不存储,你的更改将会丢失。"),
("Zoom", "缩放"),
("built-in", "内置"),
("frames per second", "帧/秒"),
("template name", "模板名称"),
("{} contributors · {} commits", "{} 位贡献者 · {} 次提交"),
("{} x {}, {}MB per 8bpc frame", "{} x {},每 8bpc 帧 {}MB"),
("{} — coming soon", "{} — 即将推出"),
("{} — double-click to open, {}-click to reveal", "{} — 双击打开,{}-单击可显示位置"),
("⌘/Ctrl-drag a pin to record its motion", "⌘/Ctrl 拖动定位点可记录其运动"),
("▣ {}", "▣ {}"),
("⚠ {} is used by:", "⚠ {} 已被以下项目使用:"),
];
const TRADITIONAL_CHINESE: &[(&str, &str)] = &[
(" OK ", " 確定 "),
(" Delete ", " 刪除 "),
(" Open Auto-Save ", " 開啟自動儲存 "),
("(missing)", "(缺少)"),
("360 View Orientation", "360 檢視方向"),
("3:2 Pulldown: {}", "3:2 摺疊:{}"),
(
"A clean-room, open-source compositor for motion graphics and visual effects: native on macOS, Windows and Linux, and in the browser. Part of the ArtCraft family of creative apps.",
"一款從零編寫、開源的動態圖形與視覺效果合成軟件:原生支援 macOS、Windows 和 Linux,也可在瀏覽器中執行。屬於 ArtCraft 創意應用家族。",
),
("About EffectCraft", "關於 EffectCraft"),
("About...", "關於..."),
("Active Camera", "活動攝影機"),
("Adapt Feature On Every Frame", "每個影格都適應特徵"),
("Adaptive Sample Limit:", "自適應取樣限制:"),
("Add Animator", "添加動畫制作器"),
("Add Comment", "添加註解"),
("Add Formatting", "添加格式"),
("Add Group", "添加組"),
("Add Mirror", "添加鏡像"),
("Add Selected As", "將所選專案添加為"),
("Add a comment", "添加註解"),
("Add a shape, fill, stroke or path operation", "添加形狀、填滿、筆畫或路徑操作"),
("Add to Composition", "添加到合成"),
("Add to Favorites", "添加到收藏夾"),
("Add:", "添加:"),
("Adjust Exposure (stops)", "調整曝光(光圈級數)"),
("Adjust composition duration to the time span of the selected layers", "將合成時長調整為所選圖層的時間範圍"),
("Advanced 3D", "高級 3D"),
("Align Layers to:", "將圖層對齊到:"),
("All six face cameras turn together; the scene is not changed.", "六個面攝影機一起旋轉;場景不會改變。"),
("Anchor:", "釘選點:"),
("Aperture", "光圈"),
("Apply Dimensions:", "應用尺寸:"),
("Apply Motion To:", "將運動應用於:"),
("Arrange", "排列"),
("Assign", "指定"),
("Auto", "自動"),
("Auto-saves", "自動儲存"),
("Back", "背面"),
("Background Color:", "背景顏色:"),
("Blend Mode:", "混合模式:"),
("Blending Mode", "混合模式"),
("Blur", "模糊"),
("Blur Level", "模糊級別"),
("Browser Storage", "瀏覽器儲存"),
("Browse…", "瀏覽…"),
("Brush Dynamics", "筆刷動態"),
("Caching frames…", "正在快取幀…"),
("Cancel", "取消"),
("Casts Shadows", "投射陰影"),
("Change Renderer…", "更改算圖引擎…"),
("Changing a shortcut creates a custom preset; the default stays as it is.", "修改快速鍵會創建自定義預設集;預設預設集保持不變。"),
("Channel", "色版"),
("Channel:", "通道:"),
("Chapter:", "章節:"),
("Choose...", "選取..."),
("Classic 3D", "經典 3D"),
("Clear", "清除"),
("Clear list", "清空清單"),
("Click a key to see its commands.", "按一下某個按鍵以查看其命令。"),
("Click adds a point (½ height = no change)", "按一下可添加點(上下滑動高度的一半 = 無變化)"),
("Click adds a point; drag one off to remove", "按一下可添加點;拖出一個即可刪除"),
("Click to make this viewer active", "按一下可激活此檢視"),
("Click to reveal the expression in the timeline", "按一下可在時間軸中顯示表達式"),
("Click to show the active composition here", "按一下可在此顯示目前合成"),
("Click, then click in the Composition panel", "按一下後,在合成面板中按一下"),
("Clone Options", "仿製選項"),
("Clone Source Overlay:", "仿製源疊加:"),
("Close", "關閉"),
("Close Panel", "關閉面板"),
("Close tutorial", "關閉教學"),
("Color", "顏色"),
("Color Depth: {}", "顏色深度:{}"),
("Color:", "顏色:"),
("Colour map", "顏色圖"),
("Columns", "列"),
("Comment:", "註解:"),
("Community", "社區"),
("Composition", "合成"),
("Composition Mini-Flowchart", "合成微型流程圖"),
("Composition Name:", "合成名稱:"),
("Composition Settings ▸ 3D Renderer", "合成設置 ▸ 3D 算圖引擎"),
("Composition Settings…", "合成設置…"),
("Composition marker bin: drag a marker to the time ruler", "合成標記箱:將標記拖到時間標尺上"),
("Cone Angle", "圓錐角"),
("Cone Feather", "圓錐羽化"),
("Constrain Proportions", "約束比例"),
("Continuous (Lock Outgoing to Incoming)", "連續(將出點鎖定到入點)"),
("Cue Point", "提示點"),
("Current Render", "目前算圖"),
("Darker", "更深"),
("Default Output:", "預設輸出:"),
("Default: {}", "預設:{}"),
("Defaults", "預設值"),
("Delete", "刪除"),
("Delete Selected Points", "刪除所選的頂點"),
("Delete selected project items", "刪除所選的專案項"),
("Delete this template", "刪除此範本"),
("Depth of Field", "景深"),
("Discord", "Discord"),
("Distribute Layers:", "分佈圖層:"),
("Don't Recover", "不恢復"),
("Don't Save", "不儲存"),
("Double-click a layer to open it in the Layer panel", "連按兩下圖層可在圖層面板中開啟"),
("Double-click footage in the Project panel to open it here", "連按兩下專案面板中的素材可在此處開啟"),
("Double-click to edit the comment", "連按兩下可編輯註解"),
("Download", "下載"),
(
"Drag properties here from the timeline,\nor use Animation > Add Property to Essential Graphics.",
"請從時間軸將屬性拖到此處,\n或使用 動畫 > 將屬性添加到基本圖形。",
),
("Drag to change", "拖曳可更改"),
("Drag to create a guide", "拖曳可創建參考線"),
("Drag to slip the source", "拖曳可滑移源"),
("Drop Frame", "丟格"),
("Duplicate", "重複"),
("Duration:", "持續時間:"),
("Edit Gradient…", "編輯漸變…"),
("Edit Target: {}", "編輯目標:{}"),
("Edit in the Timeline", "在時間軸中編輯"),
("EffectCraft didn't quit normally last time.", "EffectCraft 上次未正常結束。"),
("Effects & Presets options", "效果和預設集選項"),
("Effects: {}", "效果:{}"),
("Empty folder", "空資料夾"),
("Enable Depth of Field", "啟用景深"),
("Enable Expression", "啟用表達式"),
("Enhance", "增強"),
("Essential Properties — {}", "基本屬性 — {}"),
("Event", "事件"),
("Export Template…", "匯出範本…"),
("Export...", "匯出..."),
("Expression Language Menu", "表達式語言選單"),
("Expression pick whip: drag onto a property", "表達式拾取線:拖到屬性上"),
("Expression:", "表達式:"),
("Eyedropper: click, then click in the Composition panel", "吸管:按一下後,在合成面板中按一下"),
("Falloff", "衰減"),
("Falloff Distance", "衰減距離"),
("Favorites", "收藏"),
("Field Render: {}", "場算圖:{}"),
("Figures", "數字"),
("Fill Target", "填滿目標"),
("Finished", "已完成"),
("Flowchart: {}", "流程圖:{}"),
("Focus Distance", "焦距"),
("Follow Feature Rotation and Scale", "跟隨特徵的旋轉和縮放"),
("Footage: {}", "素材:{}"),
("Format: {}", "格式:{}"),
("Frame Aspect Ratio: {}", "影格長寬比:{}"),
("Frame Blending: {}", "影格混合:{}"),
("Frame Rate:", "影格速率:"),
("Frame Render Time {}ms", "影格算圖時間 {} 毫秒"),
("Frame Target:", "幀目標:"),
("Grab bag", "清單"),
("Grid", "格點"),
("Guide Layers: {}", "參考圖層:{}"),
("Guides", "參考線"),
("Height:", "高度:"),
("Hide This", "隱藏此項"),
("Histogram", "直方圖"),
("Hold In Place", "保持在原位"),
("Home", "主頁"),
("If Confidence is Below", "如果置信度低於"),
("Import", "匯入"),
("Import and Add to Composition", "匯入並添加到合成"),
("Import...", "匯入..."),
("Imported media", "已匯入的媒體"),
("Influence:", "影響:"),
("Install from File…", "從文件安裝…"),
("Intensity", "強度"),
("Inverted", "反轉"),
("Join the ArtCraft community on Discord", "加入 ArtCraft 的 Discord 社區"),
("Key: {}", "按鍵:{}"),
("LEARN", "學習"),
("Label", "標籤"),
("Label Colors and Names:", "標籤顏色和名稱:"),
("Label:", "標籤:"),
("Latest auto-save: {}", "最新的自動儲存:{}"),
("Layer", "圖層"),
("Layer controls", "圖層控制"),
("Layer {}", "圖層 {}"),
("Layer:", "圖層:"),
("Layer: {}", "圖層:{}"),
("Learn", "學習"),
("Leave all attributes in \"{}\"", "將所有屬性保留在“{}”中"),
("Licence: {}", "許可:{}"),
("Ligatures", "連字"),
("Light Type", "燈光類型"),
("Lighter", "更淺"),
("Link Selected Property", "鏈接所選屬性"),
("Lock Aspect Ratio to {}", "鎖定長寬比例為 {}"),
("Lock to Zoom", "鎖定縮放"),
("Locked: {} — {}", "已鎖定:{} — {}"),
("Log:", "日志:"),
("Loop (Trace Path)", "循環(追蹤路徑)"),
("MIT OR Apache-2.0 • Fonts: Inter, JetBrains Mono (OFL)", "MIT 或 Apache-2.0 • 字型:Inter、JetBrains Mono(OFL)"),
("Magnification ratio popup", "放大倍率快顯選單"),
("Make Comp Size", "設為合成長寬"),
("Masks", "遮色片"),
("Maximize Panel", "最大化面板"),
("Media Replacement", "媒體替換"),
("Mesh:", "格點:"),
("Method Used: {} Average Error: {} pixels", "使用方法:{} 平均誤差:{} 像素"),
("Models folder: {}", "模型資料夾:{}"),
("Modifiers:", "修飾鍵:"),
("More", "更多"),
("More ArtCraft apps", "更多 ArtCraft 應用"),
("More tutorials", "更多教學"),
("Motion Blur", "運動模糊"),
("Motion Blur: {}", "動態模糊:{}"),
("Motion Sketch: drag to record", "動態草圖:拖曳以記錄"),
("Move Down", "下移"),
("Move Up", "上移"),
("Move to Project Root", "移到專案根目錄"),
("Name", "名稱"),
("Name:", "名稱:"),
("Navigation", "導航"),
("New", "新建"),
("New Comp from Selection", "由所選專案新建合成"),
("New Duration:", "新持續時間:"),
("New composition name:", "新合成名稱:"),
("New from Render Queue item:", "由算圖佇列項新建:"),
("New from Template", "從範本新建"),
("Next", "下一個"),
("Nice work. Pick another tutorial on the Home screen's Learn tab.", "干得漂亮。請在主頁面的“學習”索引標籤中選取另一個教學。"),
("No VR environments yet. Create one with Composition ▸ VR ▸ Create VR Environment…", "還沒有 VR 環境。請用 合成 ▸ VR ▸ 創建 VR 環境… 新建一個。"),
("No audio layer selected", "未選取音訊圖層"),
("No background jobs running", "沒有正在執行的後台任務"),
("No composition markers", "沒有合成標記"),
("No contributor data was built into this copy.", "此副本未內置貢獻者數據。"),
("No device list from this host; the system default output is used.", "此主機無法獲取設備清單;將使用系統預設輸出。"),
("No layer selected", "未選取圖層"),
("No matching effects or presets", "沒有匹配的效果或預設集"),
("No model credits were built into this copy.", "此副本未內置模型致謝。"),
("No nested compositions", "沒有嵌套合成"),
("No shortcut", "無快速鍵"),
("No unlocked layer selected", "未選取已解鎖的圖層"),
("No video", "無視訊"),
("None", "無"),
("Not applied: tick it in the list to add it.", "未應用:在清單中勾選即可添加。"),
("Not assigned", "未分配"),
("Note: Shadows are only cast from layers with Cast Shadows enabled.", "注意:只有啟用了“投射陰影”的圖層才會投射陰影。"),
("Notify", "通知"),
("OK", "確定"),
("Offset:", "偏移:"),
("On ({}) stop:", "在({})時停止:"),
("One-Node Camera", "單節點攝影機"),
("Opacity:", "不透明度:"),
("Open Composition", "開啟合成"),
("Open Last Saved Project", "開啟上次儲存的專案"),
("Open New Composition", "開啟新建合成"),
("Open Output", "開啟輸出"),
("Open a composition to build Essential Graphics", "開啟一個合成以構建基本圖形"),
("Open a composition to see its scopes", "開啟一個合成以查看其示波器"),
("Open a composition to track motion.", "開啟一個合成以追蹤運動。"),
("Opus Tuning: {}", "Opus 調優:{}"),
("Original Duration:", "原始持續時間:"),
("Output Cycle: {}", "輸出循環:{}"),
("Output To:", "輸出到:"),
("Parameter Name:", "參數名稱:"),
("Parent pick whip: drag onto a layer", "上層拾取線:拖到圖層上"),
("Pixel Aspect Ratio:", "像素長寬比例:"),
("Playing on Video Preview", "在視訊預覽中播放"),
("Post-Render Action: {}", "算圖後動作:{}"),
("Preserve frame rate when nested or in render queue", "嵌套或在算圖佇列中時保留影格速率"),
("Preserve resolution when nested", "嵌套時保留分辨率"),
("Preset", "預設集"),
("Preset:", "預設集:"),
("Presets", "預設集"),
("Previous", "上一個"),
("Primary:", "主要:"),
("Process Before Match", "匹配前處理"),
("Profile: {}", "設定檔:{}"),
(
"Project color depth: click to cycle 8/16/32 bpc, Alt-click for Project Settings",
"專案顏色深度:按一下可在 8/16/32 bpc 之間循環,按住 Alt 按一下可開啟專案設置",
),
("Project: {}", "專案:{}"),
("Projects", "專案"),
("Property pick whip: drag onto a property", "屬性拾取線:拖到屬性上"),
("Protected Region", "受保護區域"),
("Proxy Use: {}", "代理使用:{}"),
("Push All to Comp", "全部推送到合成"),
("Radius", "半徑"),
("Rate Control: {}", "位元速率控制:{}"),
("Recent", "最近使用"),
("Recording", "錄製中"),
("Remove", "移除"),
("Rename", "重命名"),
("Render: {} ms • UI {} fps{}", "算圖:{} 毫秒 • 介面 {} fps{}"),
("Renderer:", "算圖引擎:"),
("Request Persistent Storage", "要求持久化儲存"),
("Reset", "重置"),
("Reset Labels", "重置標籤"),
("Reset Preset", "重置預設集"),
("Reset to Default", "重置為預設"),
("Reset to Saved Layout", "重置為已儲存的布局"),
("Resolution/Down Sample Factor Popup", "分辨率/向下取樣係數快顯選單"),
("Restore Panel Size", "恢復面板大小"),
("Reverse the order", "反轉順序"),
("Revert All", "全部還原"),
("Roman Hanging Punctuation", "西文懸掛標點"),
("Roving:", "游動:"),
("Ruler zero point (drag to move, double-click to reset)", "標尺零點(拖曳可移動,連按兩下可重置)"),
("Rulers", "標尺"),
("Run", "執行"),
("Sample Format: {}", "取樣格式:{}"),
("Samples Per Frame:", "每個影格取樣數:"),
("Save from #{}", "從 #{} 儲存"),
("Saved {}", "已儲存 {}"),
("Script… (⌘/Ctrl+Enter runs)", "指令碼…(⌘/Ctrl+Enter 執行)"),
("Search commands or shortcuts", "搜尋命令或快速鍵"),
("Select", "選取"),
("Select a command to change its shortcut.", "選取一條命令以更改其快速鍵。"),
("Select a layer to see its effects", "選取圖層以查看其效果"),
("Select a layer to see its properties", "選取圖層以查看其屬性"),
(
"Select a layer with a mask or shape path (or the path property), or Puppet pins.",
"請選取帶遮色片或形狀路徑(或路徑屬性)的圖層,或帶有人偶釘選點的圖層。",
),
("Select a text layer", "選取文字圖層"),
("Select an item in the Project panel", "在專案面板中選取一個項"),
("Select animated properties to show them in the Graph Editor", "選取已制作動畫的屬性以在圖表編輯器中顯示"),
(
"Select the leader pin, then Shift-click the pins that should trail it (hair, cloth, tails)",
"先選取引導釘選點,再按住 Shift 按一下應跟隨它的釘選點(頭發、布料、尾巴)",
),
("Set Ground Plane and Origin", "設置地平面和原點"),
("Set Paint Colors to Black and White (D)", "將繪畫顏色設為黑白(D)"),
("Settings", "設置"),
("Settings Name:", "設置名稱:"),
("Shadow Darkness", "陰影暗度"),
("Shadow Diffusion", "陰影擴散"),
("Shadows", "陰影"),
("Shape…", "形狀…"),
("Show", "顯示"),
("Show Layer Name", "顯示圖層名稱"),
("Show Source Name", "顯示源名稱"),
("Show me", "演示一下"),
("Show:", "顯示:"),
("Shutter Angle:", "快門角度:"),
("Shutter Phase:", "快門相位:"),
("Size", "大小"),
("Skip", "跳過"),
("Snapping", "對齊"),
("Snapping options", "對齊選項"),
("Snapshot", "快照"),
("Solo Supported Properties", "支援獨奏的屬性"),
("Solo Switches: {}", "獨奏開關:{}"),
("Sort", "排序"),
("Spacing:", "間距:"),
("Spatial Interpolation:", "空間插值:"),
("Speed:", "速度:"),
("Start Timecode:", "開始時間碼:"),
("Start: {} Duration: {}", "開始:{} 持續時間:{}"),
("Step {} of {}: {}", "第 {} 步,共 {} 步:{}"),
("Stop {} at {}°", "停止點 {} 位於 {}°"),
("Stored in: {}", "儲存位置:{}"),
("Stretch", "伸展"),
("Stretch Factor:", "伸展係數:"),
("Stylistic Sets", "樣式集"),
("Subpixel Positioning", "次像素定位"),
("Swap Paint Colors (X)", "交換繪畫顏色(X)"),
("System Default", "系統預設"),
("Table", "表格"),
("Template name", "範本名稱"),
("Template: {}\n{}", "範本:{}\n{}"),
("Temporal Interpolation:", "時間插值:"),
("The Media Browser is not available here (use File ▸ Import)", "此處不支援媒體瀏覽器(請使用 文件 ▸ 匯入)"),
("The OpenEXR layer shown in red, green, blue and alpha", "以紅、綠、藍和 Alpha 顯示的 OpenEXR 圖層"),
("The render queue is empty.", "算圖佇列為空。"),
("This ScriptUI panel has closed", "此 ScriptUI 面板已關閉"),
("This change will create a new solid for this layer.", "此更改將為該圖層創建新的純色。"),
("Time", "時間"),
("Time Stretch…", "時間伸縮…"),
("Time:", "時間:"),
("Time: {}", "時間:{}"),
("Title/action safe", "字幕/動作安全框"),
("Toggle Switches / Modes", "切換開關/模式"),
("Track Name:", "追蹤名稱:"),
("Trained models are available in the desktop app; the browser uses the classic engine.", "訓練好的模型僅在桌面應用中可用;瀏覽器版使用經典引擎。"),
("Transform", "變換"),
("Transparency grid", "透明格點"),
("Tutorial complete", "教學完成"),
("Two-Node Camera", "雙節點攝影機"),
("Type", "文字"),
("Type a command or effect…", "輸入命令或效果…"),
("URL:", "URL:"),
("Undock Panel", "取消停靠面板"),
("Unlink {}", "取消鏈接 {}"),
(
"Use this option to place the currently selected layers together into a new intermediate composition.",
"使用此選項可將目前所選圖層一起放入一個新的中間合成。",
),
("VR Environments", "VR 環境"),
("Value:", "值:"),
("Variable Font Axes", "可變字型軸"),
("Video Codec: {}", "視訊轉碼器:{}"),
("View:", "檢視:"),
("Welcome to EffectCraft", "歡迎使用 EffectCraft"),
("Width:", "寬度:"),
("You can undo this.", "您可以復原此操作。"),
("Your changes will be lost if you don't save them.", "如果不儲存,你的更改將會丟失。"),
("Zoom", "縮放"),
("built-in", "內建"),
("frames per second", "影格/秒"),
("template name", "範本名稱"),
("{} contributors · {} commits", "{} 位貢獻者 · {} 次提交"),
("{} x {}, {}MB per 8bpc frame", "{} x {},每 8bpc 幀 {}MB"),
("{} — coming soon", "{} — 即將推出"),
("{} — double-click to open, {}-click to reveal", "{} — 連按兩下開啟,{}-按一下可顯示位置"),
("⌘/Ctrl-drag a pin to record its motion", "⌘/Ctrl 拖曳釘選點可記錄其運動"),
("▣ {}", "▣ {}"),
("⚠ {} is used by:", "⚠ {} 已被以下專案使用:"),
];
#[cfg(test)]
mod tests {
use super::*;
/// The interface text that has moved into this catalog. Add a panel here when you convert it;
/// the tests below then keep it translated.
const CONVERTED: &[(&str, &str)] = &[
("credits.rs", include_str!("../credits.rs")),
("header.rs", include_str!("../header.rs")),
("menus.rs", include_str!("../menus.rs")),
("panels/anim_tools.rs", include_str!("../panels/anim_tools.rs")),
("panels/camera_tracker_ui.rs", include_str!("../panels/camera_tracker_ui.rs")),
("panels/comp_settings.rs", include_str!("../panels/comp_settings.rs")),
("panels/content_fill_panel.rs", include_str!("../panels/content_fill_panel.rs")),
("panels/delete_items.rs", include_str!("../panels/delete_items.rs")),
("panels/dialogs.rs", include_str!("../panels/dialogs.rs")),
("panels/dialogs_3d.rs", include_str!("../panels/dialogs_3d.rs")),
("panels/effect_controls.rs", include_str!("../panels/effect_controls.rs")),
("panels/effects_presets.rs", include_str!("../panels/effects_presets.rs")),
("panels/essential.rs", include_str!("../panels/essential.rs")),
("panels/expr_bar.rs", include_str!("../panels/expr_bar.rs")),
("panels/flowchart.rs", include_str!("../panels/flowchart.rs")),
("panels/footage_panel.rs", include_str!("../panels/footage_panel.rs")),
("panels/forms.rs", include_str!("../panels/forms.rs")),
("panels/fx_editors.rs", include_str!("../panels/fx_editors.rs")),
("panels/graph.rs", include_str!("../panels/graph.rs")),
("panels/home.rs", include_str!("../panels/home.rs")),
("panels/info.rs", include_str!("../panels/info.rs")),
("panels/key_dialogs.rs", include_str!("../panels/key_dialogs.rs")),
("panels/layer_panel.rs", include_str!("../panels/layer_panel.rs")),
("panels/layer_styles_dialog.rs", include_str!("../panels/layer_styles_dialog.rs")),
("panels/learn.rs", include_str!("../panels/learn.rs")),
("panels/markers_ui.rs", include_str!("../panels/markers_ui.rs")),
("panels/media_panels.rs", include_str!("../panels/media_panels.rs")),
("panels/misc.rs", include_str!("../panels/misc.rs")),
("panels/mod.rs", include_str!("../panels/mod.rs")),
("panels/paint_panels.rs", include_str!("../panels/paint_panels.rs")),
("panels/path_vr_panels.rs", include_str!("../panels/path_vr_panels.rs")),
("panels/precomp.rs", include_str!("../panels/precomp.rs")),
("panels/project.rs", include_str!("../panels/project.rs")),
("panels/properties.rs", include_str!("../panels/properties.rs")),
("panels/render_queue.rs", include_str!("../panels/render_queue.rs")),
("panels/rq_templates.rs", include_str!("../panels/rq_templates.rs")),
("panels/scopes_panel.rs", include_str!("../panels/scopes_panel.rs")),
("panels/script_console.rs", include_str!("../panels/script_console.rs")),
("panels/scriptui_view.rs", include_str!("../panels/scriptui_view.rs")),
("panels/settings.rs", include_str!("../panels/settings.rs")),
("panels/shortcut_editor.rs", include_str!("../panels/shortcut_editor.rs")),
("panels/templates.rs", include_str!("../panels/templates.rs")),
("panels/text_panels.rs", include_str!("../panels/text_panels.rs")),
("panels/timeline.rs", include_str!("../panels/timeline.rs")),
("panels/tracker.rs", include_str!("../panels/tracker.rs")),
("panels/unsaved.rs", include_str!("../panels/unsaved.rs")),
("panels/viewer.rs", include_str!("../panels/viewer.rs")),
("panels/viewer_tools.rs", include_str!("../panels/viewer_tools.rs")),
("panels/viewers.rs", include_str!("../panels/viewers.rs")),
];
/// Call shapes that hand a string literal straight to the user.
const CALLS: &[&str] = &[
".label(\"",
".button(\"",
".small(\"",
".strong(\"",
".heading(\"",
".monospace(\"",
".on_hover_text(\"",
".hint_text(\"",
".text(\"",
".prefix(\"",
".suffix(\"",
"RichText::new(\"",
"Label::new(\"",
"Button::new(\"",
"Window::new(\"",
"CollapsingHeader::new(\"",
];
/// Literals that stay as they are: a unit or a separator reads the same in every language.
const UNITS: &[&str] = &[" px", "%", "·", "s", "ms", "°", "fps", " bpc", " mm", " s", " %", " pixels"];
fn catalogs() -> Vec<(&'static str, &'static str)> {
SIMPLIFIED_CHINESE.iter().copied().chain(TRADITIONAL_CHINESE.iter().copied()).collect()
}
/// A row that translates nothing, repeats a source string, or changes the number of values the
/// English source carries is a bug in the catalog itself.
#[test]
fn catalogs_are_unique_and_keep_the_english_shape() {
let hans: Vec<&str> = SIMPLIFIED_CHINESE.iter().map(|(en, _)| *en).collect();
let hant: Vec<&str> = TRADITIONAL_CHINESE.iter().map(|(en, _)| *en).collect();
assert_eq!(hans, hant, "the two Chinese catalogs list different source strings");
let mut sorted = hans.clone();
sorted.sort_unstable();
let listed = sorted.len();
sorted.dedup();
assert_eq!(listed, sorted.len(), "a source string is listed twice");
for (en, translated) in catalogs() {
assert!(!en.is_empty() && !translated.is_empty(), "empty row for {en:?}");
assert!(en.contains("{}") || !en.contains('{'), "{en:?} has a placeholder but no `{{}}`");
assert_eq!(en.matches("{}").count(), translated.matches("{}").count(), "{en:?} and {translated:?} carry a different number of values");
}
}
/// English, a language without rows yet, and anything the catalog does not know stay verbatim:
/// a filename or layer name must never be translated.
#[test]
fn english_and_unknown_text_pass_through() {
set_current("en");
assert_eq!(tr("Composition Name:"), "Composition Name:");
set_current("ja"); // no rows for Japanese yet
assert_eq!(tr("Composition Name:"), "Composition Name:");
set_current("zh-hans");
assert_eq!(tr("Composition Name:"), "合成名称:");
assert_eq!(tr("my layer.mp4"), "my layer.mp4");
set_current("en");
}
/// Values fill the placeholders in order, and a missing value is dropped instead of panicking.
#[test]
fn tr_args_fills_values_in_order() {
set_current("zh-hans");
assert_eq!(tr_args("Proxy Use: {}", &[&"Best"]), "代理使用:Best");
assert_eq!(tr_args("Step {} of {}: {}", &[&1, &3, &"Colour"]), "第 1 步,共 3 步:Colour");
assert_eq!(tr_args("Proxy Use: {}", &[]), "代理使用:");
set_current("en");
assert_eq!(tr_args("Proxy Use: {}", &[&"Best"]), "Proxy Use: Best");
}
/// Every row is asked for by a converted panel: a leftover row means the panel went back to its
/// English literal.
#[test]
fn every_row_is_used_by_a_converted_panel() {
for (en, _) in catalogs() {
let plain = format!("tr({en:?})");
let formatted = format!("tr_args({en:?}");
assert!(
CONVERTED.iter().any(|(_, src)| src.contains(&plain) || src.contains(&formatted)),
"{en:?} is in the catalog but no converted panel asks for it"
);
}
}
/// A newly hard-coded interface string fails here instead of shipping in English to every
/// language. It is a heuristic - it looks at the call shapes the panels use - and it ignores
/// one-character literals, which are punctuation or a key name rather than a sentence.
#[test]
fn converted_panels_have_no_unwrapped_literals() {
for (path, source) in CONVERTED {
for (n, line) in source.lines().enumerate() {
let code = line.split("//").next().unwrap_or(line);
for call in CALLS {
let Some(at) = code.find(call) else { continue };
let rest = &code[at + call.len()..];
let Some(end) = rest.find('"') else { continue };
let literal = &rest[..end];
assert!(
literal.chars().count() < 2 || UNITS.contains(&literal),
"{path}:{}: interface text `{literal}` in `{call}` is not in the catalog",
n + 1
);
}
}
}
}
}