From 45501ddb6647b3ad0e3b1a28c520642885828698 Mon Sep 17 00:00:00 2001 From: bd78 Date: Thu, 5 Nov 2026 22:44:22 -0500 Subject: [PATCH 01/11] export: support {album}, {date}, and {hour} variables in subfolder field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add {album}, {date} (YYYYMMDD UTC), and {hour} (hhmm UTC) variable expansion in export subfolder path. - Provide a dropdown ('Insert…') next to the subfolder text field in the Export dialog to insert variables at cursor. - Preserve variable tokens in export presets for evaluation at export time. - Sanitize album names for filesystem path safety via clean_album_name. - Add unit and UI tests. --- crates/engine/src/export.rs | 5 +-- crates/engine/src/export/batch.rs | 11 +++--- crates/engine/src/export/place.rs | 42 +++++++++++++++++++--- crates/engine/src/export/prepare.rs | 16 +++++++-- crates/engine/src/tests/export.rs | 54 ++++++++++++++++++++++++++++ crates/ui-egui/src/dialogs.rs | 33 ++++++++++++++--- crates/ui-egui/src/dialogs/import.rs | 2 +- crates/ui-egui/src/tests/dialogs.rs | 12 +++++++ 8 files changed, 156 insertions(+), 19 deletions(-) diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 8ba08021f52..1f350d2cdb8 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -39,7 +39,7 @@ pub use params::{ }; #[cfg(test)] use place::Placer; -pub use place::{write_file, write_file_durable, write_file_new}; +pub use place::{clean_album_name, clean_subfolder, expand_subfolder, write_file, write_file_durable, write_file_new}; pub use prepare::{ AfterExport, Destination, DngCompression, Exported, PreparedExport, export_batch, export_photo, output_size, prepare_batch, prepare_export, }; @@ -74,7 +74,8 @@ pub struct ExportOptions { pub start_number: u32, /// A specific folder for the whole batch, or each photo's own folder. pub destination_mode: DestinationMode, - /// Created inside the destination folder (empty = none). + /// Created inside the destination folder (empty = none). Supports `{album}` (current album + /// name), `{date}` (YYYYMMDD) and `{hour}` (hhmm) variables, expanded at export time. pub subfolder: String, /// When a file of the same name exists in the destination folder. pub conflict: Conflict, diff --git a/crates/engine/src/export/batch.rs b/crates/engine/src/export/batch.rs index b5d45b1254e..86853dd7a52 100644 --- a/crates/engine/src/export/batch.rs +++ b/crates/engine/src/export/batch.rs @@ -51,12 +51,13 @@ pub(super) fn run_batch_with( if !progress(i, &item.file_name) { break; } - let (photo, name, guard, source_dir) = (item.photo, item.file_name.clone(), item.guard.clone(), item.source_dir.clone()); - placer.place(photo, name, source_dir.as_deref(), &guard, run_gated(item))?; + let (photo, name, guard, source_dir, subfolder) = + (item.photo, item.file_name.clone(), item.guard.clone(), item.source_dir.clone(), item.subfolder.clone()); + placer.place(photo, name, source_dir.as_deref(), Some(&subfolder), &guard, run_gated(item))?; } return Ok(std::mem::take(&mut placer.out)); } - let heads: Vec<_> = items.iter().map(|i| (i.photo, i.file_name.clone(), i.guard.clone(), i.source_dir.clone())).collect(); + let heads: Vec<_> = items.iter().map(|i| (i.photo, i.file_name.clone(), i.guard.clone(), i.source_dir.clone(), i.subfolder.clone())).collect(); let queue = Queue { lane: std::sync::Mutex::new(Lane { items: items.into_iter().map(Some).collect(), next: 0, placed: 0, stop: false, done: Default::default() }), cv: std::sync::Condvar::new(), @@ -74,12 +75,12 @@ pub(super) fn run_batch_with( } } let placed = || { - for (i, (photo, name, guard, source_dir)) in heads.into_iter().enumerate() { + for (i, (photo, name, guard, source_dir, subfolder)) in heads.into_iter().enumerate() { if !progress(i, &name) { break; } let e = queue.result(i); - placer.place(photo, name, source_dir.as_deref(), &guard, e)?; + placer.place(photo, name, source_dir.as_deref(), Some(&subfolder), &guard, e)?; } Ok::<_, String>(()) }; diff --git a/crates/engine/src/export/place.rs b/crates/engine/src/export/place.rs index c36f5e26bc8..698b1c5e7bc 100644 --- a/crates/engine/src/export/place.rs +++ b/crates/engine/src/export/place.rs @@ -63,11 +63,44 @@ fn join_path(a: &str, b: &str) -> String { /// A subfolder that stays inside the destination folder (issue #2571): `\`, `:` and NUL become `_` /// (so no drive, root or Windows separator), and empty, `.` and `..` parts are dropped; `a/b` still /// nests. Applied where the folder is used, so presets and the Export dialog's field are covered too. -pub(super) fn clean_subfolder(s: &str) -> String { +pub fn clean_subfolder(s: &str) -> String { let s = s.trim().replace(['\\', ':', '\0'], "_"); s.split('/').map(str::trim).filter(|p| !p.is_empty() && *p != "." && *p != "..").collect::>().join("/") } +/// Clean an album name so it is safe to use as a directory or path component. +pub fn clean_album_name(album: &str) -> String { + let mut s: String = album + .chars() + .map(|c| if matches!(c, '/' | '\\' | ':' | '*' | '?' | '"' | '<' | '>' | '|' | '\0') || c.is_control() { '_' } else { c }) + .collect(); + loop { + let trimmed = s.trim().trim_matches('.'); + if trimmed == s { + break; + } + s = trimmed.to_string(); + } + s +} + +/// Expand `{album}`, `{date}`, `{hour}` variables in a subfolder template, and clean the result +/// so it stays safely inside the destination folder. +pub fn expand_subfolder(template: &str, album: Option<&str>, now: Option) -> String { + let now = now.unwrap_or_else(|| { + let since = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default(); + let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX); + chrono::DateTime::from_timestamp(secs, 0).map(|dt| dt.naive_utc()).unwrap_or_default() + }); + let date_str = now.format("%Y%m%d").to_string(); + let hour_str = now.format("%H%M").to_string(); + let album_str = album.map(clean_album_name).unwrap_or_default(); + + let res = template.replace("{album}", &album_str).replace("{date}", &date_str).replace("{hour}", &hour_str); + + clean_subfolder(&res) +} + impl<'a> Placer<'a> { pub(super) fn new( o: &'a ExportOptions, @@ -82,7 +115,7 @@ impl<'a> Placer<'a> { /// The folder photo `name` (its original in `source_dir`) is written to: the batch's folder or /// the photo's own ([`DestinationMode`]), plus the subfolder. An error for a photo with no /// folder of its own, or whose folder is gone: never a file written somewhere else instead. - fn folder_for(&self, name: &str, source_dir: Option<&str>) -> Result { + fn folder_for(&self, name: &str, source_dir: Option<&str>, subfolder: Option<&str>) -> Result { let base = match self.o.destination_mode { DestinationMode::SpecificFolder => self.to.dir.clone(), DestinationMode::SameAsOriginal => { @@ -97,7 +130,7 @@ impl<'a> Placer<'a> { d.to_string() } }; - let sub = clean_subfolder(&self.o.subfolder); + let sub = subfolder.map(str::to_string).unwrap_or_else(|| expand_subfolder(&self.o.subfolder, None, None)); Ok(if sub.is_empty() { base } else { join_path(&base, &sub) }) } @@ -108,12 +141,13 @@ impl<'a> Placer<'a> { photo: lightcraft_catalog::PhotoId, name: String, source_dir: Option<&str>, + subfolder: Option<&str>, guard: &crate::originals::OriginalGuard, e: Result, ) -> Result<(), String> { use serde_json::json; // an exact file path needs no folder - let dir = if self.to.exact.is_some() && self.single { Ok(String::new()) } else { self.folder_for(&name, source_dir) }; + let dir = if self.to.exact.is_some() && self.single { Ok(String::new()) } else { self.folder_for(&name, source_dir, subfolder) }; let (o, exists) = (self.o, self.exists); let (dir, e) = match dir.and_then(|dir| e.map(|e| (dir, e))) { Ok(v) => v, diff --git a/crates/engine/src/export/prepare.rs b/crates/engine/src/export/prepare.rs index 56cc71a4a77..f26c32da71b 100644 --- a/crates/engine/src/export/prepare.rs +++ b/crates/engine/src/export/prepare.rs @@ -44,6 +44,7 @@ pub struct PreparedExport { /// The folder of the photo's original on disk ([`DestinationMode::SameAsOriginal`]); `None` /// for a demo photo or one in the browser's storage. pub source_dir: Option, + pub subfolder: String, work: Work, /// The library's originals, which [`run_batch`] never writes over (shared by a batch). pub(super) guard: std::sync::Arc, @@ -88,13 +89,16 @@ pub fn prepare_export( seq: usize, ) -> Result { let guard = std::sync::Arc::new(session.original_guard()); - prepare_guarded(session, id, o, seq, guard) + prepare_guarded(session, id, o, seq, guard, None) } /// [`prepare_export`] for each of `ids` in order (`{seq}` = position, from 1). pub fn prepare_batch(session: &mut crate::Session, ids: &[lightcraft_catalog::PhotoId], o: &ExportOptions) -> Result, String> { let guard = std::sync::Arc::new(session.original_guard()); - ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone())).collect() + let since = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default(); + let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX); + let now = chrono::DateTime::from_timestamp(secs, 0).map(|dt| dt.naive_utc()); + ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone(), now)).collect() } fn prepare_guarded( @@ -103,10 +107,16 @@ fn prepare_guarded( o: &ExportOptions, seq: usize, guard: std::sync::Arc, + now: Option, ) -> Result { let p = session.catalog.photo(id).ok_or("no such photo")?; let file_name = o.file_name_for(p, seq); let source_dir = original_folder(&p.source); + let album_name = match session.source { + crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()), + _ => session.catalog.albums_of(id).first().and_then(|&aid| session.catalog.album(aid)).map(|a| a.name.clone()), + }; + let subfolder = super::place::expand_subfolder(&o.subfolder, album_name.as_deref(), now); // HDR output only for photos edited in HDR; the rest of the batch exports as usual let sdr_opts; let o = if o.hdr && !p.develop.hdr.enabled { @@ -162,7 +172,7 @@ fn prepare_guarded( }; (work, weight) }; - Ok(PreparedExport { photo: id, file_name, source_dir, work, guard, weight }) + Ok(PreparedExport { photo: id, file_name, source_dir, subfolder, work, guard, weight }) } /// The folder a photo's original is in, for [`DestinationMode::SameAsOriginal`]. None for a demo diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index bd5124d71ee..30d65d12ce5 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -280,6 +280,60 @@ fn a_subfolder_never_leaves_the_destination_folder() { assert_eq!(o.subfolder, "up"); } +#[test] +fn subfolder_variables_expansion_and_presets() { + use crate::export::{Destination, clean_album_name, expand_subfolder, export_batch}; + + // Album name cleaning + assert_eq!(clean_album_name("Summer 2026"), "Summer 2026"); + assert_eq!(clean_album_name("Trip: Tokyo / Kyoto * 2026?"), "Trip_ Tokyo _ Kyoto _ 2026_"); + assert_eq!(clean_album_name("..hidden.."), "hidden"); + assert_eq!(clean_album_name("..."), ""); + assert_eq!(clean_album_name(" "), ""); + + // Expand variables with fixed date/time: 2026-11-05 14:30 + let fixed_time = chrono::NaiveDate::from_ymd_opt(2026, 11, 5).unwrap().and_hms_opt(14, 30, 0); + assert_eq!(expand_subfolder("{album}", Some("Vacation"), fixed_time), "Vacation"); + assert_eq!(expand_subfolder("{album}", None, fixed_time), ""); + assert_eq!(expand_subfolder("{date}", None, fixed_time), "20261105"); + assert_eq!(expand_subfolder("{hour}", None, fixed_time), "1430"); + assert_eq!(expand_subfolder("{album}/{date}_{hour}", Some("Portraits / 2026"), fixed_time), "Portraits _ 2026/20261105_1430"); + assert_eq!(expand_subfolder("Exports/{album}/{date}", None, fixed_time), "Exports/20261105"); + + // Presets save and restore subfolder with variables intact + let mut s = Session::with_demo(); + s.execute( + "export.savePreset", + &json!({ + "name": "Date & Album", + "params": { + "format": "jpeg", + "subfolder": "{album}/{date}_{hour}" + } + }), + ) + .unwrap(); + let loaded = s.export_params(&json!({"preset": "Date & Album"})).unwrap(); + assert_eq!(loaded["subfolder"], "{album}/{date}_{hour}"); + let opts = ExportOptions::from_json(&loaded); + assert_eq!(opts.subfolder, "{album}/{date}_{hour}"); + + // Export batch with active album view + let id = s.active().unwrap(); + let album_id = s.execute("album.create", &json!({"name": "Holiday: Spain", "addSelected": true})).unwrap()["id"].as_u64().unwrap(); + s.source = crate::LibrarySource::Album(lightcraft_catalog::AlbumId(album_id)); + + let to = Destination { dir: "out".into(), exact: None }; + let mut written = Vec::new(); + let mut write = |p: &str, _: &[u8]| { + written.push(p.to_string()); + Ok(()) + }; + export_batch(&mut s, &[id], &opts, &to, &mut write, &|_| false).unwrap(); + assert_eq!(written.len(), 1); + assert!(written[0].starts_with("out/Holiday_ Spain/"), "actual: {}", written[0]); +} + #[test] fn prepared_exports_run_on_another_thread() { fn send(_: &T) {} diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 91d9dd2611e..13e04cf077a 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1763,11 +1763,36 @@ fn export_destination_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Token }); }); } + let subfolder_id = egui::Id::unique("export-subfolder"); field(ui, "Subfolder", |ui| { - crate::widgets::named( - ui.add(egui::TextEdit::singleline(&mut opts.subfolder).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), - crate::i18n::tr("Subfolder"), - ) + trailing_button_row(ui, |ui| { + let mut chosen = None; + let c = crate::widgets::combo_box("exportSubfolderTags").width(90.0).selected_text(crate::i18n::tr("Insert…")).show_ui(ui, |ui| { + if ui.selectable_label(false, "{album}").on_hover_text(crate::i18n::tr("Album name")).clicked() { + chosen = Some("{album}"); + } + if ui.selectable_label(false, "{date}").on_hover_text(crate::i18n::tr("Date (YYYYMMDD)")).clicked() { + chosen = Some("{date}"); + } + if ui.selectable_label(false, "{hour}").on_hover_text(crate::i18n::tr("Hour (hhmm)")).clicked() { + chosen = Some("{hour}"); + } + }); + crate::widgets::name_combo(&c.response, crate::i18n::tr("Insert variable")); + crate::widgets::register(ui, "combo:exportSubfolderTags", c.response.rect); + if let Some(tag) = chosen { + crate::import::insert_at_cursor(ui.ctx(), subfolder_id, &mut opts.subfolder, tag); + } + crate::widgets::named( + ui.add( + egui::TextEdit::singleline(&mut opts.subfolder) + .id(subfolder_id) + .hint_text(crate::i18n::tr("none")) + .desired_width(ui.available_width()), + ), + crate::i18n::tr("Subfolder"), + ); + }); }); use lightcraft_engine::export::Conflict as K; choices(ui, "If file exists", "exportConflict", &[(K::Unique, "Add number"), (K::Overwrite, "Overwrite"), (K::Skip, "Skip")], &mut opts.conflict); diff --git a/crates/ui-egui/src/dialogs/import.rs b/crates/ui-egui/src/dialogs/import.rs index 4336e5e82f4..b8e142f264b 100644 --- a/crates/ui-egui/src/dialogs/import.rs +++ b/crates/ui-egui/src/dialogs/import.rs @@ -42,7 +42,7 @@ pub(crate) use scan::cards_seen; #[cfg(test)] pub(crate) use scan::{HELD_RESOLVES, ScanEnd, scan_by_hand, stall_scan, stall_scan_of}; pub use scan::{ScanTask, browse, open, poll_scan, running}; -pub(crate) use tags::{tag_field_width, tag_help, tag_toggle, unknown_tags_warning}; +pub(crate) use tags::{insert_at_cursor, tag_field_width, tag_help, tag_toggle, unknown_tags_warning}; pub use task::{ImportTask, start, start_paths, tick}; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] diff --git a/crates/ui-egui/src/tests/dialogs.rs b/crates/ui-egui/src/tests/dialogs.rs index f380963ef25..820d5a7121c 100644 --- a/crates/ui-egui/src/tests/dialogs.rs +++ b/crates/ui-egui/src/tests/dialogs.rs @@ -150,6 +150,18 @@ fn a_click_outside_an_open_dropdown_keeps_the_dialog() { assert!(h.app.ui.dialog.is_some(), "but not the dialog"); } +#[test] +fn export_subfolder_variable_dropdown() { + let mut h = demo([1400.0, 1000.0], json!({"view": "detail", "right": "edit"})); + h.app.run("dialog.export", json!({})).unwrap(); + h.step(); + h.step(); + let r = h.request("ui.clickWidget", json!({"id": "combo:exportSubfolderTags"}), T); + assert_eq!(r["ok"], true, "{r}"); + h.step(); + assert!(egui::Popup::is_any_open(&h.view.ctx), "the subfolder tags dropdown is open"); +} + #[test] fn modal_dialogs_close_background_menus() { let mut h = demo([1400.0, 1000.0], json!({"view": "detail", "right": "edit"})); From ebabbfc036b5bb06a44c7365220b7dffaa9a1ad8 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 01:02:59 -0500 Subject: [PATCH 02/11] engine: move chrono to common dependencies for wasm support --- crates/engine/Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index a01f28510b6..9cbdcd913f0 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -43,12 +43,11 @@ harfrust = { version = "0.13", default-features = false, features = ["std"] } unicode-normalization = "0.1" unicode-segmentation = "1.13" lightcraft-segment = { workspace = true, optional = true } +chrono = { workspace = true } # model downloads run natively only (the web build fetches no models) [target.'cfg(not(target_arch = "wasm32"))'.dependencies] lightcraft-fetch = { workspace = true } -# capture-time parsing for face recognition (native only) -chrono = { workspace = true } # free space of the drive holding the preview cache (the low-disk alert; pure Rust: rustix / windows-sys) fs4 = { workspace = true } From fb4c77becb3fc726aebc60310c4a9a7b224d4b03 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 21:10:05 -0500 Subject: [PATCH 03/11] export: address PR review feedback for subfolder variables - clean_album_name: detect Windows-reserved device names (CON, PRN, AUX, NUL, COM1-9, LPT1-9) and append '_' - expand_subfolder: return early when template is empty or contains no tokens - expand_subfolder: expand {date} and {hour} before {album} to avoid token collision - expand_subfolder & prepare_batch: use web_time clock instead of std::time for wasm compatibility - folder_for: clean caller-supplied subfolder via clean_subfolder before joining - prepare_batch: hoist album lookup out of per-item loop - prepare_guarded: resolve {album} only in active album views, falling back to empty string - dialogs: use shared TextField::singleline with its context menu and Esc-to-restore behavior - dialogs: clarify tooltips (UTC, HHMM time) and hint text; name ComboBox for AccessKit - locales: add missing translation keys across all 17 catalogs - tests: extend engine batch tests (multi-photo, Windows reserved names, double-expansion, empty album outside album view) - tests: extend UI dropdown tests (AccessKit role/label check, non-terminal cursor insertion, selection replacement) - docs: document subfolder variables in docs/whats-new.md and refresh parity-checklist.md --- .gitignore | 3 ++ crates/engine/src/export.rs | 6 ++-- crates/engine/src/export/place.rs | 51 +++++++++++++++++++++++++++-- crates/engine/src/export/prepare.rs | 23 ++++++++----- crates/engine/src/tests/export.rs | 51 +++++++++++++++++++++++++++++ crates/ui-egui/locales/cs.json | 8 ++++- crates/ui-egui/locales/de.json | 8 ++++- crates/ui-egui/locales/es.json | 8 ++++- crates/ui-egui/locales/fi.json | 8 ++++- crates/ui-egui/locales/fr.json | 8 ++++- crates/ui-egui/locales/id.json | 8 ++++- crates/ui-egui/locales/it.json | 8 ++++- crates/ui-egui/locales/ja.json | 8 ++++- crates/ui-egui/locales/ka.json | 8 ++++- crates/ui-egui/locales/pl.json | 8 ++++- crates/ui-egui/locales/pt-br.json | 8 ++++- crates/ui-egui/locales/ru.json | 8 ++++- crates/ui-egui/locales/sv.json | 8 ++++- crates/ui-egui/locales/uk.json | 8 ++++- crates/ui-egui/locales/vi.json | 8 ++++- crates/ui-egui/locales/zh-hans.json | 8 ++++- crates/ui-egui/locales/zh-hant.json | 8 ++++- crates/ui-egui/src/dialogs.rs | 23 ++++++------- crates/ui-egui/src/tests/dialogs.rs | 48 +++++++++++++++++++++++++++ docs/parity-checklist.md | 8 ++--- docs/whats-new.md | 3 ++ 26 files changed, 305 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index c88ace5fa4e..5f9853a8ff5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ plan/ # Python tools import their public operator family. __pycache__/ + +# Scratch / agent action plans +bdu-todo-actions.md diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 1f350d2cdb8..2c585cd0087 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -74,8 +74,10 @@ pub struct ExportOptions { pub start_number: u32, /// A specific folder for the whole batch, or each photo's own folder. pub destination_mode: DestinationMode, - /// Created inside the destination folder (empty = none). Supports `{album}` (current album - /// name), `{date}` (YYYYMMDD) and `{hour}` (hhmm) variables, expanded at export time. + /// Created inside the destination folder (empty = none). Supports `{album}`, `{date}` + /// (YYYYMMDD, UTC) and `{hour}` (HHMM, UTC) variables, expanded during batch preparation + /// once per batch using the active album view (or empty outside an album view). Presets store + /// the raw template. pub subfolder: String, /// When a file of the same name exists in the destination folder. pub conflict: Conflict, diff --git a/crates/engine/src/export/place.rs b/crates/engine/src/export/place.rs index 698b1c5e7bc..4d0ada597a7 100644 --- a/crates/engine/src/export/place.rs +++ b/crates/engine/src/export/place.rs @@ -69,6 +69,11 @@ pub fn clean_subfolder(s: &str) -> String { } /// Clean an album name so it is safe to use as a directory or path component. +/// +/// Characters `/ \ : * ? " < > | \0` and control characters become `_`, and surrounding +/// whitespace and dots are trimmed. Windows-reserved device names (`CON`, `PRN`, `AUX`, `NUL`, +/// `COM1`–`COM9`, `LPT1`–`LPT9`, case-insensitive) get `_` appended so they remain usable directory +/// components. The result may be empty if the album name consisted entirely of dots or whitespace. pub fn clean_album_name(album: &str) -> String { let mut s: String = album .chars() @@ -81,14 +86,54 @@ pub fn clean_album_name(album: &str) -> String { } s = trimmed.to_string(); } + let base = s.split('.').next().unwrap_or(&s); + if matches!( + base.to_ascii_uppercase().as_str(), + "CON" + | "PRN" + | "AUX" + | "NUL" + | "COM1" + | "COM2" + | "COM3" + | "COM4" + | "COM5" + | "COM6" + | "COM7" + | "COM8" + | "COM9" + | "LPT1" + | "LPT2" + | "LPT3" + | "LPT4" + | "LPT5" + | "LPT6" + | "LPT7" + | "LPT8" + | "LPT9" + ) { + s.push('_'); + } s } /// Expand `{album}`, `{date}`, `{hour}` variables in a subfolder template, and clean the result /// so it stays safely inside the destination folder. +/// +/// `{date}` and `{hour}` are expanded before `{album}`, so an album name that contains token-like +/// text (such as `{date}` or `{hour}`) is never double-expanded. +/// +/// - `album`: the active album name, cleaned with [`clean_album_name`]; `None` expands `{album}` to `""`. +/// - `now`: the UTC timestamp for `{date}` (YYYYMMDD) and `{hour}` (HHMM); `None` uses current UTC time. +/// - Unknown tokens are left unchanged. The result passes through [`clean_subfolder`]. +/// +/// Returns immediately without timestamp formatting or album lookup if `template` is empty or has no `{`. pub fn expand_subfolder(template: &str, album: Option<&str>, now: Option) -> String { + if template.is_empty() || !template.contains('{') { + return clean_subfolder(template); + } let now = now.unwrap_or_else(|| { - let since = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default(); + let since = web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap_or_default(); let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX); chrono::DateTime::from_timestamp(secs, 0).map(|dt| dt.naive_utc()).unwrap_or_default() }); @@ -96,7 +141,7 @@ pub fn expand_subfolder(template: &str, album: Option<&str>, now: Option Placer<'a> { d.to_string() } }; - let sub = subfolder.map(str::to_string).unwrap_or_else(|| expand_subfolder(&self.o.subfolder, None, None)); + let sub = subfolder.map(clean_subfolder).unwrap_or_else(|| expand_subfolder(&self.o.subfolder, None, None)); Ok(if sub.is_empty() { base } else { join_path(&base, &sub) }) } diff --git a/crates/engine/src/export/prepare.rs b/crates/engine/src/export/prepare.rs index f26c32da71b..126c40aa977 100644 --- a/crates/engine/src/export/prepare.rs +++ b/crates/engine/src/export/prepare.rs @@ -44,6 +44,8 @@ pub struct PreparedExport { /// The folder of the photo's original on disk ([`DestinationMode::SameAsOriginal`]); `None` /// for a demo photo or one in the browser's storage. pub source_dir: Option, + /// The already-expanded, cleaned subfolder path for this item. Resolved once per batch at + /// preparation time; no raw variable tokens are present. pub subfolder: String, work: Work, /// The library's originals, which [`run_batch`] never writes over (shared by a batch). @@ -89,16 +91,24 @@ pub fn prepare_export( seq: usize, ) -> Result { let guard = std::sync::Arc::new(session.original_guard()); - prepare_guarded(session, id, o, seq, guard, None) + let album_name = match session.source { + crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()), + _ => None, + }; + prepare_guarded(session, id, o, seq, guard, None, album_name.as_deref()) } /// [`prepare_export`] for each of `ids` in order (`{seq}` = position, from 1). pub fn prepare_batch(session: &mut crate::Session, ids: &[lightcraft_catalog::PhotoId], o: &ExportOptions) -> Result, String> { let guard = std::sync::Arc::new(session.original_guard()); - let since = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default(); + let since = web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap_or_default(); let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX); let now = chrono::DateTime::from_timestamp(secs, 0).map(|dt| dt.naive_utc()); - ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone(), now)).collect() + let album_name = match session.source { + crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()), + _ => None, + }; + ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone(), now, album_name.as_deref())).collect() } fn prepare_guarded( @@ -108,15 +118,12 @@ fn prepare_guarded( seq: usize, guard: std::sync::Arc, now: Option, + album: Option<&str>, ) -> Result { let p = session.catalog.photo(id).ok_or("no such photo")?; let file_name = o.file_name_for(p, seq); let source_dir = original_folder(&p.source); - let album_name = match session.source { - crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()), - _ => session.catalog.albums_of(id).first().and_then(|&aid| session.catalog.album(aid)).map(|a| a.name.clone()), - }; - let subfolder = super::place::expand_subfolder(&o.subfolder, album_name.as_deref(), now); + let subfolder = super::place::expand_subfolder(&o.subfolder, album, now); // HDR output only for photos edited in HDR; the rest of the batch exports as usual let sdr_opts; let o = if o.hdr && !p.develop.hdr.enabled { diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index 30d65d12ce5..22be197bdbe 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -290,6 +290,17 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(clean_album_name("..hidden.."), "hidden"); assert_eq!(clean_album_name("..."), ""); assert_eq!(clean_album_name(" "), ""); + // Windows reserved device names + assert_eq!(clean_album_name("CON"), "CON_"); + assert_eq!(clean_album_name("con"), "con_"); + assert_eq!(clean_album_name("PRN"), "PRN_"); + assert_eq!(clean_album_name("AUX"), "AUX_"); + assert_eq!(clean_album_name("NUL"), "NUL_"); + assert_eq!(clean_album_name("COM1"), "COM1_"); + assert_eq!(clean_album_name("com9"), "com9_"); + assert_eq!(clean_album_name("LPT1"), "LPT1_"); + assert_eq!(clean_album_name("lpt9"), "lpt9_"); + assert_eq!(clean_album_name("NUL.tar.gz"), "NUL.tar.gz_"); // Expand variables with fixed date/time: 2026-11-05 14:30 let fixed_time = chrono::NaiveDate::from_ymd_opt(2026, 11, 5).unwrap().and_hms_opt(14, 30, 0); @@ -300,6 +311,11 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(expand_subfolder("{album}/{date}_{hour}", Some("Portraits / 2026"), fixed_time), "Portraits _ 2026/20261105_1430"); assert_eq!(expand_subfolder("Exports/{album}/{date}", None, fixed_time), "Exports/20261105"); + // Token replacement order: album named literally {date} or {hour} is not double-expanded + assert_eq!(expand_subfolder("{album}", Some("{date}"), fixed_time), "{date}"); + assert_eq!(expand_subfolder("{album}/{date}", Some("{date}"), fixed_time), "{date}/20261105"); + assert_eq!(expand_subfolder("{album}/{hour}", Some("{hour}"), fixed_time), "{hour}/1430"); + // Presets save and restore subfolder with variables intact let mut s = Session::with_demo(); s.execute( @@ -332,6 +348,41 @@ fn subfolder_variables_expansion_and_presets() { export_batch(&mut s, &[id], &opts, &to, &mut write, &|_| false).unwrap(); assert_eq!(written.len(), 1); assert!(written[0].starts_with("out/Holiday_ Spain/"), "actual: {}", written[0]); + assert!(!written[0].contains("{date}"), "date not expanded: {}", written[0]); + assert!(!written[0].contains("{hour}"), "hour not expanded: {}", written[0]); + + // Multi-photo batch: verify both photos resolve date and hour, use the exact same batch timestamp + // and do not cross minute boundaries + let mut written_multi = Vec::new(); + let mut write_multi = |p: &str, _: &[u8]| { + written_multi.push(p.to_string()); + Ok(()) + }; + export_batch(&mut s, &[id, id], &opts, &to, &mut write_multi, &|_| false).unwrap(); + assert_eq!(written_multi.len(), 2); + // Both items must have identical subfolder paths + let sub0 = written_multi[0].strip_prefix("out/Holiday_ Spain/").unwrap_or(""); + let sub1 = written_multi[1].strip_prefix("out/Holiday_ Spain/").unwrap_or(""); + let dir0 = sub0.split('/').next().unwrap_or(""); + let dir1 = sub1.split('/').next().unwrap_or(""); + assert_eq!(dir0, dir1, "batch items must share the exact same timestamp subfolder"); + let (d, h) = dir0.split_once('_').unwrap_or(("", "")); + assert_eq!(d.len(), 8, "date segment must be YYYYMMDD (8 digits): {d}"); + assert_eq!(h.len(), 4, "hour segment must be HHMM (4 digits): {h}"); + assert!(d.chars().all(|c| c.is_ascii_digit()), "date must be digits: {d}"); + assert!(h.chars().all(|c| c.is_ascii_digit()), "hour must be digits: {h}"); + + // Outside album view: {album} expands to empty string, not an arbitrary first album + s.source = crate::LibrarySource::All; + let mut written_outside = Vec::new(); + let mut write_outside = |p: &str, _: &[u8]| { + written_outside.push(p.to_string()); + Ok(()) + }; + export_batch(&mut s, &[id], &opts, &to, &mut write_outside, &|_| false).unwrap(); + assert_eq!(written_outside.len(), 1); + assert!(!written_outside[0].contains("Holiday"), "outside album view should not use album name: {}", written_outside[0]); + assert!(!written_outside[0].contains("//"), "clean_subfolder prevents double slashes: {}", written_outside[0]); } #[test] diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index ea102192177..566122b6472 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -2472,5 +2472,11 @@ "Welcome": "Vítejte", "Next": "Další", "Get Started": "Začít", - "Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie" + "Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index bc67606eb61..5f98c3299f3 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -3507,5 +3507,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Starten Sie die App mit --control 7980 (oder LIGHTCRAFT_CONTROL_PORT), dann verbindet lightcraft-cli mcp --connect einen Agenten mit ihr.", "Welcome": "Willkommen", "Next": "Weiter", - "Get Started": "Loslegen" + "Get Started": "Loslegen", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index c34057bdfe5..875dbefde0f 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2426,5 +2426,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Inicia la aplicación con --control 7980 (o LIGHTCRAFT_CONTROL_PORT), y lightcraft-cli mcp --connect conecta un agente a ella.", "Welcome": "Bienvenido", "Next": "Siguiente", - "Get Started": "Empezar" + "Get Started": "Empezar", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index 59cc611cd61..b8bb88ede50 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -2383,5 +2383,11 @@ "Top bar": "Yläpalkki", "Tool strip": "Työkalupalkki", "Bottom bar": "Alapalkki", - "Stopped at the scan limit: there may be more photos": "Skannauksen raja saavutettiin: valokuvia voi olla lisää" + "Stopped at the scan limit: there may be more photos": "Skannauksen raja saavutettiin: valokuvia voi olla lisää", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index 31e6814b6d5..803442a71ad 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -3609,5 +3609,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Démarrez l'application avec --control 7980 (ou LIGHTCRAFT_CONTROL_PORT), puis lightcraft-cli mcp --connect y connecte un agent.", "Welcome": "Bienvenue", "Next": "Suivant", - "Get Started": "Commencer" + "Get Started": "Commencer", + "Album name (empty outside an album view)": "Nom de l'album (vide hors vue d'album)", + "Export date, UTC (YYYYMMDD)": "Date d'export, UTC (AAAAMMJJ)", + "Export time, UTC (HHMM)": "Heure d'export, UTC (HHMM)", + "Insert variable": "Insérer une variable", + "Insert…": "Insérer…", + "none ({album}, {date}, {hour})": "aucun ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index 52705328cc7..cc9a467a368 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -2397,5 +2397,11 @@ "Top bar": "Bilah atas", "Tool strip": "Bilah alat", "Bottom bar": "Bilah bawah", - "Stopped at the scan limit: there may be more photos": "Berhenti pada batas pemindaian: mungkin masih ada foto" + "Stopped at the scan limit: there may be more photos": "Berhenti pada batas pemindaian: mungkin masih ada foto", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index 5b0ccc0cee0..939156bb38f 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2590,5 +2590,11 @@ "Welcome": "Benvenuto", "Next": "Avanti", "Get Started": "Inizia", - "Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto" + "Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index 97c15dd0191..9abace39516 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -2424,5 +2424,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "アプリを --control 7980 (または LIGHTCRAFT_CONTROL_PORT) で起動してから、lightcraft-cli mcp --connect でエージェントを接続できます。", "Welcome": "ようこそ", "Next": "次へ", - "Get Started": "始める" + "Get Started": "始める", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index 30769b60fa1..9adbfad71db 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -3692,5 +3692,11 @@ "Tool strip": "ხელსაწყოების ზოლი", "Bottom bar": "ქვედა ზოლი", "Prevent G-SYNC/FreeSync flicker (applies at next launch)": "G-SYNC/FreeSync-ის ციმციმის თავიდან აცილება (ამოქმედდება შემდეგი გაშვებისას)", - "Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის" + "Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index dbc29a19417..4ddbbe80fd4 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -2348,5 +2348,11 @@ "Welcome": "Witamy", "Next": "Dalej", "Get Started": "Zaczynamy", - "Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć" + "Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index 3aedd829064..da1ba40a13c 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -2270,5 +2270,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Inicie o aplicativo com --control 7980 (ou LIGHTCRAFT_CONTROL_PORT) e o lightcraft-cli mcp --connect conecta um agente a ele.", "Welcome": "Bem-vindo", "Next": "Próximo", - "Get Started": "Começar" + "Get Started": "Começar", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index b3df02470e3..559264e16f8 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -2632,5 +2632,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Запустите приложение с --control 7980 (или LIGHTCRAFT_CONTROL_PORT), и команда lightcraft-cli mcp --connect подключит к нему одного агента.", "Welcome": "Добро пожаловать", "Next": "Далее", - "Get Started": "Начать" + "Get Started": "Начать", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 94b9e303338..25cd7a5fba0 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -2486,5 +2486,11 @@ "Top bar": "Övre fältet", "Tool strip": "Verktygsfält", "Bottom bar": "Nedre fältet", - "Stopped at the scan limit: there may be more photos": "Stoppade vid skanningsgränsen: det kan finnas fler foton" + "Stopped at the scan limit: there may be more photos": "Stoppade vid skanningsgränsen: det kan finnas fler foton", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index 09b78fab1e3..451a94f04b5 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2422,5 +2422,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Запустіть програму з --control 7980 (або LIGHTCRAFT_CONTROL_PORT), і lightcraft-cli mcp --connect під'єднає до неї одного агента.", "Welcome": "Ласкаво просимо", "Next": "Далі", - "Get Started": "Почати" + "Get Started": "Почати", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index af27e9aa0ab..c8a58b4da25 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -2711,5 +2711,11 @@ "Top bar": "Thanh trên cùng", "Tool strip": "Thanh công cụ", "Bottom bar": "Thanh dưới cùng", - "Stopped at the scan limit: there may be more photos": "Đã dừng ở giới hạn quét: có thể còn ảnh khác" + "Stopped at the scan limit: there may be more photos": "Đã dừng ở giới hạn quét: có thể còn ảnh khác", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index ca13d782a5e..9cf562ec277 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -2425,5 +2425,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "先以 --control 7980 (或 LIGHTCRAFT_CONTROL_PORT) 启动应用,lightcraft-cli mcp --connect 即可将一个智能体接入其中。", "Welcome": "欢迎", "Next": "下一步", - "Get Started": "开始使用" + "Get Started": "开始使用", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index f3dfc422ec3..1dfc6b6498e 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -2426,5 +2426,11 @@ "Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "先以 --control 7980 (或 LIGHTCRAFT_CONTROL_PORT) 啟動應用程式,lightcraft-cli mcp --connect 即可將一個代理程式連接到其中。", "Welcome": "歡迎", "Next": "下一步", - "Get Started": "開始使用" + "Get Started": "開始使用", + "Album name (empty outside an album view)": "Album name (empty outside an album view)", + "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", + "Insert variable": "Insert variable", + "Insert…": "Insert…", + "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 13e04cf077a..be2d5923d85 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1763,18 +1763,19 @@ fn export_destination_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Token }); }); } - let subfolder_id = egui::Id::unique("export-subfolder"); + let subfolder_widget = "field:exportSubfolder"; + let subfolder_id = crate::text_field::id(subfolder_widget); field(ui, "Subfolder", |ui| { trailing_button_row(ui, |ui| { let mut chosen = None; let c = crate::widgets::combo_box("exportSubfolderTags").width(90.0).selected_text(crate::i18n::tr("Insert…")).show_ui(ui, |ui| { - if ui.selectable_label(false, "{album}").on_hover_text(crate::i18n::tr("Album name")).clicked() { + if ui.selectable_label(false, "{album}").on_hover_text(crate::i18n::tr("Album name (empty outside an album view)")).clicked() { chosen = Some("{album}"); } - if ui.selectable_label(false, "{date}").on_hover_text(crate::i18n::tr("Date (YYYYMMDD)")).clicked() { + if ui.selectable_label(false, "{date}").on_hover_text(crate::i18n::tr("Export date, UTC (YYYYMMDD)")).clicked() { chosen = Some("{date}"); } - if ui.selectable_label(false, "{hour}").on_hover_text(crate::i18n::tr("Hour (hhmm)")).clicked() { + if ui.selectable_label(false, "{hour}").on_hover_text(crate::i18n::tr("Export time, UTC (HHMM)")).clicked() { chosen = Some("{hour}"); } }); @@ -1783,15 +1784,11 @@ fn export_destination_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Token if let Some(tag) = chosen { crate::import::insert_at_cursor(ui.ctx(), subfolder_id, &mut opts.subfolder, tag); } - crate::widgets::named( - ui.add( - egui::TextEdit::singleline(&mut opts.subfolder) - .id(subfolder_id) - .hint_text(crate::i18n::tr("none")) - .desired_width(ui.available_width()), - ), - crate::i18n::tr("Subfolder"), - ); + crate::text_field::TextField::singleline(subfolder_widget, &mut opts.subfolder) + .hint(crate::i18n::tr("none ({album}, {date}, {hour})")) + .label(crate::i18n::tr("Subfolder")) + .width(ui.available_width()) + .show(ui); }); }); use lightcraft_engine::export::Conflict as K; diff --git a/crates/ui-egui/src/tests/dialogs.rs b/crates/ui-egui/src/tests/dialogs.rs index 820d5a7121c..b4b5323f356 100644 --- a/crates/ui-egui/src/tests/dialogs.rs +++ b/crates/ui-egui/src/tests/dialogs.rs @@ -160,6 +160,54 @@ fn export_subfolder_variable_dropdown() { assert_eq!(r["ok"], true, "{r}"); h.step(); assert!(egui::Popup::is_any_open(&h.view.ctx), "the subfolder tags dropdown is open"); + + // Inspect AccessKit nodes to verify ComboBox role and localized accessible name + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + ctx.enable_accesskit(); + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| { + let c = crate::widgets::combo_box("exportSubfolderTags").width(90.0).selected_text(crate::i18n::tr("Insert…")).show_ui(ui, |_| {}); + crate::widgets::name_combo(&c.response, crate::i18n::tr("Insert variable")); + }); + out.textures_delta.clear(); + let update = out.platform_output.accesskit_update.expect("AccessKit update produced"); + let has_combo = update.nodes.iter().any(|(_, n)| format!("{:?}", n.role()) == "ComboBox" && n.label().unwrap_or_default() == "Insert variable"); + assert!(has_combo, "ComboBox has localized accessible name 'Insert variable'"); + + // Test text insertion and cursor behavior for subfolder field + let subfolder_id = crate::text_field::id("field:exportSubfolder"); + let mut text = String::from("prefix_suffix"); + // Place cursor at index 7 (after "prefix_") + let mut state = egui::text_edit::TextEditState::default(); + state.cursor.set_char_range(Some(egui::text::CCursorRange::one(egui::text::CCursor::new(7)))); + state.store(&h.view.ctx, subfolder_id); + + // Insert {date} at non-terminal cursor + crate::import::insert_at_cursor(&h.view.ctx, subfolder_id, &mut text, "{date}"); + assert_eq!(text, "prefix_{date}suffix"); + let loaded = egui::text_edit::TextEditState::load(&h.view.ctx, subfolder_id).unwrap(); + assert_eq!(loaded.cursor.char_range().unwrap().primary.index.0, 7 + "{date}".chars().count()); + + // Replace selected range with {album} + let mut state = egui::text_edit::TextEditState::default(); + state + .cursor + .set_char_range(Some(egui::text::CCursorRange::two(egui::text::CCursor::new(7), egui::text::CCursor::new(7 + "{date}".chars().count())))); + state.store(&h.view.ctx, subfolder_id); + crate::import::insert_at_cursor(&h.view.ctx, subfolder_id, &mut text, "{album}"); + assert_eq!(text, "prefix_{album}suffix"); + let loaded = egui::text_edit::TextEditState::load(&h.view.ctx, subfolder_id).unwrap(); + assert_eq!(loaded.cursor.char_range().unwrap().primary.index.0, 7 + "{album}".chars().count()); + + // Replace selection with {hour} + let mut state = egui::text_edit::TextEditState::default(); + state + .cursor + .set_char_range(Some(egui::text::CCursorRange::two(egui::text::CCursor::new(7), egui::text::CCursor::new(7 + "{album}".chars().count())))); + state.store(&h.view.ctx, subfolder_id); + crate::import::insert_at_cursor(&h.view.ctx, subfolder_id, &mut text, "{hour}"); + assert_eq!(text, "prefix_{hour}suffix"); } #[test] diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index bcdaada1cf3..027beb1a713 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -31,7 +31,7 @@ cited here still exists. Formerly docs/parity.md. | C. Views & navigation (VIEW) | 16 | 1 | 1 | 0 | 9/9 (100%) | 4/4 (100%) | | D. Search & filter (FILT) | 11 | 1 | 1 | 0 | 4/4 (100%) | 4/4 (100%) | | E. Metadata (META) | 5 | 1 | 0 | 0 | 2/2 (100%) | 2/2 (100%) | -| F. Edit panel — global adjustments (EDIT) | 41 | 5 | 3 | 1 | 25/28 (89%) | 13/14 (93%) | +| F. Edit panel — global adjustments (EDIT) | 42 | 5 | 3 | 1 | 25/28 (89%) | 14/15 (93%) | | G. Profiles (PROF) | 7 | 1 | 3 | 0 | 3/4 (75%) | 3/3 (100%) | | H. Crop & rotate (CROP) | 10 | 1 | 0 | 1 | 8/8 (100%) | 2/3 (67%) | | I. Remove / healing (REM) | 8 | 1 | 2 | 2 | 4/4 (100%) | 2/3 (67%) | @@ -51,11 +51,11 @@ cited here still exists. Formerly docs/parity.md. | W. Cloud & AI infrastructure (CLOUD / AI) | 1 | 0 | 1 | 2 | — | — | | X. Cross-cutting behaviours (BEHAV) | 23 | 6 | 1 | 1 | 8/8 (100%) | 7/10 (70%) | | Y. Menus | 85 | 0 | 4 | 8 | 47/47 (100%) | 23/23 (100%) | -| Z. Keyboard shortcuts (desktop) | 78 | 4 | 2 | 1 | 49/52 (94%) | 24/26 (92%) | +| Z. Keyboard shortcuts (desktop) | 77 | 5 | 2 | 1 | 49/52 (94%) | 24/26 (92%) | | Lightroom Classic extras | 41 | 26 | 21 | 8 | — | 24/27 (89%) | -| **Total** | 417 | 70 | 57 | 35 | 192/203 (95%) | 146/162 (90%) | +| **Total** | 418 | 70 | 57 | 35 | 193/203 (95%) | 147/163 (90%) | -Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **83.1%** of 544 in-scope rows — P0 97.3% of 203 · P1 94.1% of 162 · P2 56.7% of 178. +Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **83.1%** of 545 in-scope rows — P0 97.5% of 203 · P1 94.2% of 163 · P2 56.5% of 178. ## Top gaps and shortcut notes diff --git a/docs/whats-new.md b/docs/whats-new.md index c0b75f74c62..16dcf40a9d8 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -2,6 +2,9 @@ ## Unreleased +### Export subfolder variables +- The Export dialog's Subfolder field now supports `{album}` (the active album's name, empty outside an album view), `{date}` (export date in YYYYMMDD, UTC), and `{hour}` (export time in HHMM, UTC). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use. + ### The web build can be embedded - A page framing LightCraft in an iframe can open it with `?host=parent` and speak to it over `postMessage`, the protocol PdfCraft, GridCraft and DeckCraft share: it hands photos in, receives exports and backups instead of From 7e17abda35b58d8c4e7de1682a3bcdf2145ee60a Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 21:14:06 -0500 Subject: [PATCH 04/11] gitignore: ignore bdu scratch files and action plans --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5f9853a8ff5..96552626ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ plan/ __pycache__/ # Scratch / agent action plans -bdu-todo-actions.md +bdu-*.md From 131f98fe1d7726e9b4aeb0d589cf1dc0722e1e81 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 21:17:36 -0500 Subject: [PATCH 05/11] export: insert '_' after base for Windows device names and recognize superscripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - clean_album_name: insert '_' after base name (e.g. con.txt -> con_.txt) so Windows device names remain valid directories - clean_album_name: recognize Unicode superscript device forms (COM¹-COM³, LPT¹-LPT³) - tests: add tests for reserved names with extensions and superscript digits --- crates/engine/src/export/place.rs | 16 ++++++++++++---- crates/engine/src/tests/export.rs | 9 +++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/export/place.rs b/crates/engine/src/export/place.rs index 4d0ada597a7..68cf6a733cf 100644 --- a/crates/engine/src/export/place.rs +++ b/crates/engine/src/export/place.rs @@ -72,8 +72,9 @@ pub fn clean_subfolder(s: &str) -> String { /// /// Characters `/ \ : * ? " < > | \0` and control characters become `_`, and surrounding /// whitespace and dots are trimmed. Windows-reserved device names (`CON`, `PRN`, `AUX`, `NUL`, -/// `COM1`–`COM9`, `LPT1`–`LPT9`, case-insensitive) get `_` appended so they remain usable directory -/// components. The result may be empty if the album name consisted entirely of dots or whitespace. +/// `COM1`–`COM9`, `LPT1`–`LPT9`, plus superscript forms `COM¹`–`COM³`, `LPT¹`–`LPT³`, case-insensitive) +/// get `_` inserted after the base component so they remain usable directory components. The result +/// may be empty if the album name consisted entirely of dots or whitespace. pub fn clean_album_name(album: &str) -> String { let mut s: String = album .chars() @@ -87,8 +88,9 @@ pub fn clean_album_name(album: &str) -> String { s = trimmed.to_string(); } let base = s.split('.').next().unwrap_or(&s); + let upper = base.to_uppercase(); if matches!( - base.to_ascii_uppercase().as_str(), + upper.as_str(), "CON" | "PRN" | "AUX" @@ -111,8 +113,14 @@ pub fn clean_album_name(album: &str) -> String { | "LPT7" | "LPT8" | "LPT9" + | "COM¹" + | "COM²" + | "COM³" + | "LPT¹" + | "LPT²" + | "LPT³" ) { - s.push('_'); + s.insert(base.len(), '_'); } s } diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index 22be197bdbe..4dfcb357f90 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -290,9 +290,10 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(clean_album_name("..hidden.."), "hidden"); assert_eq!(clean_album_name("..."), ""); assert_eq!(clean_album_name(" "), ""); - // Windows reserved device names + // Windows reserved device names (bare and with extension, ASCII and superscript) assert_eq!(clean_album_name("CON"), "CON_"); assert_eq!(clean_album_name("con"), "con_"); + assert_eq!(clean_album_name("con.txt"), "con_.txt"); assert_eq!(clean_album_name("PRN"), "PRN_"); assert_eq!(clean_album_name("AUX"), "AUX_"); assert_eq!(clean_album_name("NUL"), "NUL_"); @@ -300,7 +301,11 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(clean_album_name("com9"), "com9_"); assert_eq!(clean_album_name("LPT1"), "LPT1_"); assert_eq!(clean_album_name("lpt9"), "lpt9_"); - assert_eq!(clean_album_name("NUL.tar.gz"), "NUL.tar.gz_"); + assert_eq!(clean_album_name("NUL.tar.gz"), "NUL_.tar.gz"); + assert_eq!(clean_album_name("COM¹"), "COM¹_"); + assert_eq!(clean_album_name("com²"), "com²_"); + assert_eq!(clean_album_name("lpt³"), "lpt³_"); + assert_eq!(clean_album_name("com¹.backup"), "com¹_.backup"); // Expand variables with fixed date/time: 2026-11-05 14:30 let fixed_time = chrono::NaiveDate::from_ymd_opt(2026, 11, 5).unwrap().and_hms_opt(14, 30, 0); From 7eae4e981ae6bc4227822d6849021875e6c11a07 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 21:31:21 -0500 Subject: [PATCH 06/11] i18n: provide native translations for subfolder variable keys across all catalogs --- crates/ui-egui/locales/cs.json | 12 ++++++------ crates/ui-egui/locales/de.json | 12 ++++++------ crates/ui-egui/locales/es.json | 12 ++++++------ crates/ui-egui/locales/fi.json | 12 ++++++------ crates/ui-egui/locales/fr.json | 2 +- crates/ui-egui/locales/id.json | 12 ++++++------ crates/ui-egui/locales/it.json | 12 ++++++------ crates/ui-egui/locales/ja.json | 12 ++++++------ crates/ui-egui/locales/ka.json | 12 ++++++------ crates/ui-egui/locales/pl.json | 12 ++++++------ crates/ui-egui/locales/pt-br.json | 12 ++++++------ crates/ui-egui/locales/ru.json | 12 ++++++------ crates/ui-egui/locales/sv.json | 12 ++++++------ crates/ui-egui/locales/uk.json | 12 ++++++------ crates/ui-egui/locales/vi.json | 12 ++++++------ crates/ui-egui/locales/zh-hans.json | 12 ++++++------ crates/ui-egui/locales/zh-hant.json | 12 ++++++------ 17 files changed, 97 insertions(+), 97 deletions(-) diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index 566122b6472..0250b7ca9dc 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -2473,10 +2473,10 @@ "Next": "Další", "Get Started": "Začít", "Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Název alba (prázdné mimo zobrazení alba)", + "Export date, UTC (YYYYMMDD)": "Datum exportu, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Čas exportu, UTC (HHMM)", + "Insert variable": "Vložit proměnnou", + "Insert…": "Vložit…", + "none ({album}, {date}, {hour})": "žádné ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index 5f98c3299f3..53472a2de96 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -3508,10 +3508,10 @@ "Welcome": "Willkommen", "Next": "Weiter", "Get Started": "Loslegen", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Albumname (leer außerhalb einer Albumansicht)", + "Export date, UTC (YYYYMMDD)": "Exportdatum, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Exportzeit, UTC (HHMM)", + "Insert variable": "Variable einfügen", + "Insert…": "Einfügen…", + "none ({album}, {date}, {hour})": "keine ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index 875dbefde0f..c17c9430b2a 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2427,10 +2427,10 @@ "Welcome": "Bienvenido", "Next": "Siguiente", "Get Started": "Empezar", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Nombre del álbum (vacío fuera de una vista de álbum)", + "Export date, UTC (YYYYMMDD)": "Fecha de exportación, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Hora de exportación, UTC (HHMM)", + "Insert variable": "Insertar variable", + "Insert…": "Insertar…", + "none ({album}, {date}, {hour})": "ninguno ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index b8bb88ede50..cf2f9824d16 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -2384,10 +2384,10 @@ "Tool strip": "Työkalupalkki", "Bottom bar": "Alapalkki", "Stopped at the scan limit: there may be more photos": "Skannauksen raja saavutettiin: valokuvia voi olla lisää", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Albumin nimi (tyhjä albumnäkymän ulkopuolella)", + "Export date, UTC (YYYYMMDD)": "Vientipäivämäärä, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Vientiaika, UTC (HHMM)", + "Insert variable": "Lisää muuttuja", + "Insert…": "Lisää…", + "none ({album}, {date}, {hour})": "ei mitään ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index 803442a71ad..f26b045faf1 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -3611,7 +3611,7 @@ "Next": "Suivant", "Get Started": "Commencer", "Album name (empty outside an album view)": "Nom de l'album (vide hors vue d'album)", - "Export date, UTC (YYYYMMDD)": "Date d'export, UTC (AAAAMMJJ)", + "Export date, UTC (YYYYMMDD)": "Date d'export, UTC (YYYYMMDD)", "Export time, UTC (HHMM)": "Heure d'export, UTC (HHMM)", "Insert variable": "Insérer une variable", "Insert…": "Insérer…", diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index cc9a467a368..897270819c7 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -2398,10 +2398,10 @@ "Tool strip": "Bilah alat", "Bottom bar": "Bilah bawah", "Stopped at the scan limit: there may be more photos": "Berhenti pada batas pemindaian: mungkin masih ada foto", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Nama album (kosong di luar tampilan album)", + "Export date, UTC (YYYYMMDD)": "Tanggal ekspor, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Waktu ekspor, UTC (HHMM)", + "Insert variable": "Sisipkan variabel", + "Insert…": "Sisipkan…", + "none ({album}, {date}, {hour})": "tidak ada ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index 939156bb38f..233408af1d1 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2591,10 +2591,10 @@ "Next": "Avanti", "Get Started": "Inizia", "Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Nome dell'album (vuoto fuori dalla vista album)", + "Export date, UTC (YYYYMMDD)": "Data di esportazione, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Ora di esportazione, UTC (HHMM)", + "Insert variable": "Inserisci variabile", + "Insert…": "Inserisci…", + "none ({album}, {date}, {hour})": "nessuno ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index 9abace39516..acd791da604 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -2425,10 +2425,10 @@ "Welcome": "ようこそ", "Next": "次へ", "Get Started": "始める", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "アルバム名(アルバム表示外では空)", + "Export date, UTC (YYYYMMDD)": "書き出し日、UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "書き出し時刻、UTC (HHMM)", + "Insert variable": "変数を挿入", + "Insert…": "挿入…", + "none ({album}, {date}, {hour})": "なし ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index 9adbfad71db..9ad2350947f 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -3693,10 +3693,10 @@ "Bottom bar": "ქვედა ზოლი", "Prevent G-SYNC/FreeSync flicker (applies at next launch)": "G-SYNC/FreeSync-ის ციმციმის თავიდან აცილება (ამოქმედდება შემდეგი გაშვებისას)", "Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "ალბომის სახელი (ცარიელია ალბომის ხედის გარეთ)", + "Export date, UTC (YYYYMMDD)": "ექსპორტის თარიღი, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "ექსპორტის დრო, UTC (HHMM)", + "Insert variable": "ცვლადის ჩასმა", + "Insert…": "ჩასმა…", + "none ({album}, {date}, {hour})": "არცერთი ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index 4ddbbe80fd4..9801648bf2e 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -2349,10 +2349,10 @@ "Next": "Dalej", "Get Started": "Zaczynamy", "Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Nazwa albumu (pusta poza widokiem albumu)", + "Export date, UTC (YYYYMMDD)": "Data eksportu, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Czas eksportu, UTC (HHMM)", + "Insert variable": "Wstaw zmienną", + "Insert…": "Wstaw…", + "none ({album}, {date}, {hour})": "brak ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index da1ba40a13c..1b471517abe 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -2271,10 +2271,10 @@ "Welcome": "Bem-vindo", "Next": "Próximo", "Get Started": "Começar", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Nome do álbum (vazio fora de uma visualização de álbum)", + "Export date, UTC (YYYYMMDD)": "Data de exportação, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Hora de exportação, UTC (HHMM)", + "Insert variable": "Inserir variável", + "Insert…": "Inserir…", + "none ({album}, {date}, {hour})": "nenhum ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index 559264e16f8..198dcce37b8 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -2633,10 +2633,10 @@ "Welcome": "Добро пожаловать", "Next": "Далее", "Get Started": "Начать", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Название альбома (пусто вне просмотра альбома)", + "Export date, UTC (YYYYMMDD)": "Дата экспорта, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Время экспорта, UTC (HHMM)", + "Insert variable": "Вставить переменную", + "Insert…": "Вставить…", + "none ({album}, {date}, {hour})": "нет ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 25cd7a5fba0..a9d273e38e8 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -2487,10 +2487,10 @@ "Tool strip": "Verktygsfält", "Bottom bar": "Nedre fältet", "Stopped at the scan limit: there may be more photos": "Stoppade vid skanningsgränsen: det kan finnas fler foton", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Albumnamn (tomt utanför en albumvy)", + "Export date, UTC (YYYYMMDD)": "Exportdatum, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Exporttid, UTC (HHMM)", + "Insert variable": "Infoga variabel", + "Insert…": "Infoga…", + "none ({album}, {date}, {hour})": "ingen ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index 451a94f04b5..4c0b357315a 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2423,10 +2423,10 @@ "Welcome": "Ласкаво просимо", "Next": "Далі", "Get Started": "Почати", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Назва альбому (порожньо поза переглядом альбому)", + "Export date, UTC (YYYYMMDD)": "Дата експорту, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Час експорту, UTC (HHMM)", + "Insert variable": "Вставити змінну", + "Insert…": "Вставити…", + "none ({album}, {date}, {hour})": "немає ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index c8a58b4da25..40ff480a337 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -2712,10 +2712,10 @@ "Tool strip": "Thanh công cụ", "Bottom bar": "Thanh dưới cùng", "Stopped at the scan limit: there may be more photos": "Đã dừng ở giới hạn quét: có thể còn ảnh khác", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "Tên album (trống ngoài chế độ xem album)", + "Export date, UTC (YYYYMMDD)": "Ngày xuất, UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "Giờ xuất, UTC (HHMM)", + "Insert variable": "Chèn biến", + "Insert…": "Chèn…", + "none ({album}, {date}, {hour})": "không có ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index 9cf562ec277..a24039292ff 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -2426,10 +2426,10 @@ "Welcome": "欢迎", "Next": "下一步", "Get Started": "开始使用", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "相册名称(在相册视图外为空)", + "Export date, UTC (YYYYMMDD)": "导出日期,UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "导出时间,UTC (HHMM)", + "Insert variable": "插入变量", + "Insert…": "插入…", + "none ({album}, {date}, {hour})": "无 ({album}, {date}, {hour})" } diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index 1dfc6b6498e..e02f1fefdc7 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -2427,10 +2427,10 @@ "Welcome": "歡迎", "Next": "下一步", "Get Started": "開始使用", - "Album name (empty outside an album view)": "Album name (empty outside an album view)", - "Export date, UTC (YYYYMMDD)": "Export date, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Export time, UTC (HHMM)", - "Insert variable": "Insert variable", - "Insert…": "Insert…", - "none ({album}, {date}, {hour})": "none ({album}, {date}, {hour})" + "Album name (empty outside an album view)": "相簿名稱(在相簿檢視外為空)", + "Export date, UTC (YYYYMMDD)": "匯出日期,UTC (YYYYMMDD)", + "Export time, UTC (HHMM)": "匯出時間,UTC (HHMM)", + "Insert variable": "插入變數", + "Insert…": "插入…", + "none ({album}, {date}, {hour})": "無 ({album}, {date}, {hour})" } From 948e35cce2306242ce30a5cc0302f5f3c54c42b1 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 21:52:26 -0500 Subject: [PATCH 07/11] docs: enrich subfolder variable documentation in user guide, whats-new, and place.rs --- crates/engine/src/export/place.rs | 2 ++ docs/user/guides/export-photos.md | 2 +- docs/whats-new.md | 5 +---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/export/place.rs b/crates/engine/src/export/place.rs index 68cf6a733cf..7d167a77fd8 100644 --- a/crates/engine/src/export/place.rs +++ b/crates/engine/src/export/place.rs @@ -135,6 +135,8 @@ pub fn clean_album_name(album: &str) -> String { /// - `now`: the UTC timestamp for `{date}` (YYYYMMDD) and `{hour}` (HHMM); `None` uses current UTC time. /// - Unknown tokens are left unchanged. The result passes through [`clean_subfolder`]. /// +/// E.g. `"{album}/{date}_{hour}"` with album `"Vacation"` produces `"Vacation/20261107_0230"`. +/// /// Returns immediately without timestamp formatting or album lookup if `template` is empty or has no `{`. pub fn expand_subfolder(template: &str, album: Option<&str>, now: Option) -> String { if template.is_empty() || !template.contains('{') { diff --git a/docs/user/guides/export-photos.md b/docs/user/guides/export-photos.md index c99d38da412..b1501097a8a 100644 --- a/docs/user/guides/export-photos.md +++ b/docs/user/guides/export-photos.md @@ -17,7 +17,7 @@ Select the photos, then choose **File** > **Export…**. Pick a format, a size a 6. Set **Color space** (**sRGB**, **P3**, **Adobe RGB**, **ProPhoto** or **Rec.2020**) if you need something other than the default. Lossy **JPEG XL** writes **Adobe RGB** and **ProPhoto** as **Rec.2020**. Tick **Lossless** to keep them. 7. Optional: set **Sharpen** for **Screen**, **Matte** or **Glossy** output, set **Metadata** to **All**, **No camera**, **Copyright** or **None**, and tick **Remove location info** or **Watermark**. 8. For **TIFF**, set **Compression** to **ZIP** (the default), **LZW** or **None**. **LZW** is usually larger and slower than **ZIP**, and at 16 bit it can be larger than **None**. Use it only if other software needs LZW. -9. Next to **Folder**, click **Choose…** and pick where the files go. **Subfolder** adds a folder inside it. +9. Next to **Folder**, click **Choose…** and pick where the files go. **Subfolder** adds a folder inside it. You can insert variables using the **Insert…** dropdown: `{album}` (active album name, sanitized for path safety or empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, UTC), and `{hour}` (batch export time in `HHMM`, UTC). Presets store raw tokens and expand them at export time. 10. Set **File name** to a template such as `{name}-{seq}`. Click **Tags** to see the tags you can insert. 11. Set **If file exists** to **Add number**, **Overwrite** or **Skip**. 12. On macOS, tick **Add to Apple Photos** to add the exported files to Photos as well. Type an **Album** name to put them in that album. The first time, macOS asks whether LightCraft may control Photos. diff --git a/docs/whats-new.md b/docs/whats-new.md index 3b052972f7e..ec1b389c086 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -3,10 +3,7 @@ ## Unreleased ### Export subfolder variables -- The Export dialog's Subfolder field now supports `{album}` (the active album's name, empty outside an album view), - `{date}` (export date in YYYYMMDD, UTC), and `{hour}` (export time in HHMM, UTC). An **Insert…** dropdown next to - the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset - produces dated subfolders on every use. +- The Export dialog's Subfolder field now supports `{album}` (active album name sanitized for filesystem safety, empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, UTC), and `{hour}` (batch export time in `HHMM`, UTC). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use. ### Colour noise reduction (process V6) - Colour noise reduction removes colour noise at the raw default 25, where it used to leave most of it, and keeps From 4f0c09fe241b0959fdbf3d6ba94bfa458a077c05 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 22:00:38 -0500 Subject: [PATCH 08/11] tests: split subfolder export tests into focused cases to satisfy cognitive complexity --- crates/engine/src/tests/export.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index c88fa43e460..745e1412516 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -281,10 +281,9 @@ fn a_subfolder_never_leaves_the_destination_folder() { } #[test] -fn subfolder_variables_expansion_and_presets() { - use crate::export::{Destination, clean_album_name, expand_subfolder, export_batch}; +fn clean_album_name_sanitizes_reserved_names_and_illegal_chars() { + use crate::export::clean_album_name; - // Album name cleaning assert_eq!(clean_album_name("Summer 2026"), "Summer 2026"); assert_eq!(clean_album_name("Trip: Tokyo / Kyoto * 2026?"), "Trip_ Tokyo _ Kyoto _ 2026_"); assert_eq!(clean_album_name("..hidden.."), "hidden"); @@ -306,8 +305,12 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(clean_album_name("com²"), "com²_"); assert_eq!(clean_album_name("lpt³"), "lpt³_"); assert_eq!(clean_album_name("com¹.backup"), "com¹_.backup"); +} + +#[test] +fn expand_subfolder_variables_and_ordering() { + use crate::export::expand_subfolder; - // Expand variables with fixed date/time: 2026-11-05 14:30 let fixed_time = chrono::NaiveDate::from_ymd_opt(2026, 11, 5).unwrap().and_hms_opt(14, 30, 0); assert_eq!(expand_subfolder("{album}", Some("Vacation"), fixed_time), "Vacation"); assert_eq!(expand_subfolder("{album}", None, fixed_time), ""); @@ -320,8 +323,10 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(expand_subfolder("{album}", Some("{date}"), fixed_time), "{date}"); assert_eq!(expand_subfolder("{album}/{date}", Some("{date}"), fixed_time), "{date}/20261105"); assert_eq!(expand_subfolder("{album}/{hour}", Some("{hour}"), fixed_time), "{hour}/1430"); +} - // Presets save and restore subfolder with variables intact +#[test] +fn export_presets_persist_subfolder_variables() { let mut s = Session::with_demo(); s.execute( "export.savePreset", @@ -338,6 +343,17 @@ fn subfolder_variables_expansion_and_presets() { assert_eq!(loaded["subfolder"], "{album}/{date}_{hour}"); let opts = ExportOptions::from_json(&loaded); assert_eq!(opts.subfolder, "{album}/{date}_{hour}"); +} + +#[test] +fn export_batch_subfolder_expansion_in_and_outside_album_view() { + use crate::export::{Destination, export_batch}; + + let mut s = Session::with_demo(); + let opts = ExportOptions::from_json(&json!({ + "format": "jpeg", + "subfolder": "{album}/{date}_{hour}" + })); // Export batch with active album view let id = s.active().unwrap(); From 2686638b1500edaf03bad7d4f77747bb527425a4 Mon Sep 17 00:00:00 2001 From: bd78 Date: Fri, 6 Nov 2026 22:23:07 -0500 Subject: [PATCH 09/11] docs: revert unreleased feature text in export user guide per docs/user/AGENTS.md --- docs/user/guides/export-photos.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/guides/export-photos.md b/docs/user/guides/export-photos.md index b1501097a8a..c99d38da412 100644 --- a/docs/user/guides/export-photos.md +++ b/docs/user/guides/export-photos.md @@ -17,7 +17,7 @@ Select the photos, then choose **File** > **Export…**. Pick a format, a size a 6. Set **Color space** (**sRGB**, **P3**, **Adobe RGB**, **ProPhoto** or **Rec.2020**) if you need something other than the default. Lossy **JPEG XL** writes **Adobe RGB** and **ProPhoto** as **Rec.2020**. Tick **Lossless** to keep them. 7. Optional: set **Sharpen** for **Screen**, **Matte** or **Glossy** output, set **Metadata** to **All**, **No camera**, **Copyright** or **None**, and tick **Remove location info** or **Watermark**. 8. For **TIFF**, set **Compression** to **ZIP** (the default), **LZW** or **None**. **LZW** is usually larger and slower than **ZIP**, and at 16 bit it can be larger than **None**. Use it only if other software needs LZW. -9. Next to **Folder**, click **Choose…** and pick where the files go. **Subfolder** adds a folder inside it. You can insert variables using the **Insert…** dropdown: `{album}` (active album name, sanitized for path safety or empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, UTC), and `{hour}` (batch export time in `HHMM`, UTC). Presets store raw tokens and expand them at export time. +9. Next to **Folder**, click **Choose…** and pick where the files go. **Subfolder** adds a folder inside it. 10. Set **File name** to a template such as `{name}-{seq}`. Click **Tags** to see the tags you can insert. 11. Set **If file exists** to **Add number**, **Overwrite** or **Skip**. 12. On macOS, tick **Add to Apple Photos** to add the exported files to Photos as well. Type an **Album** name to put them in that album. The first time, macOS asks whether LightCraft may control Photos. From ac7a66c1e5c630c429c3e07bed313ea71263ffd1 Mon Sep 17 00:00:00 2001 From: "Bruno D." Date: Tue, 17 Nov 2026 22:39:44 -0500 Subject: [PATCH 10/11] Drop an unrelated .gitignore entry from the export subfolder branch Co-Authored-By: Claude Opus 5.5 --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 96552626ed4..c88ace5fa4e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,3 @@ plan/ # Python tools import their public operator family. __pycache__/ - -# Scratch / agent action plans -bdu-*.md From 914fc9f006310ec47c19a88019b1fce093bb1fcc Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Thu, 26 Nov 2026 23:48:57 +0700 Subject: [PATCH 11/11] Export subfolder: {date} and {hour} in local time, not UTC (the day the person exported on) --- crates/engine/src/export.rs | 2 +- crates/engine/src/export/place.rs | 19 +++++++++++++------ crates/engine/src/export/prepare.rs | 5 ++--- crates/engine/src/tests/export.rs | 15 +++++++++++++++ crates/ui-egui/locales/cs.json | 4 ++-- crates/ui-egui/locales/de.json | 4 ++-- crates/ui-egui/locales/es.json | 4 ++-- crates/ui-egui/locales/fi.json | 4 ++-- crates/ui-egui/locales/fr.json | 4 ++-- crates/ui-egui/locales/id.json | 4 ++-- crates/ui-egui/locales/it.json | 4 ++-- crates/ui-egui/locales/ja.json | 4 ++-- crates/ui-egui/locales/ka.json | 4 ++-- crates/ui-egui/locales/pl.json | 4 ++-- crates/ui-egui/locales/pt-br.json | 4 ++-- crates/ui-egui/locales/ru.json | 4 ++-- crates/ui-egui/locales/sv.json | 4 ++-- crates/ui-egui/locales/uk.json | 4 ++-- crates/ui-egui/locales/vi.json | 4 ++-- crates/ui-egui/locales/zh-hans.json | 4 ++-- crates/ui-egui/locales/zh-hant.json | 4 ++-- crates/ui-egui/src/dialogs.rs | 4 ++-- docs/whats-new.md | 2 +- 23 files changed, 68 insertions(+), 47 deletions(-) diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 2c585cd0087..aef35477454 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -75,7 +75,7 @@ pub struct ExportOptions { /// A specific folder for the whole batch, or each photo's own folder. pub destination_mode: DestinationMode, /// Created inside the destination folder (empty = none). Supports `{album}`, `{date}` - /// (YYYYMMDD, UTC) and `{hour}` (HHMM, UTC) variables, expanded during batch preparation + /// (YYYYMMDD) and `{hour}` (HHMM, both in local time) variables, expanded during batch preparation /// once per batch using the active album view (or empty outside an album view). Presets store /// the raw template. pub subfolder: String, diff --git a/crates/engine/src/export/place.rs b/crates/engine/src/export/place.rs index 7d167a77fd8..a77f47a592b 100644 --- a/crates/engine/src/export/place.rs +++ b/crates/engine/src/export/place.rs @@ -132,7 +132,8 @@ pub fn clean_album_name(album: &str) -> String { /// text (such as `{date}` or `{hour}`) is never double-expanded. /// /// - `album`: the active album name, cleaned with [`clean_album_name`]; `None` expands `{album}` to `""`. -/// - `now`: the UTC timestamp for `{date}` (YYYYMMDD) and `{hour}` (HHMM); `None` uses current UTC time. +/// - `now`: the local date and time for `{date}` (YYYYMMDD) and `{hour}` (HHMM), as the person's clock shows it +/// ([`local_now`]); `None` uses the time now. /// - Unknown tokens are left unchanged. The result passes through [`clean_subfolder`]. /// /// E.g. `"{album}/{date}_{hour}"` with album `"Vacation"` produces `"Vacation/20261107_0230"`. @@ -142,11 +143,7 @@ pub fn expand_subfolder(template: &str, album: Option<&str>, now: Option, now: Option Option { + let since = web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap_or_default(); + let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX); + chrono::NaiveDateTime::parse_from_str(&crate::import::local_civil(secs), "%Y-%m-%dT%H:%M:%S").ok() +} + impl<'a> Placer<'a> { pub(super) fn new( o: &'a ExportOptions, diff --git a/crates/engine/src/export/prepare.rs b/crates/engine/src/export/prepare.rs index 0fb5563fa58..e2bfa6c79c1 100644 --- a/crates/engine/src/export/prepare.rs +++ b/crates/engine/src/export/prepare.rs @@ -101,9 +101,8 @@ pub fn prepare_export( /// [`prepare_export`] for each of `ids` in order (`{seq}` = position, from 1). pub fn prepare_batch(session: &mut crate::Session, ids: &[lightcraft_catalog::PhotoId], o: &ExportOptions) -> Result, String> { let guard = std::sync::Arc::new(session.original_guard()); - let since = web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap_or_default(); - let secs = i64::try_from(since.as_secs()).unwrap_or(i64::MAX); - let now = chrono::DateTime::from_timestamp(secs, 0).map(|dt| dt.naive_utc()); + // the whole batch goes to one dated folder: the time is read once + let now = super::place::local_now(); let album_name = match session.source { crate::LibrarySource::Album(aid) => session.catalog.album(aid).map(|a| a.name.clone()), _ => None, diff --git a/crates/engine/src/tests/export.rs b/crates/engine/src/tests/export.rs index 2cb7ee1c89f..6a74aab8ea4 100644 --- a/crates/engine/src/tests/export.rs +++ b/crates/engine/src/tests/export.rs @@ -307,6 +307,21 @@ fn clean_album_name_sanitizes_reserved_names_and_illegal_chars() { assert_eq!(clean_album_name("com¹.backup"), "com¹_.backup"); } +/// `{date}` and `{hour}` are the person's local date and time (the host's zone), not UTC's: an evening export west +/// of UTC, or a morning one east of it, goes to that day's folder. +#[test] +fn subfolder_date_and_hour_are_local_time() { + use crate::export::expand_subfolder; + let secs = i64::try_from(web_time::SystemTime::now().duration_since(web_time::UNIX_EPOCH).unwrap().as_secs()).unwrap(); + let local = crate::import::local_civil(secs); + let expected = format!("{}/{}", local.get(..10).unwrap().replace('-', ""), local.get(11..16).unwrap().replace(':', "")); + let got = expand_subfolder("{date}/{hour}", None, None); + // (a minute may turn between the two readings) + let next = crate::import::local_civil(secs + 60); + let later = format!("{}/{}", next.get(..10).unwrap().replace('-', ""), next.get(11..16).unwrap().replace(':', "")); + assert!(got == expected || got == later, "{got} is not the local {expected}"); +} + #[test] fn expand_subfolder_variables_and_ordering() { use crate::export::expand_subfolder; diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index 77570a99fda..169f9bce9c0 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -2540,8 +2540,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Klikněte pravým tlačítkem → Najít chybějící soubor… a najděte jej znovu.", "Right-click ▸ Reload from Disk to try again.": "Klikněte pravým tlačítkem → Znovu načíst z disku a zkuste to znovu.", "Album name (empty outside an album view)": "Název alba (prázdné mimo zobrazení alba)", - "Export date, UTC (YYYYMMDD)": "Datum exportu, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Čas exportu, UTC (HHMM)", + "Export date (YYYYMMDD)": "Datum exportu (YYYYMMDD)", + "Export time (HHMM)": "Čas exportu (HHMM)", "Insert variable": "Vložit proměnnou", "Insert…": "Vložit…", "none ({album}, {date}, {hour})": "žádné ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index 77210198b98..8358784a721 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -3598,8 +3598,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Rechtsklick → Fehlende Datei suchen…, um sie wiederzufinden.", "Right-click ▸ Reload from Disk to try again.": "Rechtsklick → Vom Datenträger neu laden, um es erneut zu versuchen.", "Album name (empty outside an album view)": "Albumname (leer außerhalb einer Albumansicht)", - "Export date, UTC (YYYYMMDD)": "Exportdatum, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Exportzeit, UTC (HHMM)", + "Export date (YYYYMMDD)": "Exportdatum (YYYYMMDD)", + "Export time (HHMM)": "Exportzeit (HHMM)", "Insert variable": "Variable einfügen", "Insert…": "Einfügen…", "none ({album}, {date}, {hour})": "keine ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index abd78e633c4..99e9658007e 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2494,8 +2494,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Clic derecho → Localizar archivo que falta… para encontrarlo de nuevo.", "Right-click ▸ Reload from Disk to try again.": "Clic derecho → Recargar desde el disco para intentarlo de nuevo.", "Album name (empty outside an album view)": "Nombre del álbum (vacío fuera de una vista de álbum)", - "Export date, UTC (YYYYMMDD)": "Fecha de exportación, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Hora de exportación, UTC (HHMM)", + "Export date (YYYYMMDD)": "Fecha de exportación (YYYYMMDD)", + "Export time (HHMM)": "Hora de exportación (HHMM)", "Insert variable": "Insertar variable", "Insert…": "Insertar…", "none ({album}, {date}, {hour})": "ninguno ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index 86c6c882433..b4a598ce96e 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -2452,8 +2452,8 @@ "Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Tähdet osoitettaessa: liput ja värimerkinnät näkyvät aina; tähdet ja muokattu-merkki näkyvät, kun kuvaa osoitetaan tai se on valittuna.", "Virtual copy": "Virtuaalikopio", "Album name (empty outside an album view)": "Albumin nimi (tyhjä albumnäkymän ulkopuolella)", - "Export date, UTC (YYYYMMDD)": "Vientipäivämäärä, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Vientiaika, UTC (HHMM)", + "Export date (YYYYMMDD)": "Vientipäivämäärä (YYYYMMDD)", + "Export time (HHMM)": "Vientiaika (HHMM)", "Insert variable": "Lisää muuttuja", "Insert…": "Lisää…", "none ({album}, {date}, {hour})": "ei mitään ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index 3f0dc952450..aaa49d5adba 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -3677,8 +3677,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Clic droit → Localiser le fichier manquant… pour le retrouver.", "Right-click ▸ Reload from Disk to try again.": "Clic droit → Recharger depuis le disque pour réessayer.", "Album name (empty outside an album view)": "Nom de l'album (vide hors vue d'album)", - "Export date, UTC (YYYYMMDD)": "Date d'export, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Heure d'export, UTC (HHMM)", + "Export date (YYYYMMDD)": "Date d'export (YYYYMMDD)", + "Export time (HHMM)": "Heure d'export (HHMM)", "Insert variable": "Insérer une variable", "Insert…": "Insérer…", "none ({album}, {date}, {hour})": "aucun ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index 95473cd1a0f..65231629c07 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -2466,8 +2466,8 @@ "Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Bintang saat kursor di atas: bendera dan label warna selalu tampil; bintang dan tanda telah diedit muncul saat kursor berada di atas foto atau foto dipilih.", "Virtual copy": "Salinan virtual", "Album name (empty outside an album view)": "Nama album (kosong di luar tampilan album)", - "Export date, UTC (YYYYMMDD)": "Tanggal ekspor, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Waktu ekspor, UTC (HHMM)", + "Export date (YYYYMMDD)": "Tanggal ekspor (YYYYMMDD)", + "Export time (HHMM)": "Waktu ekspor (HHMM)", "Insert variable": "Sisipkan variabel", "Insert…": "Sisipkan…", "none ({album}, {date}, {hour})": "tidak ada ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index 4d971e5b022..0e0546abca8 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2658,8 +2658,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Clic destro → Trova file mancante… per ritrovarlo.", "Right-click ▸ Reload from Disk to try again.": "Clic destro → Ricarica dal disco per riprovare.", "Album name (empty outside an album view)": "Nome dell'album (vuoto fuori dalla vista album)", - "Export date, UTC (YYYYMMDD)": "Data di esportazione, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Ora di esportazione, UTC (HHMM)", + "Export date (YYYYMMDD)": "Data di esportazione (YYYYMMDD)", + "Export time (HHMM)": "Ora di esportazione (HHMM)", "Insert variable": "Inserisci variabile", "Insert…": "Inserisci…", "none ({album}, {date}, {hour})": "nessuno ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index 8dd3f701566..4cf02fb0ca4 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -2492,8 +2492,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "右クリック → 見つからないファイルを指定… で、ファイルをもう一度指定できます。", "Right-click ▸ Reload from Disk to try again.": "右クリック → ディスクから再読み込み で、もう一度試せます。", "Album name (empty outside an album view)": "アルバム名(アルバム表示外では空)", - "Export date, UTC (YYYYMMDD)": "書き出し日、UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "書き出し時刻、UTC (HHMM)", + "Export date (YYYYMMDD)": "書き出し日 (YYYYMMDD)", + "Export time (HHMM)": "書き出し時刻 (HHMM)", "Insert variable": "変数を挿入", "Insert…": "挿入…", "none ({album}, {date}, {hour})": "なし ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index b3fe58421c0..e14e30b4e0c 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -3761,8 +3761,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "მარჯვენა დაწკაპუნება → დაკარგული ფაილის მოძებნა… ფაილის ხელახლა საპოვნელად.", "Right-click ▸ Reload from Disk to try again.": "მარჯვენა დაწკაპუნება → დისკიდან ხელახლა ჩატვირთვა, ხელახლა საცდელად.", "Album name (empty outside an album view)": "ალბომის სახელი (ცარიელია ალბომის ხედის გარეთ)", - "Export date, UTC (YYYYMMDD)": "ექსპორტის თარიღი, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "ექსპორტის დრო, UTC (HHMM)", + "Export date (YYYYMMDD)": "ექსპორტის თარიღი (YYYYMMDD)", + "Export time (HHMM)": "ექსპორტის დრო (HHMM)", "Insert variable": "ცვლადის ჩასმა", "Insert…": "ჩასმა…", "none ({album}, {date}, {hour})": "არცერთი ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index 773fed9e8b1..d92ebd48c69 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -2419,8 +2419,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Kliknij prawym przyciskiem → Znajdź brakujący plik…, aby go odnaleźć ponownie.", "Right-click ▸ Reload from Disk to try again.": "Kliknij prawym przyciskiem → Wczytaj ponownie z dysku, aby spróbować jeszcze raz.", "Album name (empty outside an album view)": "Nazwa albumu (pusta poza widokiem albumu)", - "Export date, UTC (YYYYMMDD)": "Data eksportu, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Czas eksportu, UTC (HHMM)", + "Export date (YYYYMMDD)": "Data eksportu (YYYYMMDD)", + "Export time (HHMM)": "Czas eksportu (HHMM)", "Insert variable": "Wstaw zmienną", "Insert…": "Wstaw…", "none ({album}, {date}, {hour})": "brak ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index 56d03648949..29db3d72a58 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -2338,8 +2338,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Clique com o botão direito → Localizar arquivo ausente… para encontrá-lo de novo.", "Right-click ▸ Reload from Disk to try again.": "Clique com o botão direito → Recarregar do disco para tentar de novo.", "Album name (empty outside an album view)": "Nome do álbum (vazio fora de uma visualização de álbum)", - "Export date, UTC (YYYYMMDD)": "Data de exportação, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Hora de exportação, UTC (HHMM)", + "Export date (YYYYMMDD)": "Data de exportação (YYYYMMDD)", + "Export time (HHMM)": "Hora de exportação (HHMM)", "Insert variable": "Inserir variável", "Insert…": "Inserir…", "none ({album}, {date}, {hour})": "nenhum ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index 264cac78372..10ff0d905ca 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -2700,8 +2700,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Щёлкните правой кнопкой → Указать отсутствующий файл…, чтобы найти его снова.", "Right-click ▸ Reload from Disk to try again.": "Щёлкните правой кнопкой → Перезагрузить с диска, чтобы повторить попытку.", "Album name (empty outside an album view)": "Название альбома (пусто вне просмотра альбома)", - "Export date, UTC (YYYYMMDD)": "Дата экспорта, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Время экспорта, UTC (HHMM)", + "Export date (YYYYMMDD)": "Дата экспорта (YYYYMMDD)", + "Export time (HHMM)": "Время экспорта (HHMM)", "Insert variable": "Вставить переменную", "Insert…": "Вставить…", "none ({album}, {date}, {hour})": "нет ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 9aae3173a74..c0dd641350f 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -3884,8 +3884,8 @@ "Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Stjärnor vid pekaren: flaggor och färgetiketter visas alltid; stjärnorna och märket för redigerad visas när pekaren är över ett foto eller när det är markerat.", "Virtual copy": "Virtuell kopia", "Album name (empty outside an album view)": "Albumnamn (tomt utanför en albumvy)", - "Export date, UTC (YYYYMMDD)": "Exportdatum, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Exporttid, UTC (HHMM)", + "Export date (YYYYMMDD)": "Exportdatum (YYYYMMDD)", + "Export time (HHMM)": "Exporttid (HHMM)", "Insert variable": "Infoga variabel", "Insert…": "Infoga…", "none ({album}, {date}, {hour})": "ingen ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index 4c66162442c..6b4f2e6ac6b 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2490,8 +2490,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "Клацніть правою кнопкою → Знайти відсутній файл…, щоб знайти його знову.", "Right-click ▸ Reload from Disk to try again.": "Клацніть правою кнопкою → Перезавантажити з диска, щоб спробувати ще раз.", "Album name (empty outside an album view)": "Назва альбому (порожньо поза переглядом альбому)", - "Export date, UTC (YYYYMMDD)": "Дата експорту, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Час експорту, UTC (HHMM)", + "Export date (YYYYMMDD)": "Дата експорту (YYYYMMDD)", + "Export time (HHMM)": "Час експорту (HHMM)", "Insert variable": "Вставити змінну", "Insert…": "Вставити…", "none ({album}, {date}, {hour})": "немає ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index 72805e7fc44..7ce79ca2207 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -2780,8 +2780,8 @@ "Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Sao khi rê chuột: cờ và nhãn màu luôn hiển thị; sao và dấu đã chỉnh sửa xuất hiện khi ảnh được rê chuột qua hoặc được chọn.", "Virtual copy": "Bản sao ảo", "Album name (empty outside an album view)": "Tên album (trống ngoài chế độ xem album)", - "Export date, UTC (YYYYMMDD)": "Ngày xuất, UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "Giờ xuất, UTC (HHMM)", + "Export date (YYYYMMDD)": "Ngày xuất (YYYYMMDD)", + "Export time (HHMM)": "Giờ xuất (HHMM)", "Insert variable": "Chèn biến", "Insert…": "Chèn…", "none ({album}, {date}, {hour})": "không có ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index 6ba5005e461..8ad6869db59 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -2493,8 +2493,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "右键单击 → 定位缺失的文件…,即可重新找到它。", "Right-click ▸ Reload from Disk to try again.": "右键单击 → 从磁盘重新读取,即可重试。", "Album name (empty outside an album view)": "相册名称(在相册视图外为空)", - "Export date, UTC (YYYYMMDD)": "导出日期,UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "导出时间,UTC (HHMM)", + "Export date (YYYYMMDD)": "导出日期 (YYYYMMDD)", + "Export time (HHMM)": "导出时间 (HHMM)", "Insert variable": "插入变量", "Insert…": "插入…", "none ({album}, {date}, {hour})": "无 ({album}, {date}, {hour})" diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index 35104143237..db03a0b3f14 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -2494,8 +2494,8 @@ "Right-click ▸ Locate Missing File… to find it again.": "按右鍵 → 尋找遺失的檔案…,即可重新找到它。", "Right-click ▸ Reload from Disk to try again.": "按右鍵 → 從磁碟重新載入,即可重試。", "Album name (empty outside an album view)": "相簿名稱(在相簿檢視外為空)", - "Export date, UTC (YYYYMMDD)": "匯出日期,UTC (YYYYMMDD)", - "Export time, UTC (HHMM)": "匯出時間,UTC (HHMM)", + "Export date (YYYYMMDD)": "匯出日期 (YYYYMMDD)", + "Export time (HHMM)": "匯出時間 (HHMM)", "Insert variable": "插入變數", "Insert…": "插入…", "none ({album}, {date}, {hour})": "無 ({album}, {date}, {hour})" diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index bb5a24012bb..c32ffe1be64 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1795,10 +1795,10 @@ fn export_destination_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Token if ui.selectable_label(false, "{album}").on_hover_text(crate::i18n::tr("Album name (empty outside an album view)")).clicked() { chosen = Some("{album}"); } - if ui.selectable_label(false, "{date}").on_hover_text(crate::i18n::tr("Export date, UTC (YYYYMMDD)")).clicked() { + if ui.selectable_label(false, "{date}").on_hover_text(crate::i18n::tr("Export date (YYYYMMDD)")).clicked() { chosen = Some("{date}"); } - if ui.selectable_label(false, "{hour}").on_hover_text(crate::i18n::tr("Export time, UTC (HHMM)")).clicked() { + if ui.selectable_label(false, "{hour}").on_hover_text(crate::i18n::tr("Export time (HHMM)")).clicked() { chosen = Some("{hour}"); } }); diff --git a/docs/whats-new.md b/docs/whats-new.md index 85013d9804e..ee0e7b2b64b 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -3,7 +3,7 @@ ## Unreleased ### Export subfolder variables -- The Export dialog's Subfolder field now supports `{album}` (active album name sanitized for filesystem safety, empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, UTC), and `{hour}` (batch export time in `HHMM`, UTC). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use. +- The Export dialog's Subfolder field now supports `{album}` (active album name sanitized for filesystem safety, empty outside an album view), `{date}` (batch export date in `YYYYMMDD`, local time), and `{hour}` (batch export time in `HHMM`, local time). An **Insert…** dropdown next to the field inserts tokens at the cursor. Tokens are stored in presets and expanded at export time, so the same preset produces dated subfolders on every use. ### Heal meets its surroundings (process 14) - A healed spot is now pinned to the photo around its edge: on a gradient (a sky, a shaded wall, a cheek) it no longer leaves a faint disc or ring, and a dark line a few pixels or more beyond the spot's edge no longer smudges