prepare for localizations
This commit is contained in:
1 parent
d835a40199
commit
bf0d7989bd
7 files changed
+24
-23
No files matched your search
@@ -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 {
|
for url in selectedTendies {
|
||||||
let unzippedDir = try unzipFile(at: url)
|
let unzippedDir = try unzipFile(at: url)
|
||||||
guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling
|
guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ class VideoHandler {
|
|||||||
while let sampleBuffer = readerOutput.copyNextSampleBuffer(),
|
while let sampleBuffer = readerOutput.copyNextSampleBuffer(),
|
||||||
let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
|
let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
|
||||||
let name = "\(frameCount).jpg"
|
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 ciImage = CIImage(cvPixelBuffer: imageBuffer)
|
||||||
let context = CIContext()
|
let context = CIContext()
|
||||||
@@ -108,7 +109,7 @@ class VideoHandler {
|
|||||||
} catch {
|
} catch {
|
||||||
print("Error reading asset: \(error)")
|
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 += """
|
camlData += """
|
||||||
</values>
|
</values>
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ enum ApplyError: LocalizedError {
|
|||||||
public var errorDescription: String? {
|
public var errorDescription: String? {
|
||||||
switch self {
|
switch self {
|
||||||
case .wrongAppHash:
|
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:
|
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):
|
case .unexpected(let info):
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ extension UIApplication {
|
|||||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
||||||
let appBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
let appBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
||||||
let systemVersion = device.systemVersion
|
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)
|
currentUIAlertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ struct Pocket_PosterApp: App {
|
|||||||
if url.absoluteString.starts(with: "pocketposter://download") {
|
if url.absoluteString.starts(with: "pocketposter://download") {
|
||||||
// prohibit to only tendies files
|
// prohibit to only tendies files
|
||||||
if !url.absoluteString.hasSuffix(".tendies") {
|
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 {
|
} 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 {
|
} else {
|
||||||
downloadURL = url.absoluteString.replacingOccurrences(of: "pocketposter://download?url=", with: "")
|
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()
|
downloadWallpaper()
|
||||||
}, noCancel: false)
|
}, noCancel: false)
|
||||||
}
|
}
|
||||||
@@ -47,17 +47,17 @@ struct Pocket_PosterApp: App {
|
|||||||
}
|
}
|
||||||
else if url.pathExtension == "tendies" {
|
else if url.pathExtension == "tendies" {
|
||||||
if PosterBoardManager.shared.selectedTendies.count >= PosterBoardManager.MaxTendies {
|
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 {
|
} else {
|
||||||
// copy it over to the KFC bucket
|
// copy it over to the KFC bucket
|
||||||
do {
|
do {
|
||||||
let newURL = try DownloadManager.copyTendies(from: url)
|
let newURL = try DownloadManager.copyTendies(from: url)
|
||||||
PosterBoardManager.shared.selectedTendies.append(newURL)
|
PosterBoardManager.shared.selectedTendies.append(newURL)
|
||||||
Haptic.shared.notify(.success)
|
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 {
|
} catch {
|
||||||
Haptic.shared.notify(.error)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ struct ContentView: View {
|
|||||||
Haptic.shared.notify(.success)
|
Haptic.shared.notify(.success)
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: {
|
||||||
pbManager.selectedTendies.removeAll()
|
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() {
|
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")
|
pbManager.runShortcut(named: "PosterBoard")
|
||||||
}, noCancel: true)
|
}, noCancel: true)
|
||||||
}
|
}
|
||||||
@@ -103,11 +103,11 @@ struct ContentView: View {
|
|||||||
hideResetHelp = false // fallback to tutorial
|
hideResetHelp = false // fallback to tutorial
|
||||||
return
|
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) {
|
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 {
|
} 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)
|
}, noCancel: false)
|
||||||
}) {
|
}) {
|
||||||
@@ -144,7 +144,7 @@ struct ContentView: View {
|
|||||||
switch result {
|
switch result {
|
||||||
case .success(let url):
|
case .success(let url):
|
||||||
if pbManager.selectedTendies.count + url.count > PosterBoardManager.MaxTendies {
|
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 {
|
} else {
|
||||||
pbManager.selectedTendies.append(contentsOf: url)
|
pbManager.selectedTendies.append(contentsOf: url)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ struct SettingsView: View {
|
|||||||
do {
|
do {
|
||||||
try PosterBoardManager.clearCache()
|
try PosterBoardManager.clearCache()
|
||||||
Haptic.shared.notify(.success)
|
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 {
|
} catch {
|
||||||
Haptic.shared.notify(.error)
|
Haptic.shared.notify(.error)
|
||||||
UIApplication.shared.alert(body: error.localizedDescription)
|
UIApplication.shared.alert(body: error.localizedDescription)
|
||||||
@@ -110,10 +110,10 @@ struct SettingsView: View {
|
|||||||
// MARK: Credits
|
// MARK: Credits
|
||||||
Section {
|
Section {
|
||||||
LinkCell(imageName: "leminlimez", url: "https://github.com/leminlimez", title: "LeminLimez", contribution: NSLocalizedString("Main Developer", comment: "leminlimez's contribution"), circle: true)
|
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: "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: "Exploit", 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: "Exploit", 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: "Fallback Shortcut Creator", circle: true)
|
LinkCell(imageName: "sky", url: "https://bsky.app/profile/did:plc:xykfeb7ieeo335g3aly6vev4", title: "dootskyre", contribution: NSLocalizedString("Fallback Shortcut Creator", comment: ""), circle: true)
|
||||||
} header: {
|
} header: {
|
||||||
Label("Credits", systemImage: "wrench.and.screwdriver")
|
Label("Credits", systemImage: "wrench.and.screwdriver")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user