feat: translate with situational context in OpenAI

This commit is contained in:
2026-10-18 10:26:43 +02:00
parent 9613cbb994
commit b63565429e
7 changed files with 240 additions and 50 deletions
@@ -812,12 +812,15 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
tool.dismiss = { [weak self] in self?.dismiss() }
translation = tool
tool.input = { [weak self] in self?.searchField.stringValue ?? "" }
tool.replaceInput = { [weak self] in self?.searchField.stringValue = $0 }
tool.focusSearch = { [weak self] in self?.window?.makeFirstResponder(self?.searchField) }
tool.languagesChanged = { [weak self, weak tool] in
tool.inputPresentationChanged = { [weak self, weak tool] in
guard let self, let tool else { return }
let attributes = self.searchField.placeholderAttributedString?.attributes(at: 0, effectiveRange: nil) ?? [:]
self.searchField.placeholderAttributedString = NSAttributedString(string: tool.inputPlaceholder, attributes: attributes)
self.searchField.setAccessibilityLabel(tool.inputAccessibilityLabel)
self.commandBack.setAccessibilityLabel(tool.backAccessibilityLabel)
self.commandBack.toolTip = tool.backAccessibilityLabel
}
controller = tool
placeholder = tool.inputPlaceholder
@@ -873,6 +876,8 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
(window as? LauncherPanel)?.resetNumberHints()
openButton.keyEquivalent = ""
searchSymbol.isHidden = true
commandBack.setAccessibilityLabel("Back to applications")
commandBack.toolTip = "Back to applications"
commandBack.target = self
commandBack.action = #selector(goBackCommand)
commandBack.isHidden = false