Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Sources/SPGlassCore/GlassL10n.swift8// Module : SPGlassCore9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import Foundation4243/// Localised strings owned by GlassKit itself (accessibility labels, default button titles, status words).44///45/// Text supplied by the host application is never routed through this type: components accept46/// `LocalizedStringKey`, `Text` or `String` from the caller and leave their localisation to the host.47public enum GlassL10n {48 /// The bundle holding `Localizable.strings`. In package mode this is the module bundle; when the sources49 /// are copied into an application (registry source mode) it is the main bundle.50 public static var bundle: Bundle {51 #if SWIFT_PACKAGE52 Bundle.module53 #else54 Bundle.main55 #endif56 }5758 /// Returns the localised string for `key`, or the key itself when it is missing.59 public static func string(_ key: Key) -> String {60 bundle.localizedString(forKey: key.rawValue, value: key.rawValue, table: "GlassKit")61 }6263 /// Returns a localised format string filled with `arguments`.64 public static func string(_ key: Key, _ arguments: any CVarArg...) -> String {65 String(format: string(key), locale: .current, arguments: arguments)66 }6768 /// Returns the string for a specific localisation, used by tests and by the Studio language preview.69 public static func string(_ key: Key, localization: String) -> String {70 guard let path = bundle.path(forResource: localization, ofType: "lproj"),71 let localized = Bundle(path: path) else { return string(key) }72 return localized.localizedString(forKey: key.rawValue, value: key.rawValue, table: "GlassKit")73 }7475 public static let supportedLocalizations = ["en", "fr"]7677 /// Every key present in `GlassKit.strings`. Tests verify that both localisations define all of them.78 public enum Key: String, CaseIterable, Sendable {79 case close = "glass.close"80 case cancel = "glass.cancel"81 case done = "glass.done"82 case ok = "glass.ok"83 case retry = "glass.retry"84 case clear = "glass.clear"85 case copy = "glass.copy"86 case copied = "glass.copied"87 case more = "glass.more"88 case moreActions = "glass.more_actions"89 case loading = "glass.loading"90 case search = "glass.search"91 case send = "glass.send"92 case stop = "glass.stop"93 case attach = "glass.attach"94 case showPassword = "glass.show_password"95 case hidePassword = "glass.hide_password"96 case required = "glass.required"97 case charactersCount = "glass.characters_count"98 case charactersOfLimit = "glass.characters_of_limit"99 case codeDigitsEntered = "glass.code_digits_entered"100 case verificationCode = "glass.verification_code"101 case selected = "glass.selected"102 case expanded = "glass.expanded"103 case collapsed = "glass.collapsed"104 case noData = "glass.no_data"105 case errorTitle = "glass.error_title"106 case info = "glass.status.info"107 case success = "glass.status.success"108 case warning = "glass.status.warning"109 case error = "glass.status.error"110 case dismiss = "glass.dismiss"111 case progressPercent = "glass.progress_percent"112 case increase = "glass.increase"113 case decrease = "glass.decrease"114 case sortAscending = "glass.sort_ascending"115 case sortDescending = "glass.sort_descending"116 case trendUp = "glass.trend_up"117 case trendDown = "glass.trend_down"118 case trendFlat = "glass.trend_flat"119 case play = "glass.play"120 case pause = "glass.pause"121 case skipBack = "glass.skip_back"122 case skipForward = "glass.skip_forward"123 case elapsedTime = "glass.elapsed_time"124 case remainingTime = "glass.remaining_time"125 case playbackPosition = "glass.playback_position"126 case volume = "glass.volume"127 case mute = "glass.mute"128 case unmute = "glass.unmute"129 case previous = "glass.previous"130 case next = "glass.next"131 case imageOfCount = "glass.image_of_count"132 case waveform = "glass.waveform"133 case waveformSummary = "glass.waveform_summary"134 case mediaUnavailable = "glass.media_unavailable"135 case zoomIn = "glass.zoom_in"136 case zoomOut = "glass.zoom_out"137 case resetNorth = "glass.reset_north"138 case compassHeading = "glass.compass_heading"139 case compassUnavailable = "glass.compass_unavailable"140 case locate = "glass.locate"141 case locationDenied = "glass.location_denied"142 case locationUnavailable = "glass.location_unavailable"143 case locationFollowing = "glass.location_following"144 case mapControls = "glass.map_controls"145 case results = "glass.results"146 case roleUser = "glass.role.user"147 case roleAssistant = "glass.role.assistant"148 case roleSystem = "glass.role.system"149 case roleTool = "glass.role.tool"150 case streaming = "glass.streaming"151 case working = "glass.working"152 case message = "glass.message"153 case modelLocal = "glass.model.local"154 case modelRemote = "glass.model.remote"155 case modelUnavailable = "glass.model.unavailable"156 case statusPending = "glass.task.pending"157 case statusRunning = "glass.task.running"158 case statusSucceeded = "glass.task.succeeded"159 case statusFailed = "glass.task.failed"160 case statusCancelled = "glass.task.cancelled"161 case stepsCompleted = "glass.steps_completed"162 case breadcrumb = "glass.breadcrumb"163 case hiddenLevels = "glass.hidden_levels"164 case sidebar = "glass.sidebar"165 case notification = "glass.notification"166 case badgeCount = "glass.badge_count"167 case noEvents = "glass.no_events"168 case noResults = "glass.no_results"169 // Keys added for navigation, forms and selection go below this line.170 case currentLocation = "glass.current_location"171 case fieldRequired = "glass.field.required"172 case fieldTooShort = "glass.field.too_short"173 case fieldTooLong = "glass.field.too_long"174 case navigationSection = "glass.section.navigation"175 // Keys added for containers, feedback and data go below this line.176 case resizePanel = "glass.resize_panel"177 case panelSize = "glass.panel_size"178 case badgeMoreThan = "glass.badge_more_than"179 case sortBy = "glass.sort_by"180 case chartSeries = "glass.chart_series"181 case chartSummary = "glass.chart_summary"182 case timeline = "glass.timeline"183 case contentSection = "glass.section.content"184 // Keys added for media, maps and AI go below this line.185 case expand = "glass.expand"186 case collapse = "glass.collapse"187 case videoPlayer = "glass.video_player"188 case timeOfDuration = "glass.time_of_duration"189 case muted = "glass.muted"190 case locating = "glass.locating"191 case clusterCount = "glass.cluster_count"192 case attachments = "glass.attachments"193 case removeAttachment = "glass.remove_attachment"194 case model = "glass.model"195 case capabilityText = "glass.capability.text"196 case capabilityVision = "glass.capability.vision"197 case capabilityTools = "glass.capability.tools"198 case capabilityReasoning = "glass.capability.reasoning"199 case capabilityAudio = "glass.capability.audio"200 case capabilityCode = "glass.capability.code"201 case mediaSection = "glass.section.media"202 }203}204