From 33501ebba97008e2e844f39a15a34236d567a6e7 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 5 Feb 2023 12:02:06 +0800 Subject: [PATCH] PrefWindow // Warn when unchecking the fart suppressor. --- .../WindowControllers/CtlPrefWindow.swift | 28 +++++++++++++++++++ .../Resources/Base.lproj/Localizable.strings | 4 +++ Source/Resources/en.lproj/Localizable.strings | 4 +++ Source/Resources/ja.lproj/Localizable.strings | 4 +++ .../zh-Hans.lproj/Localizable.strings | 4 +++ .../zh-Hant.lproj/Localizable.strings | 4 +++ 6 files changed, 48 insertions(+) diff --git a/Source/Modules/WindowControllers/CtlPrefWindow.swift b/Source/Modules/WindowControllers/CtlPrefWindow.swift index 0722fa7c..576dbf55 100644 --- a/Source/Modules/WindowControllers/CtlPrefWindow.swift +++ b/Source/Modules/WindowControllers/CtlPrefWindow.swift @@ -238,6 +238,34 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate { } @IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) { + let content = String( + format: NSLocalizedString( + "You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas.", + comment: "" + )) + let alert = NSAlert(error: NSLocalizedString("Warning", comment: "")) + alert.informativeText = content + alert.addButton(withTitle: NSLocalizedString("Uncheck", comment: "")) + if #available(macOS 11, *) { + alert.buttons.forEach { button in + button.hasDestructiveAction = true + } + } + alert.addButton(withTitle: NSLocalizedString("Leave it checked", comment: "")) + if let window = window, !PrefMgr.shared.shouldNotFartInLieuOfBeep { + PrefMgr.shared.shouldNotFartInLieuOfBeep = true + alert.beginSheetModal(for: window) { result in + switch result { + case .alertFirstButtonReturn: + PrefMgr.shared.shouldNotFartInLieuOfBeep = false + case .alertSecondButtonReturn: + PrefMgr.shared.shouldNotFartInLieuOfBeep = true + default: break + } + IMEApp.buzz() + } + return + } IMEApp.buzz() } diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 32bb35f4..77edc2d0 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -1,4 +1,8 @@ "vChewing" = "vChewing"; +"You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas." = "You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas."; +"Uncheck" = "Uncheck"; +"Leave it checked" = "Leave it checked"; +"Warning" = "Warning"; "You may follow:" = "You may follow:"; "Initial" = "Initial"; "Phrase" = "Phrase"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 32bb35f4..77edc2d0 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -1,4 +1,8 @@ "vChewing" = "vChewing"; +"You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas." = "You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas."; +"Uncheck" = "Uncheck"; +"Leave it checked" = "Leave it checked"; +"Warning" = "Warning"; "You may follow:" = "You may follow:"; "Initial" = "Initial"; "Phrase" = "Phrase"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 6326c614..bcc86625 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -1,4 +1,8 @@ "vChewing" = "威注音入力アプリ"; +"You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas." = "マナーモードのチェックの外すことになります。周りの人は貴殿のパソコンから屁音を聞いてしまい、それについての結果は全部貴殿の自己責任でございます。公的なる場所でこのチェックを外すのはお勧めできません。"; +"Uncheck" = "チェックの外す"; +"Leave it checked" = "チェックをそのままに"; +"Warning" = "警告"; "You may follow:" = "このように:"; "Initial" = "頭文字"; "Phrase" = "語彙"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index 8d5ee2cd..6bbbeb65 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -1,4 +1,8 @@ "vChewing" = "威注音输入法"; +"You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas." = "您即将取消对廉耻模式的勾选。周围的人会听到您的电脑传出放屁的声音,且您对此负全部责任。我们强烈建议您不要在任何公共场合取消对该模式的勾选。"; +"Uncheck" = "取消勾选"; +"Leave it checked" = "保持勾选"; +"Warning" = "警告"; "You may follow:" = "你可以照这样:"; "Initial" = "首字"; "Phrase" = "词语"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index afe274dc..d777276b 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -1,4 +1,8 @@ "vChewing" = "威注音輸入法"; +"You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas." = "您即將取消對廉恥模式的勾選。周圍的人會聽到您的電腦傳出放屁的聲音,且您對此負全部責任。我們強烈建議您不要在任何公共場合取消對該模式的勾選。"; +"Uncheck" = "取消勾選"; +"Leave it checked" = "保持勾選"; +"Warning" = "警告"; "You may follow:" = "你可以照這樣:"; "Initial" = "首字"; "Phrase" = "詞語";