diff --git a/Pocket Poster/Controllers/PosterBoardManager.swift b/Pocket Poster/Controllers/PosterBoardManager.swift index d4f3a63..4260e12 100644 --- a/Pocket Poster/Controllers/PosterBoardManager.swift +++ b/Pocket Poster/Controllers/PosterBoardManager.swift @@ -237,7 +237,7 @@ class PosterBoardManager: ObservableObject { } } } - UIApplication.shared.change(title: "Applying Wallpapers...", body: "Extracting tendies...") + UIApplication.shared.change(title: NSLocalizedString("Applying Wallpapers...", comment: ""), body: NSLocalizedString("Extracting tendies...", comment: "happens when unzipping the files")) for url in selectedTendies { let unzippedDir = try unzipFile(at: url) guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling diff --git a/Pocket Poster/Controllers/VideoHandler.swift b/Pocket Poster/Controllers/VideoHandler.swift index af9d95a..709f09c 100644 --- a/Pocket Poster/Controllers/VideoHandler.swift +++ b/Pocket Poster/Controllers/VideoHandler.swift @@ -92,7 +92,8 @@ class VideoHandler { while let sampleBuffer = readerOutput.copyNextSampleBuffer(), let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) { let name = "\(frameCount).jpg" - UIApplication.shared.change(title: "Generating Video...", body: "Creating assets/\(name)...") + let filePathName = "assets/\(name)" + UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName)) let ciImage = CIImage(cvPixelBuffer: imageBuffer) let context = CIContext() @@ -108,7 +109,7 @@ class VideoHandler { } catch { print("Error reading asset: \(error)") } - UIApplication.shared.change(title: "Generating Video...", body: "Creating CAML data...") + UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: NSLocalizedString("Creating CAML data...", comment: "translate this however you see fits")) camlData += """ diff --git a/Pocket Poster/Error Codes/ApplyError.swift b/Pocket Poster/Error Codes/ApplyError.swift index a42ef51..15c660e 100644 --- a/Pocket Poster/Error Codes/ApplyError.swift +++ b/Pocket Poster/Error Codes/ApplyError.swift @@ -20,9 +20,9 @@ enum ApplyError: LocalizedError { public var errorDescription: String? { switch self { case .wrongAppHash: - return "Your app hash is incorrect. Please set it again." + return NSLocalizedString("Your app hash is incorrect. Please set it again.", comment: "") case .collectionsNeedsReset: - return "The folder is improperly set up. Please tap \"Reset Collections\" and try again." + return NSLocalizedString("The folder is improperly set up. Please tap \"Reset Collections\" and try again.", comment: "") case .unexpected(let info): return info } diff --git a/Pocket Poster/Extensions/Alert++.swift b/Pocket Poster/Extensions/Alert++.swift index e8756a4..f6bd495 100644 --- a/Pocket Poster/Extensions/Alert++.swift +++ b/Pocket Poster/Extensions/Alert++.swift @@ -32,7 +32,7 @@ extension UIApplication { let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "" let appBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "" let systemVersion = device.systemVersion - body += "\n\(device.systemName) \(systemVersion), version \(appVersion) build \(appBuild)" + body += "\n\(device.systemName) \(systemVersion), v\(appVersion) build \(appBuild)" } currentUIAlertController = UIAlertController(title: title, message: body, preferredStyle: .alert) diff --git a/Pocket Poster/Pocket_PosterApp.swift b/Pocket Poster/Pocket_PosterApp.swift index d2f68aa..4f27740 100644 --- a/Pocket Poster/Pocket_PosterApp.swift +++ b/Pocket Poster/Pocket_PosterApp.swift @@ -31,12 +31,12 @@ struct Pocket_PosterApp: App { if url.absoluteString.starts(with: "pocketposter://download") { // prohibit to only tendies files if !url.absoluteString.hasSuffix(".tendies") { - UIApplication.shared.alert(body: "Only .tendies files can be downloaded!") + UIApplication.shared.alert(body: NSLocalizedString("Only .tendies files can be downloaded!", comment: "")) } else if PosterBoardManager.shared.selectedTendies.count >= PosterBoardManager.MaxTendies { - UIApplication.shared.alert(title: "Max Tendies Reached", body: "You can only apply \(PosterBoardManager.MaxTendies) descriptors.") + UIApplication.shared.alert(title: NSLocalizedString("Max Tendies Reached", comment: ""), body: String(format: NSLocalizedString("You can only apply %@ descriptors.", comment: ""), "\(PosterBoardManager.MaxTendies)")) } else { downloadURL = url.absoluteString.replacingOccurrences(of: "pocketposter://download?url=", with: "") - UIApplication.shared.confirmAlert(title: "Download Tendies File", body: "Would you like to download the file \(DownloadManager.getWallpaperNameFromURL(string: downloadURL ?? "/Unknown"))?", onOK: { + UIApplication.shared.confirmAlert(title: NSLocalizedString("Download Tendies File", comment: ""), body: String(format: NSLocalizedString("Would you like to download the file %@?", comment: ""), "\(DownloadManager.getWallpaperNameFromURL(string: downloadURL ?? "/Unknown"))"), onOK: { downloadWallpaper() }, noCancel: false) } @@ -47,17 +47,17 @@ struct Pocket_PosterApp: App { } else if url.pathExtension == "tendies" { if PosterBoardManager.shared.selectedTendies.count >= PosterBoardManager.MaxTendies { - UIApplication.shared.alert(title: "Max Tendies Reached", body: "You can only apply \(PosterBoardManager.MaxTendies) descriptors.") + UIApplication.shared.alert(title: NSLocalizedString("Max Tendies Reached", comment: ""), body: String(format: NSLocalizedString("You can only apply %@ descriptors.", comment: ""), "\(PosterBoardManager.MaxTendies)")) } else { // copy it over to the KFC bucket do { let newURL = try DownloadManager.copyTendies(from: url) PosterBoardManager.shared.selectedTendies.append(newURL) Haptic.shared.notify(.success) - UIApplication.shared.alert(title: "Successfully imported \(url.lastPathComponent)", body: "") + UIApplication.shared.alert(title: String(format: NSLocalizedString("Successfully imported %@", comment: ""), "\(url.lastPathComponent)"), body: "") } catch { Haptic.shared.notify(.error) - UIApplication.shared.alert(title: "Failed to import tendies", body: error.localizedDescription) + UIApplication.shared.alert(title: NSLocalizedString("Failed to import tendies", comment: ""), body: error.localizedDescription) } } } diff --git a/Pocket Poster/Views/ContentView.swift b/Pocket Poster/Views/ContentView.swift index 8936961..227cbf3 100644 --- a/Pocket Poster/Views/ContentView.swift +++ b/Pocket Poster/Views/ContentView.swift @@ -76,9 +76,9 @@ struct ContentView: View { Haptic.shared.notify(.success) DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: { pbManager.selectedTendies.removeAll() - UIApplication.shared.confirmAlert(title: "Success!", body: "The PosterBoard app will now open. Please close it from the app switcher.", onOK: { + UIApplication.shared.confirmAlert(title: NSLocalizedString("Success!", comment: ""), body: NSLocalizedString("The PosterBoard app will now open. Please close it from the app switcher.", comment: ""), onOK: { if !pbManager.openPosterBoard() { - UIApplication.shared.confirmAlert(title: "Falling Back to Shortcut", body: "PosterBoard failed to open directly. The fallback shortcut will now be opened.", onOK: { + UIApplication.shared.confirmAlert(title: NSLocalizedString("Falling Back to Shortcut", comment: ""), body: NSLocalizedString("PosterBoard failed to open directly. The fallback shortcut will now be opened.", comment: ""), onOK: { pbManager.runShortcut(named: "PosterBoard") }, noCancel: true) } @@ -103,11 +103,11 @@ struct ContentView: View { hideResetHelp = false // fallback to tutorial return } - UIApplication.shared.confirmAlert(title: "Reset Collections", body: "Do you want to reset collections?", onOK: { + UIApplication.shared.confirmAlert(title: NSLocalizedString("Reset Collections", comment: ""), body: NSLocalizedString("Do you want to reset collections?", comment: ""), onOK: { if pbManager.setSystemLanguage(to: lang) { - UIApplication.shared.alert(title: "Collections Successfully Reset!", body: "Your PosterBoard will refresh automatically.") + UIApplication.shared.alert(title: NSLocalizedString("Collections Successfully Reset!", comment: ""), body: NSLocalizedString("Your PosterBoard will refresh automatically.", comment: "")) } else { - UIApplication.shared.alert(body: "The API failed to call correctly.\nSystem Locale Code: \(lang)") + UIApplication.shared.alert(body: NSLocalizedString("The API failed to call correctly.\nSystem Locale Code: ", comment: "") + lang) } }, noCancel: false) }) { @@ -144,7 +144,7 @@ struct ContentView: View { switch result { case .success(let url): if pbManager.selectedTendies.count + url.count > PosterBoardManager.MaxTendies { - UIApplication.shared.alert(title: "Max Tendies Reached", body: "You can only apply \(PosterBoardManager.MaxTendies) descriptors.") + UIApplication.shared.alert(title: NSLocalizedString("Max Tendies Reached", comment: ""), body: String(format: NSLocalizedString("You can only apply %@ descriptors.", comment: ""), "\(PosterBoardManager.MaxTendies)")) } else { pbManager.selectedTendies.append(contentsOf: url) } diff --git a/Pocket Poster/Views/SettingsView.swift b/Pocket Poster/Views/SettingsView.swift index 1bfd041..b70bfc7 100644 --- a/Pocket Poster/Views/SettingsView.swift +++ b/Pocket Poster/Views/SettingsView.swift @@ -58,7 +58,7 @@ struct SettingsView: View { do { try PosterBoardManager.clearCache() Haptic.shared.notify(.success) - UIApplication.shared.alert(title: "App Cache Successfully Cleared!", body: "") + UIApplication.shared.alert(title: NSLocalizedString("App Cache Successfully Cleared!", comment: ""), body: "") } catch { Haptic.shared.notify(.error) UIApplication.shared.alert(body: error.localizedDescription) @@ -110,10 +110,10 @@ struct SettingsView: View { // MARK: Credits Section { LinkCell(imageName: "leminlimez", url: "https://github.com/leminlimez", title: "LeminLimez", contribution: NSLocalizedString("Main Developer", comment: "leminlimez's contribution"), circle: true) - LinkCell(imageName: "serstars", url: "https://github.com/SerStars", title: "SerStars", contribution: "Website Designer", circle: true) - LinkCell(imageName: "Nathan", url: "https://github.com/verygenericname", title: "Nathan", contribution: "Exploit", circle: true) - LinkCell(imageName: "duy", url: "https://github.com/khanhduytran0", title: "DuyKhanhTran", contribution: "Exploit", circle: true) - LinkCell(imageName: "sky", url: "https://bsky.app/profile/did:plc:xykfeb7ieeo335g3aly6vev4", title: "dootskyre", contribution: "Fallback Shortcut Creator", circle: true) + LinkCell(imageName: "serstars", url: "https://github.com/SerStars", title: "SerStars", contribution: NSLocalizedString("Website Designer", comment: ""), circle: true) + LinkCell(imageName: "Nathan", url: "https://github.com/verygenericname", title: "Nathan", contribution: NSLocalizedString("Exploit", comment: ""), circle: true) + LinkCell(imageName: "duy", url: "https://github.com/khanhduytran0", title: "DuyKhanhTran", contribution: NSLocalizedString("Exploit", comment: ""), circle: true) + LinkCell(imageName: "sky", url: "https://bsky.app/profile/did:plc:xykfeb7ieeo335g3aly6vev4", title: "dootskyre", contribution: NSLocalizedString("Fallback Shortcut Creator", comment: ""), circle: true) } header: { Label("Credits", systemImage: "wrench.and.screwdriver") }