back to article String theory and the OS X AppKit

Much of the time, we're off exploring some framework such as GraphKit or the media browser. This time it's the turn of AppKit itself, the framework that's guaranteed to be used by every self-respecting Cocoa app. Strange as it may seem, there are plenty of undocumented goodies here, too. Let's start with localization, This is …


This topic is closed for new posts.
  1. Paul Maddox

    How is this news?

    How does this qualify as "Sci/Tech News for the World"? It doesn't even qualify as a particularly interesting blog post.

  2. Anonymous Coward
    Anonymous Coward

    @Paul Maddox

    Erm, it's not a blog post it's a development article posted in the Software->Developer section.

  3. 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:@""], 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 @"".

  4. Dave Jewell

    RE: Getting localized strings doesn't require private API

    Thanks for that, Brian - interesting. Given the example code you provide, it's easy to see why the Apple developers came up with a more succinct way of doing things. ;-)

    Incidentally, _NXKitString is just a wrapper around [NSBundle localizedStringForKey:value:table:], using another undocumented routine to retrieve the bundle instance for AppKit.


This topic is closed for new posts.

Other stories you might like