Re: Access to localized images in a plug-in
Re: Access to localized images in a plug-in
- Subject: Re: Access to localized images in a plug-in
- From: Steve Weller <email@hidden>
- Date: Sat, 16 Jun 2007 11:11:00 -0700
I have bundle (see _bundle in the code below). The problem is
accessing the localized folders. I can do it by hand if I have to,
but am looking for a method that already takes care of the
localization settings.
On Jun 16, 2007, at 10:14 AM, Jim Turner wrote:
I believe [[NSBundle bundleForClass:[self class]] will get you the
specific bundle you need, at least it does for me when doing text
localization from a SIMBL plugin... but I'm not familiar with the
structure of Aperture plugins. From there, you'd use whatever
pathForResource* you need.
Jim
http://nukethemfromorbit.com
On 6/16/07, Steve Weller <email@hidden> wrote:
I am in the process of localizing my Aperture plug-in called Random
Wok. I have a TIFF image that used to be in the Resources folder that
has been localized and so is now in the lproj folders. It needs
localizing because it contains the text "No Image".
I used to use this code:
// Returns displayed image for table for a specific image
-(NSImage *)thumbnailForImageAtIndex:(unsigned)index;
{
NSImage *thumb;
// Get the thumbnail
thumb = [_exportManager thumbnailForImageAtIndex:index
size:kExportThumbnailSizeMini];
if(nil==thumb) {
NSString *noThumbPath = [[_bundle resourcePath]
stringByAppendingPathComponent:@"NoImage.tiff"];
NSImage *nothumb = [[[NSImage alloc]
initWithContentsOfFile:noThumbPath] autorelease];
thumb = nothumb;
}
return [[thumb retain] autorelease];
}
But it no longer works because the folder structure has changed. I
would use - (NSString *)pathForResource:(NSString *)name ofType:
(NSString *)extension inDirectory:(NSString *)subpath
with subpath set to nil but there is no place to specify the bundle
to use. In my case I cannot use the main bundle because that belongs
to Aperture. I need a version of this that allows me to choose the
bundle. Does such a method exist, or do I need to roll my own?
--
Bagelturf Blog http://www.bagelturf.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
Bagelturf Blog http://www.bagelturf.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden