NSLocalizedString not works in plugin

Evan Schoenberg, M.D. evan at adium.im
Tue Jan 26 00:46:42 UTC 2010


Chen,

You want to use AILocalizedStringFromTableInBundle() (or NSLocalizedStringFromTableInBundle() which is identical, as the former is #define'd as the latter) with [self bundleForClass:[self class]] as the bundle argument. Otherwise, you are looking up strings from the main bundle (Adium.app's bundle) which is not what you want, as you want to look to your own plugin bundle.

Cheers,
Evan

On Jan 23, 2010, at 10:43 PM, Chen Ze wrote:

> Below is the code. it works in an normal(like window based) cocoa
> program but not works when I use in an adium plugin.
> 
> - (void)installPlugin
> {
> 	NSAlert *alert =
> 	[NSAlert
> 	 alertWithMessageText:NSLocalizedString(@"my title", @"")
> 	 defaultButton:NSLocalizedString(@"OK", @"")
> 	 alternateButton:nil
> 	 otherButton:nil
> 	 informativeTextWithFormat:NSLocalizedString(@"my text",@"")];
> 	[alert
> 	 performSelector:@selector(runModal)
> 	 onThread:[NSThread mainThread]
> 	 withObject:nil waitUntilDone:NO];
> }
> 
> and the the files are:
> zh_CN.lproj/Localizable.strings
> English.lproj/Localizable.strings
> 
> I also tried AILocalizedString with the table name which is same as
> bundle name.it also not works.
> 
> Did I miss something? I am new to plugin development.
> 
> -- 
> aka Surf Chen
> http://chenze.name/
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20100125/ee4ae1fe/attachment-0002.html>


More information about the devel mailing list