Skip to content

Commit

Permalink
Partial localization
Browse files Browse the repository at this point in the history
  • Loading branch information
lijamez committed Aug 30, 2011
1 parent 508f8b0 commit 9b361f5
Show file tree
Hide file tree
Showing 18 changed files with 288 additions and 140 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions AddStopViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@

@interface AddStopViewController : AbstractFancyViewController <UIAlertViewDelegate>{
UITextField * stopNumberTextField;
UILabel * enterStopNumberLabel;

id<ModalViewDelegate> delegate;

StopRouteCollection * foundStopRoutes;
}

@property (nonatomic, retain) IBOutlet UITextField * stopNumberTextField;
@property (nonatomic, retain) IBOutlet UILabel * enterStopNumberLabel;

@property (nonatomic, retain) StopRouteCollection * foundStopRoutes;
@property (nonatomic, assign) id<ModalViewDelegate> delegate;

Expand Down
20 changes: 11 additions & 9 deletions AddStopViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@implementation AddStopViewController

@synthesize stopNumberTextField, foundStopRoutes;
@synthesize stopNumberTextField, enterStopNumberLabel, foundStopRoutes;
@synthesize delegate;

int const MAX_FIELD_CHARS = 5;
Expand All @@ -25,7 +25,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.title = @"Stop Number";
self.title = NSLocalizedString(@"ViewTitle_EnterStopNumber", nil);
}
return self;
}
Expand Down Expand Up @@ -66,7 +66,7 @@ - (void) processStopNumber: (NSString*) stopNumber

if (error)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:[error localizedDescription] delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alert show];
[alert release];
return;
Expand All @@ -80,7 +80,7 @@ - (void) processStopNumber: (NSString*) stopNumber
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Stop number not found." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"DialogMessage_StopNumberNotFound", @"Stop Number Not Found dialog message") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alert show];
[alert release];
}
Expand All @@ -92,15 +92,15 @@ - (IBAction) notifyNext: (id) sender

if ([newStopNumber length] == 0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter a stop number." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"DialogMessage_MissingStopNumber", @"Please enter a stop number dialog message") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alert show];
[alert release];
return;
}

if ([newStopNumber length] != 5)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"A stop number is 5 digits long." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"DialogMessage_InsufficientStopNumberDigits", @"A stop number should be 5 digits long.") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alert show];
[alert release];
return;
Expand All @@ -109,7 +109,7 @@ - (IBAction) notifyNext: (id) sender

[stopNumberTextField resignFirstResponder];

[self showHUDWithSelector:@selector(processStopNumber:) mode:MBProgressHUDModeIndeterminate text:@"Fetching Routes..." DimBackground:YES animated:YES onTarget:self withObject:newStopNumber];
[self showHUDWithSelector:@selector(processStopNumber:) mode:MBProgressHUDModeIndeterminate text:NSLocalizedString(@"HUDMessage_FetchingRoutes", nil) DimBackground:YES animated:YES onTarget:self withObject:newStopNumber];

}

Expand Down Expand Up @@ -145,12 +145,14 @@ - (void)viewDidLoad
{
[super viewDidLoad];

UIBarButtonItem * cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(notifyIsCancelled:)];
UIBarButtonItem * cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(notifyIsCancelled:)];
self.navigationItem.leftBarButtonItem = cancelButton;

UIBarButtonItem * nextButton = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStyleBordered target:self action:@selector(notifyNext:)];
UIBarButtonItem * nextButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Next", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(notifyNext:)];
self.navigationItem.rightBarButtonItem = nextButton;

enterStopNumberLabel.text = [NSString stringWithFormat:@"%@:", NSLocalizedString(@"AddRoute_EnterStopNumber", nil)];

}

