Skip to content

Commit

Permalink
feat: Translate more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed May 11, 2023
1 parent d44f3e1 commit 49265e9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion MailCore/API/MailApiError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class MailApiError: MailError {
localizedDescription: MailResourcesStrings.Localizable.errorNewFolderAlreadyExists,
shouldDisplay: true
),
MailApiError(code: "folder__not_exists"),
MailApiError(code: "folder__not_exists",
localizedDescription: MailResourcesStrings.Localizable.errorFolderNotFound,
shouldDisplay: true),

// Mail
MailApiError(code: "mail__move_destination_folder_not_found"),
Expand Down
16 changes: 11 additions & 5 deletions MailCore/API/MailError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,27 @@ public class MailError: LocalizedError {
public let errorDescription: String
public let shouldDisplay: Bool

init(code: String, localizedDescription: String? = nil, shouldDisplay: Bool = false) {
init(code: String,
localizedDescription: String = MailResourcesStrings.Localizable.errorUnknown,
shouldDisplay: Bool = false) {
self.code = code
errorDescription = localizedDescription ?? "Unknown error"
errorDescription = localizedDescription
self.shouldDisplay = shouldDisplay
}

public static let unknownError = MailError(code: "unknownError", shouldDisplay: true)
public static let noToken = MailError(code: "noToken", shouldDisplay: true)
public static let resourceError = MailError(code: "resourceError", shouldDisplay: true)
public static let unknownToken = MailError(code: "unknownToken", shouldDisplay: true)
public static let noMailbox = MailError(code: "noMailbox", shouldDisplay: true)
public static let folderNotFound = MailError(code: "folderNotFound", shouldDisplay: true)
public static let noMailbox = MailError(code: "noMailbox")
public static let folderNotFound = MailError(code: "folderNotFound",
localizedDescription: MailResourcesStrings.Localizable.errorFolderNotFound,
shouldDisplay: true)
public static let addressBookNotFound = MailError(code: "addressBookNotFound", shouldDisplay: true)
public static let contactNotFound = MailError(code: "contactNotFound", shouldDisplay: true)
public static let messageNotFound = MailError(code: "messageNotFound", shouldDisplay: true)
public static let messageNotFound = MailError(code: "messageNotFound",
localizedDescription: MailResourcesStrings.Localizable.errorMessageNotFound,
shouldDisplay: true)
public static let attachmentsSizeLimitReached = MailError(code: "attachmentsSizeLimitReached",
localizedDescription: MailResourcesStrings.Localizable
.attachmentFileLimitReached,
Expand Down
Binary file modified MailResources/Localizable/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified MailResources/Localizable/en.lproj/Localizable.strings
Binary file not shown.
Binary file modified MailResources/Localizable/es.lproj/Localizable.strings
Binary file not shown.
Binary file modified MailResources/Localizable/fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified MailResources/Localizable/it.lproj/Localizable.strings
Binary file not shown.

0 comments on commit 49265e9

Please sign in to comment.