Repository Public
1// ORIX Docs2// File: App/Sources/Intelligence/IntelligenceTexts.swift3// Description: User-facing wording of the intelligence panel: action names, the precise reason generation is unavailable,4// error explanations and progress labels.5//6// Author: Simon-Pierre Boucher7// Contact: contact@spboucher.ai8import Foundation9import DocAutomation1011nonisolated extension IntelligenceAction {12 var title: String {13 switch self {14 case .summarise: return String(localized: "Summarise")15 case .rewrite: return String(localized: "Rewrite")16 case .improveClarity: return String(localized: "Improve Clarity")17 case .adjustTone(let tone): return String(localized: "Tone: \(tone.title)")18 case .suggestHeadings: return String(localized: "Suggest Headings")19 case .outline: return String(localized: "Generate Outline")20 case .actionItems: return String(localized: "Extract Action Items")21 case .explain: return String(localized: "Explain Passage")22 case .suggestStructure: return String(localized: "Suggest Structure")23 }24 }2526 var symbol: String {27 switch self {28 case .summarise: return "text.redaction"29 case .rewrite: return "arrow.triangle.2.circlepath"30 case .improveClarity: return "wand.and.stars"31 case .adjustTone: return "dial.medium"32 case .suggestHeadings: return "textformat.size"33 case .outline: return "list.bullet.indent"34 case .actionItems: return "checklist"35 case .explain: return "questionmark.bubble"36 case .suggestStructure: return "rectangle.3.group"37 }38 }3940 var help: String {41 switch self {42 case .summarise: return String(localized: "A shorter version that keeps the main points")43 case .rewrite: return String(localized: "The same content, written again; shown as a proposal with its changes")44 case .improveClarity: return String(localized: "Shorter sentences and more direct wording, changing as little as needed")45 case .adjustTone: return String(localized: "The same content in another tone")46 case .suggestHeadings: return String(localized: "Headings that describe the text")47 case .outline: return String(localized: "The points of the text as a hierarchical list")48 case .actionItems: return String(localized: "Tasks, commitments and deadlines found in the text")49 case .explain: return String(localized: "A plain-language explanation of a technical passage")50 case .suggestStructure: return String(localized: "A better order of sections for the existing content")51 }52 }53}5455nonisolated extension IntelligenceTone {56 var title: String {57 switch self {58 case .formal: return String(localized: "Formal")59 case .friendly: return String(localized: "Friendly")60 case .concise: return String(localized: "Concise")61 case .academic: return String(localized: "Academic")62 }63 }64}6566nonisolated extension IntelligenceAvailability {67 /// One line for the status row.68 var headline: String {69 switch self {70 case .available: return String(localized: "On-device model ready")71 case .requiresNewerSystem: return String(localized: "Requires macOS 26 or later")72 case .deviceNotEligible: return String(localized: "This Mac is not eligible")73 case .appleIntelligenceNotEnabled: return String(localized: "Apple Intelligence is turned off")74 case .modelNotReady: return String(localized: "The model is being prepared")75 case .unavailable: return String(localized: "Not available")76 }77 }7879 /// The real reason, and what the user can do about it.80 var explanation: String {81 switch self {82 case .available:83 return String(localized: "Text is generated by the language model built into macOS, on this Mac. Nothing you write is sent anywhere.")84 case .requiresNewerSystem:85 return String(localized: "On-device generation requires macOS 26 or later with Apple Intelligence. This Mac runs an earlier version. Everything else in ORIX Docs works without it, including the text analysis below.")86 case .deviceNotEligible:87 return String(localized: "This Mac does not support Apple Intelligence, which provides the on-device language model. The text analysis below does not need it.")88 case .appleIntelligenceNotEnabled:89 return String(localized: "Apple Intelligence is turned off. Turn it on in System Settings › Apple Intelligence & Siri to generate text on this Mac.")90 case .modelNotReady:91 return String(localized: "macOS is downloading or preparing the on-device language model. This panel becomes available by itself when the model is ready.")92 case .unavailable(let reason):93 return String(localized: "The on-device language model is not available (\(reason)).")94 }95 }96}9798nonisolated extension IntelligenceError {99 var message: String {100 switch self {101 case .unavailable(let state): return state.explanation102 case .contextExceeded: return String(localized: "The text is too long for the on-device model, even when split into parts. Select a shorter passage.")103 case .refused(let why):104 if let why, !why.isEmpty { return String(localized: "The model declined this request: \(why) The text was left untouched.") }105 return String(localized: "The model declined this request. The text was left untouched.")106 case .guardrail: return String(localized: "The system's safety filter stopped this request. This can happen with text on sensitive subjects. The text was left untouched.")107 case .unsupportedLanguage: return String(localized: "The on-device model does not support the language of this text.")108 case .rateLimited: return String(localized: "The on-device model is busy with other requests. Try again in a moment.")109 case .assetsUnavailable: return String(localized: "The files of the on-device model are not available right now. macOS may be updating them; try again later.")110 case .busy: return String(localized: "The model is already answering another request.")111 case .timedOut: return String(localized: "The model took too long to answer. Try again, or select a shorter passage.")112 case .emptyInput: return String(localized: "There is no text to work on. Select some text or place the caret in a paragraph.")113 case .other(let detail): return String(localized: "The model could not complete the request: \(detail)")114 }115 }116}117118nonisolated extension IntelligenceEvent.Stage {119 var label: String {120 switch self {121 case .preparing: return String(localized: "Measuring the text…")122 case .generating: return String(localized: "Writing…")123 case .readingPart(let i, let n): return String(localized: "Reading part \(i) of \(n)…")124 case .rewritingPart(let i, let n): return String(localized: "Rewriting part \(i) of \(n)…")125 case .combining: return String(localized: "Combining the parts…")126 }127 }128}129130nonisolated extension IntelligenceOutcome.Strategy {131 /// Shown above a proposal when the text did not fit the model in one request.132 var notice: String? {133 switch self {134 case .direct: return nil135 case .partByPart(let parts):136 return String(localized: "The text was too long for one request: it was rewritten in \(parts) parts, cut between paragraphs. Check the transitions.")137 case .mapReduce(let parts, _):138 return String(localized: "The text was too long for one request: it was condensed in \(parts) parts, then the result was written from those notes. Details may be missing.")139 }140 }141}142143nonisolated extension UnsupportedPassage.Kind {144 var title: String {145 switch self {146 case .authorYear: return String(localized: "Citation")147 case .numericReference: return String(localized: "Reference number")148 case .quotation: return String(localized: "Quotation")149 case .link: return String(localized: "Link or DOI")150 }151 }152}153