Cotton code
42 lines · 2.1 KB · SwiftRaw
// The sentences the calendar lane says in THREE OR MORE places.//// Copy lives at its call site. A sentence earns a place here only by being// said on three screens or more, where two spellings of one fact would be the// drift this file exists to prevent; everything a screen says once or twice is// a literal where it is read. The scope labels are GOOGLE CALENDAR'S OWN// ("This event" / "All events") and the failure sentences are word for word —// "The calendar couldn't be reached. Your events are safe — try again." says// whose fault it is and what is not lost, which "Something went wrong" does// not — so both are held verbatim wherever they now sit.//// A NAME HERE CARRIES ITS LANE'S PREFIX, and the prefix is the point: a bare// `today` is the word every lane wants, so the first lane to claim it makes// every later one either collide or borrow a sentence it does not own. The// group name in front says whose sentence this is, and `git grep "static var// <name>"` before adding one is the check that keeps it true.import CottonKitimport Foundationextension CottonStrings {    public static var edit: String { ShellLines.line("words", "edit") }    // ── When a write refuses ──────────────────────────────────────────────    /// What a failed write says to the person.    ///    /// `toastError` → `formatErrorForUser`, ported: an error carrying its own    /// `{code, message}` shows THAT message, and every refusal the core makes    /// is exactly that shape; anything else gets the generic sentence.    ///    /// PORT GAP: [calendar-write-failure-unreported] `toastError`'s other half    /// — `captureError` into Bugsink (R62) — has no home on this phone, so a    /// failure is a sentence on one screen and nothing anywhere else.    public static func writeFailure(_ error: Error) -> String {        guard let refusal = error as? CottonCallError,            !refusal.message.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty        else { return somethingWentWrong }        return refusal.message    }}