macOS: Localize export sheets

This commit is contained in:
Roopesh Chander 2019-01-09 02:33:22 +05:30
parent 3969cc6ee3
commit 5cd3859b47
2 changed files with 10 additions and 4 deletions

View File

@ -245,6 +245,12 @@
"macButtonImportTunnels" = "Import tunnel(s) from file"; "macButtonImportTunnels" = "Import tunnel(s) from file";
"macSheetButtonImport" = "Import"; "macSheetButtonImport" = "Import";
"macNameFieldExportLog" = "Export log to";
"macSheetButtonExportLog" = "Save";
"macNameFieldExportZip" = "Export tunnels to";
"macSheetButtonExportZip" = "Save";
// Mac detail/edit view fields // Mac detail/edit view fields
"macFieldKey (%@)" = "%@:"; "macFieldKey (%@)" = "%@:";

View File

@ -165,8 +165,8 @@ class TunnelsListTableViewController: NSViewController {
@objc func exportLogClicked() { @objc func exportLogClicked() {
guard let window = view.window else { return } guard let window = view.window else { return }
let savePanel = NSSavePanel() let savePanel = NSSavePanel()
savePanel.prompt = "Save" savePanel.prompt = tr("macSheetButtonExportLog")
savePanel.nameFieldLabel = "Export log to" savePanel.nameFieldLabel = tr("macNameFieldExportLog")
let dateFormatter = ISO8601DateFormatter() let dateFormatter = ISO8601DateFormatter()
dateFormatter.formatOptions = [.withFullDate, .withTime, .withTimeZone] // Avoid ':' in the filename dateFormatter.formatOptions = [.withFullDate, .withTime, .withTimeZone] // Avoid ':' in the filename
@ -199,8 +199,8 @@ class TunnelsListTableViewController: NSViewController {
guard let window = view.window else { return } guard let window = view.window else { return }
let savePanel = NSSavePanel() let savePanel = NSSavePanel()
savePanel.allowedFileTypes = ["zip"] savePanel.allowedFileTypes = ["zip"]
savePanel.prompt = "Save" savePanel.prompt = tr("macSheetButtonExportZip")
savePanel.nameFieldLabel = "Export tunnels to" savePanel.nameFieldLabel = tr("macNameFieldExportZip")
savePanel.nameFieldStringValue = "wireguard-export.zip" savePanel.nameFieldStringValue = "wireguard-export.zip"
savePanel.beginSheetModal(for: window) { [weak tunnelsManager] response in savePanel.beginSheetModal(for: window) { [weak tunnelsManager] response in
guard let tunnelsManager = tunnelsManager else { return } guard let tunnelsManager = tunnelsManager else { return }