diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2011-11-02 20:30:16 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2011-11-02 20:30:16 +0000 |
commit | 371dc04d5eee387439a6345e486eba9b8a1d0060 (patch) | |
tree | fceec206ab538405d0f1a39eff1d3baf7047e025 /iPhone | |
parent | 1204639d4aeeac3d3dda7b0c53b8941266b9e685 (diff) |
[Author: thomasvl]
Some quick comment cleanup.
Quick switch over to properties.
R=dmaclach
DELTA=38 (9 added, 14 deleted, 15 changed)
Diffstat (limited to 'iPhone')
-rw-r--r-- | iPhone/GTMUILocalizer.h | 42 | ||||
-rw-r--r-- | iPhone/GTMUILocalizer.m | 9 | ||||
-rw-r--r-- | iPhone/GTMUILocalizerTest.h | 2 | ||||
-rw-r--r-- | iPhone/GTMUILocalizerTest.m | 4 |
4 files changed, 26 insertions, 31 deletions
diff --git a/iPhone/GTMUILocalizer.h b/iPhone/GTMUILocalizer.h index 2917e61..3d5552b 100644 --- a/iPhone/GTMUILocalizer.h +++ b/iPhone/GTMUILocalizer.h @@ -20,32 +20,26 @@ // A class for localizing nibs by doing simple string replacement. // To use this, make an instance of GTMUILocalizer in your nib. Connect the -// owner_ outlet of the your instance to the File Owner of the nib. It expects -// the owner_ outlet to be an instance or subclass of NSWindowController, -// NSViewController or NSApplication. Using the bundle of the nib it will then -// localize any items in the NSWindowController's window and subviews, or the -// NSViewController's view and subviews or the NSApplication's main menu -// and dockmenu at when awakeFromNib is called on the GTMUILocalizer instance. -// You can optionally hook up otherObjectToLocalize_ and -// yetAnotherObjectToLocalize_ and those will also be localized. Strings in the +// owner outlet of the your instance to the File Owner of the nib. It expects +// the owner outlet to be an instance or subclass of UIViewController. Using +// the bundle of the nib it will then localize any items in the +// UIViewController's view and subviews when awakeFromNib is called on the +// GTMUILocalizer instance. +// You can optionally hook up otherObjectToLocalize and +// yetAnotherObjectToLocalize and those will also be localized. Strings in the // nib that you want localized must start with ^ (shift-6). The strings will // be looked up in the Localizable.strings table without the caret as the // key. -// Things that will be localized are: -// - Titles and altTitles (for menus, buttons, windows, menuitems, tabViewItem) -// - stringValue (for labels) -// - tooltips -// - accessibility help -// - menus // +// TODO(tvl): this correct for iOS? // Due to technical limitations, accessibility description cannot be localized. // See http://lists.apple.com/archives/Accessibility-dev/2009/Dec/msg00004.html // and http://openradar.appspot.com/7496255 for more information. // // As an example if I wanted to localize a button with the word "Print" on -// it, I would put it in a window controlled by a NSWindowController that was +// it, I would put it in a view controlled by a UIViewController that was // the owner of the nib. I would set it's title to be "^Print". I would then -// create an instance of GTMUILocalizer and set it's owner_ to be the owner +// create an instance of GTMUILocalizer and set it's owner to be the owner // of the nib. // In my Localizable.strings file in my fr.lproj directory for the bundle // I would put "Print" = "Imprimer"; @@ -64,19 +58,17 @@ // will localize properly. This keeps the differences between the nibs down // to the bare essentials. // -// NOTE: NSToolbar localization support is limited to only working on the -// default items in the toolbar. We cannot localize items that are on of the -// customization palette but not in the default items because there is not an -// API for NSToolbar to get all possible items. You are responsible for -// localizing all non-default toolbar items by hand. -// @interface GTMUILocalizer : NSObject { @private - IBOutlet id owner_; - IBOutlet id otherObjectToLocalize_; - IBOutlet id yetAnotherObjectToLocalize_; + id owner_; + id otherObjectToLocalize_; + id yetAnotherObjectToLocalize_; NSBundle *bundle_; } +@property(retain) IBOutlet id owner; +@property(retain) IBOutlet id otherObjectToLocalize; +@property(retain) IBOutlet id yetAnotherObjectToLocalize; + - (id)initWithBundle:(NSBundle *)bundle; // Localize |object|. If |recursive| is true, it will attempt diff --git a/iPhone/GTMUILocalizer.m b/iPhone/GTMUILocalizer.m index 5eff255..274eb04 100644 --- a/iPhone/GTMUILocalizer.m +++ b/iPhone/GTMUILocalizer.m @@ -22,15 +22,18 @@ @interface GTMUILocalizer (GTMUILocalizerPrivate) - (void)localizeAccessibility:(id)object; -// Never recursively call any of these methods. Always call -// -[self localizeObject:recursively:] otherwise bindings will not be -// localized properly. +// Never recursively call any of these methods. Always call +// -[self localizeObject:recursively:]. - (void)localizeToolbar:(UIToolbar *)toolbar; - (void)localizeView:(UIView *)view recursively:(BOOL)recursive; @end @implementation GTMUILocalizer +@synthesize owner = owner_; +@synthesize otherObjectToLocalize = otherObjectToLocalize_; +@synthesize yetAnotherObjectToLocalize = yetAnotherObjectToLocalize_; + - (id)initWithBundle:(NSBundle *)bundle { if ((self = [super init])) { bundle_ = [bundle retain]; diff --git a/iPhone/GTMUILocalizerTest.h b/iPhone/GTMUILocalizerTest.h index 041444d..87a0f22 100644 --- a/iPhone/GTMUILocalizerTest.h +++ b/iPhone/GTMUILocalizerTest.h @@ -24,6 +24,6 @@ UILabel *label_; } -@property(nonatomic, retain)IBOutlet UILabel *label; +@property(nonatomic, retain) IBOutlet UILabel *label; @end diff --git a/iPhone/GTMUILocalizerTest.m b/iPhone/GTMUILocalizerTest.m index 116d170..682285d 100644 --- a/iPhone/GTMUILocalizerTest.m +++ b/iPhone/GTMUILocalizerTest.m @@ -23,7 +23,7 @@ @end @implementation TestUILocalizer -- (NSString *)localizedStringForString:(NSString *)string{ +- (NSString *)localizedStringForString:(NSString *)string { return [string substringFromIndex:5]; } @@ -43,7 +43,7 @@ } @end -@interface GTMUILocalizerTest : GTMTestCase +@interface GTMUILocalizerTest : GTMTestCase @end @implementation GTMUILocalizerTest |