diff options
author | rowanbeentje <rowan@beent.je> | 2013-01-08 01:00:00 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2013-01-08 01:00:00 +0000 |
commit | b0b4d3698cd9b873e63da5a95478d3369efd2b2d (patch) | |
tree | 68228088896a93e3caa948a4aa9b3b5c19e144fd /Source | |
parent | 18c31ef044b6d2959e55edb3bbff1fd373ea4350 (diff) | |
download | sequelpro-b0b4d3698cd9b873e63da5a95478d3369efd2b2d.tar.gz sequelpro-b0b4d3698cd9b873e63da5a95478d3369efd2b2d.tar.bz2 sequelpro-b0b4d3698cd9b873e63da5a95478d3369efd2b2d.zip |
- Enable translation of the Show/Hide Toolbar menu item by taking over title changes ourselves, fixing the last part of Issue #1521
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPWindow.m | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/SPWindow.m b/Source/SPWindow.m index f4164ef2..492b8779 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -192,13 +192,30 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - + + // If the item is the Show/Hide Toolbar menu item, override the text to allow correct translation + if ([menuItem action] == @selector(toggleToolbarShown:)) { + BOOL theResponse = [super validateMenuItem:menuItem]; + if ([[self toolbar] isVisible] || [menuItem state] == NSOnState) { + [menuItem setTitle:NSLocalizedString(@"Hide Toolbar", @"Hide Toolbar menu item")]; + } else { + [menuItem setTitle:NSLocalizedString(@"Show Toolbar", @"Show Toolbar menu item")]; + } + return theResponse; + } + + // On systems which don't support fullscreen windows, disable the fullscreen menu item if ([menuItem action] == @selector(toggleFullScreen:)) { - return ([super respondsToSelector:@selector(toggleFullScreen:)]); + if (![super respondsToSelector:@selector(toggleFullScreen:)]) { + return NO; + } } + + // Allow the superclass to perform validation otherwise (if possible) if ([super respondsToSelector:@selector(validateMenuItem:)]) { return [super validateMenuItem:menuItem]; } + return YES; } |