From d456a7a6e644c34e2c79ebf4eb03987f4945ee1e Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 08:23:05 -0700 Subject: [PATCH] translation strings for log headers, add device log setting to save --- Meshtastic/Persistence/UpdateCoreData.swift | 18 +++++++++--------- de.lproj/Localizable.strings | 6 ++++++ en.lproj/Localizable.strings | 6 ++++++ fr.lproj/Localizable.strings | 6 ++++++ he.lproj/Localizable.strings | 6 ++++++ pl.lproj/Localizable.strings | 6 ++++++ pt-PT.lproj/Localizable.strings | 6 ++++++ se.lproj/Localizable.strings | 6 ++++++ zh-Hans.lproj/Localizable.strings | 6 ++++++ zh-Hant-TW.lproj/Localizable.strings | 6 ++++++ 10 files changed, 63 insertions(+), 9 deletions(-) diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index 1ef04ff7..c78ab2d2 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -383,18 +383,16 @@ func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext) } } -func upsertBluetoothConfigPacket(config: Meshtastic.Config.BluetoothConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertBluetoothConfigPacket(config: Config.BluetoothConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.bluetooth.config %@".localized, String(nodeNum)) MeshLogger.log("📶 \(logString)") - let fetchNodeInfoRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") + let fetchNodeInfoRequest = NodeInfoEntity.fetchRequest() fetchNodeInfoRequest.predicate = NSPredicate(format: "num == %lld", Int64(nodeNum)) do { - guard let fetchedNode = try context.fetch(fetchNodeInfoRequest) as? [NodeInfoEntity] else { - return - } + let fetchedNode = try context.fetch(fetchNodeInfoRequest) // Found a node, save Device Config if !fetchedNode.isEmpty { if fetchedNode[0].bluetoothConfig == nil { @@ -402,26 +400,28 @@ func upsertBluetoothConfigPacket(config: Meshtastic.Config.BluetoothConfig, node newBluetoothConfig.enabled = config.enabled newBluetoothConfig.mode = Int32(config.mode.rawValue) newBluetoothConfig.fixedPin = Int32(config.fixedPin) + newBluetoothConfig.deviceLoggingEnabled = config.deviceLoggingEnabled fetchedNode[0].bluetoothConfig = newBluetoothConfig } else { fetchedNode[0].bluetoothConfig?.enabled = config.enabled fetchedNode[0].bluetoothConfig?.mode = Int32(config.mode.rawValue) fetchedNode[0].bluetoothConfig?.fixedPin = Int32(config.fixedPin) + fetchedNode[0].bluetoothConfig?.deviceLoggingEnabled = config.deviceLoggingEnabled } do { try context.save() - Logger.data.info("💾 Updated Bluetooth Config for node number: \(String(nodeNum))") + Logger.data.info("💾 Updated Bluetooth Config for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data BluetoothConfigEntity: \(nsError)") + Logger.data.error("💥 Error Updating Core Data BluetoothConfigEntity: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Bluetooth Config") + Logger.data.error("💥 No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Bluetooth Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data BluetoothConfigEntity failed: \(nsError)") + Logger.data.error("💥 Fetching node for core data BluetoothConfigEntity failed: \(nsError, privacy: .public)") } } diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index 511ecdaa..83fe06d3 100644 --- a/de.lproj/Localizable.strings +++ b/de.lproj/Localizable.strings @@ -173,6 +173,12 @@ "interval.seventytwo.hours"="Seventy Two Hours"; "keyboard.type"="Keyboard Typ"; "logging"="Logging"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Einstellungen"; "map"="Mesh Karte"; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 4c507879..fb3af6f6 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="Seventy Two Hours"; "keyboard.type"="Keyboard Type"; "logging"="Logging"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Config"; "map"="Mesh Map"; diff --git a/fr.lproj/Localizable.strings b/fr.lproj/Localizable.strings index 785a2012..3c517ac3 100644 --- a/fr.lproj/Localizable.strings +++ b/fr.lproj/Localizable.strings @@ -154,6 +154,12 @@ "interval.seventytwo.hours"="Soixante douze heures"; "keyboard.type"="Type de clavier"; "logging"="Enregistrement"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="Configuration LoRa"; "map"="Carte de maillage"; diff --git a/he.lproj/Localizable.strings b/he.lproj/Localizable.strings index 154c2391..fd844980 100644 --- a/he.lproj/Localizable.strings +++ b/he.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="שבעים ושתיים שעות"; "keyboard.type"="סוג מקלדת"; "logging"="רישום"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="לורה"; "lora.config"="הגדרות לורה"; "map"="מפת מש"; diff --git a/pl.lproj/Localizable.strings b/pl.lproj/Localizable.strings index eb8372b0..e09d745b 100644 --- a/pl.lproj/Localizable.strings +++ b/pl.lproj/Localizable.strings @@ -175,6 +175,12 @@ "interval.seventytwo.hours"="Siedemdziesiąt Dwie Godziny"; "keyboard.type"="Typ Klawiatury"; "logging"="Rejestracja"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="Konfiguracja LoRa"; "map"="Mapa Sieci"; diff --git a/pt-PT.lproj/Localizable.strings b/pt-PT.lproj/Localizable.strings index 4c507879..fb3af6f6 100644 --- a/pt-PT.lproj/Localizable.strings +++ b/pt-PT.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="Seventy Two Hours"; "keyboard.type"="Keyboard Type"; "logging"="Logging"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Config"; "map"="Mesh Map"; diff --git a/se.lproj/Localizable.strings b/se.lproj/Localizable.strings index e45ca2fe..81d00170 100644 --- a/se.lproj/Localizable.strings +++ b/se.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="Sjuttiotvå Timmar"; "keyboard.type"="Tangentbordstyp"; "logging"="Loggning"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Konfiguration"; "map"="Mesh Karta"; diff --git a/zh-Hans.lproj/Localizable.strings b/zh-Hans.lproj/Localizable.strings index 5606f44b..3a241f3f 100644 --- a/zh-Hans.lproj/Localizable.strings +++ b/zh-Hans.lproj/Localizable.strings @@ -173,6 +173,12 @@ "interval.eventytwo.hours"="七十二小时"; "keyboard.type"="键盘类型"; "logging"="加载中"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa 配置"; "map"="Mesh 地图"; diff --git a/zh-Hant-TW.lproj/Localizable.strings b/zh-Hant-TW.lproj/Localizable.strings index 1665f916..fdc02df2 100644 --- a/zh-Hant-TW.lproj/Localizable.strings +++ b/zh-Hant-TW.lproj/Localizable.strings @@ -173,6 +173,12 @@ "interval.eventytwo.hours"="七十二小時"; "keyboard.type"="鍵盤類型"; "logging"="加載中"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa 設定"; "map"="Mesh 地圖";