Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1159)

Unified Diff: chrome/browser/cocoa/ui_localizer.mm

Issue 159197: Add a custom subclass of GTMUILocalizer that skips the bundle work so we can ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/ui_localizer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/ui_localizer.mm
===================================================================
--- chrome/browser/cocoa/ui_localizer.mm (revision 21272)
+++ chrome/browser/cocoa/ui_localizer.mm (working copy)
@@ -78,3 +78,33 @@
}
} // namespace ui_localizer
+
+@interface GTMUILocalizer (PrivateAdditions)
+- (void)localizedObjects;
+@end
+
+@implementation GTMUILocalizer (PrivateAdditions)
+- (void)localizedObjects {
+ // The ivars are private, so this method lets us trigger the localization
+ // from -[ChromeUILocalizer awakeFromNib].
+ [self localizeObject:owner_ recursively:YES];
+ [self localizeObject:otherObjectToLocalize_ recursively:YES];
+ [self localizeObject:yetAnotherObjectToLocalize_ recursively:YES];
+}
+ @end
+
+@implementation ChromeUILocalizer
+- (void)awakeFromNib {
+ // The GTM base is bundle based, since don't need the bundle, use this
+ // override to bypass the bundle lookup and directly do the localization
+ // calls.
+ [self localizedObjects];
+}
+#ifndef NDEBUG
+// Catch anyone that uses this directly.
+- (NSString *)localizedStringForString:(NSString *)string {
+ LOG(FATAL) << "Don't use ChromeUILocalizer directly.";
+ return @"Don't use ChromeUILocalizer directly.";
+}
+#endif
+@end
« no previous file with comments | « chrome/browser/cocoa/ui_localizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698