diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-04-16 04:30:29 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-04-16 04:30:29 +0000 |
commit | 4b39e586b5c5625b275a78f0efbc0a50e27e6a61 (patch) | |
tree | 7702606b513c5abf4ea068cf00b1bd3ea521813d /AppKit/GTMUILocalizer.m | |
parent | b8787b78e65a3b1ed18c406b0e2ea5232af7ac14 (diff) |
[Author: dmaclach]
Fixed up GTMUILocalizer to work properly with popup menus and alternate titles.
Fixed up UnitTesting code to check for it.
R=thomasvl
DELTA=3175 (3151 added, 14 deleted, 10 changed)
Diffstat (limited to 'AppKit/GTMUILocalizer.m')
-rw-r--r-- | AppKit/GTMUILocalizer.m | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/AppKit/GTMUILocalizer.m b/AppKit/GTMUILocalizer.m index cfeb401..2f756d3 100644 --- a/AppKit/GTMUILocalizer.m +++ b/AppKit/GTMUILocalizer.m @@ -152,6 +152,17 @@ } } + // Must do the menu before the titles, or else this will screw up + // popup menus on us. + [self localizeMenu:[view menu] recursively:recursive]; + if (recursive) { + NSArray *subviews = [view subviews]; + NSView *subview = nil; + GTM_FOREACH_OBJECT(subview, subviews) { + [self localizeView:subview recursively:recursive]; + } + } + // Then do titles if ([view isKindOfClass:[NSTextField class]]) { NSString *title = [(NSTextField *)view stringValue]; @@ -168,6 +179,17 @@ [view performSelector:@selector(setTitle:) withObject:localizedTitle]; } } + if ([view respondsToSelector:@selector(alternateTitle)] + && [view respondsToSelector:@selector(setAlternateTitle:)]) { + title = [view performSelector:@selector(alternateTitle)]; + if (title) { + NSString *localizedTitle = [self localizedStringForString:title]; + if (localizedTitle) { + [view performSelector:@selector(setAlternateTitle:) + withObject:localizedTitle]; + } + } + } } else if ([view respondsToSelector:@selector(tabViewItems)]) { NSArray *items = [view performSelector:@selector(tabViewItems)]; NSEnumerator *itemEnum = [items objectEnumerator]; @@ -183,14 +205,6 @@ } } } - [self localizeMenu:[view menu] recursively:recursive]; - if (recursive) { - NSArray *subviews = [view subviews]; - NSView *subview = nil; - GTM_FOREACH_OBJECT(subview, subviews) { - [self localizeView:subview recursively:recursive]; - } - } } } |