Cotton code
89 lines · 6.1 KB · SwiftRaw
// Every sentence the boot path and Join say.//// A separate file from `Strings.swift` because that one is the DESIGN SYSTEM's// vocabulary and this one is the app's front door, but the rule is the same and// so is the mechanism: a sentence goes through `CottonStrings` rather than// being written at a call site, so `LanguageSweepTests` reads it, so it can be// counted and reused, and so the string catalogue is the one place English// lives ([english-only-no-translations]).//// **The four terminal refusals' sentences are VERBATIM.** They are not// decoration: each one says what happened, whose fault it is and what to do,// and each was written after an incident where the generic "Something went// wrong. Try again." was both untrue and useless. `BootScreensTests` holds all// four word for word.//// **And every one names the machine it is drawn on.** A sentence that says// "this phone" is written for both machines through `HostNoun.sentence(phone:// mac:)` — the phone's words exactly as they were, the Mac's beside them —// because the Mac draws these same screens: one Mac's Removed screen said "This// phone was removed" and offered to "Erase Cotton from this iPhone" (29 Sep// 2026). `GateScreensNameTheirMachineTests` reads them all as each machine.import CottonKitimport Foundationextension CottonStrings {    // ── The refusal screen ────────────────────────────────────────────────    public static var tryAgainAction: String { ShellLines.line("refusal", "actions.try_again") }    public static var startOverOnThisPhone: String { ShellLines.onThisHost("refusal", "actions.start_over") }    /// It runs `BootModel.erase`, behind one confirmation.    public static var eraseCottonFromThisPhone: String { ShellLines.onThisHost("refusal", "actions.erase") }    public static var eraseConfirmTitle: String { ShellLines.onThisHost("refusal", "actions.erase_confirm.title") }    public static var eraseConfirmBody: String { ShellLines.onThisHost("refusal", "actions.erase_confirm.body") }    public static var eraseConfirmVerb: String { ShellLines.line("refusal", "actions.erase_confirm.verb") }    public static var refusalKeyUnreadableTitle: String { ShellLines.onThisHost("refusal", "key_unreadable.title") }    public static var refusalKeyUnreadableBody: String { ShellLines.onThisHost("refusal", "key_unreadable.body") }    // A whole copy whose sha256 is not the one the Mac promised: refused before    // anything opened it, its bytes gone. Nothing on disk can be kept — nothing    // says which byte was wrong — so Try again fetches the copy again.    public static var refusalUpgradeTitle: String { ShellLines.line("refusal", "upgrade.title") }    public static var refusalNoWorkspaceTitle: String { ShellLines.line("refusal", "no_workspace.title") }    public static var refusalSignupClosedTitle: String { ShellLines.line("refusal", "signup_closed.title") }    // Not a refusal a server makes: the Keychain refusing THIS BUILD outright    // (`errSecMissingEntitlement`), which is what a simulator build made with    // `CODE_SIGNING_ALLOWED=NO` gets. There is no key to read and none can be    // written, so "Start over" — which forgets a key and mints a new one —    // cannot help, and offering it was a button that did nothing.    static var refusalKeychainUnavailableTitle: String { ShellLines.line("refusal", "keychain_unavailable.title") }    static var refusalKeychainUnavailableBody: String { ShellLines.onThisHost("refusal", "keychain_unavailable.body") }    // The Keychain answering "not now" (`errSecInteractionNotAllowed`): this    // phone's key is kept until the phone is unlocked once after it starts,    // and Cotton was opened before that — by a notification. The    // key is there and fine; starting over would throw away a good identity.    static var refusalKeychainLockedTitle: String { ShellLines.onThisHost("refusal", "keychain_locked.title") }    static var refusalKeychainLockedBody: String { ShellLines.onThisHost("refusal", "keychain_locked.body") }    // ── The reason, in red ink, on a refusal slip ─────────────────────────    //    // A few words that name what stands in the way, above the title — the one    // line on the slip in the palette's red. Never a second copy of the title.    static var refusalReasonKeyUnreadable: String { ShellLines.line("refusal", "key_unreadable.reason") }    static var refusalReasonKeychain: String { ShellLines.line("refusal", "keychain_unavailable.reason") }    static var refusalReasonKeychainLocked: String { ShellLines.onThisHost("refusal", "keychain_locked.reason") }    // ── The move's failure, its details copied ─────────────────────────────    public static var copied: String { ShellLines.line("boot", "screen.copied") }    // ── The error fallback, above every provider ──────────────────────────    public static var errorFallbackTitle: String { ShellLines.line("boot", "screen.error_fallback_title") }    public static var errorFallbackBody: String { ShellLines.line("boot", "screen.error_fallback_body") }    // ── A refused phone, reading its own copy ─────────────────────────────    /// The banner's sentence under the refusal's title. The copy is whole and    /// readable; what is off is writing, until the phone is let in again.    public static var readOnlyBody: String { ShellLines.onThisHost("gate", "banner.body") }    /// What the mailboxes do meanwhile: nothing is drained, nothing is lost.    public static var readOnlyHeld: String { ShellLines.line("gate", "banner.held") }    /// What a write is refused with while the banner is up — the refusal's    /// own title first, so the sentence a screen shows names the cause.    public static func readOnlyWriteRefused(_ title: String) -> String {        ShellLines.onThisHost("gate", "write_refused", ["title": title])    }}