diff --git a/LunarBarMac/Resources/Localizable.xcstrings b/LunarBarMac/Resources/Localizable.xcstrings index 0af658d..c12d5fe 100644 --- a/LunarBarMac/Resources/Localizable.xcstrings +++ b/LunarBarMac/Resources/Localizable.xcstrings @@ -1264,6 +1264,23 @@ } } }, + "Enter Month" : { + "comment" : "[Menu] Enter a month using date picker", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "输入月份" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "輸入月份" + } + } + } + }, "Enter to select dates" : { "comment" : "[AX] Tell the user to enter the current collection to select dates", "localizations" : { diff --git a/LunarBarMac/Sources/Main/AppMainVC+Menu.swift b/LunarBarMac/Sources/Main/AppMainVC+Menu.swift index 235fd11..634525a 100644 --- a/LunarBarMac/Sources/Main/AppMainVC+Menu.swift +++ b/LunarBarMac/Sources/Main/AppMainVC+Menu.swift @@ -80,7 +80,6 @@ private extension AppMainVC { // Full-fledged picker that supports any year menu.addItem({ [weak self] in - let item = NSMenuItem() let picker = NSDatePicker() picker.isBezeled = false picker.isBordered = false @@ -107,7 +106,17 @@ private extension AppMainVC { picker.centerYAnchor.constraint(equalTo: wrapper.centerYAnchor), ]) - item.view = wrapper + // Inside a submenu to avoid keyboard navigation conflicts + let menu = NSMenu() + menu.addItem({ + let item = NSMenuItem() + item.view = wrapper + + return item + }()) + + let item = NSMenuItem(title: Localized.UI.menuTitleEnterMonth) + item.submenu = menu return item }()) diff --git a/LunarBarMac/Sources/Shared/AppDefinitions.swift b/LunarBarMac/Sources/Shared/AppDefinitions.swift index 038d7cf..9b21c72 100644 --- a/LunarBarMac/Sources/Shared/AppDefinitions.swift +++ b/LunarBarMac/Sources/Shared/AppDefinitions.swift @@ -25,6 +25,7 @@ enum Localized { // Menu static let menuTitleGotoToday = String(localized: "Today", comment: "[Menu] Move to today") static let menuTitleGotoMonth = String(localized: "Go to Month", comment: "[Menu] Select year and month") + static let menuTitleEnterMonth = String(localized: "Enter Month", comment: "[Menu] Enter a month using date picker") static let menuTitleAppearance = String(localized: "Appearance", comment: "[Menu] Change dark mode preference") static let menuTitleCalendarIcon = String(localized: "Calendar Icon", comment: "[Menu] Use a calendar icon as the menu bar icon") static let menuTitleCurrentDate = String(localized: "Current Date", comment: "[Menu] Use the current date as the menu bar icon")