mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Unifies account error localizations
This commit is contained in:
@@ -32,21 +32,42 @@ public enum AccountError: LocalizedError {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public var errorTitle: String {
|
||||
switch self {
|
||||
case .createErrorNotFound:
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.title.feed-not-found", bundle: Bundle.module, comment: "Unable to Add Feed")
|
||||
case .createErrorAlreadySubscribed:
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.title.already-subscribed", bundle: Bundle.module, comment: "Already Subscribed")
|
||||
case .opmlImportInProgress:
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.title.ompl-import-in-progress", bundle: Bundle.module, comment: "OPML Import in Progress")
|
||||
case .wrappedError(_, _):
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.title.error", bundle: Bundle.module, comment: "Error")
|
||||
}
|
||||
}
|
||||
|
||||
public var errorDescription: String? {
|
||||
switch self {
|
||||
case .createErrorNotFound:
|
||||
return NSLocalizedString("The feed couldn’t be found and can’t be added.", comment: "Not found")
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.message.feed-not-found", bundle: Bundle.module, comment: "Can’t add a feed because no feed was found.")
|
||||
case .createErrorAlreadySubscribed:
|
||||
return NSLocalizedString("You are already subscribed to this feed and can’t add it again.", comment: "Already subscribed")
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.message.feed-already-subscribed", bundle: Bundle.module, comment: "You are already subscribed to this feed and can’t add it again.")
|
||||
case .opmlImportInProgress:
|
||||
return NSLocalizedString("An OPML import for this account is already running.", comment: "Import running")
|
||||
// TODO: Add to Localizable
|
||||
return NSLocalizedString("error.message.opml-import-in-progress", bundle: Bundle.module, comment: "An OPML import for this account is already running.")
|
||||
case .wrappedError(let error, let account):
|
||||
switch error {
|
||||
case TransportError.httpError(let status):
|
||||
if isCredentialsError(status: status) {
|
||||
let localizedText = NSLocalizedString("Your “%@” credentials are invalid or expired.", comment: "Invalid or expired")
|
||||
return NSString.localizedStringWithFormat(localizedText as NSString, account.nameForDisplay) as String
|
||||
// TODO: Add to Localizable
|
||||
let localizedText = NSLocalizedString("error.message.credentials-expired.%@", bundle: Bundle.module, comment: "Your ”%@” credentials have expired.")
|
||||
return String(format: localizedText, account.nameForDisplay)
|
||||
} else {
|
||||
return unknownError(error, account)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Localizable.strings
|
||||
|
||||
|
||||
Created by Stuart Breckenridge on 11/03/2023.
|
||||
|
||||
*/
|
||||
|
||||
"error.title.feed-not-found" = "Unable to Add Feed";
|
||||
"error.title.already-subscribed" = "Already Subscribed";
|
||||
"error.title.ompl-import-in-progress" = "OPML Import in Progress";
|
||||
"error.title.error" = "Error";
|
||||
|
||||
"error.message.feed-not-found" = "Can’t add a feed because no feed was found.";
|
||||
"error.message.already-subscribed" = "You are already subscribed to this feed and can’t add it again.";
|
||||
"error.message.opml-import-in-progress" = "An OPML import for this account is already running.";
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Localizable.strings
|
||||
|
||||
|
||||
Created by Stuart Breckenridge on 11/03/2023.
|
||||
|
||||
*/
|
||||
|
||||
"error.title.feed-not-found" = "Unable to Add Feed";
|
||||
"error.title.already-subscribed" = "Already Subscribed";
|
||||
"error.title.ompl-import-in-progress" = "OPML Import in Progress";
|
||||
"error.title.error" = "Error";
|
||||
|
||||
"error.message.feed-not-found" = "Can’t add a feed because no feed was found.";
|
||||
"error.message.already-subscribed" = "You are already subscribed to this feed and can’t add it again.";
|
||||
"error.message.opml-import-in-progress" = "An OPML import for this account is already running.";
|
||||
Reference in New Issue
Block a user