From b0b4d3698cd9b873e63da5a95478d3369efd2b2d Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 8 Jan 2013 01:00:00 +0000 Subject: - Enable translation of the Show/Hide Toolbar menu item by taking over title changes ourselves, fixing the last part of Issue #1521 --- Source/SPWindow.m | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'Source') 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; } -- cgit v1.2.3