diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index ba964a9f..be61797f 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -230,6 +230,35 @@ jobs: cp "$stage/draftcraft-cli.exe" "$dir/draftcraft-cli.exe" (cd dist/zip && 7z a -tzip "../upload/draftcraft-windows-${{ matrix.arch }}.zip" DraftCraft > /dev/null) ls -l dist/upload + - name: Update over DraftCraft 2.2.2 + # 2.2.2 and earlier used the upgrade code DraftCraft shared with CADCraft (#35). The new + # setup must replace such a copy (as Update Now runs it), leaving one DraftCraft, not two. + if: matrix.arch == 'x64' + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $old = Join-Path $env:RUNNER_TEMP 'draftcraft-2.2.2-setup.exe' + Invoke-WebRequest 'https://github.com/DraftCraft-DEV/DraftCraft/releases/download/v2.2.2/draftcraft-windows-x64-setup.exe' -OutFile $old + $p = Start-Process $old -ArgumentList @('/quiet') -Wait -PassThru + if ($p.ExitCode -ne 0) { throw "installing 2.2.2 failed: $($p.ExitCode)" } + $installer = New-Object -ComObject WindowsInstaller.Installer + $legacy = '{119D7D76-0167-4A9E-8F37-09DA0235F68E}' + $current = '{' + (Get-Content packaging/windows/install-policy.json -Raw | ConvertFrom-Json).upgradeCode + '}' + if (@($installer.RelatedProducts($legacy)).Count -ne 1) { throw '2.2.2 did not install' } + $setup = (Resolve-Path 'dist/upload/draftcraft-windows-x64-setup.exe').Path + $log = Join-Path $env:RUNNER_TEMP 'upgrade.log' + $p = Start-Process $setup -ArgumentList @('/quiet', '--scope', 'user', '/log', "`"$log`"") -Wait -PassThru + if ($p.ExitCode -ne 0) { if (Test-Path $log) { Get-Content $log -Tail 80 }; throw "update failed: $($p.ExitCode)" } + $left = @($installer.RelatedProducts($legacy)).Count + $now = @($installer.RelatedProducts($current)).Count + if ($left -ne 0) { Get-Content $log -Tail 80; throw "the update left DraftCraft 2.2.2 installed beside the new one" } + if ($now -ne 1) { throw "expected one new DraftCraft, found $now" } + $exe = (Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\App Paths\draftcraft.exe').'(default)' + if (-not (Test-Path $exe)) { throw "App Paths names a missing exe after the update: $exe" } + $msi = (Resolve-Path 'dist/release/draftcraft-*-windows-x64.msi').Path + $p = Start-Process msiexec.exe -ArgumentList @('/x', "`"$msi`"", '/qn') -Wait -PassThru + if ($p.ExitCode -ne 0) { throw "uninstall failed: $($p.ExitCode)" } + Write-Output 'the new setup replaced DraftCraft 2.2.2 and left one copy' - name: Install, check and uninstall the installer # A real install on this throwaway runner, for this account (no administrator), as a # double-click with the default choice does, through the setup .exe people download. diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 70405b47..636e7bcb 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -133,6 +133,7 @@ contributors, and where a line says so by Skryx Dev: | `crates/ui-egui/src/i18n/cs.tsv` | @Losminek (AI-assisted) | Original Czech translations of the English interface strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied | | `crates/ui-egui/src/i18n/ru.tsv` | @pechnikov2026-star | Original Russian translations of the English interface strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied | | `crates/ui-egui/src/i18n/fr.tsv` | @pechnikov2026-star | Original French translations of the English interface strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied | +| `crates/ui-egui/src/i18n/zh_tw.tsv` | Skryx Dev with Claude Code (AI-assisted), from `zh.tsv` | Original Traditional Chinese (Taiwan) translations of the English interface strings: the Simplified Chinese catalog in Traditional characters with Taiwan terminology | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied; not yet reviewed by a native speaker | | `crates/ui-egui/src/i18n/zh.tsv` | @mayloglog; DraftCraft ribbon strings: Skryx Dev | Original Simplified Chinese translations of the English interface strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied | | `crates/ui-egui/src/i18n/sv.tsv` | Erik Holmbom (@holmbom) with Claude Code (AI-assisted) | Original Swedish translations of the English interface strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied; terminology and the running app reviewed by a native speaker | | `crates/ui-egui/src/i18n/it.tsv` | Emanuele Bottelli (AI-assisted); terminology corrections: Andrea Brandi (@starise) with OpenAI Codex (AI-assisted); DraftCraft ribbon strings: Skryx Dev | Original Italian translations of the English interface strings | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | No proprietary localization resources copied; targeted Chamfer terminology review by a native speaker | diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fdeb720..59af7b96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,13 @@ How to write it (see AGENTS.md): ## Unreleased +### New +- The interface is available in Traditional Chinese (繁體中文), with the terms used in Taiwan: choose it in Edit › Interface Language, or let DraftCraft pick it on a computer set to Taiwan, Hong Kong or Macau. +- The Start page can begin a new drawing in centimeters, beside millimeters and inches; text, dimensions, linetypes and hatches are sized so the drawing prints as a millimeter one does. Options › Units of new drawings offers centimeters too, and a later New remembers the choice. + +### Fixed +- DraftCraft and CADCraft can be installed side by side on Windows: installing one no longer removes the other or fails with an error. Updating DraftCraft still replaces an earlier DraftCraft. + ## 2.2.2 ### New diff --git a/crates/doc/src/header.rs b/crates/doc/src/header.rs index 06828ef7..ab7c7d60 100644 --- a/crates/doc/src/header.rs +++ b/crates/doc/src/header.rs @@ -165,4 +165,18 @@ impl Header { h.set("LIMMAX", HVal::Point(Vec3::new(420.0, 297.0, 0.0))); h } + + /// The metric header in centimetres (INSUNITS 5): the same A3 limits and printed sizes as the + /// millimetre one, so text, linetypes, hatches and dimensions (DIMSCALE) are a tenth as large + /// in drawing units. + pub fn centimetres() -> Header { + let mut h = Header::metric(); + h.set_i64("INSUNITS", 5); + h.set_f64("TEXTSIZE", 0.25); + h.set_f64("LTSCALE", 0.1); + h.set_f64("HPSCALE", 0.1); + h.set_f64("DIMSCALE", 0.1); + h.set("LIMMAX", HVal::Point(Vec3::new(42.0, 29.7, 0.0))); + h + } } diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index b928dabf..92172541 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -175,6 +175,28 @@ impl Drawing { d.header.set_str("DIMSTYLE", "ISO-25"); d } + /// An empty metric drawing in centimetres (#34): the millimetre drawing with its default + /// sizes a tenth as large in drawing units (ISO-25 at DIMSCALE 0.1, multileaders, tables), so + /// annotation prints at the same size. + pub fn new_centimetres() -> Self { + let mut d = Drawing::new_metric(); + d.header = Header::centimetres(); + d.header.set_str("DIMSTYLE", "ISO-25"); + for style in d.dim_styles.iter_mut().filter(|s| s.name == "ISO-25") { + style.scale = 0.1; + } + for style in &mut d.mleader_styles { + style.arrow_size /= 10.0; + style.text_height /= 10.0; + style.landing_gap /= 10.0; + style.dogleg /= 10.0; + } + for style in &mut d.table_styles { + style.text_height /= 10.0; + style.margin /= 10.0; + } + d + } fn bare() -> Self { Drawing { header: Header::default(), diff --git a/crates/doc/src/tests.rs b/crates/doc/src/tests.rs index b1601783..29125bae 100644 --- a/crates/doc/src/tests.rs +++ b/crates/doc/src/tests.rs @@ -714,3 +714,22 @@ fn space_names_its_tab() { assert_eq!(p.layout(), Some("Sheet A")); assert_eq!(p.tab_name(), "Sheet A"); } + +/// #34: a centimetre drawing prints like the millimetre one, every default size a tenth as large. +#[test] +fn new_centimetre_drawing_is_the_metric_one_a_tenth_as_large() { + let (mm, cm) = (Drawing::new_metric(), Drawing::new_centimetres()); + assert_eq!((cm.header.i64("INSUNITS", 0), cm.header.i64("MEASUREMENT", 0)), (5, 1)); + assert_eq!(cm.header.str("DIMSTYLE", ""), "ISO-25"); + for (name, k) in [("TEXTSIZE", 0.1), ("LTSCALE", 0.1), ("HPSCALE", 0.1), ("DIMSCALE", 0.1)] { + assert!((cm.header.f64(name, 1.0) - mm.header.f64(name, 1.0) * k).abs() < 1e-12, "{name}"); + } + let iso = |d: &Drawing| d.dim_style("ISO-25").map(|s| s.text_height * s.effective_scale(1.0)).unwrap(); + assert!((iso(&cm) - iso(&mm) / 10.0).abs() < 1e-12); + let (ml, ml_mm) = (&cm.mleader_styles[0], &mm.mleader_styles[0]); + assert!((ml.text_height - ml_mm.text_height / 10.0).abs() < 1e-12 && (ml.dogleg - ml_mm.dogleg / 10.0).abs() < 1e-12); + assert!((cm.table_styles[0].text_height - mm.table_styles[0].text_height / 10.0).abs() < 1e-12); + // The Standard dimension style and the tables are as in any new drawing. + assert_eq!(cm.dim_style("Standard"), mm.dim_style("Standard")); + assert_eq!(cm.layers, mm.layers); +} diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 4aabbde8..8d0f7ed0 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -206,7 +206,9 @@ pub fn specs() -> Vec { .menu(&["File", "New Drawing..."]) .key("Cmd+N") .alias(&["qnew"]) - .params("{metric?: bool (default MEASUREINIT), template?: path to a .dwt/.dxf template (\".\" for none; default QNEWTEMPLATE)}") + .params( + "{units?: in|mm|cm, metric?: bool (default MEASUREINIT; metric is MEASUREINITUNITS, mm or cm), template?: path to a .dwt/.dxf template (\".\" for none; default QNEWTEMPLATE)}", + ) .enabled(always) .noundo(), CommandSpec::new("open", "Open...", run_open) @@ -297,11 +299,28 @@ fn run_new(s: &mut Session, p: &Value) -> Result { if let Some(r) = template::run_new(s, p)? { return Ok(r); } - let metric = s.settings.measureinit; - let i = s.new_drawing(bool_or(p, "metric", metric)); + let insunits = match p.get("units") { + Some(v) => new_units(v).ok_or_else(|| bad("new", "`units` must be in, mm or cm"))?, + None if bool_or(p, "metric", s.settings.measureinit) => i64::from(s.settings.measureinit_units), + None => 1, + }; + let i = s.new_drawing_in(insunits); Ok(json!({ "index": i, "title": s.docs.get(i).map(|d| d.title.clone()) })) } +/// NEW's `units`: inches, millimetres or centimetres, by name or INSUNITS code (1, 4, 5). +fn new_units(v: &Value) -> Option { + if let Some(code) = v.as_i64() { + return [1, 4, 5].contains(&code).then_some(code); + } + match v.as_str()?.trim().to_ascii_lowercase().as_str() { + "in" | "inch" | "inches" => Some(1), + "mm" | "millimeter" | "millimeters" | "millimetre" | "millimetres" => Some(4), + "cm" | "centimeter" | "centimeters" | "centimetre" | "centimetres" => Some(5), + _ => None, + } +} + fn file_name(path: &str) -> String { std::path::Path::new(path).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| path.to_string()) } diff --git a/crates/engine/src/cmd/options.rs b/crates/engine/src/cmd/options.rs index b9a24580..80f113e9 100644 --- a/crates/engine/src/cmd/options.rs +++ b/crates/engine/src/cmd/options.rs @@ -53,6 +53,7 @@ pub const PROFILE_VARS: &[&str] = &[ "PICKDRAG", "MAXARRAY", "MEASUREINIT", + "MEASUREINITUNITS", ]; /// The most profile entries [`restore`] reads (a saved profile is untrusted input). diff --git a/crates/engine/src/session/files.rs b/crates/engine/src/session/files.rs index f973ecb6..821b0435 100644 --- a/crates/engine/src/session/files.rs +++ b/crates/engine/src/session/files.rs @@ -3,10 +3,20 @@ use super::{DocState, Drawing, EngineError, Result, Session, Space, Value, Vec2, impl Session { /// Append a new untitled drawing (`DrawingN`, metric or imperial default view), end a running command, make it active, bump the document epoch and return its index. pub fn new_drawing(&mut self, metric: bool) -> usize { + self.new_drawing_in(if metric { 4 } else { 1 }) + } + + /// [`Session::new_drawing`] in the units of an INSUNITS code: 1 inches, 5 centimetres, any + /// other millimetres. A metric drawing opens on its A3 limits. + pub fn new_drawing_in(&mut self, insunits: i64) -> usize { self.untitled_counter += 1; - let d = if metric { Drawing::new_metric() } else { Drawing::new_imperial() }; + let (d, a3) = match insunits { + 1 => (Drawing::new_imperial(), None), + 5 => (Drawing::new_centimetres(), Some(0.1)), + _ => (Drawing::new_metric(), Some(1.0)), + }; let mut st = DocState::new(d, &format!("Drawing{}", self.untitled_counter), None); - st.set_view_quiet(if metric { View { center: Vec2::new(210.0, 148.5), height: 297.0, twist: 0.0 } } else { View::default() }); + st.set_view_quiet(a3.map_or_else(View::default, |k| View { center: Vec2::new(210.0 * k, 148.5 * k), height: 297.0 * k, twist: 0.0 })); self.end_running(); self.docs.push(st); self.active = self.docs.len() - 1; diff --git a/crates/engine/src/settings.rs b/crates/engine/src/settings.rs index 736cec91..3d739775 100644 --- a/crates/engine/src/settings.rs +++ b/crates/engine/src/settings.rs @@ -25,6 +25,9 @@ pub struct Settings { /// MEASUREINIT: the units of a new drawing made without a template (NEW, QNEW and the first /// drawing at startup): `false` (0, the default) imperial, `true` (1) metric. pub measureinit: bool, + /// MEASUREINITUNITS (DraftCraft's): the INSUNITS of such a drawing when it is metric, 4 + /// millimetres (the default) or 5 centimetres (#34). + pub measureinit_units: u8, /// -VIEW sEttings > Layer snapshot: named views save the layer settings with them. pub view_layer_snapshot: bool, pub dynmode: bool, @@ -147,6 +150,7 @@ impl Default for Settings { gridmajor: 5, zoomfactor: 60, measureinit: false, + measureinit_units: 4, view_layer_snapshot: true, dynmode: true, dyndigrip: 31, diff --git a/crates/engine/src/sysvars.rs b/crates/engine/src/sysvars.rs index b1669098..3031e490 100644 --- a/crates/engine/src/sysvars.rs +++ b/crates/engine/src/sysvars.rs @@ -68,6 +68,7 @@ const SESSION_VARS: &[&str] = &[ "MAXARRAY", "ZOOMFACTOR", "MEASUREINIT", + "MEASUREINITUNITS", "LASTPOINT", "AREA", "PERIMETER", @@ -149,6 +150,7 @@ pub fn get(s: &Session, name: &str) -> Option { "MAXARRAY" => json!(st.maxarray), "ZOOMFACTOR" => json!(st.zoomfactor), "MEASUREINIT" => json!(i32::from(st.measureinit)), + "MEASUREINITUNITS" => json!(st.measureinit_units), "LASTPOINT" => json!([s.last_point.x, s.last_point.y, 0.0]), "AREA" => json!(s.area), "PERIMETER" => json!(s.perimeter), @@ -379,6 +381,7 @@ pub fn set(s: &mut Session, name: &str, v: &Value) -> Result<()> { "MAXARRAY" => st.maxarray = as_f64(v).ok_or_else(bad)?.clamp(100.0, 10_000_000.0) as u64, "ZOOMFACTOR" => st.zoomfactor = as_i(v).filter(|z| (3..=100).contains(z)).ok_or_else(bad)? as u32, "MEASUREINIT" => st.measureinit = small(v, 1).ok_or_else(bad)? == 1, + "MEASUREINITUNITS" => st.measureinit_units = small(v, 5).filter(|u| matches!(u, 4 | 5)).ok_or_else(bad)?, "FONTALT" => draftcraft_fonts::ttf::set_font_alt(v.as_str().ok_or_else(bad)?), "FONTFALLBACK" => draftcraft_fonts::ttf::set_fallback_fonts(v.as_str().ok_or_else(bad)?), "SAVETIME" => crate::autosave::set_savetime( diff --git a/crates/engine/tests/measureinit.rs b/crates/engine/tests/measureinit.rs index 005440e2..3bf8ddde 100644 --- a/crates/engine/tests/measureinit.rs +++ b/crates/engine/tests/measureinit.rs @@ -49,3 +49,53 @@ fn kept_in_the_profile() { draftcraft_engine::cmd::options::restore(&mut restarted, &saved); assert_eq!(var(&mut restarted, "MEASUREINIT"), json!(1)); } + +/// #34: a new drawing in centimetres, chosen by NEW's `units` or remembered by MEASUREINITUNITS. +#[test] +fn centimetres_by_units_or_measureinitunits() { + let mut s = Session::empty(); + s.execute("new", &json!({ "units": "cm" })).unwrap(); + assert_eq!(var(&mut s, "INSUNITS"), json!(5)); + assert_eq!(var(&mut s, "MEASUREMENT"), json!(1)); + assert_eq!(var(&mut s, "DIMSTYLE"), json!("ISO-25")); + // The millimetre drawing's printed sizes, a tenth as large in centimetres. + let d = s.doc().unwrap(); + assert_eq!(d.header.f64("TEXTSIZE", 0.0), 0.25); + assert_eq!(d.header.f64("LTSCALE", 0.0), 0.1); + assert_eq!(d.dim_style("ISO-25").unwrap().effective_scale(1.0), 0.1); + assert!((s.docs[s.active].view().height - 29.7).abs() < 1e-9); + // Inches and millimetres by name or INSUNITS code; `units` wins over `metric`. + for (units, code) in [(json!("in"), 1), (json!("Millimeters"), 4), (json!(5), 5), (json!(" CM "), 5)] { + s.execute("new", &json!({ "units": units, "metric": code == 1 })).unwrap(); + assert_eq!(var(&mut s, "INSUNITS"), json!(code), "{units}"); + } + // Remembered for a plain New, and for `metric`, once metric drawings are in centimetres. + assert_eq!(var(&mut s, "MEASUREINITUNITS"), json!(4)); + s.execute("options", &json!({ "MEASUREINIT": 1, "MEASUREINITUNITS": 5 })).unwrap(); + s.execute("new", &json!({})).unwrap(); + assert_eq!(var(&mut s, "INSUNITS"), json!(5)); + s.execute("new", &json!({ "metric": true })).unwrap(); + assert_eq!(var(&mut s, "INSUNITS"), json!(5)); + s.execute("new", &json!({ "metric": false })).unwrap(); + assert_eq!(var(&mut s, "INSUNITS"), json!(1)); + let saved = draftcraft_engine::cmd::options::profile(&s); + assert_eq!(saved["MEASUREINITUNITS"], json!(5)); + let mut restarted = Session::empty(); + draftcraft_engine::cmd::options::restore(&mut restarted, &saved); + restarted.execute("new", &json!({})).unwrap(); + assert_eq!(var(&mut restarted, "INSUNITS"), json!(5)); +} + +#[test] +fn units_that_are_not_inches_millimetres_or_centimetres_are_refused() { + let mut s = Session::empty(); + for bad in [json!("m"), json!(2), json!(-1), json!(""), json!(true), json!(i64::MAX), json!(1.5)] { + let before = s.docs.len(); + assert!(s.execute("new", &json!({ "units": bad })).is_err(), "{bad}"); + assert_eq!(s.docs.len(), before, "no drawing for {bad}"); + } + for bad in [json!(1), json!(6), json!(0), json!("cm"), json!(-4), json!(f64::NAN.to_string())] { + assert!(s.execute("options", &json!({ "MEASUREINITUNITS": bad })).is_err(), "{bad}"); + } + assert_eq!(var(&mut s, "MEASUREINITUNITS"), json!(4)); +} diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 855772ca..9d436466 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -414,16 +414,17 @@ pub fn start_page(app: &mut CadApp, ui: &mut egui::Ui) { let heading = |y: f32, text: &str| { p.text(pos2(x, y), egui::Align2::LEFT_TOP, text, crate::theme::small(), t.text_faint); }; - // New drawing: metric or imperial, as AutoCAD's two starting templates (acadiso, acad). The - // one picked is remembered (MEASUREINIT) for a plain New, and is outlined here. + // New drawing: metric (millimetres or centimetres) or imperial, as AutoCAD's two starting + // templates (acadiso, acad). The one picked is remembered (MEASUREINIT, MEASUREINITUNITS) for + // a plain New, and is outlined here. let mut y = left.top() + 128.0; heading(y, crate::tl!("NEW DRAWING")); y += 20.0; - let metric_default = app.session.settings.measureinit; - for (metric, title, sub, cmd) in [(true, "Metric", "Millimeters", "new.metric"), (false, "Imperial", "Inches", "new.imperial")] { + let units_default = default_new_units(app); + for (units, title, sub, cmd) in START_NEW { let br = Rect::from_min_size(pos2(x, y), vec2(232.0, 48.0)); let resp = ui.interact(br, ui.scope_id().with(("start", cmd)), Sense::click()); - let current = metric == metric_default; + let current = units == units_default; if resp.hovered() { p.rect_filled(br, 4.0, t.control_hover.gamma_multiply(0.5)); } @@ -437,7 +438,11 @@ pub fn start_page(app: &mut CadApp, ui: &mut egui::Ui) { p.rect_stroke(br, 4.0, Stroke::new(if current { 1.5 } else { 1.0 }, edge), egui::StrokeKind::Inside); p.text(pos2(br.left() + 16.0, br.top() + 16.0), egui::Align2::LEFT_CENTER, crate::i18n::t(title), crate::theme::body(), t.text); p.text(pos2(br.left() + 16.0, br.top() + 34.0), egui::Align2::LEFT_CENTER, crate::i18n::t(sub), crate::theme::small(), t.text_dim); - let tip = if metric { crate::tl!("A new drawing in millimeters") } else { crate::tl!("A new drawing in inches") }; + let tip = match units { + 4 => crate::tl!("A new drawing in millimeters"), + 5 => crate::tl!("A new drawing in centimeters"), + _ => crate::tl!("A new drawing in inches"), + }; if resp.on_hover_text(tip).clicked() { action = Some(cmd); } @@ -522,24 +527,40 @@ pub fn start_page(app: &mut CadApp, ui: &mut egui::Ui) { } match action { Some("open") => app.start("ui.open"), - Some(cmd @ ("new.metric" | "new.imperial")) => { - if let Err(e) = start_new(app, cmd == "new.metric") { - app.status = Some((e, crate::now_ms())); - } - } Some("sample") => { app.start("ui.sample"); } - _ => {} + Some(cmd) => { + if let Some(&(units, ..)) = START_NEW.iter().find(|n| n.3 == cmd) + && let Err(e) = start_new(app, units) + { + app.status = Some((e, crate::now_ms())); + } + } + None => {} } } -/// The Start page's New: remember metric or imperial for later plain News (MEASUREINIT, as -/// AutoCAD keeps the last template), then open a new drawing in it. -pub(crate) fn start_new(app: &mut CadApp, metric: bool) -> Result<(), String> { +/// The Start page's New buttons: INSUNITS (1 inches, 4 millimetres, 5 centimetres), title, +/// subtitle and the button's id. +const START_NEW: [(i64, &str, &str, &str); 3] = + [(4, "Metric", "Millimeters", "new.metric"), (5, "Metric", "Centimeters", "new.metric.cm"), (1, "Imperial", "Inches", "new.imperial")]; + +/// The INSUNITS a plain New gives (MEASUREINIT, and MEASUREINITUNITS when that is metric). +fn default_new_units(app: &CadApp) -> i64 { + if app.session.settings.measureinit { i64::from(app.session.settings.measureinit_units) } else { 1 } +} + +/// The Start page's New: remember the units for later plain News (MEASUREINIT and +/// MEASUREINITUNITS, as AutoCAD keeps the last template), then open a new drawing in them. +pub(crate) fn start_new(app: &mut CadApp, insunits: i64) -> Result<(), String> { + let metric = insunits != 1; // New first: SETVAR needs a drawing open, and the Start page may have none. - app.run("new", json!({ "metric": metric }))?; + app.run("new", json!({ "units": insunits }))?; app.run("setvar", json!({ "name": "MEASUREINIT", "value": i32::from(metric) }))?; + if metric { + app.run("setvar", json!({ "name": "MEASUREINITUNITS", "value": insunits }))?; + } app.ui.start_tab = false; Ok(()) } @@ -565,12 +586,33 @@ mod tests { // As the desktop app starts: on the Start page, with no drawing open. let mut app = CadApp::new(draftcraft_engine::Session::empty(), crate::Services::default()); app.ui.start_tab = true; - start_new(&mut app, false).unwrap(); + start_new(&mut app, 1).unwrap(); assert_eq!(app.session.doc().unwrap().header.i64("INSUNITS", -1), 1, "imperial is inches"); assert!(!app.session.settings.measureinit); - start_new(&mut app, true).unwrap(); + assert_eq!(default_new_units(&app), 1); + start_new(&mut app, 4).unwrap(); assert_eq!(app.session.doc().unwrap().header.i64("INSUNITS", -1), 4, "metric is millimeters"); assert!(app.session.settings.measureinit, "a later plain New stays metric"); + assert_eq!(default_new_units(&app), 4); + } + + #[test] + fn the_start_page_offers_centimeters_and_a_plain_new_remembers_them() { + // #34: millimeters, centimeters and inches, each outlined when it is what New gives. + assert_eq!(START_NEW.map(|n| n.0), [4, 5, 1]); + let mut app = CadApp::new(draftcraft_engine::Session::empty(), crate::Services::default()); + app.ui.start_tab = true; + start_new(&mut app, 5).unwrap(); + let d = app.session.doc().unwrap(); + assert_eq!((d.header.i64("INSUNITS", -1), d.header.i64("MEASUREMENT", -1)), (5, 1), "centimeters are metric"); + assert_eq!(default_new_units(&app), 5); + app.run("new", json!({})).unwrap(); + assert_eq!(app.session.doc().unwrap().header.i64("INSUNITS", -1), 5, "a plain New stays in centimeters"); + start_new(&mut app, 1).unwrap(); + start_new(&mut app, 4).unwrap(); + assert_eq!(default_new_units(&app), 4, "back to millimeters"); + app.run("new", json!({})).unwrap(); + assert_eq!(app.session.doc().unwrap().header.i64("INSUNITS", -1), 4); } #[test] diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index af289ff5..245ed7e3 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -33,6 +33,8 @@ pub enum Preference { French, #[serde(rename = "zh")] Chinese, + #[serde(rename = "zh-TW")] + TraditionalChinese, #[serde(rename = "it")] Italian, #[serde(rename = "ko")] @@ -52,7 +54,7 @@ pub enum Preference { } impl Preference { - pub const ALL: [Self; 19] = [ + pub const ALL: [Self; 20] = [ Self::Auto, Self::English, Self::Greek, @@ -64,6 +66,7 @@ impl Preference { Self::Russian, Self::French, Self::Chinese, + Self::TraditionalChinese, Self::Italian, Self::Korean, Self::Swedish, @@ -113,6 +116,7 @@ impl Preference { Self::Russian => "ru", Self::French => "fr", Self::Chinese => "zh", + Self::TraditionalChinese => "zh-TW", Self::Italian => "it", Self::Korean => "ko", Self::Swedish => "sv", @@ -137,6 +141,7 @@ impl Preference { Self::Russian => "Русский", Self::French => "Français", Self::Chinese => "简体中文", + Self::TraditionalChinese => "繁體中文", Self::Italian => "Italiano", Self::Korean => { if crate::theme::shows_hangul(CURRENT.with(Cell::get)) { @@ -182,6 +187,7 @@ impl Preference { Self::Russian => "ru", Self::French => "fr", Self::Chinese => "zh", + Self::TraditionalChinese => "zh-TW", Self::Italian => "it", Self::Korean => "ko", Self::Swedish => "sv", @@ -206,7 +212,7 @@ pub struct Language { catalog: OnceLock>, } -pub static LANGUAGES: [Language; 18] = [ +pub static LANGUAGES: [Language; 19] = [ Language { code: "en", name: "English", source: "", plural: plural_en, plural_forms: 2, catalog: OnceLock::new() }, // Greek: one for exactly 1; other for zero and all other integer counts. Language { @@ -237,6 +243,15 @@ pub static LANGUAGES: [Language; 18] = [ // Chinese has no grammatical plural: both `@plural` forms read the same. Its glyphs come from // an installed CJK font (`theme::cjk_font`); without one the interface stays English. Language { code: "zh", name: "简体中文", source: include_str!("i18n/zh.tsv"), plural: plural_en, plural_forms: 2, catalog: OnceLock::new() }, + // Traditional Chinese, as written in Taiwan (#33): the same font needs and plural forms. + Language { + code: "zh-TW", + name: "繁體中文", + source: include_str!("i18n/zh_tw.tsv"), + plural: plural_en, + plural_forms: 2, + catalog: OnceLock::new(), + }, // Italian integer plurals (CLDR `it`) follow the English rule: one (1), other. Language { code: "it", name: "Italiano", source: include_str!("i18n/it.tsv"), plural: plural_en, plural_forms: 2, catalog: OnceLock::new() }, // Korean has one integer plural form and needs a Hangul-capable interface font. @@ -263,9 +278,17 @@ pub static LANGUAGES: [Language; 18] = [ ]; /// BCP 47 and POSIX locale tags, including `uk-UA`, `uk_UA.UTF-8` and `pt_BR.UTF-8`. -/// A catalog is chosen by the tag's primary language, so any `pt-*` tag selects `pt-BR`. +/// A catalog is chosen by the tag's primary language, so any `pt-*` tag selects `pt-BR`; Chinese +/// also by its script or region: Traditional (`zh-TW`) for `Hant`, Taiwan, Hong Kong and Macau, +/// else Simplified (`zh`). pub fn locale_language(tag: &str) -> Option<&'static str> { + // The language, script and region subtags: a POSIX codeset (`.UTF-8`) or modifier (`@…`) ends them. + let subtags = tag.trim().split(['.', '@']).next().unwrap_or_default(); let primary = tag.trim().split(['-', '_', '.', '@']).next()?; + if primary.eq_ignore_ascii_case("zh") { + let has = |names: &[&str]| subtags.split(['-', '_']).skip(1).any(|s| names.iter().any(|n| s.eq_ignore_ascii_case(n))); + return Some(if !has(&["Hans"]) && has(&["Hant", "TW", "HK", "MO"]) { "zh-TW" } else { "zh" }); + } LANGUAGES.iter().find(|l| l.code.split('-').next().is_some_and(|p| p.eq_ignore_ascii_case(primary))).map(|l| l.code) } diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 6e6bcfb9..fcfc0bd2 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -1684,3 +1684,8 @@ menu Workspaces Aree di lavoro A new drawing in millimeters Un nuovo disegno in millimetri A new drawing in inches Un nuovo disegno in pollici Unitless Senza unità + Centimeters Centimetri + A new drawing in centimeters Un nuovo disegno in centimetri + Imperial (inches) Imperiale (pollici) + Metric (millimetres) Metrico (millimetri) + Metric (centimetres) Metrico (centimetri) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 42302818..c67ec045 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -202,7 +202,8 @@ fn assert_additional_locale_aliases() { ("bs", &["bs", "bs-BA", "bs_BA.UTF-8", "BS-ba", " bs-BA ", "bs-Latn-BA"]), ("vi", &["vi", "vi-VN", "vi_VN.UTF-8", "VI-vn", " vi-VN "]), ("el", &["el", "el-GR", "el_GR.UTF-8", "EL-cy"]), - ("zh", &["zh", "zh-CN"]), + ("zh", &["zh", "zh-CN", "zh_CN.UTF-8", "zh-SG", "zh-Hans", "zh-Hans-CN", "zh-Hans-HK", "zh_CN@pinyin"]), + ("zh-TW", &["zh-TW", "zh_TW.UTF-8", "ZH-tw", " zh-TW ", "zh-HK", "zh_HK.UTF-8", "zh-MO", "zh-Hant", "zh-Hant-TW", "zh-Hant-HK"]), ] { for tag in tags { assert_eq!(locale_language(tag), Some(code), "{tag}"); @@ -481,7 +482,7 @@ fn dialogs_render_in_every_language_and_keep_their_source_ids() { #[test] fn interface_fonts_cover_every_letter_in_each_catalog() { for language in translated() { - let extra_font = ["ko", "zh", "ar", "vi"].contains(&language.code); + let extra_font = ["ko", "zh", "zh-TW", "ar", "vi"].contains(&language.code); if extra_font && !crate::theme::can_show(language.code) { continue; } @@ -609,6 +610,32 @@ fn chinese_menus_and_commands_are_fully_translated() { assert_eq!(missing_commands_menus_tools_and_snap_labels("zh"), Vec::::new()); } +/// #33: Traditional Chinese (Taiwan) is its own interface language, with every menu and command +/// translated, in Traditional characters, chosen by Taiwan, Hong Kong and Macau locales. +#[test] +fn traditional_chinese_is_complete_and_written_in_traditional_characters() { + assert_eq!(missing_commands_menus_tools_and_snap_labels("zh-TW"), Vec::::new()); + assert!(missing_marked_ui_literals("zh-TW").len() <= missing_marked_ui_literals("zh").len()); + assert_eq!(tr("zh-TW", "Layer"), "圖層"); + assert_eq!(tr("zh-TW", "Object Snap"), "物件鎖點"); + assert_eq!(tr("zh-TW", "Centimeters"), "公分"); + // Not one Simplified-only character among the most common ones. + let catalog: String = LANGUAGES.iter().find(|l| l.code == "zh-TW").map(|l| l.source).unwrap_or_default().into(); + let simplified = "与个为么义于们会传体关内写决几击则创删别务动区单历参双发变号后图圆块处备复头对导将层带应开强当录态总扩换数断无时显机来极构标样检点电画确离积称类线组经结绘统续编缩网联节范获装见观规视览计认记设识试该语误请读调资转软载输边达过运还这进连选释长闭问间页项须预题颜"; + let found: Vec = catalog + .lines() + .filter(|l| !l.starts_with('#')) + .flat_map(|l| l.split('\t').nth(2).unwrap_or_default().chars()) + .filter(|c| simplified.contains(*c)) + .collect(); + assert!(found.is_empty(), "Simplified characters in zh_tw.tsv: {found:?}"); + let mut app = CadApp::new(Session::new(), Services::default()); + let r = app.run("ui.language", json!({"lang": "zh-TW"})).unwrap(); + assert_eq!(r["interfaceLanguage"], "zh-TW"); + assert_eq!(app.language(), if crate::theme::can_show("zh-TW") { "zh-TW" } else { "en" }); + assert_eq!(Preference::TraditionalChinese.native_name(), "繁體中文"); +} + /// Bosnian counts: 1, 21 `one`; 2–4, 22–24 (not 12–14) `few`; everything else `other`. #[test] fn bosnian_counts_take_one_few_other() { diff --git a/crates/ui-egui/src/i18n/zh.tsv b/crates/ui-egui/src/i18n/zh.tsv index c246ec0b..ffa4d9e7 100644 --- a/crates/ui-egui/src/i18n/zh.tsv +++ b/crates/ui-egui/src/i18n/zh.tsv @@ -1644,3 +1644,9 @@ menu CAD Standards CAD 标准 Total Area and Length 总面积和长度 Total Area 总面积 Specify point to place the totals as text 指定将合计放置为文字的点 + A new drawing in centimeters 以厘米为单位的新图形 + Metric (centimetres) 公制(厘米) + Metric 公制 + Imperial 英制 + A new drawing in millimeters 以毫米为单位的新图形 + A new drawing in inches 以英寸为单位的新图形 diff --git a/crates/ui-egui/src/i18n/zh_tw.tsv b/crates/ui-egui/src/i18n/zh_tw.tsv new file mode 100644 index 00000000..5829103b --- /dev/null +++ b/crates/ui-egui/src/i18n/zh_tw.tsv @@ -0,0 +1,1649 @@ +# DraftCraft Traditional Chinese (Taiwan) interface catalog — original translations. +# License: MIT OR Apache-2.0 (the repository LICENSE-MIT and LICENSE-APACHE). +# Written from DraftCraft's Simplified Chinese catalog (zh.tsv) in Traditional characters, with +# the terms used in Taiwan; no proprietary translations were copied. +# UTF-8: contextEnglish sourceTraditional Chinese translation. +# Empty context = ordinary label; @plural = one|other forms with {n}. + Cancel 取消 + OK 確定 + or [ 或 [ + % of all commits % 的所有提交 + * Wildcard Match * 通配符匹配 + *VARIES* *多值* + + | Top | 2D Wireframe + | 俯視 | 二維線框 + +Bin +Bin + +LOC +LOC + 1 Viewport 1 個視埠 + 2 Points 2 點 + 2 Viewports 2 個視埠 + 2D Solid 二維實體 + 3 Points 3 點 + 3 Viewports 3 個視埠 + 3D Face 三維面 + 3D Operations 三維操作 + 3D Polyline 三維聚合線 + 4 Viewports 4 個視埠 + < Less than < 小於 + <> Not Equal <> 不等於 + = Equals = 等於 + > Greater than > 大於 + About 關於 + About DraftCraft 關於 DraftCraft + Absolute 絕對 + Add Leader 新增引線 + Align 對齊 + Align Text 對齊文字 + Aligned 對齊 + All 全部 + All Used Layers 所有已使用的圖層 + All files 所有檔案 + Angle 角度 + Angular 角度 + Annotation Visibility 註解可見性 + Annotation scale 註解比例 + Apparent Intersection 外觀交點 + Append to current selection set 新增到目前選集 + Apply to: 應用於: + Apply true color 應用真彩色 + Arc 圓弧 + Arc Length 弧長 + Area 面積 + Arrange Panel 排列面板 + Array 陣列 + Attach 貼附 + Attribute 屬性 + Attribute Definition 屬性定義 + Attribute Display 屬性顯示 + Audit 檢查 + Auto (system language) 自動(系統語言) + Auto Constrain 自動約束 + AutoConstrain 自動約束 + Axis, End 軸端點 + Base 基準 + Baseline 基線 + Batch Publish 批量發佈 + Binary assets added 已新增二進位資產 + Binary assets removed 已移除二進位資產 + Blend 過渡 + Block 圖塊 + Block Attribute Manager... 圖塊屬性管理器... + Block Description... 圖塊描述... + Block Editor 圖塊編輯器 + Block Reference 圖塊參考 + Block... 圖塊... + Blocks 圖塊 + Blue 藍色 + Bold 粗體 + Boolean 布爾運算 + Boundary 邊界 + Boundary... 邊界... + Box 長方體 + Break 打斷 + Break At Point 於點打斷 + Bring to Front 置於頂層 + ByBlock ByBlock + ByColor ByColor + ByLayer ByLayer + DraftCraft Help DraftCraft 說明 + Cancel 取消 + Cartesian (x, y) 笛卡爾座標 (x, y) + Center 中心 + Center Line 中心線 + Center Mark 中心標記 + Center X 中心 X + Center Y 中心 Y + Center Z 中心 Z + Center, Diameter 中心點、直徑 + Center, Radius 中心點、半徑 + Center, Start, Angle 中心點、起點、角度 + Center, Start, End 中心點、起點、端點 + Center, Start, Length 中心點、起點、長度 + Chamfer 倒角 + Change Space 修改空間 + Change to Current Layer 改至目前圖層 + Circle 圓 + Circumference 圓周 + Clear 清除 + Clipboard 剪貼板 + Close 關閉 + Minimize 最小化 + Maximize 最大化 + Restore Down 向下還原 + Close All 全部關閉 + Closed 已關閉 + Coincident 重合 + Collapse Palettes 折疊選項板 + Collapse Tool Sets 折疊工具集 + Collinear 共線 + Color 顏色 + Color 8 顏色 8 + Color 9 顏色 9 + Color Index 顏色索引 + Color... 顏色... + Command History 指令行歷史 + Command Line 指令行 + Command Line History Lines 指令行歷史行數 + Command Reference 指令參考 + Commits 提交 + Company 公司 + Computer-aided design and drafting: an open-source, clean-room CAD application written in pure Rust. 計算機輔助設計與繪圖:一個用純 Rust 編寫的開源、自主實現的 CAD 應用程式。 + Concentric 同心 + Cone 圓錐體 + Constraint Bars 約束欄 + Constraint Settings 約束設定 + Construction Line 建構線 + Contents 內容 + Continue 繼續 + Contributors 貢獻者 + Control Vertices 控制點 + Copy 複製 + Copy Layout 複製配置 + Copy Nested Objects 複製嵌套物件 + Copy Selection 複製所選物件 + Copy with Base Point 帶基點複製 + Count 計數 + Create Block 建立圖塊 + Creates a user parameter 建立一個使用者參數 + Ctrl+Enter to finish Ctrl+Enter 完成 + Current layer 目前圖層 + Current selection 目前選擇 + Current: {color} 目前: {color} + Cut 剪下 + Cut with Base Point 帶基點剪下 + Cyan 青色 + Cylinder 圓柱體 + DView 動態視圖 + DWG DWG + DXF DXF + Dark 深色 + Default 預設 + Default Save Format 預設儲存格式 + Define Attributes 定義屬性 + Define Attributes... 定義屬性... + Defined width 指定寬度 + Degree 度 + Delete 刪除 + Delete Column 刪除列 + Delete Constraints 刪除約束 + Delete Dimension Style 刪除標註型式 + Delete Duplicate Objects 刪除重複物件 + Delete Layer 刪除圖層 + Delete Layer State 刪除圖層狀態 + Delete Layout 刪除配置 + Delete Row 刪除行 + Delete Text Style 刪除文字型式 + Delta X 增量 X + Delta Y 增量 Y + Description 描述 + Deselect All 取消全選 + Diameter 直徑 + Dim style 標註型式 + Dimension 標註 + Dimension Space 標註間距 + Dimension Style Override 標註型式替代 + Dimension Style... 標註型式... + Dimension Text Edit 編輯標註文字 + Dimension style 標註型式 + Dimensional Constraint 尺寸約束 + Dimensional Constraint Parameters 尺寸約束參數 + Dimensional Constraints 尺寸約束 + Disassociate Dimensions 取消標註關聯 + Display name 顯示名稱 + Distance 距離 + Divide 定數等分 + Do not plot (click: plot) 不列印(按一下:列印) + Donut 圓環 + Double-click to edit the description 按兩下編輯描述 + Down 向下 + Drafting 繪圖 + Drafting Settings 草圖設定 + Drafting Settings... 草圖設定... + Draw 繪圖 + Draw Order 繪圖次序 + Drawing (DWG) 圖形 (DWG) + Drawing (DXF) 圖形 (DXF) + Drawing Limits 圖形界限 + Drawing Utilities 圖形實用工具 + Drawings (DWG, DXF) 圖形 (DWG, DXF) + Dynamic Dimensions 動態標註 + Dynamic Input 動態輸入 + Dynamic Input (F12) 動態輸入 (F12) + E E + Edit 編輯 + Edit Text... 編輯文字... + Elevation 標高 + Ellipse 橢圓 + Elliptical Arc 橢圓弧 + Enable Dynamic Input (F12) 啟用動態輸入 (F12) + End Width 端點寬度 + End X 終點 X + End Y 終點 Y + End angle 端點角度 + Endpoint 端點 + Enter Top, Zero or Bottom. 輸入 Top、Zero 或 Bottom。 + Enter a fit data option 輸入擬合資料選項 + Enter a pattern name 輸入圖案名稱 + Enter a vertex editing option 輸入頂點編輯選項 + Enter an option 輸入選項 + Enter angle of xline 輸入建構線角度 + Enter angle of xline (0) 輸入建構線角度 (0) + Enter area of rectangle in current units 在目前單位中輸入矩形面積 + Enter attribute prompt 輸入屬性提示 + Enter attribute tag name 輸入屬性標記名稱 + Enter attribute value 輸入屬性值 + Enter block name 輸入圖塊名 + Enter constraint type 輸入約束類型 + Enter continuity 輸入連續性 + Enter default attribute value 輸入預設屬性值 + Enter degree of spline 輸入雲形線次數 + Enter delta angle 輸入增量角度 + Enter delta length 輸入增量長度 + Enter dimension text 輸入標註文字 + Enter dimension text (<> = measurement) 輸入標註文字 (<> = 測量值) + Enter dimension value or [name=expression] 輸入標註值或 [名稱=運算式] + Enter dimension variable name to override 輸入要替代的標註變數名 + Enter justification type 輸入對齊類型 + Enter leader text 輸入引線文字 + Enter mline scale 輸入多線比例 + Enter mode 輸入模式 + Enter name of block to insert 輸入要插入的圖塊名 + Enter new text 輸入新文字 + Enter next point 指定下一點 + Enter number of columns 輸入列數 + Enter number of data rows 輸入資料行數 + Enter number of items 輸入項目數 + Enter number of items along path 輸入路徑上的項目數 + Enter number of sides 輸入邊數 + Enter number of turns 輸入圈數 + Enter percentage length 輸入百分比長度 + Enter rectangle length 輸入矩形長度 + Enter rectangle width 輸入矩形寬度 + Enter scale factor 輸入比例因子 + Enter text 輸入文字 + Enter text (use \P for new paragraphs) 輸入文字(使用 \P 建立新段落) + Enter the number of segments 輸入段數 + Enter twist direction of helix 輸入螺旋的扭曲方向 + Entire drawing 整個圖形 + Equal 相等 + Erase 擦除 + Exclude from new selection set 從新選集中排除 + Explode 分解 + Export 匯出 + Export to PDF... 匯出為 PDF... + Expression 運算式 + Extend 延伸 + Extension 延伸線 + Extents 範圍 + Extrude 拉伸 + File 檔案 + File Tab 檔案頁籤 + Fillet 圓角 + Filter 篩選器 + Filters 篩選器 + Find and Replace 尋找和取代 + Find... 尋找... + First 第一 + First commit 首次提交 + Fit Points 擬合點 + Fix 固定 + Flatten Objects 展平物件 + Format 格式 + Freehand 徒手畫 + Freeze 凍結 + Freeze Layer 凍結圖層 + Freeze in new viewports 在新視埠中凍結 + Freeze/Thaw 凍結/解凍 + Freeze/Thaw in all viewports 在所有視埠中凍結/解凍 + Freeze/Thaw in the current viewport 在目前視埠中凍結/解凍 + From 自 + General 常規 + Geometric Center 幾何中心 + Geometric Constraint 幾何約束 + Geometric Constraints 幾何約束 + Geometry 幾何圖形 + Get Variable 獲取變數 + Get View 獲取視圖 + Global 全域 + Global width 全域寬度 + Grab bag 雜項 + Gradient 漸層色 + Gradient... 漸層色... + Green 綠色 + Grid (F7) 格線 (F7) + Grid Display 格線顯示 + Grid On (F7) 開啟格線 (F7) + Grid spacing 格線間距 + Grip Mirror 掣點鏡像 + Grip Rotate 掣點旋轉 + Grip Scale 掣點縮放 + Grip Stretch 掣點拉伸 + Group 編組 + Group Edit 編組編輯 + Hatch 填充線 + Hatch Edit 編輯填充線 + Hatch... 填充線... + Height 高度 + Height: {height} 高度: {height} + Helix 螺旋 + Help 說明 + Hide All 全部隱藏 + Hide All Constraint Bars 隱藏所有約束欄 + Hide All Dynamic Dimensions 隱藏所有動態標註 + Hide Layer List 隱藏圖層清單 + Hide Palettes 隱藏選項板 + Home 主頁 + Horizontal 水平 + HorizontalDistance 水平距離 + How to apply: 應用方式: + ID Point 點座標 + Import 匯入 + In 放大 + In-window Menu Bar 視窗內選單欄 + Include in new selection set 包含在新選集中 + Increment angle 增量角度 + Index Color 索引顏色 + Index color: {index} 索引顏色: {index} + Inquiry 查詢 + Insert 插入 + Insert Block 插入圖塊 + Insert Column 插入列 + Insert Row 插入行 + Insert this block 插入此圖塊 + Insertion 插入 + Insertion X 插入 X + Insertion Y 插入 Y + Insertion Z 插入 Z + Inspect Constraints 檢查約束 + Inspect Drawing 檢查圖形 + Interface Language 介面語言 + Interface Theme 介面主題 + Intersect 相交 + Intersection 交點 + Isolate 隔離 + Isolate Layer 隔離圖層 + Isometric Drafting 等軸測製圖 + Join 合併 + Language 語言 + Last 最後 + Last commit 最後提交 + Layer 圖層 + Layer Delete 刪除圖層 + Layer Match 匹配圖層 + Layer Merge 合併圖層 + Layer Off 關閉圖層 + Layer Properties 圖層性質 + Layer Properties Manager 圖層性質管理器 + Layer Properties Manager — current viewport 圖層性質管理器 — 目前視埠 + Layer State 圖層狀態 + Layer States Manager... 圖層狀態管理器... + Layer Tools 圖層工具 + Layer contains objects (double-click to make current) 圖層包含物件(按兩下將其置為目前) + Layer is empty (double-click to make current) 圖層為空(按兩下將其置為目前) + Layers 圖層 + Layers Palette 圖層選項板 + Layers displayed: {shown} of {total}. Current layer: {layer} 顯示的圖層: {shown} / {total}。目前圖層: {layer} + Layout 配置 + Layout list 配置清單 + Leader 引線 + Left 左 + Length 長度 + Length X 長度 X + Length Y 長度 Y + Lengthen 拉長 + Light 淺色 + Line 直線 + Line delta 直線增量 + Linear 線性 + Lines +/− 直線 +/− + Lines added 新增的行數 + Lines deleted 刪除的行數 + Linetype 線型 + Linetype Scale 線型比例 + Linetype scale 線型比例 + Ltscale Ltscale + Linetype... 線型... + Lineweight 線寬 + Lineweight... 線寬... + List 清單 + List Blocks 列出圖塊 + List Dimension Styles 列出標註型式 + List Groups 列出編組 + List Layer States 列出圖層狀態 + List Layouts 列出配置 + List System Variables 列出系統變數 + List Text Styles 列出文字型式 + Load all 全部載入 + Load... 載入... + Loaded linetypes 已載入的線型 + Lock 鎖定 + Lock Layer 鎖定圖層 + Lock/Unlock 鎖定/解鎖 + Loft 放樣 + MIT OR Apache-2.0. Not affiliated with Autodesk, Inc. MIT 或 Apache-2.0。與 Autodesk, Inc. 無關。 + DraftCraft and the DraftCraft logo are trademarks of DraftCraft Engineering Ventures. DraftCraft 和 DraftCraft 標誌是 DraftCraft Engineering Ventures 的商標。 + MODEL 模型 + MText 多行文字 + Magenta 品紅 + Major line every 主網格線間隔 + Make Current 置為目前 + Make Object's Layer Current 將物件的圖層置為目前 + Make... 製作... + Match Layer 匹配圖層 + Match Properties 性質匹配 + Measure 度量 + Measure Distance 測量距離 + Measure Geometry 測量幾何圖形 + Merge Cells 合併儲存格 + Merged PRs 已合併的 PR + Mid Between 2 Points 兩點之間的中點 + Midpoint 中點 + Mirror 鏡像 + Model 模型 + Model Space (in viewport) 模型空間(在視埠中) + Modeling 建模 + Models 模型 + Modify 修改 + Move 移動 + Multileader 多重引線 + Multileader Style... 多重引線型式... + Multileader style 多重引線型式 + Multiline 多線 + Multiline Text 多行文字 + Multiline Text... 多行文字... + Multiple 多個 + Multiple Insert 多重插入 + Multiple Point 多點 + My 我的 + My properties: not available yet 我的屬性:暫不可用 + N N + Name 名稱 + Name (A–Z) 名稱 (A–Z) + Nearest 最近點 + New 新建 + New (metric) 新建(公制) + New Drawing 新圖形 + New Drawing (⌘N) 新圖形 (⌘N) + New Drawing... 新建圖形... + New Layer 新圖層 + New Layout 新配置 + New VP Freeze 新視埠凍結 + New Viewports... 新視埠... + New layout 新配置 + New state name 新狀態名稱 + No 否 + No blocks defined in this drawing. 此圖形中未定義圖塊。 + No contributor data was built into this copy. 此副本中未內置貢獻者資料。 + No model credits were built into this copy. 此副本中未內置模型鳴謝資料。 + No saved layer states 沒有儲存的圖層狀態 + No selection 未選擇 + Node 節點 + None 無 + Not available 不可用 + Not available yet 暫不可用 + OK 確定 + Object 物件 + Object Snap 物件鎖點 + Object Snap (F3) 物件鎖點 (F3) + Object Snap On (F3) 開啟物件鎖點 (F3) + Object Snap Tracking 物件鎖點追蹤 + Object Snap Tracking (F11) 物件鎖點追蹤 (F11) + Object type: 物件類型: + Off 關閉 + Offset 偏移 + On 開啟 + On/Off 開/關 + Oops 恢復已擦除物件 + Open (⌘O) 開啟 (⌘O) + Open Sample Drawing 開啟範例圖形 + Open sample drawing 開啟範例圖形 + Open... 開啟... + Operator: 運算符: + Orbit 三維動態觀察 + Ordinate 座標標註 + Ortho (F8) 正交 (F8) + Ortho Mode 正交模式 + Ortho Mode (F8) 正交模式 (F8) + Osnap Settings... 鎖點設定... + Out 縮小 + Override 替代 + PAPER 圖紙 + Percent 百分比 + Polar (distance < angle) 極座標 (距離 < 角度) + PRs PR + Page Setup Manager 頁面設定管理器 + Page Setup Manager... 頁面設定管理器... + Pan 平移 + Pan Down 向下平移 + Pan Left 向左平移 + Pan Right 向右平移 + Pan Up 向上平移 + Paper Space 圖紙空間 + Parallel 平行 + Parameters Manager 參數管理器 + Parametric 參數化 + Paste 貼上 + Paste as Block 貼上為圖塊 + Paste to Original Coordinates 貼上到原座標 + Path Array 路徑陣列 + Pattern 圖案 + Perpendicular 垂直 + Plot 列印 + Plot (click: do not plot) 列印(按一下:不列印) + Plot Preview 列印預覽 + Plot style 列印型式 + Plot style attached to 附加到...的列印型式 + Plot style table 列印型式表 + Plot Style... 列印型式... + Plot Style Manager 列印型式管理器 + Plot Style Manager... 列印型式管理器... + Plot Styles... 列印型式... + New CTB 新 CTB + New STB 新 STB + New style 新型式 + Reset Panel Layout 重設面板版面 + Use for this layout 用於此配置 + Display plot styles 顯示列印型式 + No plot style tables. 沒有列印型式表。 + A built-in table: editing it keeps an edited copy in the drawing. 內置表:對其進行編輯會在圖形中保留一個編輯過的副本。 + Keep an editable copy of this table in the drawing 在此圖形中保留此表的編輯副本 + Layout {name}: {table} 配置 {name}: {table} + Grayscale 灰度 + Screening 網目調 + Use object linetype 使用物件線型 + Use object lineweight 使用物件線寬 + Remove 移除 + Add 新增 + Open a drawing first. 請先開啟一個圖形。 + Plot table type 列印型式表類型 + Color-dependent 顏色相關 + Named 命名 + Plus/minus 正/負 + Point 點 + Point Filters 點過濾器 + Point Style... 點型式... + Polar Array 環形陣列 + Polar Tracking 極座標追蹤 + Polar Tracking (F10) 極座標追蹤 (F10) + Polar Tracking On (F10) 開啟極座標追蹤 (F10) + Polar: {distance} < {angle}° 極座標: {distance} < {angle}° + Polygon 多邊形 + Polygonal 多邊形 + Polyline 聚合線 + Position X 位置 X + Position Y 位置 Y + Position Z 位置 Z + Previous 上一個 + Previous Layer 上一圖層 + Primitives 圖元 + Print 列印 + Print... 列印... + Properties 性質 + Properties Inspector 性質檢視器 + Properties: 性質: + Proxy 代理 + Purge 清理 + Pyramid 稜錐體 + Quadrant 四分點 + Query Entities 查詢實體 + Quick 快速 + Quick Dimension 快速標註 + Quick Properties 快速性質 + Quick Select 快速選擇 + Quick Select Properties 快速選擇性質 + Quick Select... 快速選擇... + QuickCalc 快速計算機 + Quit DraftCraft 退出 DraftCraft + Radius 半徑 + Raster Image 點陣影像 + Raster Image Reference... 點陣影像參考... + Raster Images 點陣影像 + Ray 射線 + Read-only 唯讀 + Real name 真實姓名 + Realtime 即時 + Reassociate Dimensions 重新關聯標註 + Recent 最近 + Recover... 修復... + Rectangle 矩形 + Rectangular 矩形 + Rectangular Array 矩形陣列 + Red 紅色 + Redo 重做 + Redo (⇧⌘Z) 重做 (⇧⌘Z) + Redraw 重繪 + Regen 重生成 + Regen All 全部重生成 + Region 面域 + Region/Mass Properties 面域/品質性質 + Relative 相對 + Remove Leader 刪除引線 + Remove the viewport override 移除視埠替代 + Rename Dimension Style 重新命名標註型式 + Rename Layer 重新命名圖層 + Rename Layer State 重新命名圖層狀態 + Rename Layout 重新命名配置 + Rename Text Style 重新命名文字型式 + Rename... 重新命名... + Repeat {command} 重複 {command} + Replace Block... 取代圖塊... + Requires a point (x,y, @dx,dy or @d 指定第二點或 <使用第一點作為位移> + Specify second source point 指定第二個源點 + Specify side to offset 指定偏移側 + Specify start angle 指定起始角度 + Specify start point 指定起點 + Specify start point of arc 指定圓弧起點 + Specify start point of polyline 指定聚合線起點 + Specify start point of text 指定文字起點 + Specify starting width 指定起端寬度 + Specify starting width for next segment 指定下一段的起端寬度 + Specify tangent direction for the start point of arc 指定圓弧起點的切線方向 + Specify the elevation for rectangles 指定矩形標高 + Specify thickness for rectangles 指定矩形厚度 + Specify third point on circle 指定圓上的第三點 + Specify third point on circle: _tan to 指定圓上的第三點: _tan 到 + Specify third source point or 指定第三個源點或 <繼續> + Specify through point 指定通過點 + Specify top diameter 指定頂面直徑 + Specify top radius Specify top radius + Specify total angle 指定總角度 + Specify total length Specify total length + Specify width for rectangles 指定矩形寬度 + Sphere 球體 + Spline 雲形線 + Conic 圓錐曲線 + Spline Fit 雲形線擬合 + Spline CV 雲形線控制點 + Specify start point of conic 指定圓錐曲線的起點 + Specify apex (where the end tangents meet) 指定頂點(兩端切線的交點) + Specify end point of conic 指定圓錐曲線的端點 + Specify rho or a point on the conic 指定 rho 值或圓錐曲線上的點 + Stack (type 1/2 then select) 堆疊(輸入 1/2 然後選擇) + Standard 標準 + Start 起點 + Start Width 起點寬度 + Start X 起點 X + Start Y 起點 Y + Start angle 起點角度 + Start, Center, Angle 起點、中心點、角度 + Start, Center, End 起點、中心點、端點 + Start, Center, Length 起點、中心點、長度 + Start, End, Angle 起點、端點、角度 + Start, End, Direction 起點、端點、方向 + Start, End, Radius 起點、端點、半徑 + Status 狀態 + Status Bar 狀態列 + Stretch 拉伸 + Style: Standard 型式: Standard + Subtract 差集 + Sweep 掃掠 + Switch Drawing 切換圖形 + Switch Layout 切換配置 + Switch between model space in a viewport and paper space 在視埠中的模型空間與圖紙空間之間切換 + Symmetric 對稱 + Synchronize Attributes 同步屬性 + Toggle PICKADD (off: each pick replaces the selection) 切換 PICKADD(關閉:每次按一下取代目前選擇) + Toggle PICKADD (on: picks add to the selection) 切換 PICKADD(開啟:按一下會新增到選集) + TOP 俯視 + Table 表格 + Table Style... 表格型式... + Table style 表格型式 + Table... 表格... + Tan, Tan, Radius 相切、相切、半徑 + Tan, Tan, Tan 相切、相切、相切 + Tangent 相切 + Text 文字 + Text Editor 文字編輯器 + Text Height 文字高度 + Text Style... 文字型式... + Text height 文字高度 + Text override 文字替代 + Text style 文字型式 + Thaw All Layers 解凍所有圖層 + There is nothing here yet. 這裡什麼也沒有。 + Thickness 厚度 + Time 時間 + To get started, create or open a drawing. 若要開始,請建立或開啟一個圖形。 + Tool Bar 工具列 + Tool Sets 工具集 + Tools 工具 + Torus 圓環體 + Trace 追蹤 + Transparency 透明度 + Trim 修剪 + True Color 真彩色 + Turn All Layers On 開啟所有圖層 + Turn Off Layer 關閉圖層 + Turn Quick Properties off (QPMODE) 關閉快速性質 (QPMODE) + Type 類型 + Type a command 輸入指令 + Type text; Enter starts a new paragraph 輸入文字;Enter 鍵開始新段落 + UCS Icon UCS 圖示 + Undo 放棄 + Undo (⌘Z) 放棄 (⌘Z) + Ungroup 取消編組 + Union 聯集 + Unisolate Layer 取消圖層隔離 + Units... 單位... + Unlock Layer 解鎖圖層 + Unmerge Cells 取消合併儲存格 + Unsaved Layer State 未儲存的圖層狀態 + Up 向上 + Update 更新 + Use System Setting 使用系統設定 + User 使用者 + User Parameters 使用者參數 + Username 使用者名 + VP Color 視埠顏色 + VP Freeze 視埠凍結 + Value 值 + Value: 值: + Version 版本 + Version {version} 版本 {version} + Vertical 垂直 + VerticalDistance 垂直距離 + View 視圖 + ViewCube 視圖立方 + Viewport 視埠 + Viewport Layer Freeze 視埠圖層凍結 + Viewport Properties 視埠性質 + Viewport {id} 視埠 {id} + Viewports 視埠 + W W + WCS WCS + White 白色 + Width factor 寬度因子 + Window 視窗 + Wipeout 區域覆蓋 + Workspace Switching 工作空間切換 + Write Block 寫圖塊 + Xline 建構線 + Yellow 黃色 + Yes 是 + Zoom 縮放 + Zoom All 全部縮放 + Zoom Extents 範圍縮放 + Zoom In 放大 + Zoom Object 物件縮放 + Zoom Out 縮小 + Zoom Previous 上一個縮放 + Zoom Window 視窗縮放 + error 錯誤 + {contributors} · {commits} {contributors} · {commits} + {kind} (constraint {id}) {kind} (約束 {id}) + {kind} constraint {name} = {expression} (double-click to edit) {kind} 約束 {name} = {expression} (按兩下編輯) + {name}: {distance} < {angle}° {name}: {distance} < {angle}° + ƒx New User Parameter ƒx 新建使用者參數 + ΔLOC ΔLOC + −Bin −Bin + −LOC −LOC + ⌘↩ to finish ⌘↩ 完成 +@plural {n} commit {n} 次提交|{n} 次提交 +@plural {n} contributor {n} 位貢獻者|{n} 位貢獻者 + Drawing as bytes 位元組形式的圖形 + Services 服務 + Hide DraftCraft 隱藏 DraftCraft + Hide Others 隱藏其他人 + Accessibility 輔助功能 + Show System Cursor 顯示系統游標 + Animation Effects 動畫效果 + Animation effects 動畫效果 + 3D Mouse... 3D 滑鼠... + 3D Mouse 3D 滑鼠 + Calibrate 3D Mouse 校準 3D 滑鼠 + 3D Mouse Navigation 3D 滑鼠導航 + 3D mouse input is unavailable on this platform 此平台不可用 3D 滑鼠輸入 + No supported 3D mouse found 未找到支援的 3D 滑鼠 + Release the 3D mouse to calibrate its resting position 釋放 3D 滑鼠以校準其靜止位置 + 3D mouse connected 3D 滑鼠已連接 + 3D mouse busy, possibly 3DxWare or missing device permissions 3D 滑鼠忙,可能是因為 3DxWare 或缺少設備權限 + 3D mouse disconnected 3D 滑鼠已斷開連接 + 3D mouse input could not be started 無法啟動 3D 滑鼠輸入 + Enable 3D mouse navigation 啟用 3D 滑鼠導航 + Pan sensitivity 平移靈敏度 + Zoom sensitivity 縮放靈敏度 + Reverse zoom direction 反轉縮放方向 + Calibrate 校準 + Move sideways to pan; push/pull or twist to zoom. 向側面移動以平移;推拉或扭轉以縮放。 + Left device button: zoom extents. Right device button: calibrate. 左側設備按鈕:範圍縮放。右側設備按鈕:校準。 + Not a number or distance: {text} 不是數字或距離:{text} + Plotter Manager... 繪圖機管理器... + Import... 匯入... + Export... 匯出... + Batch Publish... 批量發佈... + New from Template... 根據樣板新建... + Show Annotative Objects 顯示可註解物件 + Current Scale Only 僅目前比例 + All Scales 所有比例 + Dynamic 動態 + DWG Reference... DWG 參考... + Data Link... 資料連結... + Multiline Style... 多線型式... + Scale List... 比例清單... + Run Script... 執行指令碼... + Data Extraction... 資料提取... + Open Xref 開啟外部參考 + Compare Drawings... 比較圖形... + Isolate Objects 隔離物件 + Hide Objects 隱藏物件 + End Object Isolation 結束物件隔離 + Options... 選項... + Bring Above Objects 置於物件之上 + Send Under Objects 置於物件之下 + Bring Annotations to Front 將註解置於頂層 + Send Hatches to Back 將填充置於底層 + Text Objects Only 僅文字物件 + Dimension Objects Only 僅標註物件 + Leaders Only 僅引線 + All Annotation Objects 所有註解物件 + Oblique 傾斜 + Jogged 折彎 + Jogged Linear 折彎線性 + Dimension Break 標註打斷 + Inspection 檢查 + Tolerance... 公差... + Annotative Object Scale 可註解物件比例 + Add/Delete Scales... 新增/刪除比例... + Add Current Scale 新增目前比例 + Delete Current Scale 刪除目前比例 + Synchronize Multiple-scale Positions 同步多比例位置 + Clip 剪裁 + Solid Editing 實體編輯 + Multiline... 多線... + External Reference 外部參考 + Bind... 綁定... + Reference Manager 參考管理器 + Options 選項 + Display 顯示 + Open and Save 開啟和儲存 + Selection 選擇 + User Preferences 使用者偏好 + Profiles 配置檔案 + Interface theme 介面主題 + Model background 模型背景 + Layout paper 配置圖紙 + Crosshair size 十字游標大小 + Command line history 指令行歷史 + Keep the system cursor visible over the drawing area 在繪圖區域保持系統游標可見 + Screen magnifiers, screen readers and recorders follow the system cursor. 螢幕放大鏡、螢幕閱讀器和錄製軟體將跟隨系統游標。 + Changes apply at once and are kept for next time. 更改立即生效並將為下次保留。 + Save new drawings as 將新圖形儲存為 + Default save version 預設儲存版本 + Automatic save every 自動儲存間隔 + Automatic save file location 自動儲存檔案位置 + A drawing opened from a file keeps that file's format. 從檔案開啟的圖形會保持該檔案的格式。 + Drawings with no file yet are saved in the default version. 0 minutes turns automatic save off. 尚無檔案的圖形將以預設版本儲存。設為 0 分鐘則關閉自動儲存。 + Object snap marker size 物件鎖點標記大小 + Object snap aperture 物件鎖點靶框大小 + The aperture is how near the cursor must come to a point for an object snap to find it. 靶框決定了游標必須離物件鎖點點多近才能被識別。 + Snap, grid, polar tracking and Dynamic Input: 鎖點、格線、極座標追蹤和動態輸入: + Pickbox size 拾取框大小 + Grip size 掣點大小 + Select objects first, then choose a command 先選擇物件,然後選擇指令 + Hold Shift to add to the selection 按住 Shift 鍵新增到選擇 + Show Quick Properties for selected objects 顯示所選物件的快速性質 + Largest array 最大陣列數 + An array that would create more objects than this is refused. 將拒絕建立超出此物件數量的陣列。 + Time-sensitive right-click: a quick click is Enter, holding opens the menu 時間敏感右鍵:快速按一下相當於Enter 鍵,按住不放開啟選單 + Turned off, a right-click while a command runs always opens the shortcut menu. 關閉後,在指令執行期間右鍵按一下總是開啟快捷選單。 + DraftCraft keeps these preferences, object snap modes and drafting toggles for your user account and restores them when it starts. DraftCraft 會為你的使用者帳號保留這些偏好設定、物件鎖點模式和繪圖切換開關,並在啟動時恢復它們。 + Reset to Defaults 恢復預設設定 + Copy as JSON 複製為 JSON + Reset keeps the interface language. 重置時會保留介面語言。 + Rectangular snap 矩形鎖點 + Isometric snap 等軸測鎖點 + Snap type 鎖點類型 + Grid snap 格線鎖點 + PolarSnap 極座標鎖點 + Polar distance 極座標距離 + Additional angles 附加角 + Object Snap Tracking Settings 物件鎖點追蹤設定 + Track orthogonally only 僅正交追蹤 + Track using all polar angle settings 使用所有極座標角設定追蹤 + Polar angle measurement 極座標角測量 + Relative to last segment 相對於上一線段 + Show command prompting near the crosshairs 在游標附近顯示指令提示 + Open Recent 開啟最近的圖形 + Sheet Books to PDF... 圖紙冊轉 PDF... + Drawing Recovery Manager... 圖形恢復管理器... + Named Viewports... 命名視埠... + Named Views... 命名視圖... + Polygonal Viewport 多邊形視埠 + From Template... 來自樣板... + Layouts 配置 + Printer/plotter 印表機/繪圖機 + Paper size 圖紙尺寸 + Orientation 方向 + Portrait 縱向 + Landscape 橫向 + Plot area 列印區域 + Fit to paper 佈滿圖紙 + Center the plot 居中列印 + Plot object lineweights 列印物件線寬 + Plot transparency 列印透明度 + Apply to Layout 應用到配置 + Preview 預覽 + Load Application... 載入應用程式... + Enter name of LISP file to load 輸入要載入的 LISP 檔名 + Enter geometric characteristic 輸入幾何特徵 + Enter block names to extract 輸入要提取的圖塊名 + Limits 邊界 + Plot offset 列印偏移 + X offset (mm) X 偏移 (mm) + Y offset (mm) Y 偏移 (mm) + First corner 第一角點 + Opposite corner 對角點 + Window < 視窗 < + History 歷史記錄 + Grip Edit 掣點編輯 + Paste to Command Line 貼上到指令行 + Changed: {n} 已更改: {n} + Bulleted list 項目符號清單 + No external references are attached. 沒有附加的外部參考。 + Unloaded 已解除安裝 + Make it a block of this drawing, keeping its layer names 將其製作為此圖形的圖塊,保留其圖層名稱 + Spline Edit 雲形線編輯 + Degrees of Freedom 自由度 + Stretch Vertex 拉伸頂點 + Analyze Shapes 分析形狀 + Over-constrained 過度約束 + Previous Change 上一個更改 + Close Comparison 關閉比較 + Export Comparison 匯出比較 + Plotter Manager 印表機管理 + Clear Command History 清除指令歷史記錄 + Reset Suggestion Order 重置建議順序 + Degrees of freedom: {n} 自由度: {n} + Open 開啟 + Arrow size 箭頭大小 + Viewport scale 視埠比例 + Unresolved 未解析 + Version 2007 2007 版 + Clear History 清除歷史記錄 + Isometric Plane 等軸測平面 + min 最小 + Grip Option 掣點選項 + Interface language 介面語言 + Command Aliases 指令別名 + Version 2013 2013 版 + Reload 重新載入 + Default Save Version 預設儲存版本 + Export Table 匯出表格 + A variable name starts with a letter and has only letters, digits and _ 變數名必須以字母開頭,且只能包含字母、數字和底線 + External References 外部參考 + Variables 變數 + Settings... 設定... + Set Current Viewport 設定目前視埠 + Convert 轉換為 + Copy Full File Path 複製完整檔案路徑 + Edit Table Cell 編輯表格儲存格 + Numbered list 編號清單 + Recent Commands 最近的指令 + Edit Attributes... 編輯屬性... + Select Similar 選擇相似 + Viewport is locked 視埠已鎖定 + Show in Tool Sets 在工具集中顯示 + Infer Constraints 推斷約束 + Group Selection 編組選擇 + Copy History 複製歷史記錄 + Clip Viewport 裁剪視埠 + Dimension Edit 標註編輯 + Hide Palette 隱藏選項板 + Search for pattern 搜尋圖案 + Recent Input 最近輸入 + Attach DWG... 附加 DWG... + Lines of Command History 指令歷史記錄行數 + Close All Other Drawings 關閉所有其他圖形 + Overlay 覆蓋 + Units Conversion 單位轉換 + Unload 解除安裝 + Unlock viewport 解除鎖定視埠 + Not loaded 未載入 + References: {n} 參考: {n} + Volume 體積 + Remove Vertex 移除頂點 + Evaluate 求值 + To 到 + Count Table 計數表 + Only in this drawing: {n} 僅在此圖形中: {n} + Reinitialize 重新初始化 + Update Data Links 更新資料連結 + Dim scale overall 全域標註比例 + DraftCraft DraftCraft + Enter 輸入 + Temporary track point 臨時追蹤點 + Plot Window 視窗列印 + Show and hide the tools of this category 顯示和隱藏此類別的工具 + Query Texts 查詢文字 + Unreferenced 未參考 + Drawing Template (DWT) 圖形樣板 (DWT) + Turn On Layer 開啟圖層 + QuickCalc Pick 快速計算機拾取 + Loaded 已載入 + Add Vertex 新增頂點 + Make it a block of this drawing; its layers become NAME$0$LAYER 將其製作為此圖形的圖塊;其圖層將變為 NAME$0$LAYER + Recalculate Table Formulas 重新計算表格公式 + Convert to Line 轉換為直線 + More toolbar commands 更多工具列指令 + Reference Name 參考名 + Close Array Editing 關閉陣列編輯 + Version 2018 2018 版 + Reload All 全部重新載入 + objects 個物件 + Set Table Cell Style 設定表格儲存格型式 + Snap Overrides 鎖點替代 + Count List 計數清單 + Thaw Layer 解凍圖層 + Convert to Arc 轉換為圓弧 + Precision 精度 + Version 2004 2004 版 + Saved Path 儲存的路徑 + Apply 應用 + Lock viewport 鎖定視埠 + Bind 綁定 + Only in {name}: {n} 僅在 {name} 中: {n} + SVG drawings (SVG, SVGZ) SVG 圖形 (SVG, SVGZ) + Insert Table Formula 插入表格公式 + Detach 分離 + Zoom Realtime 即時縮放 + Not Found 未找到 + Version 2010 2010 版 + Group Options 編組選項 + Version 2000 2000 版 + Insert tab 插入頁籤 + Polyline Edit 聚合線編輯 + Next Change 下一個更改 + Table Breaks 表格斷開 + Hatch Patterns 填充圖案 + Table Cell Style 表格儲存格型式 + Annotative Update 可註解更新 + Hatch Pattern 填充圖案 + Get from the Drawing 從圖形中獲取 + Zoom Dynamic 動態縮放 + Edit Array 編輯陣列 + Save changes to {name}? 是否儲存對 {name} 的更改? + Your changes will be lost if you don't save them. 如果不儲存,您的更改將丟失。 + Don't Save 不儲存 + Hatch and Gradient 填充和漸層 + Boundaries 邊界 + Add: Pick points 新增:拾取點 + Add: Select objects 新增:選擇物件 + Boundaries picked: {n} 已拾取邊界:{n} + Associate 關聯 + Create separate hatches 建立獨立的填充 + Island detection 孤島檢測 + Normal 普通 + Outer 外部 + Ignore 忽略 + Hatch origin 填充原點 + Use current origin 使用目前原點 + Specified origin 指定原點 + Click to set new origin 按一下設定新原點 + Default to boundary extents 預設至邊界範圍 + Bottom left 左下 + Bottom right 右下 + Top right 右上 + Top left 左上 + Color 1 顏色 1 + Color 2 顏色 2 + Shape 形狀 + Inverted 反向 + Centered 居中 + Curved 曲線 + Spherical 球面 + Hemispherical 半球面 + Drawing Units 圖形單位 + Insertion scale 插入比例 + Units to scale inserted content 用於縮放插入內容的單位 + Sample output 範例輸出 + Architectural 建築 + Decimal 十進制 + Engineering 工程 + Fractional 分數 + Scientific 科學 + Decimal Degrees 十進制度 + Deg/Min/Sec 度/分/秒 + Grads 梯度 + Radians 弧度 + Surveyor's Units 測量員單位 + Unitless 無單位 + Inches 英寸 + Feet 英尺 + Miles 英哩 + Millimeters 公釐 + Centimeters 公分 + Meters 公尺 + Kilometers 公里 + Microinches 微英寸 + Mils 密爾 + Yards 碼 + Angstroms 埃 + Nanometers 奈米 + Microns 微米 + Decimeters 公寸 + Decameters 公丈 + Hectometers 公引 + Gigameters 吉公尺 + Astronomical Units 天文單位 + Light Years 光年 + Parsecs 秒差距 + US Survey Feet 美國測量英尺 + US Survey Inch 美國測量英寸 + US Survey Yard 美國測量碼 + US Survey Mile 美國測量英哩 + Check for Updates… 檢查更新… + DraftCraft is up to date. DraftCraft 已是最新版本。 + Check for Updates... 檢查更新... + What's New 新功能 + Check for Updates 檢查更新 + Update Available 有可用更新 + DraftCraft {version} is available. DraftCraft {version} 已發佈。 + You have version {version}. 目前版本為 {version}。 + Do you want to download the update? 要下載此更新嗎? + What's new 新功能 + Download 下載 + Later 稍後 + Skip This Version 跳過此版本 + DraftCraft is up to date (version {version}). DraftCraft 已是最新版本({version})。 + Could not check for updates. 無法檢查更新。 + Do you want to install the update now? 要立即安裝更新嗎? + Update Now 立即更新 + Open the release page 開啟發佈頁面 + This copy of DraftCraft can't update itself. 此 DraftCraft 副本無法自行更新。 + Updating DraftCraft 正在更新 DraftCraft + Update Failed 更新失敗 + Installing DraftCraft {version} 正在安裝 DraftCraft {version} + Downloading: {done} of {total} MB 正在下載:{done} / {total} MB + Installing… 正在安裝… + Starting the download… 正在開始下載… + The connection dropped; trying again… 連接中斷,正在重試… + DraftCraft {version} is installed. DraftCraft {version} 已安裝。 + Restart DraftCraft to use it. If you restart later, it opens the next time you start DraftCraft. 重新啟動 DraftCraft 即可使用。如果稍後重啟,下次啟動 DraftCraft 時將開啟新版本。 + Restart Now 立即重啟 + The update could not be installed. 無法安裝更新。 + You can download it from the release page instead. 您也可以從發佈頁面下載。 + Align Multileaders 對齊多重引線 + Analyze Usage 分析使用情況 + Break-line Symbol 折斷線符號 + Change 更改 + Change Properties 修改性質 + Clear Recent Files 清除最近的檔案 + Close Block Editor 關閉圖塊編輯器 + Collect 合併 + Collect Multileaders 合併多重引線 + Convert Text to Mtext 將文字轉換為多行文字 + Customize 自訂 + Drag Dynamic Grip 拖曳動態掣點 + Dynamic Block Data 動態圖塊資料 + Dynamic Block Grips 動態圖塊掣點 + Dynamic Block Reference 動態圖塊參考 + Edit Command Aliases (PGP)... 編輯指令別名 (PGP)... + Edit Multileader 編輯多重引線 + Evaluate LISP 求值 LISP + Explode Attributes to Text 將屬性分解為文字 + Express Tools 擴展工具 + Groups 編組 + Hatch Pick 拾取填充線 + Implied Loops 隱含環 + Justify 對正 + Move/Copy/Rotate 移動/複製/旋轉 + Save Block 儲存圖塊 + Save Block As 圖塊另存為 + Save Layout as Template 將配置另存為樣板 + Set Dynamic Property 設定動態性質 + Units 單位 + Find All 尋找全部 + Find what: 尋找內容: + Match case 區分大小寫 + Replace 取代 + Replace All 全部取代 + Replace with: 取代為: + Replacement text 取代文字 + Results 結果 + Searches the current space. 僅搜尋目前空間。 + Text to find 要尋找的文字 + Whole words 全字匹配 + Nothing found 未找到 + + Add… 新增… + Alias 別名 + Alias file: {file} 別名檔案:{file} + Associative 關聯 + AutoLISP (LSP) AutoLISP (LSP) + B B + Backup copy 備份副本 + Block to create or edit 要建立或編輯的圖塊 + Choose the command the alias starts. 選擇別名要啟動的指令。 + Click the ruler to add a tab stop, right-click to remove one 按一下標尺可新增製表位,右鍵按一下可將其刪除 + Command 指令 + Create backup copy with each save 每次儲存時建立備份副本 + Crossing selection color: 交叉選擇顏色: + Custom 自訂 + Define each corner of the selection window with a separate click. 分別按一下以定義選擇視窗的各個角點。 + Discard 放棄 + Edit Block Definition 編輯圖塊定義 + Edit… 編輯… + Exclude: 排除: + Font 字型 + Grips 掣點 + Hatches 填充線 + Imperial (inches) 英制(英寸) + Indicate selection area 指示選擇區域 + Interface scale 介面縮放 + Island 孤島 + Italic 斜體 + Metric (millimetres) 公制(公釐) + More than {n} aliases. 超過 {n} 個別名。 + Multiline text 多行文字 + New and the first drawing at startup use these units unless a default template is set (QNEWTEMPLATE). 啟動時的新建圖形和第一個圖形使用這些單位,除非設定了預設樣板 (QNEWTEMPLATE)。 + New block 新建圖塊 + No alias file loaded. REINIT replaces these aliases with a file's. 未載入別名檔案。REINIT 將用檔案中的別名取代這些別名。 + Object grouping 物件編組 + Object selection limit for display of grips 顯示掣點時物件選擇的數目上限 + Objects on locked layers 鎖定圖層上的物件 + Open in Block Editor 在圖塊編輯器中開啟 + Origin: {x}, {y} 原點:{x}, {y} + Overline 頂線 + Save alias 儲存別名 + Save changes to block "{name}"? 儲存對圖塊「{name}」的更改嗎? + Select boundaries to remove 選擇要刪除的邊界 + Select using two clicks only 僅用兩次按一下選擇 + Selection Area Effect 選擇區域效果 + Selection Preview Filter 選擇預覽過濾器 + Selection area opacity: 選擇區域不透明度: + Selection effect color 選擇效果顏色 + Selection modes 選擇模式 + Selection preview 選擇預覽 + Show grips 顯示掣點 + Tables 表格 + Text color 文字顏色 + This drawing 此圖形 + Type an alias name. 輸入別名名稱。 + Underline 底線 + Units of new drawings 新圖形的單位 + Unsaved changes 未儲存的更改 + Visual Effect Settings 視覺效果設定 + Visual Effect Settings... 視覺效果設定... + When a command is active 指令處於活動狀態時 + When no command is active 無活動指令時 + Window selection color: 視窗選擇顏色: + X X + Xrefs 外部參考 + Y Y + built-in 內置 + contains authoring elements. Open in Block Editor? 包含編寫元素。在圖塊編輯器中開啟嗎? + overrides built-in 覆蓋內置 + {alias} is already defined; select it and use Edit. {alias} 已定義;請選擇它並使用編輯。 + {command} is an unknown command. {command} 是未知指令。 +menu Dimension 標註 +menu Draw 繪圖 +menu Modify 修改 +menu View 視圖 + Clip Xref 剪裁外部參考 + Xref 外部參考 + Xref Clip Frame 外部參考剪裁邊框 + Ribbon 功能區 + PDF Underlay... PDF 參考底圖... + PDF Import PDF 輸入 + PDF Underlay PDF 參考底圖 + Underlay Layers 參考底圖圖層 + Adjust... 調整... + Close Text Editor 關閉文字編輯器 + Image Adjust 影像調整 + Image Clip 影像剪裁 + PDF Adjust PDF 調整 + PDF Clip PDF 剪裁 + Image 影像 + Action 動作 + Parameter 參數 + DesignCenter 設計中心 + Tool Palettes 工具選項板 + Sheet Set Manager 圖紙集管理器 + Type the drawing's path, then press Enter. 輸入圖形的路徑,然後按 Enter。 + Drawing file 圖形檔案 + Folder 資料夾 + Linetypes 線型 + Text Styles 文字型式 + Dimension Styles 標註型式 + Table Styles 表格型式 + Multileader Styles 多重引線型式 + Multiline Styles 多線型式 + Add to Drawing 新增到圖形 + Create Tool Palette 建立工具選項板 + Nothing of this kind in the file. 檔案中沒有此類內容。 + Open a drawing to see its blocks, layers and styles. 開啟圖形以查看其圖塊、圖層和型式。 + Annotate 註解 + Delete Palette 刪除選項板 + New Palette 新建選項板 + No tool palettes. 沒有工具選項板。 + This palette is empty: add a command below, or make a palette from DesignCenter. 此選項板為空:在下方新增指令,或從設計中心建立選項板。 + Delete Tool 刪除工具 + Add Command 新增指令 + New Sheet Set... 新建圖紙集... + Open Sheet Set... 開啟圖紙集... + Sheet sets (DCSS) 圖紙集 (DCSS) + Sheet set file 圖紙集檔案 + Make or open a sheet set to list its sheets. 新建或開啟圖紙集以列出其圖紙。 + Add Drawing... 新增圖形... + Publish to PDF... 發佈為 PDF... + No sheets yet: add a drawing's layouts. 尚無圖紙:請新增圖形的配置。 + Number 編號 + Title 標題 + Move Up 上移 + Move Down 下移 + Sheet Set (DCSS) 圖紙集 (DCSS) + Close Tool Palettes 關閉工具選項板 + Close DesignCenter 關閉設計中心 + Close Sheet Set Manager 關閉圖紙集管理器 + Manage Tool Palettes 管理工具選項板 + Palettes 選項板 +menu Palettes 選項板 + 2D Drafting 二維草圖與註解 + 2D Wireframe 二維線框 + Top 俯視 + CAD Standards CAD 標準 + Commands 指令 + Edit Aliases 編輯別名 + Edit Aliases... 編輯別名... + Changes apply at once; Save Current As keeps them in a workspace. 更改立即生效;「將目前另存為」會把它們儲存在工作空間中。 + Click layers to show only them; Ctrl or Shift adds to the choice. 按一下圖層只顯示這些圖層;按住 Ctrl 或 Shift 可加入選擇。 + Current Workspace 目前工作空間 + Customize Interface 自訂介面 + Customize User Interface 自訂使用者介面 + Customize... 自訂... + Force object color and linetype to ByLayer 強制物件顏色和線型為隨層 + Geographic Location 地理位置 + Geographic Location... 地理位置... + Latitude 緯度 + Longitude 經度 + North direction 北向 + Layer Translation Mappings 圖層轉換映射 + Layer Translator 圖層轉換器 + Layer Translator... 圖層轉換器... + Layer Walk 圖層漫遊 + Layer Walk... 圖層漫遊... + Location 位置 + Set Location 設定位置 + Remove Location 刪除位置 + The drawing's origin is at this place (WGS 84 degrees). 圖形原點位於此處(WGS 84 度)。 + Map 映射 + New layer name 新圖層名 + No mappings yet: pick layers on the left, a name on the right, then Map. 尚無映射:在左側選擇圖層,在右側選擇名稱,然後按一下「映射」。 + Translate 轉換 + Translate From 轉換自 + Translate To 轉換為 + Restore on exit 退出時恢復 + Point Cloud 點雲 + Point Cloud... 點雲... + Point clouds (XYZ, LAS) 點雲 (XYZ, LAS) + ZIP archive ZIP 壓縮檔案 + eTransmit 電子傳遞 + eTransmit... 電子傳遞... + Quick Access Toolbar 快速存取工具列 + Rename 重新命名 + Reset to Standard 重置為標準 + Ribbon Tabs 功能區頁籤 + Save Current As 將目前另存為 + Save Current As... 將目前另存為... + Save Workspace 儲存工作空間 + User Interface 使用者介面 + Workspace 工作空間 + Workspace Settings 工作空間設定 + Workspace Settings... 工作空間設定... + Workspace name 工作空間名稱 + Workspace: 工作空間: + Workspaces 工作空間 + Interface... 介面... +menu Customize 自訂 +menu Workspaces 工作空間 +menu CAD Standards CAD 標準 + Export Attribute Information... 匯出屬性資訊... + Import Attribute Information... 匯入屬性資訊... + Export Attributes 匯出屬性 + Import Attributes 匯入屬性 + Text, tab-delimited (TXT) 製表符分隔的文字 (TXT) + Enter output file name 輸入要寫入的檔名 + Enter input file name 輸入要讀取的檔名 + Import Settings 匯入設定 + Export Settings 匯出設定 + Import Settings... 匯入設定... + Export Settings... 匯出設定... + DraftCraft settings (TOML) DraftCraft 設定 (TOML) + Total Area and Length 總面積和長度 + Total Area 總面積 + Specify point to place the totals as text 指定將合計放置為文字的點 + A new drawing in centimeters 以公分為單位的新圖形 + Metric (centimetres) 公制(公分) + Metric 公制 + Imperial 英制 + A new drawing in millimeters 以公釐為單位的新圖形 + A new drawing in inches 以英寸為單位的新圖形 diff --git a/crates/ui-egui/src/options.rs b/crates/ui-egui/src/options.rs index aed3b09e..84c86550 100644 --- a/crates/ui-egui/src/options.rs +++ b/crates/ui-egui/src/options.rs @@ -10,7 +10,7 @@ //! |---|---| //! | `theme` | `"system"`, `"light"` or `"dark"` | //! | `animations` | `"system"`, `"on"` or `"off"`: dialog and menu fades and smoothed scrolling | -//! | `interfaceLanguage` | `"auto"`, `"en"`, `"uk"`, `"pt-BR"`, `"de"`, `"es"`, `"cs"`, `"ru"`, `"fr"`, `"zh"`, `"it"`, `"ko"`, `"sv"`, `"ar"`, `"hu"`, `"tr"`, `"bs"`, `"vi"` or `"el"` | +//! | `interfaceLanguage` | `"auto"`, `"en"`, `"uk"`, `"pt-BR"`, `"de"`, `"es"`, `"cs"`, `"ru"`, `"fr"`, `"zh"`, `"zh-TW"`, `"it"`, `"ko"`, `"sv"`, `"ar"`, `"hu"`, `"tr"`, `"bs"`, `"vi"` or `"el"` | //! | `saveFormat` | `"dxf"` or `"dwg"`: the format Save As suggests for new drawings | //! | `saveVersion` | `"2000"` … `"2018"`: the version drawings with no file yet are saved in | //! | `SAVETIME` | minutes between automatic saves, 0–600 (0: off) | diff --git a/crates/ui-egui/src/options/dialog.rs b/crates/ui-egui/src/options/dialog.rs index 54922980..1c441deb 100644 --- a/crates/ui-egui/src/options/dialog.rs +++ b/crates/ui-egui/src/options/dialog.rs @@ -268,12 +268,16 @@ fn save_version_row(ui: &mut egui::Ui, app: &CadApp, changes: &mut Map) { ui.label(crate::tl!("Units of new drawings")); ui.horizontal(|ui| { - let metric = app.session.settings.measureinit; - if ui.radio(!metric, crate::tl!("Imperial (inches)")).clicked() && metric { - changes.insert("MEASUREINIT".into(), json!(0)); - } - if ui.radio(metric, crate::tl!("Metric (millimetres)")).clicked() && !metric { - changes.insert("MEASUREINIT".into(), json!(1)); + let st = &app.session.settings; + let current = if st.measureinit { i64::from(st.measureinit_units) } else { 1 }; + for (units, label) in [(1, crate::tl!("Imperial (inches)")), (4, crate::tl!("Metric (millimetres)")), (5, crate::tl!("Metric (centimetres)"))] + { + if ui.radio(current == units, label).clicked() && current != units { + changes.insert("MEASUREINIT".into(), json!(i32::from(units != 1))); + if units != 1 { + changes.insert("MEASUREINITUNITS".into(), json!(units)); + } + } } }); } diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index fd6cb9ee..b92d0d2d 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -348,6 +348,10 @@ pub fn install_fonts(ctx: &egui::Context, language: &str) { if !chinese { paths.extend(japanese_font()); } + // 繁體中文: a Traditional Chinese face first, for its glyph forms, where there is one. + if language == "zh-TW" { + paths.extend(traditional_chinese_font()); + } paths.extend(cjk_font()); paths.dedup(); added.extend( @@ -487,7 +491,10 @@ fn embedded_ui_faces<'a>(faces: &[&'a draftcraft_fonts::CraftFont], language: &s let cjk = |f: &&draftcraft_fonts::CraftFont| f.style == "Regular" && f.scripts.iter().any(|s| matches!(*s, "Jpan" | "Hans" | "Hant")); let mut out: Vec<_> = faces.iter().copied().filter(cjk).collect(); out.sort_by_key(|f| !f.family.contains("Gothic") && !f.family.contains("Sans")); - if language.starts_with("zh") { + if language == "zh-TW" { + // A Simplified face before a Japanese one: it has more Traditional characters. + out.sort_by_key(|f| (!f.scripts.contains(&"Hant"), !f.scripts.contains(&"Hans"))); + } else if language.starts_with("zh") { out.sort_by_key(|f| !f.scripts.contains(&"Hans")); } if language == "ar" { @@ -546,6 +553,29 @@ pub fn cjk_font() -> Option<&'static std::path::Path> { None } +/// An installed Traditional Chinese font, put ahead of [`cjk_font`] in the 繁體中文 interface so +/// its characters take the forms used in Taiwan; fonts are never bundled. Checked once. +pub fn traditional_chinese_font() -> Option<&'static std::path::Path> { + #[cfg(not(target_arch = "wasm32"))] + { + static FOUND: std::sync::OnceLock> = std::sync::OnceLock::new(); + FOUND + .get_or_init(|| { + let candidates: &[&str] = if cfg!(target_os = "macos") { + &[] + } else if cfg!(windows) { + &["C:\\Windows\\Fonts\\msjh.ttc", "C:\\Windows\\Fonts\\msjh.ttf", "C:\\Windows\\Fonts\\mingliu.ttc"] + } else { + &["/usr/share/fonts/opentype/noto/NotoSansCJKtc-Regular.otf", "/usr/share/fonts/noto-cjk/NotoSansCJKtc-Regular.otf"] + }; + candidates.iter().map(std::path::PathBuf::from).find(|p| p.is_file()) + }) + .as_deref() + } + #[cfg(target_arch = "wasm32")] + None +} + /// An installed font with Arabic glyphs, for the العربية interface; fonts are never bundled /// (only looked for where the OS or common packages put them). Checked once. pub fn arabic_font() -> Option<&'static std::path::Path> { @@ -734,7 +764,9 @@ pub fn can_show(language: &str) -> bool { "ko" => shows_hangul("ko"), "vi" => vietnamese_font().is_some(), "ar" => arabic_font().is_some() || embedded_script("Arab"), - l if l.starts_with("zh") => cjk_font().is_some() || embedded_script("Hans") || embedded_script("Hant"), + l if l.starts_with("zh") => { + cjk_font().is_some() || traditional_chinese_font().is_some() || embedded_script("Hans") || embedded_script("Hant") + } _ => true, } } @@ -848,6 +880,12 @@ mod tests { assert_eq!(families(&super::embedded_ui_faces(&faces, "en")), ["BIZ UDPGothic", "Han Test Face"]); // A Chinese interface takes the Han face first: a Japanese face lacks 图 园 测. assert_eq!(families(&super::embedded_ui_faces(&faces, "zh")), ["Han Test Face", "BIZ UDPGothic"]); + // 繁體中文 takes a Traditional face first when there is one, else as Chinese (#33). + let traditional = face("Hant Test Face", &["Hant", "Latn"]); + let with_hant = [&japanese, &chinese, &traditional]; + assert_eq!(families(&super::embedded_ui_faces(&with_hant, "zh-TW")), ["Hant Test Face", "Han Test Face", "BIZ UDPGothic"]); + assert_eq!(families(&super::embedded_ui_faces(&with_hant, "zh")), ["Han Test Face", "BIZ UDPGothic", "Hant Test Face"]); + assert_eq!(families(&super::embedded_ui_faces(&faces, "zh-TW")), ["Han Test Face", "BIZ UDPGothic"]); // العربية adds the Arabic face, after the CJK ones egui's bundled faces have no glyphs for. assert_eq!(families(&super::embedded_ui_faces(&faces, "ar")), ["BIZ UDPGothic", "Han Test Face", "Noto Sans Arabic"]); // Another weight is a style of a face, not an interface face of its own. diff --git a/docs/config-file.md b/docs/config-file.md index 312d821b..c52bec86 100644 --- a/docs/config-file.md +++ b/docs/config-file.md @@ -29,7 +29,7 @@ follow its `noun + IMPORT/EXPORT` commands such as PDFIMPORT. The names and values are the ones SETVAR, OPTIONS, PAGESETUP and ALIASEDIT take: a value the file holds is checked exactly as if it were typed there. MEASUREINIT in `[profile]` makes new -drawings metric or imperial; the `[drawing]` section changes the drawing open now. To start every +drawings metric or imperial (MEASUREINITUNITS: metric ones in millimetres, 4, or centimetres, 5); the `[drawing]` section changes the drawing open now. To start every new drawing with the same drawing settings, save a drawing as a template and set QNEWTEMPLATE. ## Importing diff --git a/docs/localization.md b/docs/localization.md index 7d8407d6..f2b69334 100644 --- a/docs/localization.md +++ b/docs/localization.md @@ -1,7 +1,7 @@ # Interface languages Choose **Edit → Interface Language** and select **Auto (system language)**, **English**, -**Українська**, **Português (Brasil)**, **Deutsch**, **Español**, **Čeština** (Czech), **Русский**, **Français**, **简体中文**, **Italiano**, **한국어** (Korean), **Svenska** (Swedish), **العربية** (Arabic), **Magyar** (Hungarian), **Türkçe** (Turkish), or **Ελληνικά** (Greek). +**Українська**, **Português (Brasil)**, **Deutsch**, **Español**, **Čeština** (Czech), **Русский**, **Français**, **简体中文**, **繁體中文** (Traditional Chinese), **Italiano**, **한국어** (Korean), **Svenska** (Swedish), **العربية** (Arabic), **Magyar** (Hungarian), **Türkçe** (Turkish), or **Ελληνικά** (Greek). The interface updates without restarting, including the native macOS menus. The choice is saved with the other interface preferences (`draftcraft.prefs`, beside the theme): eframe storage on the desktop, browser local storage on the web. Installations without a saved @@ -11,7 +11,9 @@ Auto uses the first supported language in the operating system's preferred local browser's `navigator.languages` on the web. BCP 47 and POSIX tags select their primary language: `uk-UA` → `uk`, `de_AT.UTF-8` → `de`, `es-MX` → `es`, `pt_BR.UTF-8` → `pt-BR`, `cs-CZ` and `cs_CZ.UTF-8` → `cs`, `it-IT` and `it_CH.UTF-8` → `it`, `ko-KR` and `ko_KR.UTF-8` → `ko`, -`sv-SE`, `sv-FI` and `sv_SE.UTF-8` → `sv`, `hu-HU` and `hu_HU.UTF-8` → `hu`, `tr-TR` and `tr_TR.UTF-8` → `tr`. Unsupported languages fall back to English. +`sv-SE`, `sv-FI` and `sv_SE.UTF-8` → `sv`, `hu-HU` and `hu_HU.UTF-8` → `hu`, `tr-TR` and `tr_TR.UTF-8` → `tr`. Chinese also follows its +script or region: `zh-TW`, `zh-HK`, `zh-MO`, `zh-Hant` and `zh_TW.UTF-8` → `zh-TW` (Traditional), any other +`zh` tag → `zh` (Simplified). Unsupported languages fall back to English. Set `DRAFTCRAFT_LOCALE=cs-CZ` to override the desktop's locale for a launch. An explicit saved language choice takes precedence over that override. @@ -22,7 +24,7 @@ Automation can select the language through the existing control channel: ``` The `ui.set` method also accepts `{"interfaceLanguage":"cs"}`. Supported values are `auto`, -`en`, `uk`, `pt-BR`, `de`, `es`, `cs`, `ru`, `fr`, `zh`, `it`, `ko`, `sv`, `ar`, `hu`, `tr`, and `el`; invalid values are rejected without changing the current +`en`, `uk`, `pt-BR`, `de`, `es`, `cs`, `ru`, `fr`, `zh`, `zh-TW`, `it`, `ko`, `sv`, `ar`, `hu`, `tr`, and `el`; invalid values are rejected without changing the current selection. Resetting palettes keeps the language choice. ## Translation coverage diff --git a/packaging/windows/INSTALLATION.md b/packaging/windows/INSTALLATION.md index b6310af0..b1cfc6d0 100644 --- a/packaging/windows/INSTALLATION.md +++ b/packaging/windows/INSTALLATION.md @@ -24,6 +24,10 @@ The script builds x64, x86 and arm64 packages with deliberately non-executable p uses the actual package source and compiled database. A safe Windows Installer session checks 24 scope/registration/maintenance cases, remembered and explicit custom folders, sequencing, upgrade identity and the original registration inventory recorded in `install-policy.json`. +DraftCraft 1.0.0 to 2.2.2 were built with CADCraft's upgrade code, so the two apps replaced or +blocked each other (#35). Packages now have their own upgrade code and replace those DraftCraft +versions through an Upgrade row limited to 1.0.0–2.2.2 (`legacyUpgrade`), which no CADCraft +release (0.x) falls in; the checker and `cargo xtask` tests keep it that way. The release packaging script runs the compiled checker before signing. Packaging CI runs the small fixture builds without compiling the Rust application. diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 index bb506246..6f3142b7 100644 --- a/packaging/windows/check-install-policy.ps1 +++ b/packaging/windows/check-install-policy.ps1 @@ -88,6 +88,17 @@ try { throw 'Policy regression: new packages must default to the per-user dual-scope context.' } if ($properties['UpgradeCode'].Trim('{}') -ne $policy.upgradeCode) { throw 'The existing upgrade identity must not change.' } + # DraftCraft 1.0.0-2.2.2 shared CADCraft's upgrade code (#35): those versions are replaced by + # their version range only, both ends inclusive, so a CADCraft install (0.x) is never touched. + $legacy = $policy.legacyUpgrade + $legacyRows = @(Read-Rows $database 'SELECT `UpgradeCode`, `VersionMin`, `VersionMax`, `Attributes`, `ActionProperty` FROM `Upgrade`' 5 | + Where-Object { $_[0].Trim('{}') -eq $legacy.code }) + if ($legacyRows.Count -ne 1) { throw 'Exactly one Upgrade row must replace the DraftCraft versions that shared an upgrade code.' } + $row = $legacyRows[0] + $inclusive = 256 -bor 512 + if ([version]$row[1] -ne [version]$legacy.minimum -or [version]$row[2] -ne [version]$legacy.maximum -or ([int]$row[3] -band $inclusive) -ne $inclusive -or ([int]$row[3] -band 2)) { + throw "The shared upgrade code must be removed for DraftCraft $($legacy.minimum)-$($legacy.maximum) only, never CADCraft's versions." + } $directories = @{} foreach ($row in (Read-Rows $database 'SELECT `Directory`, `Directory_Parent`, `DefaultDir` FROM `Directory`' 3)) { $directories[$row[0]] = @($row[1], $row[2]) diff --git a/packaging/windows/draftcraft.wxs b/packaging/windows/draftcraft.wxs index c5bb45a0..2facd129 100644 --- a/packaging/windows/draftcraft.wxs +++ b/packaging/windows/draftcraft.wxs @@ -3,12 +3,19 @@ - + + + + + @@ -56,7 +63,7 @@ - + @@ -91,7 +98,7 @@ - + diff --git a/packaging/windows/install-policy.json b/packaging/windows/install-policy.json index 89723cdc..890ae59c 100644 --- a/packaging/windows/install-policy.json +++ b/packaging/windows/install-policy.json @@ -1,7 +1,12 @@ { "id": "draftcraft", "name": "DraftCraft", - "upgradeCode": "119D7D76-0167-4A9E-8F37-09DA0235F68E", + "upgradeCode": "858EACB4-C563-429E-B90A-2E021E448E54", + "legacyUpgrade": { + "code": "119D7D76-0167-4A9E-8F37-09DA0235F68E", + "minimum": "1.0.0", + "maximum": "2.2.2" + }, "sources": [ "draftcraft.wxs" ], diff --git a/xtask/src/main.rs b/xtask/src/main.rs index f97c7c65..59045d8c 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -6,6 +6,7 @@ mod assets; mod ico; mod layers; +mod packaging; mod parity; mod stats; mod version; diff --git a/xtask/src/packaging.rs b/xtask/src/packaging.rs new file mode 100644 index 00000000..a40b341f --- /dev/null +++ b/xtask/src/packaging.rs @@ -0,0 +1,57 @@ +//! Checks on the native package definitions that need no packaging tools, so they run on every +//! platform with the workspace tests (the Windows Installer checks themselves need Windows: +//! `packaging/windows/check-install-policy.ps1`). + +#[cfg(test)] +mod tests { + /// The Windows Installer identity CADCraft's packages use (`packaging/windows/cadcraft.wxs` + /// upstream): its upgrade code and component GUIDs. DraftCraft 1.0.0–2.2.2 shipped with the + /// same ones, so each installer removed the other app or refused to install (#35). + const CADCRAFT_IDS: [&str; 3] = + ["119D7D76-0167-4A9E-8F37-09DA0235F68E", "2AC18056-48DE-4079-AB79-4FDEF4FBB075", "76029CD7-EBDB-420F-AC34-FF0E82A99E32"]; + + fn read(path: &str) -> String { + std::fs::read_to_string(crate::root().join(path)).unwrap() + } + + /// The value of `attr="…"` in the first element of `xml` that starts with `element`. + fn attr<'a>(xml: &'a str, element: &str, attr: &str) -> &'a str { + let start = xml.find(element).unwrap_or_else(|| panic!("no {element}")); + let tag = &xml[start..start + xml[start..].find('>').unwrap()]; + let at = tag.find(&format!(" {attr}=\"")).unwrap_or_else(|| panic!("{element} has no {attr}")) + attr.len() + 3; + &tag[at..at + tag[at..].find('"').unwrap()] + } + + fn version(v: &str) -> (u64, u64, u64) { + let n: Vec = v.split('.').map(|p| p.parse().unwrap()).collect(); + (n[0], n[1], n[2]) + } + + #[test] + fn the_windows_installer_has_its_own_identity_and_leaves_cadcraft_alone() { + let wxs = read("packaging/windows/draftcraft.wxs"); + let policy: serde_json::Value = serde_json::from_str(&read("packaging/windows/install-policy.json")).unwrap(); + // Its own upgrade code, the one the policy checker expects. + let code = attr(&wxs, "= (1, 0, 0), "CADCraft releases are 0.x and must never match"); + assert_eq!(max, (2, 2, 2)); + } +}