- (void) viewWillAppear:(BOOL)animated
Expand Down
43 changes: 36 additions & 7 deletions AddStopViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ AAgACAAIAAEAAQABAAE</bytes>
</object>
<int key="connectionID">36</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">enterStopNumberLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="158206837"/>
</object>
<int key="connectionID">37</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
Expand Down Expand Up @@ -297,7 +305,7 @@ AAgACAAIAAEAAQABAAE</bytes>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">36</int>
<int key="maxID">37</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand All @@ -314,14 +322,35 @@ AAgACAAIAAEAAQABAAE</bytes>
<string key="className">AddStopViewController</string>
<string key="superclassName">AbstractFancyViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">stopNumberTextField</string>
<string key="NS.object.0">UITextField</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>enterStopNumberLabel</string>
<string>stopNumberTextField</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UILabel</string>
<string>UITextField</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">stopNumberTextField</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">stopNumberTextField</string>
<string key="candidateClassName">UITextField</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>enterStopNumberLabel</string>
<string>stopNumberTextField</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">enterStopNumberLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">stopNumberTextField</string>
<string key="candidateClassName">UITextField</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand Down
23 changes: 19 additions & 4 deletions Bussy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
A00E7D1D13F8D731005CFAEC /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A00E7D1C13F8D731005CFAEC /* [email protected] */; };
A00E7D1F13F8D742005CFAEC /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A00E7D1E13F8D742005CFAEC /* [email protected] */; };
A00E7D2113F8D7C6005CFAEC /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A00E7D2013F8D7C6005CFAEC /* [email protected] */; };
A01085B7140C8C0000B332F7 /* StopRouteDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A01085B8140C8C0000B332F7 /* StopRouteDetailsViewController.xib */; };
A01AFFAE1400D2C800C2A0B2 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01AFFAD1400D2C800C2A0B2 /* AudioToolbox.framework */; };
A01AFFB61400D87500C2A0B2 /* click.wav in Resources */ = {isa = PBXBuildFile; fileRef = A01AFFB51400D87500C2A0B2 /* click.wav */; };
A01AFFC61400E1D800C2A0B2 /* Background.png in Resources */ = {isa = PBXBuildFile; fileRef = A01AFFC51400E1D800C2A0B2 /* Background.png */; };
A02B3E5D13BD83E7009FCCE3 /* Stop.m in Sources */ = {isa = PBXBuildFile; fileRef = A02B3E5C13BD83E7009FCCE3 /* Stop.m */; };
A037AB9E140B890100EDCBFF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A037ABA0140B890100EDCBFF /* Localizable.strings */; };
A04611F2140766D8004B8214 /* SectionHeaderStripes.png in Resources */ = {isa = PBXBuildFile; fileRef = A04611F0140766D8004B8214 /* SectionHeaderStripes.png */; };
A04611F3140766D8004B8214 /* SectionHeaderBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A04611F1140766D8004B8214 /* SectionHeaderBackground.png */; };
A04611F614077B5E004B8214 /* topAndBottomRow.png in Resources */ = {isa = PBXBuildFile; fileRef = A04611F414077B5E004B8214 /* topAndBottomRow.png */; };
A04611FB14078546004B8214 /* topAndBottomRowSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A04611FA14078546004B8214 /* topAndBottomRowSelected.png */; };
A05B65EB13C828020039D219 /* StopRouteDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A05B65E913C828020039D219 /* StopRouteDetailsViewController.m */; };
A05B65EC13C828020039D219 /* StopRouteDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A05B65EA13C828020039D219 /* StopRouteDetailsViewController.xib */; };
A063462813BC537300CB5168 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A063462713BC537300CB5168 /* UIKit.framework */; };
A063462A13BC537300CB5168 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A063462913BC537300CB5168 /* Foundation.framework */; };
A063462C13BC537300CB5168 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A063462B13BC537300CB5168 /* CoreGraphics.framework */; };
Expand Down Expand Up @@ -99,18 +100,20 @@
A00E7D1C13F8D731005CFAEC /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
A00E7D1E13F8D742005CFAEC /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
A00E7D2013F8D7C6005CFAEC /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
A01085B8140C8C0000B332F7 /* StopRouteDetailsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StopRouteDetailsViewController.xib; sourceTree = "<group>"; };
A01AFFAD1400D2C800C2A0B2 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
A01AFFB51400D87500C2A0B2 /* click.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = click.wav; sourceTree = "<group>"; };
A01AFFC51400E1D800C2A0B2 /* Background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Background.png; sourceTree = "<group>"; };
A02B3E5B13BD83E7009FCCE3 /* Stop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stop.h; sourceTree = "<group>"; };
A02B3E5C13BD83E7009FCCE3 /* Stop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Stop.m; sourceTree = "<group>"; };
A037AB9F140B890100EDCBFF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
A037ABA1140B891100EDCBFF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
A04611F0140766D8004B8214 /* SectionHeaderStripes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SectionHeaderStripes.png; sourceTree = "<group>"; };
A04611F1140766D8004B8214 /* SectionHeaderBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SectionHeaderBackground.png; sourceTree = "<group>"; };
A04611F414077B5E004B8214 /* topAndBottomRow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = topAndBottomRow.png; sourceTree = "<group>"; };
A04611FA14078546004B8214 /* topAndBottomRowSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = topAndBottomRowSelected.png; sourceTree = "<group>"; };
A05B65E813C828020039D219 /* StopRouteDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StopRouteDetailsViewController.h; sourceTree = "<group>"; };
A05B65E913C828020039D219 /* StopRouteDetailsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StopRouteDetailsViewController.m; sourceTree = "<group>"; };
A05B65EA13C828020039D219 /* StopRouteDetailsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = StopRouteDetailsViewController.xib; sourceTree = "<group>"; };
A063462313BC537300CB5168 /* Bussy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bussy.app; sourceTree = BUILT_PRODUCTS_DIR; };
A063462713BC537300CB5168 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
A063462913BC537300CB5168 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -289,6 +292,7 @@
A063463013BC537300CB5168 /* InfoPlist.strings */,
A063463313BC537300CB5168 /* Bussy-Prefix.pch */,
A063463413BC537300CB5168 /* main.m */,
A037ABA0140B890100EDCBFF /* Localizable.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -349,7 +353,7 @@
children = (
A01AFFAA1400CE4100C2A0B2 /* Sounds */,
A0B3621413F71A940032F8B4 /* Images */,
A05B65EA13C828020039D219 /* StopRouteDetailsViewController.xib */,
A01085B8140C8C0000B332F7 /* StopRouteDetailsViewController.xib */,
A009DFFE14007D53006E1976 /* BussyTableHeaderView.xib */,
A0D89D2613F8BDB50094FA13 /* AboutViewController.xib */,
A063463913BC537300CB5168 /* MainWindow.xib */,
Expand Down Expand Up @@ -509,6 +513,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
"zh-Hans",
);
mainGroup = A063461813BC537300CB5168;
productRefGroup = A063462413BC537300CB5168 /* Products */;
Expand All @@ -531,7 +536,7 @@
A063464113BC537300CB5168 /* MyRoutesViewController.xib in Resources */,
A07E596A13C16CE5004EBC0D /* AddStopViewController.xib in Resources */,
A080847113C56B7D00DEC160 /* StopRouteChooserViewController.xib in Resources */,
A05B65EC13C828020039D219 /* StopRouteDetailsViewController.xib in Resources */,
A01085B7140C8C0000B332F7 /* StopRouteDetailsViewController.xib in Resources */,
A0B2354713F7643600018A59 /* indicator.png in Resources */,
A0F305A513F86162004F431A /* preferences.png in Resources */,
A0F305B213F86162004F431A /* star.png in Resources */,
Expand All @@ -558,6 +563,7 @@
A0863314140B7DE800D84D44 /* [email protected] in Resources */,
A086331F140B840A00D84D44 /* Bussy-Icon-Retina.png in Resources */,
A0863320140B840A00D84D44 /* Bussy-Icon.png in Resources */,
A037AB9E140B890100EDCBFF /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -645,6 +651,15 @@
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
A037ABA0140B890100EDCBFF /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
A037AB9F140B890100EDCBFF /* en */,
A037ABA1140B891100EDCBFF /* zh-Hans */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
A063463013BC537300CB5168 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "AddStopViewController.m"
timestampString = "336260472.377744"
timestampString = "336368096.434769"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "152"
endingLineNumber = "152"
startingLineNumber = "154"
endingLineNumber = "154"
landmarkName = "-viewDidLoad"
landmarkType = "5">
</FileBreakpoint>
Expand Down Expand Up @@ -357,11 +357,11 @@
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "Bussy/StopRouteDetailsViewController.m"
timestampString = "336034252.794614"
timestampString = "336367790.591288"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "128"
endingLineNumber = "128"
startingLineNumber = "130"
endingLineNumber = "130"
landmarkName = "-viewDidLoad"
landmarkType = "5">
</FileBreakpoint>
Expand Down
8 changes: 8 additions & 0 deletions Bussy/AboutViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@

