From b8a7b1c516126b66ed6d6485c3d23936bb5443f8 Mon Sep 17 00:00:00 2001 From: Sharker <1548742234@qq.com> Date: Sun, 18 Feb 2024 13:53:01 +0800 Subject: [PATCH] pref: add help menu --- Easydict/App/Localizable.xcstrings | 16 ++++++++++++++++ .../NewApp/View/MenuView/MainMenuCommand.swift | 13 +++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index db79188c4..d81fbdaad 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -1765,6 +1765,22 @@ } } }, + "menu_feedback" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Feedback" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "反馈" + } + } + } + }, "menu_input_translate" : { "extractionState" : "manual", "localizations" : { diff --git a/Easydict/NewApp/View/MenuView/MainMenuCommand.swift b/Easydict/NewApp/View/MenuView/MainMenuCommand.swift index 388caacd3..876e2e511 100644 --- a/Easydict/NewApp/View/MenuView/MainMenuCommand.swift +++ b/Easydict/NewApp/View/MenuView/MainMenuCommand.swift @@ -9,8 +9,21 @@ import SwiftUI struct EasyDictMainMenu: Commands { + @Environment(\.openURL) + private var openURL + var body: some Commands { // shortcut MainMenuShortcutCommand() + + // Help + CommandGroup(replacing: CommandGroupPlacement.help, addition: { + Button(LocalizedStringKey("menu_feedback")) { + guard let versionURL = URL(string: "\(EZGithubRepoEasydictURL)/issues") else { + return + } + openURL(versionURL) + } + }) } }