mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 13:08:07 -06:00
Merge pull request #1514 from FeiLiuEM/i18n/1451-tool-names
i18n: the 31 tool names are translated (zh-hans, zh-hant)
This commit is contained in:
@@ -94,9 +94,11 @@ fn tool_slot(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter, si:
|
||||
));
|
||||
}
|
||||
app.auto.add_response(&format!("tools.{cur:?}"), &resp, cur.label());
|
||||
// The drawn tooltip asks the catalog; the automation label above keeps the English name.
|
||||
let label = crate::i18n::tr(cur.label());
|
||||
let tip = match cur.shortcut() {
|
||||
Some(s) => format!("{} ({})", cur.label(), crate::menus::shortcut_text(s)),
|
||||
None => cur.label().to_string(),
|
||||
Some(s) => format!("{} ({})", label, crate::menus::shortcut_text(s)),
|
||||
None => label.to_string(),
|
||||
};
|
||||
let resp = resp.on_hover_text(tip);
|
||||
let held = ui.data(|d| d.get_temp::<egui::Id>(held_id)) == Some(id);
|
||||
@@ -145,7 +147,7 @@ fn slot_flyout(app: &mut EffectcraftApp, ui: &mut egui::Ui, si: usize, slot: &[T
|
||||
let close_behavior = if held && resp.clicked() { egui::PopupCloseBehavior::IgnoreClicks } else { egui::PopupCloseBehavior::CloseOnClickOutside };
|
||||
egui::Popup::menu(resp).style(crate::widgets::menu_style).open_memory(command).close_behavior(close_behavior).show(|ui| {
|
||||
for tool in slot.iter() {
|
||||
let row = ui.selectable_label(app.ui.tool == *tool, tool.label());
|
||||
let row = ui.selectable_label(app.ui.tool == *tool, crate::i18n::tr(tool.label()));
|
||||
app.auto.add(&format!("tools.select.{tool:?}"), row.rect, tool.label());
|
||||
if row.clicked() {
|
||||
app.ui.tool = *tool;
|
||||
|
||||
@@ -1643,6 +1643,37 @@ const SIMPLIFIED_CHINESE: &[(&str, &str)] = &[
|
||||
("Total Offset", "总偏移"),
|
||||
("Per Layer", "每个图层"),
|
||||
("Track", "跟踪"),
|
||||
("Selection Tool", "选择工具"),
|
||||
("Hand Tool", "抓手工具"),
|
||||
("Zoom Tool", "缩放工具"),
|
||||
("Orbit Around Cursor Tool", "绕行摄像机工具"),
|
||||
("Pan Under Cursor Tool", "平移摄像机工具"),
|
||||
("Dolly Towards Cursor Tool", "推拉摄像机工具"),
|
||||
("Rotation Tool", "旋转工具"),
|
||||
("Pan Behind (Anchor Point) Tool", "向后平移工具"),
|
||||
("Rectangle Tool", "矩形工具"),
|
||||
("Rounded Rectangle Tool", "圆角矩形工具"),
|
||||
("Ellipse Tool", "椭圆工具"),
|
||||
("Polygon Tool", "多边形工具"),
|
||||
("Star Tool", "星形工具"),
|
||||
("Pen Tool", "钢笔工具"),
|
||||
("Add Vertex Tool", "添加顶点工具"),
|
||||
("Delete Vertex Tool", "删除顶点工具"),
|
||||
("Convert Vertex Tool", "转换顶点工具"),
|
||||
("Mask Feather Tool", "蒙版羽化工具"),
|
||||
("Horizontal Type Tool", "横排文字工具"),
|
||||
("Vertical Type Tool", "直排文字工具"),
|
||||
("Brush Tool", "画笔工具"),
|
||||
("Clone Stamp Tool", "仿制图章工具"),
|
||||
("Eraser Tool", "橡皮擦工具"),
|
||||
("Roto Brush Tool", "Roto 笔刷工具"),
|
||||
("Refine Edge Tool", "调整边缘工具"),
|
||||
("Object Matte Tool", "对象遮罩工具"),
|
||||
("Puppet Position Pin Tool", "人偶位置控点工具"),
|
||||
("Puppet Starch Pin Tool", "人偶扑粉控点工具"),
|
||||
("Puppet Bend Pin Tool", "人偶弯曲控点工具"),
|
||||
("Puppet Advanced Pin Tool", "人偶高级控点工具"),
|
||||
("Puppet Overlap Pin Tool", "人偶重叠控点工具"),
|
||||
];
|
||||
|
||||
const TRADITIONAL_CHINESE: &[(&str, &str)] = &[
|
||||
@@ -2330,6 +2361,37 @@ const TRADITIONAL_CHINESE: &[(&str, &str)] = &[
|
||||
("Total Offset", "總偏移"),
|
||||
("Per Layer", "每個圖層"),
|
||||
("Track", "追蹤"),
|
||||
("Selection Tool", "選取工具"),
|
||||
("Hand Tool", "手形工具"),
|
||||
("Zoom Tool", "縮放工具"),
|
||||
("Orbit Around Cursor Tool", "繞行攝影機工具"),
|
||||
("Pan Under Cursor Tool", "平移攝影機工具"),
|
||||
("Dolly Towards Cursor Tool", "推拉攝影機工具"),
|
||||
("Rotation Tool", "旋轉工具"),
|
||||
("Pan Behind (Anchor Point) Tool", "向後平移工具"),
|
||||
("Rectangle Tool", "矩形工具"),
|
||||
("Rounded Rectangle Tool", "圓角矩形工具"),
|
||||
("Ellipse Tool", "橢圓工具"),
|
||||
("Polygon Tool", "多邊形工具"),
|
||||
("Star Tool", "星形工具"),
|
||||
("Pen Tool", "筆型工具"),
|
||||
("Add Vertex Tool", "添加頂點工具"),
|
||||
("Delete Vertex Tool", "刪除頂點工具"),
|
||||
("Convert Vertex Tool", "轉換頂點工具"),
|
||||
("Mask Feather Tool", "遮色片羽化工具"),
|
||||
("Horizontal Type Tool", "橫排文字工具"),
|
||||
("Vertical Type Tool", "垂直文字工具"),
|
||||
("Brush Tool", "筆刷工具"),
|
||||
("Clone Stamp Tool", "仿製圖章工具"),
|
||||
("Eraser Tool", "橡皮擦工具"),
|
||||
("Roto Brush Tool", "Roto 筆刷工具"),
|
||||
("Refine Edge Tool", "調整邊緣工具"),
|
||||
("Object Matte Tool", "物件遮色片工具"),
|
||||
("Puppet Position Pin Tool", "人偶位置控點工具"),
|
||||
("Puppet Starch Pin Tool", "人偶撲粉控點工具"),
|
||||
("Puppet Bend Pin Tool", "人偶彎曲控點工具"),
|
||||
("Puppet Advanced Pin Tool", "人偶高級控點工具"),
|
||||
("Puppet Overlap Pin Tool", "人偶重疊控點工具"),
|
||||
];
|
||||
|
||||
/// Ukrainian (uk): original translations of the same interface rows as the Chinese catalogs.
|
||||
@@ -5745,6 +5807,7 @@ mod tests {
|
||||
("menus/frontend.rs", include_str!("../menus/frontend.rs")),
|
||||
("menus/invoke.rs", include_str!("../menus/invoke.rs")),
|
||||
("menus/shortcuts.rs", include_str!("../menus/shortcuts.rs")),
|
||||
("state.rs", include_str!("../state.rs")),
|
||||
("prefs_live.rs", include_str!("../prefs_live.rs")),
|
||||
("widgets.rs", include_str!("../widgets.rs")),
|
||||
("panels/anim_tools.rs", include_str!("../panels/anim_tools.rs")),
|
||||
@@ -5824,6 +5887,18 @@ mod tests {
|
||||
|
||||
/// 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 the_toolbar_asks_the_catalog_for_the_tool_names() {
|
||||
let header = include_str!("../header.rs");
|
||||
for call in ["crate::i18n::tr(tool.label())", "crate::i18n::tr(cur.label())"] {
|
||||
assert!(header.contains(call), "header.rs no longer draws {call}");
|
||||
}
|
||||
assert!(
|
||||
header.contains("app.auto.add(&format!(\"tools.select.{tool:?}\"), row.rect, tool.label())"),
|
||||
"the automation label must stay the English tool name"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn catalogs_are_unique_and_keep_the_english_shape() {
|
||||
// Grouped by language: a source listed in two tables of one language is still a repeat.
|
||||
|
||||
Reference in New Issue
Block a user