Skip to content

Instantly share code, notes, and snippets.

@j4johnfox
Created July 9, 2010 06:46
Show Gist options
  • Save j4johnfox/469146 to your computer and use it in GitHub Desktop.
Save j4johnfox/469146 to your computer and use it in GitHub Desktop.
- (CPString)pathForLocalizedResource:(CPString)aResourceName
{
var mainBundle = [CPBundle mainBundle];
return [mainBundle pathForResource:[mainBundle bundleLocale] + ".lproj/" +aResourceName];
}
+ (CPCib)loadLocalizedCibNamed:(CPString)aName
owner:(id)anOwner
loadDelegate:(id)aDelegate
{
if (![aName hasSuffix:@".cib"])
aName = [aName stringByAppendingString:@".cib"];
// Path is based solely on anOwner:
var bundle = anOwner ? [CPBundle bundleForClass:[anOwner class]] : [CPBundle mainBundle];
var path = [bundle pathForLocalizedResource:aName];
return [self loadCibFile:path
externalNameTable:[CPDictionary dictionaryWithObject:anOwner forKey:CPCibOwner]
loadDelegate:aDelegate];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment