summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/ui_localizer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa/ui_localizer.mm')
-rw-r--r--chrome/browser/cocoa/ui_localizer.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/ui_localizer.mm b/chrome/browser/cocoa/ui_localizer.mm
index e9be6dc..5467203 100644
--- a/chrome/browser/cocoa/ui_localizer.mm
+++ b/chrome/browser/cocoa/ui_localizer.mm
@@ -78,3 +78,33 @@ NSString* LocalizedStringForKeyFromMapList(NSString* key,
}
} // 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