UILabel * appNameLabel;
UILabel * versionLabel;
UILabel * copyrightLabel;
UILabel * acknowledgementsLabel;
UILabel * acknowledgementsContentsLabel;
UILabel * disclaimerLabel;
}

@property (nonatomic, retain) IBOutlet UILabel * appNameLabel;
@property (nonatomic, retain) IBOutlet UILabel * versionLabel;
@property (nonatomic, retain) IBOutlet UILabel * copyrightLabel;
@property (nonatomic, retain) IBOutlet UILabel * acknowledgementsLabel;
@property (nonatomic, retain) IBOutlet UILabel * acknowledgementsContentsLabel;
@property (nonatomic, retain) IBOutlet UILabel * disclaimerLabel;

@end
7 changes: 5 additions & 2 deletions Bussy/AboutViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@implementation AboutViewController

@synthesize versionLabel, appNameLabel;
@synthesize versionLabel, appNameLabel, copyrightLabel, acknowledgementsLabel, acknowledgementsContentsLabel, disclaimerLabel;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
Expand All @@ -36,7 +36,10 @@ - (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.

versionLabel.text = [NSString stringWithFormat:@"Version %@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
versionLabel.text = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"Version", nil), [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
acknowledgementsLabel.text = NSLocalizedString(@"About_AcknowledgementsHeader", nil);
disclaimerLabel.text = NSLocalizedString(@"About_Disclaimer", nil);
copyrightLabel.text = [NSString stringWithFormat:@"%@ © 2011 James Li", NSLocalizedString(@"Copyright", nil)];

}

Expand Down
Loading

0 comments on commit 9b361f5

Please sign in to comment.