Clicky

iOS Dev Nugget 33 Prepare for Locationalization from Day One

.

Need to run a code review on your codebase? Hire me

Most version 1.0 of apps aren't localized. But you can still make it much easier for you to add localization support later. Instead of using string values directly, just wrap them with calls to NSLocalizedString(). E.g.

label1.text = @"Hello world";
label2.text = [NSString stringWithFormat:@"Name: %@", name];

becomes:

label1.text = NSLocalizedString(@"Hello world", nil);
label2.text = [NSString stringWithFormat:NSLocalizedString(@"Name: %@", nil), name];

They wouldn't do anything when you only support one language, but cuts down on a lot of effort doing search and replace later when you want to localize your app in future version.


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues