* Posts by Brian Webster

1 publicly visible post • joined 29 Apr 2009

String theory and the OS X AppKit

Brian Webster

Getting localized strings doesn't require private API

You can get the same thing by using the NSLocalizedStringFromTableInBundle() function, declared in Foundation. Following the example in the post, the call would look like:

NSString* cancelString = NSLocalizedStringFromTableInBundle(@"Cancel", @"Preferences", [NSBundle bundleWithIdentifier:@"com.apple.AppKit"], nil);

You can also do this same trick with any framework that has .strings resources like AppKit has, just substitute the identifier of the framework for @"com.apple.AppKit".