//! 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. use super::tidy::List; use super::Platform; pub fn 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. pub fn count(n: usize) -> String { let s = n.to_string(); let mut 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. pub fn 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". pub fn photos(n: usize) -> String { format!("{} {}", count(n), if n == 1 { "photo" } else { "photos" }) } // ── first run and the pass ─────────────────────────────────────────────── pub const 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."]; pub const WELCOME_PROMISE: [&str; 2] = ["Every photo is looked at on this phone.", "Nothing is uploaded to do it."]; pub const START: &str = "Start"; pub const PERMISSION_WHY: &str = "Albums needs all your photos to find what to tidy. You choose what goes; nothing leaves this phone."; pub const OPEN_SETTINGS: &str = "Open Settings"; pub fn limited(chosen: usize) -> String { format!("Albums can see the {} you chose. To tidy the whole library, allow all photos in Settings.", photos(chosen)) } pub const NO_PERMISSION: &str = "Albums can't see your photos. Allow access in Settings to tidy your library."; pub const EMPTY_LIBRARY: &str = "No photos on this phone yet."; pub fn looking(total: usize) -> String { format!("Looking through {} photos and videos", count(total)) } pub fn done_and_left(done: usize, minutes_left: Option, 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)), } } pub fn 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), } } pub const FILLS_AS_IT_GOES: &str = "Sets and lists fill in as it goes."; pub const PAUSED_BATTERY: &str = "Paused to save battery. Carries on when charging."; pub const PAUSED_CLOSED: &str = "Paused. Carries on when you open Albums or charge."; pub fn 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) }), } } pub fn done_looking(total: usize) -> String { format!("Looked through {} photos and videos.", count(total)) } // ── Tidy ──────────────────────────────────────────────────────────────── pub fn 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). pub fn delete_all(n: usize) -> String { format!("Delete {}", count(n)) } pub fn 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)), } } pub fn could_free(bytes: u64) -> String { format!("You could free about {} more", size(bytes, true)) } pub const NOTHING_TO_TIDY: &str = "Nothing to tidy right now."; pub const NOTHING_TO_TIDY_WHY: &str = "Albums offers photos here as it finds them."; // ── a Set ─────────────────────────────────────────────────────────────── pub fn set_row(n: usize, when: &str, keep: usize) -> String { format!("{} · {} · Keep {}?", photos(n), when, keep) } pub fn 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."), } } pub fn keep_button(keep: usize, bin: usize) -> String { if bin == 0 { format!("Keep {keep}") } else { format!("Keep {keep}, Bin {bin}") } } pub fn kept_after(keep: usize, binned: usize) -> String { format!("Kept {keep}. Moved {binned} to the Bin.") } pub const UNDO: &str = "Undo"; pub const KEEP_ALL: &str = "Keep all"; // ── lists ─────────────────────────────────────────────────────────────── pub fn 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)) } pub fn bin_all(n: usize) -> String { format!("Bin {}", count(n)) } pub fn moved_after(n: usize) -> String { format!("Moved {} to the Bin.", count(n)) } pub const COPIES_OF_YOURS: &str = "Copies of photos you already have"; pub const OTHER_WHATSAPP: &str = "Other WhatsApp photos"; // ── the Bin and Free ──────────────────────────────────────────────────── pub fn 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. pub const BIN_NOTE: &str = "Waiting here until you delete them."; pub const 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."; pub const 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). pub const 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."; pub fn 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."), } } pub fn 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)), } } pub fn not_freed(n: usize) -> String { format!("{} weren't deleted and are still in the Bin.", count(n)) } pub const 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. pub const GONE_HEADING: &str = "No longer on this phone"; /// An act refused because the screen showed something else than is true now. pub const 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. pub const HANDED: &str = "Some of these are being deleted. Wait until the phone has finished."; /// Deletes still waiting for the library to say what happened. pub fn 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. pub fn 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. pub fn other_library(n: usize) -> String { format!("Choices from another phone or library: {}", count(n)) } pub const CLEAR_OTHER: &str = "Clear them"; /// While the library is read again after its identity changed. pub const RECHECKING: &str = "Checking your library again"; /// The Bin group of photos he edited after binning them (ALBUMS CORE 1f). pub const EDITED_HEADING: &str = "Edited after you binned them"; pub const EDITED_LINE: &str = "These stay until you bin them again."; pub const BIN_AGAIN: &str = "Bin again"; /// The Bin under limited access: Delete is not offered. pub const DELETE_NEEDS_FULL: &str = "To delete, let Albums see all your photos."; /// You: choices that belong to photos no longer on this phone. pub fn 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)) } } pub const CLEAR_GONE: &str = "Clear them"; /// The Bin on Android: Delete is not offered yet (owner decision, 27 Nov 2026). pub const 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. pub fn 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.", } } pub fn 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). pub const PAIR_LINE: &str = "This photo and its copy can't both go. Choose which one stays."; pub fn skipped(n: usize) -> String { format!("{} changed since you looked and stayed where they were.", count(n)) } pub fn from_bin(n: usize) -> String { format!("Brought back {} from the Bin and kept.", count(n)) } pub const UNDO_LATER: &str = "Something you did after this changed these photos. Undo that first."; pub const UNDO_DELETED: &str = "Already deleted. Albums can't bring them back; Photos can, for 30 days."; pub fn 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)) } } pub fn from_other_phone(n: usize, phone: &str) -> String { format!("{} you binned on your {phone}: Bin here too?", photos(n)) } pub const BIN_EMPTY: &str = "The Bin is empty."; pub const 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). pub fn 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. pub fn year_of(at_ms: i64, offset_s: i64) -> i64 { civil((at_ms.div_euclid(1000) + offset_s).div_euclid(86_400)).0 }