Skip to content

Commit 7ae7622

Browse files
committed
Add tooltip for “Show Sidebar” menu item
1 parent 60ee546 commit 7ae7622

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
- Revert the steppers to the font setting controls in the Appearance settings pane.
99
- Remove the Script menu from the context menu.
10+
- Add a help tag for “Show Sidebar” menu item when the command is unavailable.
1011
- Update the Swift syntax to support highlighting regex literals.
1112

1213

CotEditor/Resources/Localizables/Application/MainMenu.xcstrings

+41
Original file line numberDiff line numberDiff line change
@@ -4601,6 +4601,47 @@
46014601
}
46024602
}
46034603
},
4604+
"The sidebar is only available when a folder is opened as a document." : {
4605+
"comment" : "tooltip for the “Show Sidebar” menu item",
4606+
"localizations" : {
4607+
"de" : {
4608+
"stringUnit" : {
4609+
"state" : "translated",
4610+
"value" : "Die Seitenleiste ist nur verfügbar, wenn ein Ordner als Dokument geöffnet ist."
4611+
}
4612+
},
4613+
"en-GB" : {
4614+
"stringUnit" : {
4615+
"state" : "translated",
4616+
"value" : "The sidebar is only available when a folder is opened as a document."
4617+
}
4618+
},
4619+
"es" : {
4620+
"stringUnit" : {
4621+
"state" : "needs_review",
4622+
"value" : "La barra lateral sólo está disponible cuando se abre una carpeta como documento."
4623+
}
4624+
},
4625+
"fr" : {
4626+
"stringUnit" : {
4627+
"state" : "needs_review",
4628+
"value" : "La barre latérale n'est disponible que lorsqu'un dossier est ouvert en tant que document."
4629+
}
4630+
},
4631+
"ja" : {
4632+
"stringUnit" : {
4633+
"state" : "translated",
4634+
"value" : "サイドバーはフォルダを書類として開いたときのみ有効です。"
4635+
}
4636+
},
4637+
"nl" : {
4638+
"stringUnit" : {
4639+
"state" : "needs_review",
4640+
"value" : "De navigatiekolom is alleen beschikbaar als een map als document wordt geopend."
4641+
}
4642+
}
4643+
}
4644+
},
46044645
"To show invisible characters, set them in the Window settings" : {
46054646
"comment" : "tooltip for the “Show Invisibles” menu item and toolbar item for when all invisible settings are disabled",
46064647
"localizations" : {

CotEditor/Sources/Document Window/WindowContentViewController.swift

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99
// ---------------------------------------------------------------------------
1010
//
11-
// © 2016-2024 1024jp
11+
// © 2016-2025 1024jp
1212
//
1313
// Licensed under the Apache License, Version 2.0 (the "License");
1414
// you may not use this file except in compliance with the License.
@@ -187,12 +187,21 @@ final class WindowContentViewController: NSSplitViewController, NSToolbarItemVal
187187
switch item.action {
188188
case #selector(showFileBrowser):
189189
(item as? NSMenuItem)?.state = (self.sidebarViewItem?.isCollapsed == true) ? .on : .off
190+
(item as? NSMenuItem)?.toolTip = (self.sidebarViewItem == nil)
191+
? String(localized: "The sidebar is only available when a folder is opened as a document.",
192+
table: "MainMenu", comment: "tooltip for the “Show Sidebar” menu item")
193+
: nil
190194
return self.sidebarViewItem != nil
191195

192196
case #selector(toggleSidebar):
197+
// The menu item is not validated when the responder has no sidebar (2025-03, macOS 15).
193198
(item as? NSMenuItem)?.title = self.sidebarViewItem?.isCollapsed == false
194199
? String(localized: "Hide Sidebar", table: "MainMenu")
195200
: String(localized: "Show Sidebar", table: "MainMenu")
201+
(item as? NSMenuItem)?.toolTip = (self.sidebarViewItem == nil)
202+
? String(localized: "The sidebar is only available when a folder is opened as a document.",
203+
table: "MainMenu", comment: "tooltip for the “Show Sidebar” menu item")
204+
: nil
196205
return self.sidebarStateCache == nil
197206

198207
case #selector(toggleInspector):

0 commit comments

Comments
 (0)