diff --git a/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift b/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift index 8ba5c239..eaf273e7 100644 --- a/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift +++ b/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift @@ -6,6 +6,7 @@ // marks, or product names of Contributor, except as required to fulfill notice // requirements defined in MIT License. +import Cocoa import Combine import Foundation import LangModelAssembly @@ -44,6 +45,7 @@ public struct VwrPhraseEditorUI: View { @State public var selUserDataType: vChewingLM.ReplacableUserDataType = .thePhrases @State private var isLoading = false @State private var textEditorTooltip = PETerms.TooltipTexts.sampleDictionaryContent(for: .thePhrases) + public weak var window: NSWindow? public var currentIMEInputMode: Shared.InputMode { delegate?.currentInputMode ?? selInputMode @@ -59,7 +61,7 @@ public struct VwrPhraseEditorUI: View { // MARK: - - public init(delegate theDelegate: PhraseEditorDelegate? = nil) { + public init(delegate theDelegate: PhraseEditorDelegate? = nil, window: NSWindow? = nil) { _txtContent = .init( get: { Self.txtContentStorage }, set: { newValue, _ in @@ -68,7 +70,10 @@ public struct VwrPhraseEditorUI: View { } ) guard let theDelegate = theDelegate else { return } - defer { delegate = theDelegate } + defer { + delegate = theDelegate + self.window = window + } } public func update() { @@ -273,6 +278,13 @@ public struct VwrPhraseEditorUI: View { } ).help(PETerms.TooltipTexts.weightInputBox.localized) } + Button("?") { + guard let window = window else { return } + window.callAlert( + title: "You may follow:".localized, + text: PETerms.TooltipTexts.sampleDictionaryContent(for: selUserDataType) + ) + }.disabled(window == nil) Button(PETerms.AddPhrases.locAdd.localized.0) { DispatchQueue.main.async { insertEntry() } }.disabled(txtAddPhraseField1.isEmpty || txtAddPhraseField2.isEmpty) diff --git a/Source/Modules/UIModules/PrefUI/VwrPrefPanePhrases.swift b/Source/Modules/UIModules/PrefUI/VwrPrefPanePhrases.swift index bc6bacd6..674f7c93 100644 --- a/Source/Modules/UIModules/PrefUI/VwrPrefPanePhrases.swift +++ b/Source/Modules/UIModules/PrefUI/VwrPrefPanePhrases.swift @@ -38,7 +38,8 @@ struct VwrPrefPanePhrases: View { var body: some View { ScrollView { VStack { - VwrPhraseEditorUI(delegate: LMMgr.shared).frame(width: contentWidth + 28, height: 395) + VwrPhraseEditorUI(delegate: LMMgr.shared, window: CtlPrefUI.shared.controller.window) + .frame(width: contentWidth + 28, height: 395) Spacer() } .padding() diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 98182d8f..12c39fcf 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "vChewing"; +"You may follow:" = "You may follow:"; "Initial" = "Initial"; "Phrase" = "Phrase"; "Reading/Stroke" = "Reading/Stroke"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 98182d8f..12c39fcf 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "vChewing"; +"You may follow:" = "You may follow:"; "Initial" = "Initial"; "Phrase" = "Phrase"; "Reading/Stroke" = "Reading/Stroke"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index c9fa0fd6..59139c95 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "威注音入力アプリ"; +"You may follow:" = "このように:"; "Initial" = "頭文字"; "Phrase" = "語彙"; "Reading/Stroke" = "音読/筆画"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index da5c18db..b3743ac1 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "威注音输入法"; +"You may follow:" = "你可以照这样:"; "Initial" = "首字"; "Phrase" = "词语"; "Reading/Stroke" = "读音/字根"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 23e25db2..e8124df9 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "威注音輸入法"; +"You may follow:" = "你可以照這樣:"; "Initial" = "首字"; "Phrase" = "詞語"; "Reading/Stroke" = "讀音/字根";