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 --- Resources/English.lproj/Localizable.strings | Bin 238236 -> 238488 bytes Source/SPWindow.m | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings index b27d1d80..6413a27d 100644 Binary files a/Resources/English.lproj/Localizable.strings and b/Resources/English.lproj/Localizable.strings differ 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