Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : MacLustr Identity9// File : sdk/swift/Sources/MacLustrIdentityCore/Strings.swift10// Module : MacLustrIdentityCore11// Repository : https://git.spboucher.ai/maclustr-identity12// Project Website : https://identity.spboucher.ai13// Created : 2026-12-0114// Last Modified : 2026-12-0115//16// =============================================================================17// AUTHOR & PROFESSIONAL AFFILIATION18// =============================================================================19//20// Author : Simon-Pierre Boucher21// Position : Professor of Finance22// Institution : Université du Québec en Outaouais (UQO)23// Department : Département des sciences administratives24// Organization : SP Boucher25//26// Website : https://spboucher.ai27// Git : https://git.spboucher.ai28//29// =============================================================================30// OFFICIAL CONTACT DIRECTORY31// =============================================================================32//33// General : info@spboucher.ai34// Professional : contact@spboucher.ai35// Direct : simon@spboucher.ai36// Research : research@spboucher.ai37// Development : dev@spboucher.ai38// Support : support@spboucher.ai39// Security/Admin : admin@spboucher.ai40// Notifications : notifications@spboucher.ai41//42// Preferred Contact: admin@spboucher.ai43//44// =============================================================================45// COPYRIGHT & INTELLECTUAL PROPERTY46// =============================================================================47//48// Copyright (c) 202649// Simon-Pierre Boucher50//51// All rights reserved where applicable.52//53// This file is governed by the applicable project license,54// copyright notices, institutional agreements and relevant law.55//56// Unless expressly authorized by the applicable license or57// rights holder, copying, redistribution, sublicensing,58// publication and commercial exploitation are not permitted.59//60// Existing third-party rights and notices remain unaffected.61//62// =============================================================================63// CONFIDENTIALITY & SECURITY64// =============================================================================65//66// Classification : Public67// Distribution : Public repository; use is governed by the project license68// Security Contact : admin@spboucher.ai69//70// Access to this source does not independently grant permission71// to redistribute or disclose confidential materials.72//73// Do not embed credentials, private keys, access tokens,74// certificates or confidential personal information.75//76// =============================================================================77// LICENSE & MAINTENANCE78// =============================================================================79//80// License : None specified (no license file in this repository)81// Maintainer : Simon-Pierre Boucher82// Technical Contact: dev@spboucher.ai83//84// =============================================================================85// END OF SP BOUCHER SOURCE HEADER86// =============================================================================8788// French and English strings for every text owned by the SDK. Consent texts and decision reasons come from the API.89import Foundation9091public enum IdentityLanguage: String, Sendable, CaseIterable {92 case fr, en9394 /// `fr-CA`, `fr_FR`, `fr` → French; anything else → English.95 public init(localeIdentifier: String) {96 self = localeIdentifier.lowercased().hasPrefix("fr") ? .fr : .en97 }98}99100/// Keys of the SDK-owned strings. `%@` is replaced by a text argument, `%d` by a number.101public enum IdentityString: CaseIterable, Sendable {102 case cancel, continueAction, retry, close, back, done, processedBy, sandboxBadge103 case introTitle, introBody, introStepDocument, introStepSelfie, introStepResult, introNeed, introStart104 case methodTitle, methodBiometric, methodNonBiometric, methodNeedsCamera, changeMethod, changeMethodNotice105 case consentTitle, consentAccept, consentDecline, consentController, consentPrivacyPolicy, consentVersion106 case docFrontTitle, docBackTitle, docFrontHint, docBackHint, docNoBack, docShutter, docRetake, docUse, docUploading, docChooseFile107 case docReviewTitle, docTextHardToRead, docLowResolution, docRetryNotice, docAttemptsLeft108 case docGuideSearching, docGuideCloser, docGuideSteady, docGuideDark, docGuideBright, docGuideBlurry, docGuideReady109 case issueResolution, issueBlurry, issueDark, issueOverexposed, issueContrast, issueGlare, issueGeneric110 case selfieTitle, selfieIntro, selfieStart, selfieAccessibleLink, selfieAccessibleBody, selfieAccessibleStart111 case selfieGuideNoFace, selfieGuideCloser, selfieGuideCenter, selfieGuideTurnLeft, selfieGuideTurnRight, selfieGuideBackToCenter, selfieGuideHold112 case selfieGuideDone, selfieStepProgress, selfieTimeout, selfieChallengeExpired, selfieNoCamera, selfieUploading113 case cameraPromptTitle, cameraPromptBody, cameraAllow, cameraDeniedTitle, cameraDeniedBody, cameraOpenSettings, cameraInterrupted, cameraUnavailable114 case submitting, processingTitle, processingBody, processingSlow, finishLater115 case resultVerifiedTitle, resultVerifiedBody, resultReviewTitle, resultReviewBody, resultInconclusiveTitle, resultInconclusiveBody116 case resultRejectedTitle, resultRejectedBody, resultExpiredTitle, resultExpiredBody, resultCancelledTitle, resultCancelledBody117 case resultRevokedTitle, resultRevokedBody, resultUnknownTitle, resultReasons, resultDispute118 case disputeTitle, disputePlaceholder, disputeSend, disputeSent119 case withdrawAction, withdrawConfirmTitle, withdrawConfirmBody, withdrawConfirm120 case leaveConfirmTitle, leaveConfirmBody, leave, stay121 case sandboxTitle, sandboxBody122 case errorNetwork, errorSessionInvalid, errorRateLimited, errorServiceUnavailable, errorFileTooLarge, errorUnsupportedFile, errorGeneric123 case a11yCameraPreview, a11yLogo124125 public func text(_ language: IdentityLanguage) -> String {126 let p = pair127 return language == .fr ? p.fr : p.en128 }129130 /// Formats the string with its arguments.131 public func text(_ language: IdentityLanguage, _ args: CVarArg...) -> String {132 String(format: text(language), arguments: args)133 }134135 var pair: (fr: String, en: String) {136 switch self {137 case .cancel: return ("Annuler", "Cancel")138 case .continueAction: return ("Continuer", "Continue")139 case .retry: return ("Réessayer", "Try again")140 case .close: return ("Fermer", "Close")141 case .back: return ("Retour", "Back")142 case .done: return ("Terminer", "Done")143 case .processedBy: return ("Vérification effectuée par MacLustr Identity", "Verification performed by MacLustr Identity")144 case .sandboxBadge: return ("Bac à sable : aucune donnée réelle", "Sandbox: no real data")145146 case .introTitle: return ("Vérifions votre identité", "Let's verify your identity")147 case .introBody: return ("%@ vous demande de confirmer votre identité. La vérification est effectuée par MacLustr Identity, qui traite vos renseignements.", "%@ asks you to confirm your identity. The verification is performed by MacLustr Identity, which processes your information.")148 case .introStepDocument: return ("Photographiez votre pièce d'identité", "Take a photo of your ID document")149 case .introStepSelfie: return ("Prenez un égoportrait en suivant de courts mouvements de tête", "Take a selfie while following short head movements")150 case .introStepResult: return ("Recevez le résultat, habituellement en moins d'une minute", "Get the result, usually in less than a minute")151 case .introNeed: return ("Ayez votre pièce sous la main : passeport, permis de conduire ou carte d'identité.", "Have your document at hand: passport, driver's licence or identity card.")152 case .introStart: return ("Commencer", "Get started")153154 case .methodTitle: return ("Choisissez une méthode", "Choose a method")155 case .methodBiometric: return ("Utilise des mesures de votre visage, une seule fois", "Uses measurements of your face, once")156 case .methodNonBiometric: return ("Aucune mesure de votre visage", "No measurement of your face")157 case .methodNeedsCamera: return ("Nécessite une caméra, absente de cet appareil", "Requires a camera, which this device does not have")158 case .changeMethod: return ("Changer de méthode", "Change method")159 case .changeMethodNotice: return ("Si vous choisissez une autre méthode, les photos déjà envoyées seront détruites et la capture recommencera.", "If you choose another method, the photos already sent will be destroyed and the capture will start over.")160161 case .consentTitle: return ("Votre consentement", "Your consent")162 case .consentAccept: return ("Accepter et continuer", "Accept and continue")163 case .consentDecline: return ("Refuser", "Decline")164 case .consentController: return ("Responsable de vos renseignements : %@", "Responsible for your information: %@")165 case .consentPrivacyPolicy: return ("Politique de confidentialité", "Privacy policy")166 case .consentVersion: return ("Version du texte : %@", "Text version: %@")167168 case .docFrontTitle: return ("Recto de la pièce", "Front of the document")169 case .docBackTitle: return ("Verso de la pièce", "Back of the document")170 case .docFrontHint: return ("Placez le recto de votre pièce dans le cadre, sur une surface unie et bien éclairée.", "Place the front of your document in the frame, on a plain, well-lit surface.")171 case .docBackHint: return ("Retournez la pièce et placez le verso dans le cadre.", "Turn the document over and place the back in the frame.")172 case .docNoBack: return ("Ma pièce n'a pas de verso (passeport)", "My document has no back (passport)")173 case .docShutter: return ("Prendre la photo", "Take the photo")174 case .docRetake: return ("Reprendre", "Retake")175 case .docUse: return ("Utiliser cette photo", "Use this photo")176 case .docUploading: return ("Téléversement en cours…", "Uploading…")177 case .docChooseFile: return ("Choisir un fichier", "Choose a file")178 case .docReviewTitle: return ("La photo est-elle nette et complète ?", "Is the photo sharp and complete?")179 case .docTextHardToRead: return ("Le texte semble difficile à lire. Reprenez la photo si elle est floue ou coupée.", "The text looks hard to read. Retake the photo if it is blurry or cropped.")180 case .docLowResolution: return ("La photo est petite : le code-barres et les petits caractères pourraient être illisibles. Rapprochez-vous et reprenez-la si possible.", "The photo is small: the barcode and the fine print may be unreadable. Move closer and retake it if you can.")181 case .docRetryNotice: return ("Les images n'ont pas permis l'analyse. Reprenons la capture.", "The images could not be analysed. Let's capture them again.")182 case .docAttemptsLeft: return ("Essais restants : %d", "Attempts left: %d")183184 case .docGuideSearching: return ("Placez la pièce dans le cadre", "Place the document in the frame")185 case .docGuideCloser: return ("Rapprochez-vous", "Move closer")186 case .docGuideSteady: return ("Ne bougez plus", "Hold steady")187 case .docGuideDark: return ("Trop sombre : ajoutez de la lumière", "Too dark: add some light")188 case .docGuideBright: return ("Trop de lumière : évitez les reflets", "Too bright: avoid glare")189 case .docGuideBlurry: return ("Image floue : stabilisez l'appareil", "Blurry: steady the device")190 case .docGuideReady: return ("Parfait, prise de la photo", "Perfect, taking the photo")191192 case .issueResolution: return ("L'image est trop petite. Rapprochez-vous de la pièce.", "The image is too small. Move closer to the document.")193 case .issueBlurry: return ("L'image est floue. Stabilisez l'appareil et reprenez la photo.", "The image is blurry. Steady the device and retake the photo.")194 case .issueDark: return ("L'image est trop sombre. Ajoutez de la lumière.", "The image is too dark. Add some light.")195 case .issueOverexposed: return ("L'image est surexposée. Éloignez la source de lumière.", "The image is overexposed. Move away from the light source.")196 case .issueContrast: return ("Le contraste est trop faible. Posez la pièce sur une surface unie plus foncée ou plus pâle.", "The contrast is too low. Put the document on a plain darker or lighter surface.")197 case .issueGlare: return ("Un reflet cache une partie de la pièce. Inclinez-la légèrement.", "Glare hides part of the document. Tilt it slightly.")198 case .issueGeneric: return ("La photo n'a pas pu être utilisée. Reprenez-la.", "The photo could not be used. Please retake it.")199200 case .selfieTitle: return ("Égoportrait", "Selfie")201 case .selfieIntro: return ("Tenez l'appareil à la hauteur des yeux. Nous vous demanderons de tourner lentement la tête, puis de revenir au centre.", "Hold the device at eye level. We will ask you to slowly turn your head, then come back to the centre.")202 case .selfieStart: return ("Je suis prêt", "I'm ready")203 case .selfieAccessibleLink: return ("Je ne peux pas faire ces mouvements", "I can't do these movements")204 case .selfieAccessibleBody: return ("Aucun mouvement ne vous sera demandé : regardez simplement l'appareil. Une personne autorisée examinera ensuite votre vérification, ce qui peut prendre plus de temps.", "No movement will be asked: simply look at the device. An authorised person will then review your verification, which may take longer.")205 case .selfieAccessibleStart: return ("Continuer sans mouvement", "Continue without movement")206 case .selfieGuideNoFace: return ("Placez votre visage dans l'ovale", "Place your face in the oval")207 case .selfieGuideCloser: return ("Rapprochez-vous", "Move closer")208 case .selfieGuideCenter: return ("Regardez droit devant", "Look straight ahead")209 case .selfieGuideTurnLeft: return ("Tournez lentement la tête vers votre gauche", "Slowly turn your head to your left")210 case .selfieGuideTurnRight: return ("Tournez lentement la tête vers votre droite", "Slowly turn your head to your right")211 case .selfieGuideBackToCenter: return ("Revenez au centre", "Come back to the centre")212 case .selfieGuideHold: return ("Ne bougez plus", "Hold still")213 case .selfieGuideDone: return ("Terminé", "Done")214 case .selfieStepProgress: return ("Mouvement %d de %d", "Movement %d of %d")215 case .selfieTimeout: return ("Nous n'avons pas pu suivre les mouvements. Réessayons, plus lentement.", "We could not follow the movements. Let's try again, more slowly.")216 case .selfieChallengeExpired: return ("Le délai est écoulé. Réessayons.", "Time ran out. Let's try again.")217 case .selfieNoCamera: return ("Aucune caméra n'est disponible sur cet appareil pour l'égoportrait. Poursuivez la vérification sur un téléphone.", "No camera is available on this device for the selfie. Continue the verification on a phone.")218 case .selfieUploading: return ("Envoi de l'égoportrait…", "Sending the selfie…")219220 case .cameraPromptTitle: return ("Accès à la caméra", "Camera access")221 case .cameraPromptBody: return ("La caméra sert à photographier votre pièce et à prendre votre égoportrait. Les images sont transmises chiffrées à MacLustr Identity et ne sont jamais enregistrées sur cet appareil.", "The camera is used to photograph your document and take your selfie. Images are sent encrypted to MacLustr Identity and are never saved on this device.")222 case .cameraAllow: return ("Autoriser la caméra", "Allow camera")223 case .cameraDeniedTitle: return ("Caméra non autorisée", "Camera not allowed")224 case .cameraDeniedBody: return ("Pour continuer, autorisez l'accès à la caméra dans les réglages de l'appareil.", "To continue, allow camera access in the device settings.")225 case .cameraOpenSettings: return ("Ouvrir les réglages", "Open settings")226 case .cameraInterrupted: return ("La capture a été interrompue. Reprenons cette étape.", "Capture was interrupted. Let's redo this step.")227 case .cameraUnavailable: return ("La caméra n'est pas disponible.", "The camera is not available.")228229 case .submitting: return ("Envoi en cours…", "Sending…")230 case .processingTitle: return ("Analyse en cours", "Analysis in progress")231 case .processingBody: return ("Cela prend habituellement moins d'une minute. Gardez cet écran ouvert.", "This usually takes less than a minute. Keep this screen open.")232 case .processingSlow: return ("L'analyse prend plus de temps que prévu. Vous pouvez fermer cet écran : %@ recevra le résultat.", "The analysis is taking longer than expected. You can close this screen: %@ will receive the result.")233 case .finishLater: return ("Fermer", "Close")234235 case .resultVerifiedTitle: return ("Identité vérifiée", "Identity verified")236 case .resultVerifiedBody: return ("Le résultat a été transmis à %@. Vos images sont détruites.", "The result was sent to %@. Your images are destroyed.")237 case .resultReviewTitle: return ("Examen par une personne", "Review by a person")238 case .resultReviewBody: return ("Une personne autorisée examinera votre vérification. %@ vous informera du résultat.", "An authorised person will review your verification. %@ will let you know the result.")239 case .resultInconclusiveTitle: return ("Vérification non concluante", "Verification inconclusive")240 case .resultInconclusiveBody: return ("Nous n'avons pas pu confirmer votre identité. Ce n'est pas un refus : communiquez avec %@ pour recommencer.", "We could not confirm your identity. This is not a refusal: contact %@ to start again.")241 case .resultRejectedTitle: return ("Vérification refusée", "Verification declined")242 case .resultRejectedBody: return ("La vérification n'a pas été acceptée. Vous pouvez contester cette décision : une personne l'examinera.", "The verification was not accepted. You can contest this decision: a person will review it.")243 case .resultExpiredTitle: return ("Session expirée", "Session expired")244 case .resultExpiredBody: return ("Cette session n'est plus valide. Recommencez à partir de %@.", "This session is no longer valid. Start again from %@.")245 case .resultCancelledTitle: return ("Vérification annulée", "Verification cancelled")246 case .resultCancelledBody: return ("La vérification est annulée et vos images ont été détruites.", "The verification is cancelled and your images have been destroyed.")247 case .resultRevokedTitle: return ("Vérification révoquée", "Verification revoked")248 case .resultRevokedBody: return ("Cette vérification n'est plus valide. Communiquez avec %@.", "This verification is no longer valid. Contact %@.")249 case .resultUnknownTitle: return ("Vérification terminée", "Verification finished")250 case .resultReasons: return ("Motifs", "Reasons")251 case .resultDispute: return ("Contester la décision", "Contest the decision")252253 case .disputeTitle: return ("Contester la décision", "Contest the decision")254 case .disputePlaceholder: return ("Expliquez pourquoi vous contestez la décision (5 à 2000 caractères).", "Explain why you contest the decision (5 to 2000 characters).")255 case .disputeSend: return ("Envoyer", "Send")256 case .disputeSent: return ("Votre contestation est reçue. Une personne l'examinera.", "Your dispute has been received. A person will review it.")257258 case .withdrawAction: return ("Retirer mon consentement", "Withdraw my consent")259 case .withdrawConfirmTitle: return ("Retirer votre consentement ?", "Withdraw your consent?")260 case .withdrawConfirmBody: return ("Vos images seront détruites sur-le-champ et la vérification sera annulée.", "Your images will be destroyed immediately and the verification will be cancelled.")261 case .withdrawConfirm: return ("Retirer et tout détruire", "Withdraw and destroy everything")262 case .leaveConfirmTitle: return ("Quitter la vérification ?", "Leave the verification?")263 case .leaveConfirmBody: return ("Vous pourrez la reprendre tant que la session est valide.", "You can resume it while the session is still valid.")264 case .leave: return ("Quitter", "Leave")265 case .stay: return ("Rester", "Stay")266267 case .sandboxTitle: return ("Session d'essai", "Test session")268 case .sandboxBody: return ("Cette session est en bac à sable : aucune image n'est demandée ni acceptée. Choisissez le résultat à simuler.", "This is a sandbox session: no image is requested or accepted. Choose the result to simulate.")269270 case .errorNetwork: return ("Connexion impossible. Vérifiez votre réseau, puis réessayez.", "Could not connect. Check your network, then try again.")271 case .errorSessionInvalid: return ("Ce lien de vérification n'est pas valide.", "This verification link is not valid.")272 case .errorRateLimited: return ("Trop de tentatives. Patientez un instant, puis réessayez.", "Too many attempts. Wait a moment, then try again.")273 case .errorServiceUnavailable: return ("Le service est momentanément indisponible. Réessayez dans un instant.", "The service is temporarily unavailable. Try again in a moment.")274 case .errorFileTooLarge: return ("Le fichier est trop volumineux.", "The file is too large.")275 case .errorUnsupportedFile: return ("Ce fichier n'est pas une image acceptée (JPEG, PNG ou WebP).", "This file is not an accepted image (JPEG, PNG or WebP).")276 case .errorGeneric: return ("Une erreur est survenue. Réessayez.", "Something went wrong. Please try again.")277278 case .a11yCameraPreview: return ("Aperçu de la caméra", "Camera preview")279 case .a11yLogo: return ("Logo de %@", "%@ logo")280 }281 }282}283284public extension IdentityString {285 /// Message for a document quality issue code returned by the service.286 static func forDocumentIssue(_ code: String) -> IdentityString {287 switch code {288 case "resolution_too_low", "image_too_small": return .issueResolution289 case "image_blurry": return .issueBlurry290 case "image_too_dark": return .issueDark291 case "image_overexposed": return .issueOverexposed292 case "low_contrast": return .issueContrast293 case "glare_detected": return .issueGlare294 default: return .issueGeneric295 }296 }297298 /// Message to show to the person for an error. API messages are developer-facing and are not displayed.299 static func forError(_ error: IdentityError) -> IdentityString {300 switch error {301 case .network: return .errorNetwork302 case .invalidSessionURL: return .errorSessionInvalid303 case .sessionExpired: return .resultExpiredTitle304 case .cameraDenied: return .cameraDeniedBody305 case .cameraUnavailable: return .cameraUnavailable306 case .captureFailed: return .cameraInterrupted307 case .api(let e):308 if e.status == 401 { return .errorSessionInvalid }309 if e.status == 429 { return .errorRateLimited }310 if e.status == 503 { return .errorServiceUnavailable }311 switch e.code {312 case "file_too_large", "payload_too_large": return .errorFileTooLarge313 case "unsupported_file_type", "invalid_image": return .errorUnsupportedFile314 case "image_too_small": return .issueResolution315 case "challenge_expired": return .selfieChallengeExpired316 default: return .errorGeneric317 }318 case .invalidResponse(let status): return status == 413 ? .errorFileTooLarge : status >= 500 ? .errorServiceUnavailable : .errorGeneric319 default: return .errorGeneric320 }321 }322}323