Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LR-IMP-DRAGDROP: align the pl Lightroom wording and stop the web drop toasting "Added 0"

Nathaniel Ledfordc1e3f20f5b42
diff --git a/apps/lightcraft-web/src/web.rs b/apps/lightcraft-web/src/web.rs
index 6681590a0..1a490061f 100644
--- a/apps/lightcraft-web/src/web.rs
+++ b/apps/lightcraft-web/src/web.rs
@@ -527,10 +527,17 @@ impl WebApp {
let paths = self.originals.take_pending();
if !paths.is_empty() {
match self.app.run("library.import", json!({"paths": paths})) {
- // what the import added, not what was submitted (duplicates and unsupported files add nothing)
+ // what the import did, not what was submitted: duplicates and unsupported files add nothing,
+ // and a drop that only finds duplicates says nothing (as the desktop import's toast does
+ // when it shows where they are)
Ok(report) => {
- let added = report["imported"].as_array().map_or(0, Vec::len);
- self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_added(added));
+ let count = |k: &str| report[k].as_array().map_or(0, Vec::len);
+ let (added, restored) = (count("imported"), count("restored"));
+ if added > 0 {
+ self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_added(added));
+ } else if restored > 0 {
+ self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_restored(restored));
+ }
}
Err(e) => {
log::warn!("import: {e}");
diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json
index d85e706de..3a32aa37c 100644
--- a/crates/ui-egui/locales/pl.json
+++ b/crates/ui-egui/locales/pl.json
@@ -2278,5 +2278,5 @@
"Import dropped files without review": "Importuj upuszczone pliki bez przeglądu",
"An import is running": "Import jest w toku",
"An import is running. Drop photos when it has finished": "Import jest w toku. Upuść zdjęcia, gdy się zakończy",
- "Finish Lightroom catalog import before adding photos": "Zakończ import katalogu Lightroom, zanim dodasz zdjęcia"
+ "Finish Lightroom catalog import before adding photos": "Zakończ import katalogu Lightrooma, zanim dodasz zdjęcia"
}
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index e8bdf03e2..7fdda75f8 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -278,6 +278,11 @@ pub fn dropped_photos_added(n: usize) -> String {
tr_format!("Added {n} photo{}", if n == 1 { "" } else { "s" }, n = n)
}
+/// The web build's notice for `n` dropped photos that came back from Recently Deleted.
+pub fn dropped_photos_restored(n: usize) -> String {
+ tr_format!("Restored {} photo{} from Recently Deleted", n, if n == 1 { "" } else { "s" })
+}
+
/// The title and text of the message box shown when the desktop app's window can't start
/// (issue #260), in the UI language: the error and, when there is one, the log file to look in.
pub fn startup_failed_message(error: &str, log_file: Option<&str>) -> (String, String) {