//! Every word the Albums screens read for stage 1 (DECISIONS.md "The words").//! British English, plain, exact counts; "about" only where a size is//! estimated; Bin never Trash; nothing called smart, AI or memories.usesuper::tidy::List;usesuper::Platform;pubfn list_name(list: List) -> &'static str {match list {List::Sets => "Sets",List::LargeVideos => "Large videos",List::WhatsappCopies => "WhatsApp copies",List::Screenshots => "Screenshots",List::Documents => "Receipts and documents",List::BlurryDark => "Blurry and dark",List::ExactCopies => "Exact copies", }}/// "1,912" with thousands commas.pubfn count(n: usize) -> String {let s = n.to_string();letmut out = String::new();for (i, c) in s.chars().enumerate() {if i > 0 && (s.len() - i) % 3 == 0 { out.push(','); } out.push(c); } out}/// "31.4 GB", "0.4 GB", "820 MB" under a tenth of a GB; "about " when estimated.pubfn size(bytes: u64, exact: bool) -> String {let gb = bytes as f64 / 1e9;let s = if gb >= 0.1 { format!("{gb:.1} GB") } else { format!("{} MB", ((bytes as f64 / 1e6).round() as u64).max(if bytes > 0 { 1 } else { 0 })) };if exact { s } else { format!("about {s}") }}/// "photo" / "photos", "video" / "videos", "item" / "items".pubfn photos(n: usize) -> String { format!("{} {}", count(n), if n == 1 { "photo" } else { "photos" })}// ── first run and the pass ───────────────────────────────────────────────pubconst WELCOME_LINES: [&str; 3] = ["Finds the shots of one moment and keeps the best.", "Lists what's taking space, biggest first.", "Makes albums by place and trip by itself."];pubconst WELCOME_PROMISE: [&str; 2] = ["Every photo is looked at on this phone.", "Nothing is uploaded to do it."];pubconst START: &str = "Start";pubconst PERMISSION_WHY: &str = "Albums needs all your photos to find what to tidy. You choose what goes; nothing leaves this phone.";pubconst OPEN_SETTINGS: &str = "Open Settings";pubfn limited(chosen: usize) -> String { format!("Albums can see the {} you chose. To tidy the whole library, allow all photos in Settings.", photos(chosen))}pubconst NO_PERMISSION: &str = "Albums can't see your photos. Allow access in Settings to tidy your library.";pubconst EMPTY_LIBRARY: &str = "No photos on this phone yet.";pubfn looking(total: usize) -> String { format!("Looking through {} photos and videos", count(total))}pubfn done_and_left(done: usize, minutes_left: Option<u32>, charging: bool) -> String {match minutes_left {Some(m) => format!("{} done · about {} left{}", count(done), minutes(m), if charging { " while charging" } else { "" }),None => format!("{} done", count(done)), }}pubfn minutes(m: u32) -> String {match m {0 | 1 => "a minute".to_string(), m if m < 90 => format!("{m} min"), m => format!("{} hours", (m as f32 / 60.0).round() as u32), }}pubconst FILLS_AS_IT_GOES: &str = "Sets and lists fill in as it goes.";pubconst PAUSED_BATTERY: &str = "Paused to save battery. Carries on when charging.";pubconst PAUSED_CLOSED: &str = "Paused. Carries on when you open Albums or charge.";pubfn only_in_icloud(n: usize, platform: Platform) -> String {match platform {Platform::Ios => format!("{} only in iCloud. Albums will look at them on Wi-Fi.", if n == 1 { "1 is".to_string() } else { format!("{} are", count(n)) }),Platform::Android => format!("{} couldn't be opened on this phone.", if n == 1 { "1".to_string() } else { count(n) }), }}pubfn done_looking(total: usize) -> String { format!("Looked through {} photos and videos.", count(total))}// ── Tidy ────────────────────────────────────────────────────────────────pubfn in_bin(n: usize, bytes: u64, exact: bool) -> String { format!("In the Bin: {} · {}", count(n), size(bytes, exact))}/// The iPhone Bin's one act: "Delete 2,340" (it removes from the library; the/// space comes back when Photos empties Recently Deleted, so the button names/// the count, not a size it cannot free today).pubfn delete_all(n: usize) -> String { format!("Delete {}", count(n))}pubfn delete_question(n: usize, platform: Platform) -> String {match platform {Platform::Ios => format!("Delete {} from this iPhone?", count(n)),Platform::Android => format!("Delete {} from this phone?", count(n)), }}pubfn could_free(bytes: u64) -> String { format!("You could free about {} more", size(bytes, true))}pubconst NOTHING_TO_TIDY: &str = "Nothing to tidy right now.";pubconst NOTHING_TO_TIDY_WHY: &str = "Albums offers photos here as it finds them.";// ── a Set ───────────────────────────────────────────────────────────────pubfn set_row(n: usize, when: &str, keep: usize) -> String { format!("{} · {} · Keep {}?", photos(n), when, keep)}pubfn keeps_line(keep: usize, sure: bool) -> String {if !sure {return"A first guess: Albums will look closer on Wi-Fi. Tap a photo to change.".to_string(); }match keep {1 => "Keeps the sharpest. Tap a photo to change.".to_string(), k => format!("Keeps the {k} sharpest that look different. Tap a photo to change."), }}pubfn keep_button(keep: usize, bin: usize) -> String {if bin == 0 { format!("Keep {keep}") } else { format!("Keep {keep}, Bin {bin}") }}pubfn kept_after(keep: usize, binned: usize) -> String { format!("Kept {keep}. Moved {binned} to the Bin.")}pubconst UNDO: &str = "Undo";pubconst KEEP_ALL: &str = "Keep all";// ── lists ───────────────────────────────────────────────────────────────pubfn bin_all_confirm(n: usize, what: &str) -> String { format!("Move {} {what} to the Bin? You can bring any back until you delete them.", count(n))}pubfn bin_all(n: usize) -> String { format!("Bin {}", count(n))}pubfn moved_after(n: usize) -> String { format!("Moved {} to the Bin.", count(n))}pubconst COPIES_OF_YOURS: &str = "Copies of photos you already have";pubconst OTHER_WHATSAPP: &str = "Other WhatsApp photos";// ── the Bin and Free ────────────────────────────────────────────────────pubfn bin_head(n: usize, bytes: u64, exact: bool) -> String { format!("{} · {}", count(n), size(bytes, exact))}/// One Bin on both phones (decision G): nothing leaves the library until Delete.pubconst BIN_NOTE: &str = "Waiting here until you delete them.";pubconst DELETE_NOTE_IOS: &str = "The iPhone asks once. They then stay in Photos' Recently Deleted for 30 days; the space comes back when Photos empties it, or at once if you empty Recently Deleted yourself.";pubconst DELETE_NO_WAY_BACK: &str = "Albums can't bring them back after this.";/// Android's Delete puts them in the phone's own trash (decision G).pubconst DELETE_NOTE_ANDROID: &str = "The phone asks once. They then stay in the phone's trash for 30 days; the space comes back when the phone empties it.";pubfn delete_note_many(batches: usize, platform: Platform) -> String {match platform {Platform::Ios => format!("The iPhone asks {batches} times, once for each part. They then stay in Photos' Recently Deleted for 30 days."),Platform::Android => format!("The phone asks {batches} times, once for each part. They then stay in the phone's trash for 30 days."), }}pubfn deleted_after(n: usize, bytes: u64, exact: bool, platform: Platform) -> String {let stay = if n == 1 { "It stays" } else { "They stay" };match platform {Platform::Ios => format!("Deleted {} ({}). {stay} in Photos' Recently Deleted for 30 days.", count(n), size(bytes, exact)),Platform::Android => format!("Deleted {} ({}). {stay} in the phone's trash for 30 days.", count(n), size(bytes, exact)), }}pubfn not_freed(n: usize) -> String { format!("{} weren't deleted and are still in the Bin.", count(n))}pubconst BRING_BACK: &str = "Bring back";/// Items he chose that the library no longer holds (deleted in another app):/// shown with what he chose, never counted, never acted on.pubconst GONE_HEADING: &str = "No longer on this phone";/// An act refused because the screen showed something else than is true now.pubconst CHANGED: &str = "This changed while you were looking. Here it is again.";/// An act refused: some of these are waiting for the phone's Delete.pubconst HANDED: &str = "Some of these are being deleted. Wait until the phone has finished.";/// Deletes still waiting for the library to say what happened.pubfn waiting_line(n: usize) -> String { format!("{} waiting for the phone to finish deleting.", count(n))}/// Deleted items he put back from the phone's trash: kept again.pubfn came_back(n: usize) -> String { format!("{} came back from the phone's trash and are kept.", count(n))}/// His choices made against another phone's or library's ids (decision H.b):/// suspended until a read re-matches them.pubfn other_library(n: usize) -> String { format!("Choices from another phone or library: {}", count(n))}pubconst CLEAR_OTHER: &str = "Clear them";/// While the library is read again after its identity changed.pubconst RECHECKING: &str = "Checking your library again";/// The Bin group of photos he edited after binning them (ALBUMS CORE 1f).pubconst EDITED_HEADING: &str = "Edited after you binned them";pubconst EDITED_LINE: &str = "These stay until you bin them again.";pubconst BIN_AGAIN: &str = "Bin again";/// The Bin under limited access: Delete is not offered.pubconst DELETE_NEEDS_FULL: &str = "To delete, let Albums see all your photos.";/// You: choices that belong to photos no longer on this phone.pubfn retired(n: usize) -> String {if n == 1 {"1 choice belongs to a photo no longer on this phone".to_string() } else { format!("{} choices belong to photos no longer on this phone", count(n)) }}pubconst CLEAR_GONE: &str = "Clear them";/// The Bin on Android: Delete is not offered yet (owner decision, 27 Nov 2026).pubconst DELETE_ANDROID_LATER: &str = "Deleting from Albums comes to Android later. Your Bin keeps your choices until then.";/// Why an item was kept back from a Delete.pubfn held_reason(reason: &str) -> &'static str {match reason {"original_gone" => "Kept: its original is gone.","original_trashed" => "Kept: its original is in the phone's trash.","original_binned" => "Kept: its original is going too.","copy_binned" => "Kept: its copy is going too.","changed_since_chosen" => "Kept: it changed since you chose.","edited_since_binned" => "Not deleted: you edited it after you binned it.","not_checked" => "Not deleted: waiting to read your library again.","original_not_checked" => "Not deleted: waiting to read its original again.","not_on_this_phone" => "Not deleted: deleting comes to Android later.", _ => "Kept.", }}pubfn held_back(n: usize) -> String { format!("Kept back {}: a photo and its copy can't both go. Choose which one stays.", count(n))}/// A photo and its copy, shown together: one of them must stay (rule E both ways).pubconst PAIR_LINE: &str = "This photo and its copy can't both go. Choose which one stays.";pubfn skipped(n: usize) -> String { format!("{} changed since you looked and stayed where they were.", count(n))}pubfn from_bin(n: usize) -> String { format!("Brought back {} from the Bin and kept.", count(n))}pubconst UNDO_LATER: &str = "Something you did after this changed these photos. Undo that first.";pubconst UNDO_DELETED: &str = "Already deleted. Albums can't bring them back; Photos can, for 30 days.";pubfn kept_parts(n: usize) -> String {if n == 1 { "1 photo you kept stays in your library.".to_string() } else { format!("{} you kept stay in your library.", photos(n)) }}pubfn from_other_phone(n: usize, phone: &str) -> String { format!("{} you binned on your {phone}: Bin here too?", photos(n))}pubconst BIN_EMPTY: &str = "The Bin is empty.";pubconst BIN_EMPTY_WHY: &str = "What you bin from Tidy waits here.";// ── dates ───────────────────────────────────────────────────────────────const DAYS: [&str; 7] = ["Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed"];const MONTHS: [&str; 12] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];/// (year, month 1–12, day) from days since 1970 (Howard Hinnant's civil_from_days).fn civil(z: i64) -> (i64, u32, u32) {let z = z + 719_468;let era = z.div_euclid(146_097);let doe = z - era * 146_097;let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);let mp = (5 * doy + 2) / 153;let d = (doy - (153 * mp + 2) / 5 + 1) as u32;let m = if mp < 10 { mp + 3 } else { mp - 9 } as u32; (yoe + era * 400 + i64::from(m <= 2), m, d)}/// "Sat 14 Mar, 6:12 pm", with the year when it is not `this_year`. The time is/// the phone's local time (`offset_s` from UTC).pubfn when(taken_at_ms: i64, offset_s: i64, this_year: i64) -> String {let local = taken_at_ms.div_euclid(1000) + offset_s;let days = local.div_euclid(86_400);let secs = local.rem_euclid(86_400);let (y, m, d) = civil(days);let (h, min) = (secs / 3600, (secs % 3600) / 60);let (h12, ampm) = match h {0 => (12, "am"),1..=11 => (h, "am"),12 => (12, "pm"), _ => (h - 12, "pm"), };let year = if y == this_year { String::new() } else { format!(" {y}") }; format!("{} {} {}{year}, {h12}:{min:02} {ampm}", DAYS[days.rem_euclid(7) as usize], d, MONTHS[(m - 1) as usize])}/// The year of a moment in local time.pubfn year_of(at_ms: i64, offset_s: i64) -> i64 { civil((at_ms.div_euclid(1000) + offset_s).div_euclid(86_400)).0}