Skip to content

Commit

Permalink
Merge branch 'alex/fire-window-downloads' into alex/assorted-bugs-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx committed Sep 25, 2024
2 parents ba1ff69 + 9604f7b commit ba529d2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
7 changes: 5 additions & 2 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,12 @@ struct UserText {
static let revealToolTip = NSLocalizedString("downloads.tooltip.reveal", value: "Show in Finder", comment: "Mouse-over tooltip for Show in Finder button")

static let downloadsActiveAlertTitle = NSLocalizedString("downloads.active.alert.title", value: "A download is in progress.", comment: "Alert title when trying to quit application while files are being downloaded")
static let downloadsActiveAlertMessageFormat = NSLocalizedString("downloads.active.alert.message.format", value: "Are you sure you want to quit? DuckDuckGo Privacy Browser is currently downloading “%@”%@. If you quit now DuckDuckGo Privacy Browser wont finish downloading this file.", comment: "Alert text format when trying to quit application while file “filename”[, and others] are being downloaded")
static let downloadsActiveAlertMessageFormat = NSLocalizedString("downloads.active.alert.message.format", value: "DuckDuckGo is currently downloading “%@”%@. If you quit now, DuckDuckGo wont finish downloading %@.", comment: "Alert text format when trying to quit application while file “filename (%@)”[, and others (%@)] are being downloaded; If you quit now, DuckDuckGo won‘t finish downloading [this file|these files](%@).")
static let downloadsActiveAlertMessageAndOthers = NSLocalizedString("downloads.active.alert.message.and.others", value: ", and other files", comment: "Alert text format element for “, and other files”")
static let downloadsActiveInFireWindowAlertMessageFormat = NSLocalizedString("fire-window.downloads.active.alert.message.format", value: "DuckDuckGo Privacy Browser is currently downloading “%@”%@. If you close the Fire Window, DuckDuckGo Privacy Browser will delete this file.", comment: "Alert text format when trying to close a Fire Window while file “filename”[, and others] are being downloaded in it.")
static let downloadsActiveAlertMessageThisFile = NSLocalizedString("downloads.active.alert.message.this.file", value: "this file", comment: "Alert text format element for “DuckDuckGo won‘t finish downloading ->this file<-”")
static let downloadsActiveAlertMessageTheseFiles = NSLocalizedString("downloads.active.alert.message.these.files", value: "this file", comment: "Alert text format element for “DuckDuckGo won‘t finish downloading ->these file<-”")

static let downloadsActiveInFireWindowAlertMessageFormat = NSLocalizedString("fire-window.downloads.active.alert.message.format", value: "DuckDuckGo is currently downloading “%@”%@. If you close the Fire Window, DuckDuckGo will delete %@.", comment: "Alert text format when trying to close a Fire Window while file “filename (%@)”[, and others (%@)] are being downloaded in it. If you close the Fire Window, DuckDuckGo will delete [this file|these files](%@).")

static let exportLoginsFailedMessage = NSLocalizedString("export.logins.failed.message", value: "Failed to Export Passwords", comment: "Alert title when exporting login data fails")
static let exportLoginsFailedInformative = NSLocalizedString("export.logins.failed.informative", value: "Please check that no file exists at the location you selected.", comment: "Alert message when exporting login data fails")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ extension NSAlert {
let activeDownload = downloads.first(where: { $0.state.isDownloading })
let firstFileName = activeDownload?.state.destinationFilePresenter?.url?.lastPathComponent ?? ""
let andOthers = downloads.count > 1 ? UserText.downloadsActiveAlertMessageAndOthers : ""
let thisTheseFiles = downloads.count > 1 ? UserText.downloadsActiveAlertMessageTheseFiles : UserText.downloadsActiveAlertMessageThisFile

let alert = NSAlert()
alert.messageText = UserText.downloadsActiveAlertTitle
alert.informativeText = String(format: UserText.downloadsActiveAlertMessageFormat, firstFileName, andOthers)
alert.informativeText = String(format: UserText.downloadsActiveAlertMessageFormat, firstFileName, andOthers, thisTheseFiles)
alert.addButton(withTitle: UserText.quit, response: .OK)
alert.addButton(withTitle: UserText.dontQuit, response: .cancel, keyEquivalent: .escape)

Expand All @@ -42,10 +43,11 @@ extension NSAlert {
let activeDownload = downloads.first(where: { $0.state.isDownloading })
let firstFileName = activeDownload?.state.destinationFilePresenter?.url?.lastPathComponent ?? ""
let andOthers = downloads.count > 1 ? UserText.downloadsActiveAlertMessageAndOthers : ""
let thisTheseFiles = downloads.count > 1 ? UserText.downloadsActiveAlertMessageTheseFiles : UserText.downloadsActiveAlertMessageThisFile

let alert = NSAlert()
alert.messageText = UserText.downloadsActiveAlertTitle
alert.informativeText = String(format: UserText.downloadsActiveInFireWindowAlertMessageFormat, firstFileName, andOthers)
alert.informativeText = String(format: UserText.downloadsActiveInFireWindowAlertMessageFormat, firstFileName, andOthers, thisTheseFiles)
alert.addButton(withTitle: UserText.close, response: .OK)
alert.addButton(withTitle: UserText.dontClose, response: .cancel, keyEquivalent: .escape)

Expand Down
34 changes: 29 additions & 5 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -16854,7 +16854,7 @@
}
},
"downloads.active.alert.message.format" : {
"comment" : "Alert text format when trying to quit application while file “filename”[, and others] are being downloaded",
"comment" : "Alert text format when trying to quit application while file “filename (%@)”[, and others (%@)] are being downloaded; If you quit now, DuckDuckGo won‘t finish downloading [this file|these files](%@).",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
Expand All @@ -16866,7 +16866,7 @@
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Are you sure you want to quit? DuckDuckGo Privacy Browser is currently downloading “%1$@”%2$@. If you quit now DuckDuckGo Privacy Browser wont finish downloading this file."
"value" : "DuckDuckGo is currently downloading “%1$@”%2$@. If you quit now, DuckDuckGo wont finish downloading %3$@."
}
},
"es" : {
Expand Down Expand Up @@ -16913,6 +16913,30 @@
}
}
},
"downloads.active.alert.message.these.files" : {
"comment" : "Alert text format element for “DuckDuckGo won‘t finish downloading ->these file<-”",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "this file"
}
}
}
},
"downloads.active.alert.message.this.file" : {
"comment" : "Alert text format element for “DuckDuckGo won‘t finish downloading ->this file<-”",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "this file"
}
}
}
},
"downloads.active.alert.title" : {
"comment" : "Alert title when trying to quit application while files are being downloaded",
"extractionState" : "extracted_with_value",
Expand Down Expand Up @@ -21782,13 +21806,13 @@
}
},
"fire-window.downloads.active.alert.message.format" : {
"comment" : "Alert text format when trying to close a Fire Window while file “filename”[, and others] are being downloaded in it.",
"comment" : "Alert text format when trying to close a Fire Window while file “filename (%@)”[, and others (%@)] are being downloaded in it. If you close the Fire Window, DuckDuckGo will delete [this file|these files](%@).",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "DuckDuckGo Privacy Browser is currently downloading “%1$@”%2$@. If you close the Fire Window, DuckDuckGo Privacy Browser will delete this file."
"value" : "DuckDuckGo is currently downloading “%1$@”%2$@. If you close the Fire Window, DuckDuckGo will delete %3$@."
}
}
}
Expand Down Expand Up @@ -61036,4 +61060,4 @@
}
},
"version" : "1.0"
}
}

0 comments on commit ba529d2

Please sign in to comment.