Skip to content

Instantly share code, notes, and snippets.

@ddb
Created June 23, 2011 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddb/1042781 to your computer and use it in GitHub Desktop.
Save ddb/1042781 to your computer and use it in GitHub Desktop.
If you need regional language localization, this change to main.m will enable iOS to pick the correct regionally localized resources.
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
NSString *locale = [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode];
NSString *dashed = [NSString stringWithFormat:@"%@-%@", language, locale];
NSString *underlined = [NSString stringWithFormat:@"%@_%@", language, locale];
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:dashed, underlined, language, nil]
forKey:@"AppleLanguages"];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment